SCATTER(3PVM)
π SCATTER(3PVM) π
okay bestie, gather round, because today we're talking about pvm_scatter β that's the PVM Version 3.4 era legend, the one from way back on 21 April, 1994, and she is still serving. this is the move where the root of a group just hands out slices of an array to everybody like it's a group chat dropping memes. no cap. π«Ά
β¨ NAME β¨
pvm_scatter β sends to each member of a group a section of an array from a specified member of the group. it's giving "oprah voice: you get a slice, you get a slice, EVERYBODY gets a slice" π
πΈ 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β a pointer to the starting address of an array of lengthcountofdatatype. this bad girl gets overwritten by the message coming in from the specified root member of the group. she's a receiver, she's not here to keep her old memories. πdataβ on the root only, this points to the starting address of an array ofdatatypeholding local values that are gonna get distributed out to the members of the group. ifnis how many members are in the group, then this array ofdatatypeshould be of length at leastn*count. and fr fr, this argument is meaningful only on the root. everybody else, ignore her, she's not talking to you. πcountβ an integer saying how many elements ofdatatypeget sent to each member of the group from the root. one number, many happy recipients. β¨datatypeβ an integer specifying the type of the entries in theresultanddataarrays. (defined types are down below, keep scrolling bestie β¬οΈ)msgtagβ integer message tag supplied by you, the user.msgtagshould be>= 0. it's how your program tells different kinds of messages apart. she's the label on the lunchbox. πgroupβ character string group name of an existing group. you can't just make one up, she has to already exist.rootginstβ integer instance number of the group member who performs the scatter of its array to the members of the group. that's the main character of this operation πinfoβ integer status code returned by the routine. values less than zero indicate an error. so ifinfo < 0, something went wrong and we need to talk. π
π¦ 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 feeds herself too, she's not gonna stand there handing out plates and not eat. π
all group members must call pvm_scatter(), and each one receives a portion of the data array from the root into 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.
the C and Fortran defined datatypes are:
PVM_BYTEβBYTE1PVM_SHORTβINTEGER2PVM_INTβINTEGER4PVM_FLOATβREAL4PVM_CPLXβCOMPLEX8PVM_DOUBLEβREAL8PVM_DCPLXβCOMPLEX16PVM_LONGβ (C only, no Fortran twin, she's solo π)
when you're using the scatter and gather routines, keep in mind that C stores multidimensional arrays in row order, typically starting with an initial index of0; whereas Fortran stores arrays in column order, typically starting with an offset of1. this trips up literally everyone, so note it. π₯
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, she's reliable, not maximally fast. respect her anyway. π)
β 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're not on the guest list, sorry. πPvmBadParamβ the datatype specified is not appropriate. wrong type, wrong vibe. πPvmSysErrβ Pvm system error. the universe said no. π§οΈ
π SEE ALSO π
pvm_bcast(3PVM), pvm_barrier(3PVM), pvm_psend(3PVM)
and that's the whole page, bestie! π this one came straight out of PVM Version 3.4, dated 21 April, 1994 β so go scatter something iconic today. 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