User guide

6SHMEM Description and Configuration
SHMEM Programs
6-4 IB0054606-02 A
The % character in the previous example is used to indicate the shell prompt and
is followed by a command. The program can be compiled and linked using the
shmemcc wrapper script:
% shmemcc shmem_world.c -o shmem_world
The program can be run using the shmemrun wrapper script:
% shmemrun -m hosts -np 2 ./shmem_world
Hello from PE 1 out of 2
Hello from PE 0 out of 2
This script assumes a hosts file is available, containing the host names on which
the program is run. The -np option is used to specify the number of processing
elements (PEs) to be run (for example, 2).
Compiling SHMEM Programs
The shmemcc script is a wrapper script for the compilation of the SHMEM C
programs. The main purpose of the script is to call the C compiler with additional
options to specify the SHMEM include directory, the SHMEM library directory, and
to appropriately link in the SHMEM library. The shmemcc script automatically
determines the correct directories by finding them relative to its own location. The
standard directory layout of the QLogic SHMEM software is assumed.
The default C compiler is gcc, and can be overridden by specifying a compiler with
the $SHMEM_CC environment variable.
If the option -show is added to the shmemcc command, it displays the command
line that would be used to invoke the C compiler, but the C compiler will not be
invoked. All other arguments to shmemcc are passed through to the C compiler
without modification.
The C compiler can be used directly without using shmemcc. In that case the user
must add the following to the command line:
For compilations add the following option:
-I $SHMEM_DIR/include
For linkages add the following options:
NOTE
These instructions assume a standard SHMEM installation and that
/usr/shmem/qlogic/bin has been added to the $PATH.