root/oshmem/shmem/c/shmem_collect.c

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

DEFINITIONS

This source file includes following definitions.
  1. _shmem_collect

   1 /*
   2  * Copyright (c) 2013-2018 Mellanox Technologies, Inc.
   3  *                         All rights reserved.
   4  * Copyright (c) 2019      Research Organization for Information Science
   5  *                         and Technology (RIST).  All rights reserved.
   6  * $COPYRIGHT$
   7  *
   8  * Additional copyrights may follow
   9  *
  10  * $HEADER$
  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_collect(void *target,
  24                             const void *source,
  25                             size_t nbytes,
  26                             int PE_start,
  27                             int logPE_stride,
  28                             int PE_size,
  29                             long *pSync,
  30                             bool nlong_type);
  31 
  32 #define SHMEM_TYPE_COLLECT(name, element_size, nelems_type)     \
  33     void shmem##name( void *target,                             \
  34                       const void *source,                       \
  35                       size_t nelems,                            \
  36                       int PE_start,                             \
  37                       int logPE_stride,                         \
  38                       int PE_size,                              \
  39                       long *pSync)                              \
  40 {                                                               \
  41     RUNTIME_CHECK_INIT();                                       \
  42     RUNTIME_CHECK_ADDR_SIZE(target, nelems);                    \
  43     RUNTIME_CHECK_ADDR_SIZE(source, nelems);                    \
  44                                                                 \
  45     _shmem_collect( target, source, nelems * element_size,      \
  46                      PE_start, logPE_stride, PE_size,           \
  47                      pSync,                                     \
  48                      nelems_type);                              \
  49 }
  50 
  51 static void _shmem_collect(void *target,
  52                             const void *source,
  53                             size_t nbytes,
  54                             int PE_start,
  55                             int logPE_stride,
  56                             int PE_size,
  57                             long *pSync,
  58                             bool array_type)
  59 {
  60     int rc;
  61     oshmem_group_t *group;
  62 
  63     /* Create group basing PE_start, logPE_stride and PE_size */
  64     group = oshmem_proc_group_create_nofail(PE_start, 1<<logPE_stride, PE_size);
  65     /* Call collective broadcast operation */
  66     rc = group->g_scoll.scoll_collect(group,
  67                                       target,
  68                                       source,
  69                                       nbytes,
  70                                       pSync,
  71                                       array_type,
  72                                       SCOLL_DEFAULT_ALG);
  73     oshmem_proc_group_destroy(group);
  74     RUNTIME_CHECK_RC(rc);
  75 }
  76 
  77 #if OSHMEM_PROFILING
  78 #include "oshmem/include/pshmem.h"
  79 #pragma weak shmem_collect32 = pshmem_collect32
  80 #pragma weak shmem_collect64 = pshmem_collect64
  81 #pragma weak shmem_fcollect32 = pshmem_fcollect32
  82 #pragma weak shmem_fcollect64 = pshmem_fcollect64
  83 #include "oshmem/shmem/c/profile/defines.h"
  84 #endif
  85 
  86 SHMEM_TYPE_COLLECT(_collect32, sizeof(uint32_t), false)
  87 SHMEM_TYPE_COLLECT(_collect64, sizeof(uint64_t), false)
  88 SHMEM_TYPE_COLLECT(_fcollect32, sizeof(uint32_t), true)
  89 SHMEM_TYPE_COLLECT(_fcollect64, sizeof(uint64_t), true)

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