Concatenates blocks of data from multiple PEs to an array on every PEs in the active set.
#include <shmem.h> void shmem_collect(void *target, const void *source, size_t nlong, int PE_start, int logPE_stride, int PE_size, long *pSync);
The shmem_collect routine concatenates nlong 64- or 32-bit data items from the source arrays into the target arrays over the active set that is defined by PE_start, logPE_stride, and PE_size. The resultant target array contains the contribution from PE PE_start first, then the contribution from PE PE_start + (2^PE_stride) second, and so on.
This function is a collective function, and must be called by all PEs in the active set defined by the PE_start, logPE_stride, and PE_size. On all PEs in the active set, the values of PE_root, PE_start, logPE_stride, and PE_size must be equal. And the same source, target, and pSync objects must be used on all PEs in the active set. The value of nlong must be the same in all participating PEs for fcollect functions, while collect functions allow nlong to vary from PE to PE. The performance of fcollect functions is much better than collect functions, since the same nlong is used on all participating PEs and there is no need to calculate the position of each contribution in the target array.
Before any PE calls the collective functions, users have to ensure the following conditions exist:
The pSync arrays on all PEs in the active set are not still in use from a prior call to a collective function.
The target array on all PEs in the active set is ready to accept the broadcast data.
Upon returning from the colletcive function, the following conditions are true:
The target data array is updated.
The values in the pSync array are restored to the original values.
Each of these functions assumes that only PEs in the active set call the function. If a PE not in the active set calls the collective function, the behavior is undefined.
Subroutines: shmem_broadcast, shmem_and, shmem_barrier, shmem_max, shmem_min, shmem_or, shmem_prod, shmem_sum, shmem_xor