Section: PVM Version 3.4 (3PVM)
Updated: 21 April, 1994
Return to Main Contents
pvm_gather - A specified member of the group receives messages
from each member of the group and gathers these messages into
a single array.
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)
On the root this is a
pointer to the starting address of an array
of local values
which are to be accumulated from the members of the group.
if the number of members in the group, then this array
should be of length at least
This argument is meaningful only on the root.
For each group member this is a pointer to the starting
address of an array of length
which will be sent to the specified root member of the group.
Integer specifying the number of elements of
to be sent by each member of the group to the root.
Integer specifying the type of the entries in the result and data arrays.
(See below for defined types.)
Integer message tag supplied by the user.
msgtag should be >= 0. It allows the user's program to
distinguish between different kinds of messages.
Character string group name of an existing group.
Integer instance number of group member who performs the
gather of the messages from the members of the group.
Integer status code returned by the routine.
Values less than zero indicate an error.
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(), each sends its array
to the root which accumulates these messages into its
It is as if the root receives
from the ith member of the group and places these values in its
array starting with offset i*count from the beginning of the
The root task is identified by its instance number in the group.
C and Fortran defined
C datatypes FORTRAN datatypes
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.
Note: pvm_gather() does not block. If a task calls pvm_gather and then
leaves the group before the root has called pvm_gather an error may occur.
The current algorithm is very simple and robust. A future implementation
may make more efficient use of the architecture to allow greater
info = pvm_gather(&getmatrix, &myrow, 10, PVM_INT,
msgtag, "workers", rootginst);
CALL PVMFGATHER(GETMATRIX, MYCOLUMN, COUNT, INTEGER4,
& MTAG, 'workers', ROOT, INFO)
These error conditions can be returned by
Calling task is not in the group
The datatype specified is not appropriate
Pvm system error
- SEE ALSO
linux.jgfs.net manual pages