static void _shmem_broadcast(void *target, const void *source, size_t nbytes, int PE_root, int PE_start, int logPE_stride, int PE_size, long *pSync) { int rc = OSHMEM_SUCCESS; oshmem_group_t* group = NULL; if ((0 <= PE_root) && (PE_root < PE_size)) { /* Create group basing PE_start, logPE_stride and PE_size */ #if OSHMEM_GROUP_CACHE_ENABLED == 0 group = oshmem_proc_group_create(PE_start, (1 << logPE_stride), PE_size); if (!group || (PE_root >= group->proc_count)) { rc = OSHMEM_ERROR; } #else group = find_group_in_cache(PE_start, logPE_stride, PE_size); if (!group) { group = oshmem_proc_group_create(PE_start, (1 << logPE_stride), PE_size); if (!group || (PE_root >= group->proc_count)) { rc = OSHMEM_ERROR; } else { cache_group(group, PE_start, logPE_stride, PE_size); } } #endif /* OSHMEM_GROUP_CACHE_ENABLED */ /* Collective operation call */ if (rc == OSHMEM_SUCCESS) { /* Define actual PE using relative in active set */ PE_root = oshmem_proc_pe(group->proc_array[PE_root]); /* Call collective broadcast operation */ rc = group->g_scoll.scoll_broadcast(group, PE_root, target, source, nbytes, pSync, SCOLL_DEFAULT_ALG); } #if OSHMEM_GROUP_CACHE_ENABLED == 0 if ( rc == OSHMEM_SUCCESS ) { oshmem_proc_group_destroy(group); } #endif /* OSHMEM_GROUP_CACHE_ENABLED */ } }
static void _shmem_alltoall(void *target, const void *source, ptrdiff_t dst, ptrdiff_t sst, size_t nelems, size_t element_size, int PE_start, int logPE_stride, int PE_size, long *pSync) { int rc = OSHMEM_SUCCESS; oshmem_group_t* group = NULL; if ((0 <= PE_start) && (0 <= logPE_stride)) { /* Create group basing PE_start, logPE_stride and PE_size */ #if OSHMEM_GROUP_CACHE_ENABLED == 0 group = oshmem_proc_group_create(PE_start, (1 << logPE_stride), PE_size); if (!group) rc = OSHMEM_ERROR; #else group = find_group_in_cache(PE_start, logPE_stride, PE_size); if (!group) { group = oshmem_proc_group_create(PE_start, (1 << logPE_stride), PE_size); if (!group) { rc = OSHMEM_ERROR; } else { cache_group(group, PE_start, logPE_stride, PE_size); } } #endif /* OSHMEM_GROUP_CACHE_ENABLED */ /* Collective operation call */ if (rc == OSHMEM_SUCCESS) { /* Call collective alltoall operation */ rc = group->g_scoll.scoll_alltoall(group, target, source, dst, sst, nelems, element_size, pSync, SCOLL_DEFAULT_ALG); } #if OSHMEM_GROUP_CACHE_ENABLED == 0 if ( rc == OSHMEM_SUCCESS ) { oshmem_proc_group_destroy(group); } #endif /* OSHMEM_GROUP_CACHE_ENABLED */ } }
static void __shmem_collect(void *target, const void *source, size_t nbytes, int PE_start, int logPE_stride, int PE_size, long *pSync, bool array_type) { int rc = OSHMEM_SUCCESS; oshmem_group_t* group = NULL; { /* Create group basing PE_start, logPE_stride and PE_size */ #if OSHMEM_GROUP_CACHE_ENABLED == 0 group = oshmem_proc_group_create(PE_start, (1 << logPE_stride), PE_size); if (!group) rc = OSHMEM_ERROR; #else group = find_group_in_cache(PE_start, logPE_stride, PE_size); if (!group) { group = oshmem_proc_group_create(PE_start, (1 << logPE_stride), PE_size); if (!group) { rc = OSHMEM_ERROR; } else { cache_group(group, PE_start, logPE_stride, PE_size); } } #endif /* OSHMEM_GROUP_CACHE_ENABLED */ /* Collective operation call */ if (rc == OSHMEM_SUCCESS) { /* Call collective broadcast operation */ rc = group->g_scoll.scoll_collect(group, target, source, nbytes, pSync, array_type, SCOLL_DEFAULT_ALG); } #if OSHMEM_GROUP_CACHE_ENABLED == 0 if ( rc == OSHMEM_SUCCESS ) { oshmem_proc_group_destroy(group); } #endif /* OSHMEM_GROUP_CACHE_ENABLED */ } }
void shmem_barrier(int PE_start, int logPE_stride, int PE_size, long *pSync) { int rc = OSHMEM_SUCCESS; oshmem_group_t* group = NULL; RUNTIME_CHECK_INIT(); #if OSHMEM_SPEC_COMPAT == 1 /* all outstanding puts must be completed */ shmem_fence(); #endif if ((0 <= PE_start) && (0 <= logPE_stride)) { /* Create group basing PE_start, logPE_stride and PE_size */ #if OSHMEM_GROUP_CACHE_ENABLED == 0 group = oshmem_proc_group_create(PE_start, (1 << logPE_stride), PE_size); if (!group) rc = OSHMEM_ERROR; #else group = find_group_in_cache(PE_start, logPE_stride, PE_size); if (!group) { group = oshmem_proc_group_create(PE_start, (1 << logPE_stride), PE_size); if (!group) { rc = OSHMEM_ERROR; } else { cache_group(group, PE_start, logPE_stride, PE_size); } } #endif /* OSHMEM_GROUP_CACHE_ENABLED */ /* Collective operation call */ if (rc == OSHMEM_SUCCESS) { /* Call barrier operation */ rc = group->g_scoll.scoll_barrier(group, pSync, SCOLL_DEFAULT_ALG); } #if OSHMEM_GROUP_CACHE_ENABLED == 0 if ( rc == OSHMEM_SUCCESS ) { oshmem_proc_group_destroy(group); } #endif /* OSHMEM_GROUP_CACHE_ENABLED */ } RUNTIME_CHECK_RC(rc); }