1GATHER(3PVM) PVM Version 3.4 GATHER(3PVM)
2
3
4
6 pvm_gather - A specified member of the group receives messages from
7 each member of the group and gathers these messages into a single
8 array.
9
10
12 C int info = pvm_gather( void *result, void *data,
13 int count, int datatype, int msgtag,
14 char *group, int rootginst)
15
16 Fortran call pvmfgather(result, data, count, datatype,
17 msgtag, group, rootginst, info)
18
19
21 result On the root this is a pointer to the starting address of an
22 array datatype of local values which are to be accumulated from
23 the members of the group. If n if the number of members in the
24 group, then this array of datatype should be of length at least
25 n*count. This argument is meaningful only on the root.
26
27 data For each group member this is a pointer to the starting address
28 of an array of length count of datatype which will be sent to
29 the specified root member of the group.
30
31 count Integer specifying the number of elements of datatype to be
32 sent by each member of the group to the root.
33
34 datatype
35 Integer specifying the type of the entries in the result and
36 data arrays. (See below for defined types.)
37
38 msgtag Integer message tag supplied by the user. msgtag should be >=
39 0. It allows the user's program to distinguish between differ‐
40 ent kinds of messages.
41
42 group Character string group name of an existing group.
43
44 rootginst
45 Integer instance number of group member who performs the gather
46 of the messages from the members of the group.
47
48 info Integer status code returned by the routine. Values less than
49 zero indicate an error.
50
51
52
54 pvm_gather() performs a send of messages from each member of the group
55 to the specified root member of the group. All group members must call
56 pvm_gather(), each sends its array data of length count of datatype to
57 the root which accumulates these messages into its result array. It is
58 as if the root receives count elements of datatype from the ith member
59 of the group and places these values in its result array starting with
60 offset i*count from the beginning of the result array. The root task
61 is identified by its instance number in the group.
62
63 C and Fortran defined datatypes are:
64 C datatypes FORTRAN datatypes
65 -----------------------------------
66 PVM_BYTE BYTE1
67 PVM_SHORT INTEGER2
68 PVM_INT INTEGER4
69 PVM_FLOAT REAL4
70 PVM_CPLX COMPLEX8
71 PVM_DOUBLE REAL8
72 PVM_DCPLX COMPLEX16
73 PVM_LONG
74
75 In using the scatter and gather routines, keep in mind that C stores
76 multidimensional arrays in row order, typically starting with an ini‐
77 tial index of 0; whereas, Fortran stores arrays in column order, typi‐
78 cally starting with an offset of 1.
79
80 Note: pvm_gather() does not block. If a task calls pvm_gather and
81 then leaves the group before the root has called pvm_gather an error
82 may occur.
83
84 The current algorithm is very simple and robust. A future implementa‐
85 tion may make more efficient use of the architecture to allow greater
86 parallelism.
87
88
90 C:
91 info = pvm_gather(&getmatrix, &myrow, 10, PVM_INT,
92 msgtag, "workers", rootginst);
93
94 Fortran:
95 CALL PVMFGATHER(GETMATRIX, MYCOLUMN, COUNT, INTEGER4,
96 & MTAG, 'workers', ROOT, INFO)
97
98
100 These error conditions can be returned by pvm_gather
101
102 PvmNoInst
103 Calling task is not in the group
104
105 PvmBadParam
106 The datatype specified is not appropriate
107
108 PvmSysErr
109 Pvm system error
110
112 pvm_bcast(3PVM), pvm_barrier(3PVM), pvm_psend(3PVM)
113
114
115
116 21 April, 1994 GATHER(3PVM)