SST/macro
|
Let us go back to the simple send/recv skeleton and actually look at the code.
The starting point is creating a main routine for the application, which should be named user_skeleton_main
. When SST/macro launches, it will invoke this routine and pass in any command line arguments specified via the launch_app1_argv
parameter. Upon entering the main routine, the code is now indistinguishable from regular MPI C code. In the parameter file to be used with the simulation, you must set
or, if compiling as C++
At the very top of the file, the SST/macro header files must be included. This header provides the MPI API and configures MPI function calls to link to SST/macro instead of the real MPI library. In most cases, only sstmpi.h
will be needed, but util.h
contains utility functions that may be useful. If trying to maintain code as "single-source'' compilable without modification for both SST/macro and actual MPI, we recommend creating a parallel.h
.
This creates a central point for swapping back and forth. The beginning of the file would then become
The end of the file is again just regular MPI C code:
Here the code just checks the MPI rank and sends (rank 0) or receives (rank 1) a message.