Download Compaq AlphaServer SC User Guide

Transcript
Shmem Example
2. The time after the set of repetitions has ended.
The variable t is used to hold the difference between these two
readings.
3
The tag variable is used to identify the messages sent through the
Shmem communications functions. tbuf and rbuf are pointers to
buffers for the messages, for which the process allocates space before
calling shmem_put() and shmem_wait() to send and receive
messages.
4
This group of variables is used to control how many times the process
pings its opposite number and the size of packets sent. The variable
reps is set to the number of repetitions requested with the -n option.
It has a default setting of 10,000.
The next three variables hold the minimum, maximum and increment
values for the packet size. They are used when more than one set of
repetitions is requested. The variable nwords is used to iterate from
minWords to maxWords during a set of repetitions.
5
These variables are used to identify, by means of their rank, the
process and its peer (or opposite number), to which it sends packets,
and to hold the total number of processes.
6
The variable doprint is used to enable (1) or disable (0) the printing
of results by all the processes.
The progName variable is used to extract the name of the program for
use with the standard UNIX style -h option and Usage message,
which is displayed when the program is called with the wrong
arguments.
The remaining three variables are general purpose iteration
variables.
4.7.5 Argument Checking
The first section of main() is concerned with checking the arguments passed to the
program on the command line.
int main(int argc, char *argv[]) {
...
for (progName = argv[0] + strlen (argv[0]); 1
progName > argv[0] && *(progName - 1) != ’/’;
progName--)
;
MPI and Shmem Programming 4-25