GATHER(3PVM)

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

🫢 GATHER β€” it's giving "everybody send me ur stuff" (3PVM) πŸ’Œ

okay bestie so this is the PVM Version 3.4 page for pvm_gather, and fr fr it's the collective-communication moment where one special little group member collects everyone's messages into one big array. main character energy, but make it a group project that actually works ✨


🌸 NAME 🌸

pvm_gather β€” a specified member of the group receives messages from each member of the group and gathers these messages into a single array. it's the group chat where everybody DMs one person and that person screenshots it all into one folder. iconic. πŸ’…


✨ SYNOPSIS ✨

C girlies:

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

Fortran girlies:

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

πŸŽ€ PARAMETERS πŸŽ€

  • result β€” on the root, this is a pointer to the starting address of an array of datatype holding the local values that are getting accumulated from all the group members. and listen: if n is the number of members in the group, then this array of datatype should be at least n*count long. also, this argument only means anything on the root. everyone else, mind ur business 🫢
  • data β€” for each group member, this is a pointer to the starting address of an array of length count of datatype, and that array is what gets sent to the specified root member of the group. that's ur contribution to the group project bestie, make it count (literally).
  • count β€” an integer specifying the number of elements of datatype to be sent by each member of the group to the root.
  • datatype β€” an integer specifying the type of the entries in the result and data arrays. (the defined types are down below, keep scrolling ⬇️)
  • msgtag β€” an integer message tag supplied by the user. msgtag should be >= 0. it lets ur program tell the difference between different kinds of messages, so u don't get ur vibes mixed up.
  • group β€” a character string group name of an existing group. it has to actually exist, no catfishing.
  • rootginst β€” an integer instance number of the group member who performs the gather of the messages from the members of the group. that's the one holding the aux cord. πŸ‘‘
  • info β€” the integer status code returned by the routine. values less than zero indicate an error. less than zero = bad vibes detected, abort.

πŸ’– DESCRIPTION πŸ’–

pvm_gather() does a send of messages from each member of the group to the specified root member of the group. all group members must call pvm_gather(), no lurking β€” each one sends its array data of length count of datatype to the root, and the root accumulates those messages into its result array. it's as if the root receives count elements of datatype from the *i*th member of the group and places these values into its result array starting with offset i*count from the beginning of the result array. the root task is identified by its instance number in the group. so the ordering is just straight-up member order, no chaos, no surprises. slay. ✨


🌈 the datatypes (C and Fortran defined datatypes) 🌈

C datatypes and their FORTRAN besties:

  • PVM_BYTE ↔ BYTE1
  • PVM_SHORT ↔ INTEGER2
  • PVM_INT ↔ INTEGER4
  • PVM_FLOAT ↔ REAL4
  • PVM_CPLX ↔ COMPLEX8
  • PVM_DOUBLE ↔ REAL8
  • PVM_DCPLX ↔ COMPLEX16
  • PVM_LONG ↔ (no Fortran counterpart listed, she's solo πŸ’…)

🧠 the little caveat u need to know 🧠

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. so like, same data, different layout, don't come for me when ur matrix looks transposed, that's just the culture difference πŸ¦‹

Note: pvm_gather() does not block. so if a task calls pvm_gather and then leaves the group before the root has called pvm_gather, an error may occur. no cap β€” leaving the party before the host gets there is a crime, and PVM will notice. 😭

also 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 chill, it might get glow-up'd later. we'll see. 🧚


πŸ“ EXAMPLES πŸ“

C:

info =  pvm_gather(&getmatrix, &myrow, 10, PVM_INT,
                   msgtag, "workers", rootginst);

Fortran:

CALL PVMFGATHER(GETMATRIX, MYCOLUMN, COUNT, INTEGER4,
&                MTAG, 'workers', ROOT, INFO)

πŸ’€ ERRORS πŸ’€

these error conditions can be returned by pvm_gather:

  • PvmNoInst β€” calling task is not in the group. bestie u were never in the group chat. πŸ’€
  • PvmBadParam β€” the datatype specified is not appropriate. wrong type, wrong era, wrong everything.
  • PvmSysErr β€” Pvm system error. the system said no and meant it.

πŸ‘‘ SEE ALSO πŸ‘‘

  • pvm_bcast(3PVM)
  • pvm_barrier(3PVM)
  • pvm_psend(3PVM)

and that's the whole page, bestie!! this was written for PVM Version 3.4 and the page itself is dated 21 April, 1994 β€” yes she's a vintage queen and she still ate. mwah, go gather ur messages responsibly πŸŽ€πŸ’–βœ¨

πŸ“¦ where this page comes from