SIBLINGS(3PVM)

πŸ“¦ version 3.4.6, in debian bookworm, ubuntu jammy

πŸ’– SIBLINGS β€” the pvm_siblings page, bestie edition πŸ’–

okay so this is from PVM Version 3.4 and it's a section 3 manual page, which means it's a library routine. no cap. let's get into it 🫢


✨ NAME ✨

pvm_siblings β€” returns how many tasks got started together in one single spawn call, plus all their tids. it's giving "who's in my group chat" energy πŸ’…


🌸 SYNOPSIS 🌸

C

int ntids = pvm_siblings( int **tids )

Fortran

call pvmfsiblings( ntids, index, sibling )

πŸŽ€ PARAMETERS πŸŽ€

  • ntids β€” this is the return value and it hands you back the number of tids that were spawned together. if it's less than 0, bestie, something went wrong 😭
  • tids β€” a pointer to the array of tids holding your siblings. indexed from 0 to (ntids - 1).
  • index β€” an integer index of the tid you want returned in sibling. if you set index to -1, then sibling stays exactly how it was, untouched, no notes. otherwise it has to be in the range [0, ntids - 1].
  • sibling β€” when index is in the range [0, ntids - 1], this is where you get the tid of the index you asked for. iconic ✨

πŸ’… DESCRIPTION πŸ’…

pvm_siblings returns the number of tasks and a whole list of task ids for the processes that were spawned together in a single spawn call. the spawning task multicasts the list of successful to the spawned tasks, so every single task ends up with an identical copy of the sibling list. teamwork makes the dream work fr fr πŸ¦‹

here's the important bit though: pvm_siblings uses local storage to keep the list of tids, and it does not update this list when sibling tasks exit the virtual machine. so it's a snapshot, not a live feed. the FORTRAN version lets calling programs read a particular index in the internal sibling array. if pvm_siblings is successful, ntids will be > 0. if some error occurs, then ntids will be < 0. that's the vibe check right there.

so like, why does this exist? pvm_siblings is designed to simplify the logic in static spmd-style programs. by giving tasks an identical list of tids and its size, programs may self size and treat the sibling as a static map between instances and tasks. the internal list is not updated when sibling tasks exit the virtual machine and should be treated as a snapshot of the parallel program when it was first started. periodt. πŸ“Έ

and if a task was started by pvm_spawn, then pvm_siblings will return ntids = 1 and

ntids = 1 and tids will contain a single entry identical to the task id
returned by pvm_mytid()

so yeah, a lone wolf still gets a list of one. main character energy πŸ‘‘


🌈 EXAMPLES 🌈

C:

int *tids;
ntids = pvm_siblings(&tids);

Fortran:

INTEGER TIDS(0:MAXNPROC)
CALL PVMFSIBLINGS(NTIDS, -1, IDUM)
DO I = 0, NTIDS-1
   CALL PVMFSIBLINGS(NTIDS, I, TIDS(I))

look at that loop go. obsessed 😌


πŸ’€ ERRORS πŸ’€

pvm_siblings can return the following error codes

  • PvmNoTask β€” no task at that index, or the index is invalid. basically you asked for a seat that doesn't exist bestie, the index is giving nothing πŸ™ˆ

⭐ SEE ALSO ⭐

pvm_spawn(3PVM), pvm_mytid(3PVM), pvm_parent(3PVM)

go read those next, iykyk πŸ’œ


and that's the whole page!! this one was written all the way back on 26 June, 1997, from PVM Version 3.4. vintage but still slaying, honestly πŸŽ€βœ¨πŸ«Ά

πŸ“¦ where this page comes from