1
2
3
4
5
6
7
8
9
10
11
12 #include "oshmem_config.h"
13 #include "oshmem/shmem/fortran/bindings.h"
14 #include "oshmem/include/shmem.h"
15 #include "oshmem/constants.h"
16 #include "oshmem/mca/scoll/scoll.h"
17 #include "oshmem/proc/proc.h"
18 #include "oshmem/op/op.h"
19
20 #if OSHMEM_PROFILING
21 #include "oshmem/shmem/fortran/profile/pbindings.h"
22 SHMEM_GENERATE_WEAK_BINDINGS(SHMEM_INT2_OR_TO_ALL, shmem_int2_or_to_all)
23 SHMEM_GENERATE_WEAK_BINDINGS(SHMEM_INT4_OR_TO_ALL, shmem_int4_or_to_all)
24 SHMEM_GENERATE_WEAK_BINDINGS(SHMEM_INT8_OR_TO_ALL, shmem_int8_or_to_all)
25 #include "oshmem/shmem/fortran/profile/defines.h"
26 #endif
27
28 SHMEM_GENERATE_FORTRAN_BINDINGS_SUB (void,
29 SHMEM_INT2_OR_TO_ALL,
30 shmem_int2_or_to_all_,
31 shmem_int2_or_to_all__,
32 shmem_int2_or_to_all_f,
33 (FORTRAN_POINTER_T target, FORTRAN_POINTER_T source, MPI_Fint *nreduce, MPI_Fint *PE_start, MPI_Fint * logPE_stride, MPI_Fint *PE_size, FORTRAN_POINTER_T *pWrk, FORTRAN_POINTER_T pSync),
34 (target,source,nreduce,PE_start,logPE_stride,PE_size,pWrk,pSync) )
35
36 SHMEM_GENERATE_FORTRAN_BINDINGS_SUB (void,
37 SHMEM_INT4_OR_TO_ALL,
38 shmem_int4_or_to_all_,
39 shmem_int4_or_to_all__,
40 shmem_int4_or_to_all_f,
41 (FORTRAN_POINTER_T target, FORTRAN_POINTER_T source, MPI_Fint *nreduce, MPI_Fint *PE_start, MPI_Fint * logPE_stride, MPI_Fint *PE_size, FORTRAN_POINTER_T *pWrk, FORTRAN_POINTER_T pSync),
42 (target,source,nreduce,PE_start,logPE_stride,PE_size,pWrk,pSync) )
43
44 SHMEM_GENERATE_FORTRAN_BINDINGS_SUB (void,
45 SHMEM_INT8_OR_TO_ALL,
46 shmem_int8_or_to_all_,
47 shmem_int8_or_to_all__,
48 shmem_int8_or_to_all_f,
49 (FORTRAN_POINTER_T target, FORTRAN_POINTER_T source, MPI_Fint *nreduce, MPI_Fint *PE_start, MPI_Fint * logPE_stride, MPI_Fint *PE_size, FORTRAN_POINTER_T *pWrk, FORTRAN_POINTER_T pSync),
50 (target,source,nreduce,PE_start,logPE_stride,PE_size,pWrk,pSync) )
51
52 #define SHMEM_OR_TO_ALL(F_NAME, T_NAME) void F_NAME(FORTRAN_POINTER_T target, \
53 FORTRAN_POINTER_T source, \
54 MPI_Fint *nreduce,\
55 MPI_Fint *PE_start,\
56 MPI_Fint * logPE_stride,\
57 MPI_Fint *PE_size,\
58 FORTRAN_POINTER_T *pWrk,\
59 FORTRAN_POINTER_T pSync)\
60 {\
61 int rc;\
62 oshmem_group_t *group;\
63 \
64 group = oshmem_proc_group_create_nofail(OMPI_FINT_2_INT(*PE_start),\
65 (1 << OMPI_FINT_2_INT(*logPE_stride)),\
66 OMPI_FINT_2_INT(*PE_size));\
67 oshmem_op_t* op = T_NAME;\
68 size_t size = OMPI_FINT_2_INT(*nreduce) * op->dt_size;\
69 \
70 rc = group->g_scoll.scoll_reduce( group,\
71 op,\
72 FPTR_2_VOID_PTR(target),\
73 FPTR_2_VOID_PTR(source),\
74 size,\
75 FPTR_2_VOID_PTR(pSync),\
76 FPTR_2_VOID_PTR(*pWrk), SCOLL_DEFAULT_ALG);\
77 oshmem_proc_group_destroy(group);\
78 RUNTIME_CHECK_RC(rc); \
79 }
80
81 SHMEM_OR_TO_ALL(shmem_int2_or_to_all_f, oshmem_op_or_fint2)
82 SHMEM_OR_TO_ALL(shmem_int4_or_to_all_f, oshmem_op_or_fint4)
83 SHMEM_OR_TO_ALL(shmem_int8_or_to_all_f, oshmem_op_or_fint8)