GATHER(3PVM)
π«Ά 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 ofdatatypeholding 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 ofdatatypeshould be at leastn*countlong. 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 lengthcountofdatatype, 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 ofdatatypeto be sent by each member of the group to the root.datatypeβ an integer specifying the type of the entries in theresultanddataarrays. (the defined types are down below, keep scrolling β¬οΈ)msgtagβ an integer message tag supplied by the user.msgtagshould 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βBYTE1PVM_SHORTβINTEGER2PVM_INTβINTEGER4PVM_FLOATβREAL4PVM_CPLXβCOMPLEX8PVM_DOUBLEβREAL8PVM_DCPLXβCOMPLEX16PVM_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 callspvm_gatherand then leaves the group before the root has calledpvm_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
- debian bookworm: pvm-dev 3.4.6-5
- ubuntu jammy: pvm-dev 3.4.6-3.2
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms