START_PES(3)START_PES(3)NAME
start_pes - Called at the beginning of a SHMEM program to identify the
number of processes desired
SYNOPSIS
C or C++:
void start_pes(int npes);
Fortran:
CALL START_PES(npes)DESCRIPTION
The start_pes routine identifies the number of processes for a
program. This statement must be the first statement in a program that
uses distributed, shared memory (SHMEM) communication routines. The
start_pes routine accepts the following argument:
npes Identifies the total number of processing elements (PEs)
desired. If npes is 0, the number of PEs is selected by the
NPES environment variable. The type of NPES is default
integer.
If your parallel application uses MPI and SHMEM, you can omit the
start_pes call and call MPI_Init and MPI_Finalize, as specified in the
MPI standard, and launch the program with the mpirun command. Do not
call both MPI_init and start_pes from the same program.
Programs that use both SHMEM and MPI must call MPI_Init and
MPI_Finalize instead of start_pes. PVM and SHMEM communication cannot
be used in the same program.
For an overview of programming with SHMEM communication routines,
example SHMEM programs, and instructions for compiling SHMEM programs,
see the intro_shmem(3) man page.
EXAMPLES
This is a simple program that calls shmem_integer_put(3):
PROGRAM PUT
INTEGER TARG, SRC, RECEIVER, BAR
COMMON /T/ TARG
PARAMETER (RECEIVER=1)
CALL START_PES(0)
IF (MY_PE() .EQ. 0) THEN
SRC = 33
CALL SHMEM_INTEGER_PUT(TARG, SRC, 1, RECEIVER)
ENDIF
CALL SHMEM_BARRIER_ALL ! SYNCHRONIZES SENDER AND RECEIVER
IF (MY_PE() .EQ. RECEIVER) THEN
CALL SHMEM_UDCFLUSH() ! NOT REQUIRED ON IRIX SYSTEMS
PRINT*,'PE ', MY_PE(),' TARG=',TARG
IF (TARG.NE.33) PRINT*,'FAIL'
ENDIF
END
NOTES
If the start_pes call is not the first statement in a program,
unexpected results will occur. Static data areas initialized prior to
the start_pes call will sometimes be set to zero during start_pes
processing.
SEE ALSOfork(2)intro_shmem(3), shmem_barrier(3), shmem_barrier_all(3), shmem_put(3)my_pe(3I), num_pes(3I)
Message Passing Toolkit: MPI Programmer's Manual