GATHER(3PVM)
π¦ GATHER(3PVM) π¦
okay so bestie, welcome to the pvm_gather page from PVM Version 3.4 β it's giving group chat where everyone sends their lil data to the root and the root collects it into one big array. iconic π
β¨ 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. periodt. π
π SYNOPSIS π
C:
int info = pvm_gather( void *result, void *data,
int count, int datatype, int msgtag,
char *group, int rootginst)
Fortran:
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 ofdatatypelocal values that are gonna be accumulated from the members of the group. Ifnis the number of members in the group, then this array ofdatatypeshould be at least lengthn*count. This argument is meaningful only on the root. root only, bestie. πdataβ For each group member, this is a pointer to the starting address of an array of lengthcountofdatatypethat will be sent to the specified root member of the group. your lil contribution. β¨countβ Integer specifying the number of elements ofdatatypeto be sent by each member of the group to the root. how many things you're sending.datatypeβ Integer specifying the type of the entries in theresultanddataarrays. (See below for defined types.) the vibe of your data.msgtagβ Integer message tag supplied by the user.msgtagshould be>= 0. It lets the user's program distinguish between different kinds of messages. tag it so you know what's what. π·οΈgroupβ Character string group name of an existing group. your squad's name. πrootginstβ Integer instance number of the group member who performs the gather of the messages from the members of the group. the main character who collects everything. πinfoβ Integer status code returned by the routine. Values less than zero indicate an error. negative means something went wrong, no cap. π
π₯ DESCRIPTION π₯
pvm_gather() performs 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(), and each one sends its array data of length count of datatype to the root, which accumulates these 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 in 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. math but make it cute. β¨
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. lowkey important for not messing up your arrays. π§
Note:pvm_gather()does not block. If a task callspvm_gatherand then leaves the group before the root has calledpvm_gather, an error may occur. so don't dip early, bestie. π
The current algorithm is very simple and robust. A future implementation may make more efficient use of the architecture to allow greater parallelism. future glow-up pending. β
π 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. you're not on the list, bestie. πPvmBadParamβ Thedatatypespecified is not appropriate. wrong vibe of data.PvmSysErrβ Pvm system error. system said no. π
π SEE ALSO π
pvm_bcast(3PVM)pvm_barrier(3PVM)pvm_psend(3PVM)
okay that's the whole page bestie, hope you slayed that gather. this was PVM Version 3.4, manual page GATHER(3PVM), dated 21 April, 1994 β periodt πβ¨π¦
π¦ 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