root/oshmem/mca/scoll/base/scoll_base_frame.c

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

DEFINITIONS

This source file includes following definitions.
  1. scoll_base_module_construct
  2. mca_scoll_enable
  3. mca_scoll_base_register
  4. mca_scoll_base_close
  5. mca_scoll_base_open

   1 /*
   2  * Copyright (c) 2013-2018 Mellanox Technologies, Inc.
   3  *                         All rights reserved.
   4  * $COPYRIGHT$
   5  *
   6  * Additional copyrights may follow
   7  *
   8  * $HEADER$
   9  */
  10 
  11 #include <stdio.h>
  12 
  13 #include "oshmem_config.h"
  14 
  15 #include "oshmem/constants.h"
  16 
  17 #include "oshmem/mca/mca.h"
  18 #include "opal/util/output.h"
  19 #include "opal/mca/base/base.h"
  20 #include "ompi/util/timings.h"
  21 
  22 #include "oshmem/util/oshmem_util.h"
  23 #include "oshmem/mca/scoll/scoll.h"
  24 #include "oshmem/mca/scoll/base/base.h"
  25 
  26 /*
  27  * The following file was created by configure.  It contains extern
  28  * statements and the definition of an array of pointers to each
  29  * component's public mca_base_component_t struct.
  30  */
  31 
  32 #include "oshmem/mca/scoll/base/static-components.h"
  33 
  34 /*
  35  * Global variables; most of which are loaded by back-ends of MCA
  36  * variables
  37  */
  38 long* mca_scoll_sync_array = NULL;
  39 
  40 /*
  41  * Ensure all function pointers are NULL'ed out to start with
  42  */
  43 static void scoll_base_module_construct(mca_scoll_base_module_t *m)
  44 {
  45     /* Collective function pointers */
  46     m->scoll_barrier = NULL;
  47     m->scoll_broadcast = NULL;
  48     m->scoll_collect = NULL;
  49     m->scoll_reduce = NULL;
  50     m->scoll_alltoall = NULL;
  51     m->scoll_module_enable = NULL;
  52 }
  53 
  54 OBJ_CLASS_INSTANCE(mca_scoll_base_module_t, opal_object_t,
  55                    scoll_base_module_construct, NULL);
  56 
  57 int mca_scoll_enable(void)
  58 {
  59     int ret = OSHMEM_SUCCESS;
  60 
  61     OPAL_TIMING_ENV_INIT(mca_scoll_enable);
  62 
  63     if (!mca_scoll_sync_array) {
  64         void* ptr = (void*) mca_scoll_sync_array;
  65         int i = 0;
  66 
  67         MCA_MEMHEAP_CALL(private_alloc((_SHMEM_BARRIER_SYNC_SIZE * sizeof(*mca_scoll_sync_array)), &ptr));
  68         mca_scoll_sync_array = ptr;
  69 
  70         for (i = 0; i < _SHMEM_BARRIER_SYNC_SIZE; i++) {
  71             mca_scoll_sync_array[i] = _SHMEM_SYNC_VALUE;
  72         }
  73     }
  74 
  75     OPAL_TIMING_ENV_NEXT(mca_scoll_enable, "memheap");
  76 
  77     /* Note: it is done to support FCA only and we need to consider possibility to
  78      * find a way w/o this ugly hack
  79      */
  80     if (OSHMEM_SUCCESS != (ret = mca_scoll_base_select(oshmem_group_all))) {
  81         return ret;
  82     }
  83 
  84     OPAL_TIMING_ENV_NEXT(mca_scoll_enable, "group_all");
  85 
  86     if (OSHMEM_SUCCESS != (ret = mca_scoll_base_select(oshmem_group_self))) {
  87         return ret;
  88     }
  89 
  90     OPAL_TIMING_ENV_NEXT(mca_scoll_enable, "group_self");
  91 
  92     return OSHMEM_SUCCESS;
  93 }
  94 
  95 static int mca_scoll_base_register(mca_base_register_flag_t flags)
  96 {
  97     return OSHMEM_SUCCESS;
  98 }
  99 
 100 static int mca_scoll_base_close(void)
 101 {
 102     /* This call should be done before memheap close */
 103     if (mca_scoll_sync_array) {
 104         void* ptr = (void*) mca_scoll_sync_array;
 105 
 106         MCA_MEMHEAP_CALL(private_free(ptr));
 107         mca_scoll_sync_array = NULL;
 108     }
 109 
 110     return mca_base_framework_components_close(&oshmem_scoll_base_framework, NULL);
 111 }
 112 
 113 static int mca_scoll_base_open(mca_base_open_flag_t flags)
 114 {
 115     oshmem_framework_open_output(&oshmem_scoll_base_framework);
 116 
 117     /* Open up all available components */
 118     if (OPAL_SUCCESS !=
 119             mca_base_framework_components_open(&oshmem_scoll_base_framework, flags)) {
 120         return OSHMEM_ERROR;
 121     }
 122     return OSHMEM_SUCCESS;
 123 }
 124 
 125 MCA_BASE_FRAMEWORK_DECLARE(oshmem, scoll,
 126                            "OSHMEM SCOLL",
 127                            mca_scoll_base_register,
 128                            mca_scoll_base_open,
 129                            mca_scoll_base_close,
 130                            mca_scoll_base_static_components,
 131                            MCA_BASE_FRAMEWORK_FLAG_DEFAULT);

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