SCATTER(3PVM)
π¦ 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 lengthcountofdatatype, 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 ofdatatypeof local values that are getting distributed to the members of the group. ifnis the number of members in the group, then this array ofdatatypeshould be of length at leastn*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 ofdatatypeto be sent to each member of the group from the root.datatypeβ integer specifying the type of the entries in theresultanddataarrays. (the defined types are listed below, keep scrolling π«Ά)msgtagβ integer message tag supplied by you.msgtagshould 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
- 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