Broadcasts a block of data from one processing element (PE) to one or more target PEs.
#include <shmem.h> void shmem_broadcast(void *target, const void *source, size_t nlong, int PE_root, int PE_start, int logPE_stride, int PE_size, long *pSync);
The shmem_broadcast routine is a collective routine. They copy data object source on the processor specified by PE_root and store the values at target on the other PEs specified by the triplet PE_start, logPE_stride, PE_size. The data is not copied to the target area on the root PE. The values of arguments PE_root, PE_start, logPE_stride, and PE_size must be equal on all PEs in the active set. The same target and source data objects and the same pSync work array must be passed to all PEs in the active set.
Before any PE calls the broadcast functions, users have to ensure the following conditions exist:
The pSync arrays on all PEs in the active set is not still in use from a prior call to a broadcast function.
The target array on all PEs in the active set is ready to accept the broadcast data.
Upon returning from the broadcast function, the following conditions are true:
If the current PE is not the root PE, 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. On all PEs in the active set, the values of nlong, 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.
Subroutines: shmem_barrier, shmem_barrier_all