SCATTER(3PVM)

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

πŸ¦‹ SCATTER πŸ¦‹ β€” the pvm_scatter page from PVM Version 3.4, bestie edition

okay so you found the SCATTER(3PVM) page, and honestly? it's giving "distribute the vibes to the whole group chat." no cap.


✨ NAME ✨

pvm_scatter β€” sends to each member of a group a section of an array from a specified member of the group.

like, one task has the snacks, everybody gets their own lil share. that's the whole plot. πŸ’…


🌸 SYNOPSIS 🌸

C:

int info = pvm_scatter( void *result, void *data,
                  int count, int datatype, int msgtag,
                  char *group, int rootginst)

Fortran:

call pvmfscatter(result, data, count, datatype,
                 msgtag, group, rootginst, info)

πŸŽ€ PARAMETERS πŸŽ€

  • result β€” pointer to the starting address of an array of length count of datatype, and yeah it gets overwritten by the message from the specified root member of the group. so don't get attached to whatever was in there before, bestie. πŸ™ˆ
  • data β€” on the root, this is a pointer to the starting address of an array of datatype of local values that are getting distributed to the members of the group. if n is the number of members in the group, then this array of datatype should be of length at least n*count. also β€” plot twist β€” this argument is meaningful only on the root. everyone else can just kinda stand there. πŸ’€
  • count β€” integer specifying the number of elements of datatype to be sent to each member of the group from the root.
  • datatype β€” integer specifying the type of the entries in the result and data arrays. (the defined types are listed below, keep scrolling 🫢)
  • msgtag β€” integer message tag supplied by you. msgtag should be >= 0. it's how your program tells different kinds of messages apart, like labeling your group chat threads. ✨
  • group β€” character string group name of an existing group.
  • rootginst β€” integer instance number of the group member who performs the scatter of its array to the members of the group. they're the main character of this operation, fr fr. πŸ‘‘
  • info β€” integer status code returned by the routine. values less than zero indicate an error. so if it's negative, something went wrong, no cap.

πŸ’– DESCRIPTION πŸ’–

pvm_scatter() performs a scatter of data from the specified root member of the group to each of the members of the group, including itself. yes, the root also gets a piece. everyone eats. πŸ“

all group members must call pvm_scatter(), and each one receives a portion of the data array from the root in their local result array. it's as if the root node sends to the *i*th member of the group count elements from its array data starting at offset i*count from the beginning of the data array. and, it's as if each member of the group performs a corresponding receive of count values of datatype into its result array. the root task is identified by its instance number in the group.

C and Fortran defined datatypes are:

   C datatypes   FORTRAN datatypes
 -----------------------------------
   PVM_BYTE       BYTE1
   PVM_SHORT      INTEGER2
   PVM_INT        INTEGER4
   PVM_FLOAT      REAL4
   PVM_CPLX       COMPLEX8
   PVM_DOUBLE     REAL8
   PVM_DCPLX      COMPLEX16
   PVM_LONG

in using the scatter and gather routines, keep in mind that C stores multidimensional arrays in row order, typically starting with an initial index of 0; whereas, Fortran stores arrays in column order, typically starting with an offset of 1. this is the classic C-vs-Fortran chaos and it will absolutely humble you if you forget. 😭

the current algorithm is very simple and robust. a future implementation may make more efficient use of the architecture to allow greater parallelism. so like… it works, it's just not doing cardio yet. 🧚


🌈 EXAMPLES 🌈

C:

info =  pvm_scatter(&getmyrow, &matrix, 10, PVM_INT,
                   msgtag, "workers", rootginst);

Fortran:

CALL PVMFSCATTER(GETMYCOLUMN, MATRIX, COUNT, INTEGER4,
&                MTAG, 'workers', ROOT, INFO)

πŸ’€ ERRORS πŸ’€

these error conditions can be returned by pvm_scatter:

  • PvmNoInst β€” calling task is not in the group. bestie you are literally not in this group chat. πŸšͺ
  • PvmBadParam β€” the datatype specified is not appropriate. wrong type, wrong vibe.
  • PvmSysErr β€” Pvm system error. the machine said no. πŸ™ƒ

πŸ”₯ SEE ALSO πŸ”₯

pvm_bcast(3PVM), pvm_barrier(3PVM), pvm_psend(3PVM)

go read those next, iykyk. ⭐


okay that's the whole page, you ate it, congrats. this was PVM Version 3.4, dated 21 April, 1994 β€” yes bestie, this manual page is older than us and it's still out here scattering arrays with main character energy. slay. πŸ’œβœ¨

πŸ“¦ where this page comes from