This source file includes following definitions.
- _shmem_broadcast
1
2
3
4
5
6
7
8
9
10
11
12 #include "oshmem_config.h"
13
14 #include "oshmem/constants.h"
15 #include "oshmem/include/shmem.h"
16
17 #include "oshmem/runtime/runtime.h"
18
19 #include "oshmem/mca/scoll/scoll.h"
20
21 #include "oshmem/proc/proc.h"
22
23 static void _shmem_broadcast(void *target,
24 const void *source,
25 size_t nbytes,
26 int PE_root,
27 int PE_start,
28 int logPE_stride,
29 int PE_size,
30 long *pSync);
31
32 #define SHMEM_TYPE_BROADCAST(name, element_size) \
33 void shmem##name( void *target, \
34 const void *source, \
35 size_t nelems, \
36 int PE_root, \
37 int PE_start, \
38 int logPE_stride, \
39 int PE_size, \
40 long *pSync) \
41 { \
42 RUNTIME_CHECK_INIT(); \
43 RUNTIME_CHECK_ADDR_SIZE(target, nelems); \
44 RUNTIME_CHECK_ADDR_SIZE(source, nelems); \
45 \
46 _shmem_broadcast( target, source, nelems * element_size, \
47 PE_root, PE_start, logPE_stride, PE_size, \
48 pSync); \
49 }
50
51 static void _shmem_broadcast(void *target,
52 const void *source,
53 size_t nbytes,
54 int PE_root,
55 int PE_start,
56 int logPE_stride,
57 int PE_size,
58 long *pSync)
59 {
60 int rc;
61 oshmem_group_t *group;
62
63 if ((0 <= PE_root) && (PE_root < PE_size)) {
64
65 group = oshmem_proc_group_create_nofail(PE_start, 1 << logPE_stride, PE_size);
66 if (PE_root >= group->proc_count) {
67 rc = OSHMEM_ERROR;
68 goto out;
69 }
70
71
72 PE_root = oshmem_proc_pe(group->proc_array[PE_root]);
73
74
75 rc = group->g_scoll.scoll_broadcast(group,
76 PE_root,
77 target,
78 source,
79 nbytes,
80 pSync,
81 true,
82 SCOLL_DEFAULT_ALG);
83 out:
84 oshmem_proc_group_destroy(group);
85 RUNTIME_CHECK_RC(rc);
86 }
87 }
88
89 #if OSHMEM_PROFILING
90 #include "oshmem/include/pshmem.h"
91 #pragma weak shmem_broadcast32 = pshmem_broadcast32
92 #pragma weak shmem_broadcast64 = pshmem_broadcast64
93 #include "oshmem/shmem/c/profile/defines.h"
94 #endif
95
96 SHMEM_TYPE_BROADCAST(_broadcast32, sizeof(uint32_t))
97 SHMEM_TYPE_BROADCAST(_broadcast64, sizeof(uint64_t))