Jump to content
yjt98765

SystemC stack overflow on large system

Recommended Posts

Hi there,

 

I want to simulate a lager system which calculates the inner product of two large vectors. The target vector size is 10^6, but now I can only achieve 4096. When the size N equals 8192, it reports an error: ./../src/systemc/sc_cor_qt.cpp:115: virtual void sc_core::sc_cor_qt::stack_protect(bool): Assertion `ret == 0' failed.

 

I tried set_stack_size which does not work. Because any single thread is not large. They are either an adder or a multiplier. But the whole system is quite large, containing N multiplier and more than N adders. I guess enlarge the stack for sc_main may help, but I do not know how to do that. There is such an option in ModelSim, however, it does not work for my case.

 

Does anybody have any suggestion? Thanks.

 

Jintao

Share this post


Link to post
Share on other sites

Hi Jintao,

 

You can change the Modelsim SystemC stacksize by modifying the ScMainStackSize variable in your modelsim.ini file. I believe there is also a SystemC set_stack_size() call you can use.

 

Good luck,

 

Hans.

www.ht-lab.com

Share this post


Link to post
Share on other sites

I'd guess, that this is not a stack overflow but an out-of-memory issue, where the kernel fails to obtain enough memory for your processes.

 

Maybe, you can switch your modeling style from SC_THREADs to using SC_METHODs, or even decrease the stack size as a first step?

 

hth,

 Philipp

Share this post


Link to post
Share on other sites

I'd guess, that this is not a stack overflow but an out-of-memory issue, where the kernel fails to obtain enough memory for your processes.

 

Maybe, you can switch your modeling style from SC_THREADs to using SC_METHODs, or even decrease the stack size as a first step?

 

hth,

 Philipp

Yes, it works! Thank you, Philipp. I changed all the SC_THREADs to SC_METHODS and now I can run a size as large as 32768. When N=65536, the 8GB memory on my computer runs out, but there are no errors any more. For SC_METHODS, I cannot change the stack size. So for the next step, probably I need to improve the algorithm.

 

Anyway, this problem is solved. Thanks again!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×