-
Notifications
You must be signed in to change notification settings - Fork 46
Tips & Tricks
- Don't access the global array of lps through the global variable g_tw_lp. Instead, use the tw_getlocal_lp() and tw_getlp() functions.
- Start small. Don't try and write your simulation so you can throw it on thousands of cores the first time. Your first attempt should be a sequential model. But keep in mind that you will attempt to run it on more than just a single core in the future -- don't code yourself into a corner.
- Don't allocate an event and then not send it!!!
- Don't send remote events in your
init()
functions -- there currently exists a bug in our system which could lead to incorrect event processing under certain situations. - Model errors don't need to slow you down! Use
make -k
to continue building despite errors in other models. - You can view what CMake is doing by building like this:
make VERBOSE=1
- When using bit fields for reverse events be sure to zero them out in the forward event handler:
*(int *) bf = (int) 0;
- Be sure to set g_tw_nlp, g_tw_nkp, and maybe nkp_per_pe. You probably want to write your own mapping too.
- Ensure that your model has enough event memory to initialize and run to completion. Make sure and set g_tw_events_per_pe appropriately. A good rule of thumb is 2 * batch * GVT. Sometimes it helps to have an additive value to increase the event count by tighter increments. See
optimistic_memory
in the phold model.
CMake can be used to generate projects for various IDEs. Here is the Xcode example:
- Make a build directory for your project and change to it
mkdir rossnet-xcode
cd rossnet-xcode
- Use cmake to generate the project
cmake -G Xcode ../rossnet/trunk/
- Open the project in Xcode
-
open ROSS_TOP.xcodeproj
Note: anytime the cmake files change, the Xcode project must be generated from scratch. '''Make sure that ROSS can built with therossnet/build-script
before committing any changes back to the svn repository.'''
''Quirks on Mac OS X Lion'': mpi is no longer included in the distribution of Lion/Developer tools. MPICH is the recommended distribution to use with ROSS and the Xcode project settings may need to be tweaked according to this post. Also, when generating the Xcode project from cmake, you may need to unset CC (CC=
). If any cmake
fails, you will have to remove the cmake cache file with rm CMakeCache.txt
.
The easiest way to debug your model is in sequential mode. In that case, you may use your serial debugger of choice (gdb, Xcode, etc.) However, if the problems do not show themselves under sequential runs, you must resort to a little more trickery. This involves running your serial debuggers in an MPI-enabled environment. See here for more information. I like to run a slightly modified version of that command, e.g.
*mpirun -np 2 xterm -e emacs &
Then, in each emacs window, you can run gdb and pass the appropriate command-line arguments and step through your program as you would normally.
''Chris tip:'' mpirun -np 2 xterm -e gdb ./ross/models/gates/gates