SHMEM_INIT(3)
π SHMEM_INIT(3) π
okay so this is straight out of the Open MPI manual, bestie, and it's about shmem_init and start_pes β no cap, this is the moment your whole SHMEM era begins β¨
πΈ NAME πΈ
shmem_init, start_pes β Allocates a block of memory from the symmetric heap.
β¨ SYNOPSIS β¨
C or C++:
void shmem_init(void)
void start_pes(int npes)
Fortran:
CALL SHMEM_INIT()
CALL START_PES(npes)
π DESCRIPTION π
okay so picture this: the start_pes routine should be the first statement in a SHMEM parallel program. like, main character energy β it goes first, no discussion π
start_pes accepts the following argument:
npesβ Unused. Should be set to0. that's it, that's the whole job, it's literally just sitting there being zero π
This routine initializes the SHMEM API, which means it must be called before calling any other SHMEM routine. fr fr, before anything else. This routine is responsible inter alia for setting up the symmetric heap on the calling PE, and the creation of the virtual PE numbers. Once this routine returns successfully, the calling PE will be able to communicate with and transfer data to other PEs. like, you're connected now, you're in the group chat π«Ά
π Multiple calls to this function are not allowed. one and done. do not come back for seconds.
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. it's giving prerequisite reading π
π¦ EXAMPLES π¦
This is a simple program that calls shmem_integer_put(3):
PROGRAM PUT
INCLUDE "mpp/shmem.fh"
INTEGER TARG, SRC, RECEIVER, BAR
COMMON /T/ TARG
PARAMETER (RECEIVER=1)
CALL SHMEM_INIT()
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
PRINT *,'PE ', MY_PE(),' TARG=',TARG,' (expect 33)'
ENDIF
END
lowkey iconic example tbh β PE 0 puts 33, everybody hits the barrier, receiver prints. expect 33, bestie π
β NOTES β
π If the start_pes call is not the first statement in a program, unexpected results may occur on some architectures. not kidding around here, put it first.
SEE ALSO:
intro_shmem(3) shmem_barrier(3) shmem_barrier_all(3) shmem_put(3) my_pe(3) shmem_n_pes(3)
π COPYRIGHT π
2003-2026, The Open MPI Community
and that's the whole page, bestie π β brought to you by Open MPI, dated May 14, 2026. go forth and initialize responsibly π§β¨
π¦ where this page comes from
- arch rolling: nvhpc-comm-libs 26.9-1 Β· LicenseRef-NVIDIA-HPC-SDK
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms