root/oshmem/mca/scoll/basic/scoll_basic.h

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

INCLUDED FROM


DEFINITIONS

This source file includes following definitions.
  1. scoll_log2

   1 /*
   2  * Copyright (c) 2013-2016 Mellanox Technologies, Inc.
   3  *                         All rights reserved.
   4  * $COPYRIGHT$
   5  *
   6  * Additional copyrights may follow
   7  *
   8  * $HEADER$
   9  */
  10 
  11 #ifndef MCA_SCOLL_BASIC_H
  12 #define MCA_SCOLL_BASIC_H
  13 
  14 #include "oshmem_config.h"
  15 
  16 #include "oshmem/mca/mca.h"
  17 #include "oshmem/mca/scoll/scoll.h"
  18 #include "oshmem/util/oshmem_util.h"
  19 
  20 BEGIN_C_DECLS
  21 
  22 /* These functions (BARRIER_FUNC, BCAST_FUNC)  may be called from any basic algorithm.
  23  * In case of shmem, the implementation of broadcast doesn't require
  24  * each process to know message size ( just root should know).
  25  * It differs from other implementations, so it may cause problems if
  26  * BCAST_FUNC is a callback to another implementation (e.g, fca, hcoll).
  27  * So we replace a callback (group->g_scoll.scoll_[func])
  28  * with a corresponding basic function. */
  29 
  30 #define BARRIER_FUNC mca_scoll_basic_barrier
  31 #define BCAST_FUNC mca_scoll_basic_broadcast
  32 
  33 /* Globally exported variables */
  34 
  35 OSHMEM_MODULE_DECLSPEC extern mca_scoll_base_component_1_0_0_t
  36 mca_scoll_basic_component;
  37 
  38 extern int mca_scoll_basic_priority_param;
  39 OSHMEM_DECLSPEC extern int mca_scoll_basic_param_barrier_algorithm;
  40 extern int mca_scoll_basic_param_broadcast_algorithm;
  41 extern int mca_scoll_basic_param_collect_algorithm;
  42 extern int mca_scoll_basic_param_reduce_algorithm;
  43 
  44 /* API functions */
  45 
  46 int mca_scoll_basic_init(bool enable_progress_threads, bool enable_threads);
  47 mca_scoll_base_module_t*
  48 mca_scoll_basic_query(struct oshmem_group_t *group, int *priority);
  49 
  50 enum {
  51     SHMEM_SYNC_INIT = _SHMEM_SYNC_VALUE,
  52     SHMEM_SYNC_WAIT = -2,
  53     SHMEM_SYNC_RUN = -3,
  54     SHMEM_SYNC_READY = -4,
  55 };
  56 
  57 int mca_scoll_basic_barrier(struct oshmem_group_t *group, long *pSync, int alg);
  58 int mca_scoll_basic_broadcast(struct oshmem_group_t *group,
  59                               int PE_root,
  60                               void *target,
  61                               const void *source,
  62                               size_t nlong,
  63                               long *pSync,
  64                               bool nlong_type,
  65                               int alg);
  66 int mca_scoll_basic_collect(struct oshmem_group_t *group,
  67                             void *target,
  68                             const void *source,
  69                             size_t nlong,
  70                             long *pSync,
  71                             bool nlong_type,
  72                             int alg);
  73 int mca_scoll_basic_reduce(struct oshmem_group_t *group,
  74                            struct oshmem_op_t *op,
  75                            void *target,
  76                            const void *source,
  77                            size_t nlong,
  78                            long *pSync,
  79                            void *pWrk,
  80                            int alg);
  81 int mca_scoll_basic_alltoall(struct oshmem_group_t *group,
  82                              void *target,
  83                              const void *source,
  84                              ptrdiff_t dst, ptrdiff_t sst,
  85                              size_t nelems,
  86                              size_t element_size,
  87                              long *pSync,
  88                              int alg);
  89 
  90 static inline unsigned int scoll_log2(unsigned long val)
  91 {
  92     unsigned int count = 0;
  93 
  94     while (val > 0) {
  95         val = val >> 1;
  96         count++;
  97     }
  98 
  99     return count > 0 ? count - 1 : 0;
 100 }
 101 
 102 struct mca_scoll_basic_module_t {
 103     mca_scoll_base_module_t super;
 104 };
 105 typedef struct mca_scoll_basic_module_t mca_scoll_basic_module_t;
 106 OBJ_CLASS_DECLARATION(mca_scoll_basic_module_t);
 107 
 108 END_C_DECLS
 109 
 110 #endif /* MCA_SCOLL_BASIC_H */

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