root/oshmem/shmem/fortran/shmem_collect_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_COLLECT4, shmem_collect4)
  23 SHMEM_GENERATE_WEAK_BINDINGS(SHMEM_COLLECT8, shmem_collect8)
  24 SHMEM_GENERATE_WEAK_BINDINGS(SHMEM_COLLECT32, shmem_collect32)
  25 SHMEM_GENERATE_WEAK_BINDINGS(SHMEM_COLLECT64, shmem_collect64)
  26 SHMEM_GENERATE_WEAK_BINDINGS(SHMEM_FCOLLECT4, shmem_fcollect4)
  27 SHMEM_GENERATE_WEAK_BINDINGS(SHMEM_FCOLLECT8, shmem_fcollect8)
  28 SHMEM_GENERATE_WEAK_BINDINGS(SHMEM_FCOLLECT32, shmem_fcollect32)
  29 SHMEM_GENERATE_WEAK_BINDINGS(SHMEM_FCOLLECT64, shmem_fcollect64)
  30 #include "oshmem/shmem/fortran/profile/defines.h"
  31 #endif
  32 
  33 SHMEM_GENERATE_FORTRAN_BINDINGS_SUB (void,
  34         SHMEM_COLLECT4,
  35         shmem_collect4_,
  36         shmem_collect4__,
  37         shmem_collect4_f,
  38         (FORTRAN_POINTER_T target, FORTRAN_POINTER_T source, MPI_Fint *nlong, MPI_Fint *PE_start, MPI_Fint * logPE_stride, MPI_Fint *PE_size, FORTRAN_POINTER_T pSync),
  39         (target,source,nlong,PE_start,logPE_stride,PE_size,pSync) )
  40 
  41 SHMEM_GENERATE_FORTRAN_BINDINGS_SUB (void,
  42         SHMEM_COLLECT8,
  43         shmem_collect8_,
  44         shmem_collect8__,
  45         shmem_collect8_f,
  46         (FORTRAN_POINTER_T target, FORTRAN_POINTER_T source, MPI_Fint *nlong, MPI_Fint *PE_start, MPI_Fint * logPE_stride, MPI_Fint *PE_size, FORTRAN_POINTER_T pSync),
  47         (target,source,nlong,PE_start,logPE_stride,PE_size,pSync) )
  48 
  49 SHMEM_GENERATE_FORTRAN_BINDINGS_SUB (void,
  50         SHMEM_COLLECT32,
  51         shmem_collect32_,
  52         shmem_collect32__,
  53         shmem_collect32_f,
  54         (FORTRAN_POINTER_T target, FORTRAN_POINTER_T source, MPI_Fint *nlong, MPI_Fint *PE_start, MPI_Fint * logPE_stride, MPI_Fint *PE_size, FORTRAN_POINTER_T pSync),
  55         (target,source,nlong,PE_start,logPE_stride,PE_size,pSync) )
  56 
  57 SHMEM_GENERATE_FORTRAN_BINDINGS_SUB (void,
  58         SHMEM_COLLECT64,
  59         shmem_collect64_,
  60         shmem_collect64__,
  61         shmem_collect64_f,
  62         (FORTRAN_POINTER_T target, FORTRAN_POINTER_T source, MPI_Fint *nlong, MPI_Fint *PE_start, MPI_Fint * logPE_stride, MPI_Fint *PE_size, FORTRAN_POINTER_T pSync),
  63         (target,source,nlong,PE_start,logPE_stride,PE_size,pSync) )
  64 
  65 SHMEM_GENERATE_FORTRAN_BINDINGS_SUB (void,
  66         SHMEM_FCOLLECT4,
  67         shmem_fcollect4_,
  68         shmem_fcollect4__,
  69         shmem_fcollect4_f,
  70         (FORTRAN_POINTER_T target, FORTRAN_POINTER_T source, MPI_Fint *nlong, MPI_Fint *PE_start, MPI_Fint * logPE_stride, MPI_Fint *PE_size, FORTRAN_POINTER_T pSync),
  71         (target,source,nlong,PE_start,logPE_stride,PE_size,pSync) )
  72 
  73 SHMEM_GENERATE_FORTRAN_BINDINGS_SUB (void,
  74         SHMEM_FCOLLECT8,
  75         shmem_fcollect8_,
  76         shmem_fcollect8__,
  77         shmem_fcollect8_f,
  78         (FORTRAN_POINTER_T target, FORTRAN_POINTER_T source, MPI_Fint *nlong, MPI_Fint *PE_start, MPI_Fint * logPE_stride, MPI_Fint *PE_size, FORTRAN_POINTER_T pSync),
  79         (target,source,nlong,PE_start,logPE_stride,PE_size,pSync) )
  80 
  81 SHMEM_GENERATE_FORTRAN_BINDINGS_SUB (void,
  82         SHMEM_FCOLLECT32,
  83         shmem_fcollect32_,
  84         shmem_fcollect32__,
  85         shmem_fcollect32_f,
  86         (FORTRAN_POINTER_T target, FORTRAN_POINTER_T source, MPI_Fint *nlong, MPI_Fint *PE_start, MPI_Fint * logPE_stride, MPI_Fint *PE_size, FORTRAN_POINTER_T pSync),
  87         (target,source,nlong,PE_start,logPE_stride,PE_size,pSync) )
  88 
  89 SHMEM_GENERATE_FORTRAN_BINDINGS_SUB (void,
  90         SHMEM_FCOLLECT64,
  91         shmem_fcollect64_,
  92         shmem_fcollect64__,
  93         shmem_fcollect64_f,
  94         (FORTRAN_POINTER_T target, FORTRAN_POINTER_T source, MPI_Fint *nlong, MPI_Fint *PE_start, MPI_Fint * logPE_stride, MPI_Fint *PE_size, FORTRAN_POINTER_T pSync),
  95         (target,source,nlong,PE_start,logPE_stride,PE_size,pSync) )
  96 
  97 #define SHMEM_COLLECT(F_NAME, T_NAME) void F_NAME(FORTRAN_POINTER_T target, \
  98     FORTRAN_POINTER_T source, \
  99     MPI_Fint *nlong, \
 100     MPI_Fint *PE_start, \
 101     MPI_Fint * logPE_stride, \
 102     MPI_Fint *PE_size, \
 103     FORTRAN_POINTER_T pSync)\
 104 {\
 105     int rc;\
 106     oshmem_group_t *group;\
 107     /* Create group basing PE_start, logPE_stride and PE_size */\
 108     group = oshmem_proc_group_create_nofail(OMPI_FINT_2_INT(*PE_start), \
 109                                             (1 << OMPI_FINT_2_INT(*logPE_stride)), \
 110                                             OMPI_FINT_2_INT(*PE_size));\
 111     oshmem_op_t* op = T_NAME;\
 112     /* Call collective broadcast operation */\
 113     rc = group->g_scoll.scoll_collect( group, \
 114             FPTR_2_VOID_PTR(target), \
 115             FPTR_2_VOID_PTR(source), \
 116             OMPI_FINT_2_INT(*nlong) * op->dt_size, \
 117             FPTR_2_VOID_PTR(pSync), \
 118             false, SCOLL_DEFAULT_ALG);\
 119     oshmem_proc_group_destroy(group);\
 120     RUNTIME_CHECK_RC(rc);\
 121 }
 122 
 123 SHMEM_COLLECT(shmem_collect4_f, oshmem_op_prod_fint4)
 124 SHMEM_COLLECT(shmem_collect8_f, oshmem_op_prod_fint8)
 125 SHMEM_COLLECT(shmem_collect32_f, oshmem_op_prod_fint4)
 126 SHMEM_COLLECT(shmem_collect64_f, oshmem_op_prod_fint8)
 127 SHMEM_COLLECT(shmem_fcollect4_f, oshmem_op_prod_freal4)
 128 SHMEM_COLLECT(shmem_fcollect8_f, oshmem_op_prod_freal8)
 129 SHMEM_COLLECT(shmem_fcollect32_f, oshmem_op_prod_freal4)
 130 SHMEM_COLLECT(shmem_fcollect64_f, oshmem_op_prod_freal8)

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