START_PES(3)

πŸ“¦
version 5.0.10 Β· 4 versions
, in ubuntu stonking

πŸ’– START_PES(3) β€” the Open MPI glow-up πŸ’–

okay bestie, sit down, hydrate, because we're talking about shmem_init / start_pes from the Open MPI manual, and it's literally the first thing your SHMEM program does. main character energy only. πŸ‘‘


✨ NAME ✨

shmem_init, start_pes β€” Allocates a block of memory from the symmetric heap.

yes that's the official one-liner and yes it's giving "humble but essential." 🫢


🌸 SYNOPSIS 🌸

C or C++:

void shmem_init(void)
void start_pes(int npes)

Fortran:

CALL SHMEM_INIT()
CALL START_PES(npes)

πŸ¦‹ DESCRIPTION πŸ¦‹

okay so the tea is: the start_pes routine should be the first statement in a SHMEM parallel program. first. statement. no exceptions, no warm-up, no "let me just declare one more thing first." 🚨

The start_pes routine accepts the following argument:

  • npes β€” Unused. Should be set to 0. literally a placeholder, it's giving decorative. πŸŽ€

This routine initializes the SHMEM API, which means it must be called before calling any other SHMEM routine. Not "should," must. It's the vibe check your whole program has to pass first.

This routine is responsible inter alia for setting up the symmetric heap on the calling PE, and the creation of the virtual PE numbers. Upon successful return from this routine, the calling PE will be able to communicate with and transfer data to other PEs. so like… it unlocks the group chat. πŸ”“πŸ’¬

Multiple calls to this function are not allowed. one and done, babe. periodt. 🚫

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 the syllabus, go read it πŸ“š)


πŸ”₯ 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

look at that control flow. SHMEM_INIT() first, then the put, then everybody meets at the barrier, then PE 1 prints and expects 33. immaculate. πŸ’…


⚠️ NOTES ⚠️

If the start_pes call is not the first statement in a program, unexpected results may occur on some architectures. bestie. put it first. i am begging. 😭

See also: intro_shmem(3) shmem_barrier(3) shmem_barrier_all(3) shmem_put(3) my_pe(3) shmem_n_pes(3)


2003-2026, The Open MPI Community


and that's the whole page, no cap. 🧚 this Open MPI classic was written by The Open MPI Community (copyright 2003-2026), and this particular rendering is dated Sep 10, 2026 β€” mwah, iconic, go call start_pes first. πŸŒˆβ­πŸ’–

πŸ“¦ where this page comes from