root/oshmem/shmem/fortran/shmem_xor_to_all_f.c

/* [<][>][^][v][top][bottom][index][help] */
   1 /*
   2  * Copyright (c) 2013-2018 Mellanox Technologies, Inc.
   3  *                         All rights reserved.
   4  * Copyright (c) 2013 Cisco Systems, Inc.  All rights reserved.
   5  * $COPYRIGHT$
   6  *
   7  * Additional copyrights may follow
   8  *
   9  * $HEADER$
  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_XOR_TO_ALL, shmem_int2_xor_to_all)
  23 SHMEM_GENERATE_WEAK_BINDINGS(SHMEM_INT4_XOR_TO_ALL, shmem_int4_xor_to_all)
  24 SHMEM_GENERATE_WEAK_BINDINGS(SHMEM_INT8_XOR_TO_ALL, shmem_int8_xor_to_all)
  25 SHMEM_GENERATE_WEAK_BINDINGS(SHMEM_COMP4_XOR_TO_ALL, shmem_comp4_xor_to_all)
  26 SHMEM_GENERATE_WEAK_BINDINGS(SHMEM_COMP8_XOR_TO_ALL, shmem_comp8_xor_to_all)
  27 #include "oshmem/shmem/fortran/profile/defines.h"
  28 #endif
  29 
  30 SHMEM_GENERATE_FORTRAN_BINDINGS_SUB (void,
  31         SHMEM_INT2_XOR_TO_ALL,
  32         shmem_int2_xor_to_all_,
  33         shmem_int2_xor_to_all__,
  34         shmem_int2_xor_to_all_f,
  35         (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),
  36         (target,source,nreduce,PE_start,logPE_stride,PE_size,pWrk,pSync) )
  37 
  38 SHMEM_GENERATE_FORTRAN_BINDINGS_SUB (void,
  39         SHMEM_INT4_XOR_TO_ALL,
  40         shmem_int4_xor_to_all_,
  41         shmem_int4_xor_to_all__,
  42         shmem_int4_xor_to_all_f,
  43         (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),
  44         (target,source,nreduce,PE_start,logPE_stride,PE_size,pWrk,pSync) )
  45 
  46 SHMEM_GENERATE_FORTRAN_BINDINGS_SUB (void,
  47         SHMEM_INT8_XOR_TO_ALL,
  48         shmem_int8_xor_to_all_,
  49         shmem_int8_xor_to_all__,
  50         shmem_int8_xor_to_all_f,
  51         (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),
  52         (target,source,nreduce,PE_start,logPE_stride,PE_size,pWrk,pSync) )
  53 
  54 SHMEM_GENERATE_FORTRAN_BINDINGS_SUB (void,
  55         SHMEM_COMP4_XOR_TO_ALL,
  56         shmem_comp4_xor_to_all_,
  57         shmem_comp4_xor_to_all__,
  58         shmem_comp4_xor_to_all_f,
  59         (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),
  60         (target,source,nreduce,PE_start,logPE_stride,PE_size,pWrk,pSync) )
  61 
  62 SHMEM_GENERATE_FORTRAN_BINDINGS_SUB (void,
  63         SHMEM_COMP8_XOR_TO_ALL,
  64         shmem_comp8_xor_to_all_,
  65         shmem_comp8_xor_to_all__,
  66         shmem_comp8_xor_to_all_f,
  67         (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),
  68         (target,source,nreduce,PE_start,logPE_stride,PE_size,pWrk,pSync) )
  69 
  70 #define SHMEM_XOR_TO_ALL(F_NAME, T_NAME) void F_NAME(FORTRAN_POINTER_T target, \
  71     FORTRAN_POINTER_T source, \
  72     MPI_Fint *nreduce,\
  73     MPI_Fint *PE_start,\
  74     MPI_Fint * logPE_stride,\
  75     MPI_Fint *PE_size,\
  76     FORTRAN_POINTER_T *pWrk,\
  77     FORTRAN_POINTER_T pSync)\
  78 {\
  79     int rc;\
  80     oshmem_group_t *group;\
  81     /* Create group basing PE_start, logPE_stride and PE_size */\
  82     group = oshmem_proc_group_create_nofail(OMPI_FINT_2_INT(*PE_start), \
  83                                             (1 << OMPI_FINT_2_INT(*logPE_stride)), \
  84                                             OMPI_FINT_2_INT(*PE_size));\
  85     oshmem_op_t* op = T_NAME;\
  86     size_t size = OMPI_FINT_2_INT(*nreduce) * op->dt_size;\
  87     \
  88     /* Call collective reduce operation */\
  89     rc = group->g_scoll.scoll_reduce( group,\
  90             op,\
  91             FPTR_2_VOID_PTR(target),\
  92             FPTR_2_VOID_PTR(source),\
  93             size,\
  94             FPTR_2_VOID_PTR(pSync),\
  95             FPTR_2_VOID_PTR(*pWrk), SCOLL_DEFAULT_ALG);\
  96     oshmem_proc_group_destroy(group);\
  97     RUNTIME_CHECK_RC(rc); \
  98 }
  99 
 100 SHMEM_XOR_TO_ALL(shmem_int2_xor_to_all_f, oshmem_op_xor_fint2)
 101 SHMEM_XOR_TO_ALL(shmem_int4_xor_to_all_f, oshmem_op_xor_fint4)
 102 SHMEM_XOR_TO_ALL(shmem_int8_xor_to_all_f, oshmem_op_xor_fint8)
 103 SHMEM_XOR_TO_ALL(shmem_comp4_xor_to_all_f, oshmem_op_xor_fint4)
 104 SHMEM_XOR_TO_ALL(shmem_comp8_xor_to_all_f, oshmem_op_xor_fint8)

/* [<][>][^][v][top][bottom][index][help] */