SCATTER(3PVM)

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

πŸ’– 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 length count of datatype. 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 of datatype holding local values that are gonna get distributed out to the members of the group. if n is how many members are in the group, then this array of datatype should be of length at least n*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 of datatype get 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 the result and data arrays. (defined types are down below, keep scrolling bestie ⬇️)
  • msgtag β€” integer message tag supplied by you, the user. msgtag should 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 if info < 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 β€” BYTE1
  • PVM_SHORT β€” INTEGER2
  • PVM_INT β€” INTEGER4
  • PVM_FLOAT β€” REAL4
  • PVM_CPLX β€” COMPLEX8
  • PVM_DOUBLE β€” REAL8
  • PVM_DCPLX β€” COMPLEX16
  • PVM_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 of 0; whereas Fortran stores arrays in column order, typically starting with an offset of 1. 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