Jump to content


  • Content count

  • Joined

  • Last visited

About arhdr_sc

  • Rank

Recent Profile Visitors

148 profile views
  1. Profiling SystemC using gprof

    Thank you very much!
  2. Hello, I am using SystemC 2.3.0. I am wondering how I can profile the SystemC library. I found we can use options like "--enable-debug" and "--disable-optimize" for debugging and optimization, respectively, but I was unable to find such an option to enable profiling. I need to use gprof and pass "-pg" options when building SystemC. Any help is greatly appreciated! Thank you in advance.
  3. Hi Philipp, ========== Section 1: ========== About using the MinGW compiler, I noticed that I should change my code as I used sockets for communication with another program. So, for Windows I need to rewrite my code using Windows socket API, which I prefer not to do for now. ========== Section 2: ========== About rethinking my modeling approach for a large number of threads, I have some ideas but it needs checkpointing the threads (saving and restoring threads' context and swap the threads in when they are needed to execute), which I believe the primitives are not provided by SystemC. I have a question about this as there is potential to simplify my model to use a small number of SystemC dynamic threads. I should explain the model first. Suppose I have N X M serial threads that can be assigned to M parallel threads, each executing N serial threads. Also, each serial thread is divided into P serial phases. At any point in time, there are M parallel threads running. Each parallel thread is executing one phase of one of its serial threads. Once a parallel thread is finished executing its current serial phase, it switches to the next phase, which can be a phase from another serial thread assigned to this parallel thread. To clarify I give the following example with M, N, and P set as follows: M = 2 (number of parallel threads) N = 3 (number of serial threads assigned to each parallel thread) P = 4 (number of serial phases per each serial thread) Serial threads assigned to parallel threads as follows (this assignment varies for different simulations): PT0 PT1 ------------------ ST0 ST1 ST2 ST3 ST4 ST5 Parallel thread schedule: PT0: ST0_PH0, ST2_PH0, ST4_PH0, ST0_PH1, ST2_PH1, ST4_PH1, ST0_PH2, ST2_PH2, ST4_PH2, ST0_PH3, ST2_PH3, ST4_PH3; PT0: ST1_PH0, ST3_PH0, ST5_PH0, ST1_PH1, ST3_PH1, ST5_PH1, ST1_PH2, ST3_PH2, ST5_PH2, ST1_PH3, ST3_PH3, ST5_PH3; Legend: PT: parallel thread ST: serial thread PH: phase STx_PHy: phase y from serial thread x For example, PT0 starts with PH0 from ST0, and continues with PH0 from ST2, ..., until it gets to PH3 from ST4 as a last phase. ========== Section 3: ========== About switching to a 64-bit OS, I was able to run my simulation for 16384 threads on a 64-bit Linux OS. However, when I ran my simulation for (16384 X 4) threads, I got the following error message: ../../../../src/sysc/kernel/sc_cor_qt.cpp:107: virtual void sc_core::sc_cor_qt:: stack_protect(bool): Assertion `ret == 0' failed. So, if I could find a solution for reducing the number of active threads as explained in Section 2, it would be so great. Sorry for being too long in this post. Thank you so much. Regards, Alireza
  4. Hi Philipp, I tried the SystemC installation with Pthread implementation, however, I got the following error message: "ERROR - could not create thread", which I believe is issued by sc_cor_pkg_pthread::create(). Also, I cannot use SC_METHODs as there is communication between threads using wait(). I am trying to switch to a 64-bit OS. However, it will take some time, as I need to re-install my whole system and application software to the new OS to be able to continue developing my project under the new system. BTW, I noticed a note by you from previous posts (see below) saying "Secondly, you should _NOT_ use pthreads for your SystemC processes unless needed for very specific reasons". Could you explain why? http://www.accellera.org/Discussion_Forums/systemc-forum/archive/msg?list_name=systemc-forum&monthdir=201209&msg=msg00028.html Anyways, thank you so much for your helpful and insightful comments. Regards, Alireza
  5. Hello, Philipp, thank you very much for your reply. I tried sc_spawn_options you mentioned, however, I got the following error: assertion "m_stack_size > ( 2 * pagesize )" failed: file "../../../../src/sysc/kernel/sc_cor_qt.cpp", line 76, function: virtual void sc_core::sc_cor_qt::stack_protect(bool) When I set the stack size to 0x10000 and 327680 >> 2, I get the above error message (SC_DEFAULT_STACK_SIZE is 327680 for my case). I need much less than this stack size, say, 0x1000 is enough I guess. I looked at the sc_cor_qt::stack_protect() method. I noticed a comment at the top of this method saying: // Code needs to be tested on HP-UX and disabled if it doesn't work there // Code still needs to be ported to WIN32 So, How can I set the stack size to 0x1000 without getting error messages. Thanks, Alireza
  6. Hello All, I need to spawn a large number of threads for my simulation using sc_spwan(). My threads are very small piece of code. When I have 16384 threads the simulation stops by issuing the following message in iteration 5504 of the loop invoking sc_spawn(): Error: (E549) uncaught exception: std::bad_alloc In file: ../../../../src/sysc/kernel/sc_except.cpp:98 I know this happens due to stack size, but I don't know how much memory is used by each thread. Q1) Is there a way to get the size of stack for each thread? Is there a method/function like get_stack_size()? Q2) How can I use set_stack_size() when invoking sc_spawn()? Q3) My simulation is run in CygWin under Windows 7 (32-bit). Does 32-bit the OS impose a limitation to the stack size? In other words, can the problem be fixed using a 64-bit OS? Thank you so much in advance!
  7. Hell All, I posted a question entitled "Determining source of events using global fifo" on Sep 9, 2013. Surprisingly, I have not got a reply for this post so far. What is wrong with this post? Any idea? Can anyone see my post? Thanks, Alireza
  8. Hello All, I have a question about determining the source of event for a module (module_a) connected to multiple modules (module_b1, module_b2, and module_b3) through sc_fifos (sf_b1_to_a, sf_b2_to_a, and sf_b3_to_a). module_a has a process that processes both clocked and non-clocked events. I use clk.posedge() to determine the source of clocked and non-clocked events. The process in module_a is made sensitive to clk.pos(), sf_b1_to_a.data_written(), sf_b2_to_a.data_written(), and sf_b3_to_a.data_written(). The problem is when the module_a process is triggered due to one of the non-clocked events (i.e., sf_b1_to_a.data_written(), sf_b2_to_a.data_written(), or sf_b3_to_a.data_written()) I don't know how to determine which one actually triggered the module_a process. I have an idea to determine the source of the event. I'd like to validate my idea. My idea is that I use a global fifo, and when any of modules module_b1, module_b2, or module_b3 write to the corresponding sc_fifo, write its ID to the global fifo as well. Then, when module_a is triggered for a non-clocked event, I read the global fifo and determine which fifo has written to the global fifo. Is this a valid assumption that the order that modules b1, b2, and b3 write to the global fifo, the same as the order that the SystemC kernel triggers module_a for their respective data_written() events? Thank you so much in advance! Regards, Alireza