root/oshmem/mca/atomic/base/atomic_base_frame.c

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

DEFINITIONS

This source file includes following definitions.
  1. atomic_base_module_construct
  2. mca_atomic_base_register
  3. mca_atomic_base_close
  4. mca_atomic_base_open

   1 /*
   2  * Copyright (c) 2013      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 
  21 #include "oshmem/util/oshmem_util.h"
  22 #include "oshmem/mca/atomic/atomic.h"
  23 #include "oshmem/mca/atomic/base/base.h"
  24 
  25 /*
  26  * The following file was created by configure.  It contains extern
  27  * statements and the definition of an array of pointers to each
  28  * component's public mca_base_component_t struct.
  29  */
  30 
  31 #include "oshmem/mca/atomic/base/static-components.h"
  32 
  33 /*
  34  * Global variables; most of which are loaded by back-ends of MCA
  35  * variables
  36  */
  37 
  38 /*
  39  * Ensure all function pointers are NULL'ed out to start with
  40  */
  41 static void atomic_base_module_construct(mca_atomic_base_module_t *m)
  42 {
  43     /* Atomic function pointers */
  44     m->atomic_fadd = NULL;
  45     m->atomic_cswap = NULL;
  46 }
  47 
  48 OBJ_CLASS_INSTANCE(mca_atomic_base_module_t, opal_object_t,
  49                    atomic_base_module_construct, NULL);
  50 
  51 static int mca_atomic_base_register(mca_base_register_flag_t flags)
  52 {
  53     return OSHMEM_SUCCESS;
  54 }
  55 
  56 static int mca_atomic_base_close(void)
  57 {
  58     mca_base_component_list_item_t *cli, *next;
  59     const mca_base_component_t *component;
  60 
  61     OPAL_LIST_FOREACH_SAFE(cli, next, &oshmem_atomic_base_framework.framework_components, mca_base_component_list_item_t) {
  62         component = cli->cli_component;
  63         mca_atomic_base_component_t *atomic =
  64                 (mca_atomic_base_component_t *) component;
  65 
  66         if (NULL != atomic->atomic_finalize) {
  67             atomic->atomic_finalize();
  68         }
  69     }
  70 
  71     /* Close all remaining available components */
  72     return mca_base_framework_components_close(&oshmem_atomic_base_framework, NULL);
  73 }
  74 
  75 static int mca_atomic_base_open(mca_base_open_flag_t flags)
  76 {
  77     oshmem_framework_open_output(&oshmem_atomic_base_framework);
  78 
  79     /* Open up all available components */
  80     if (OPAL_SUCCESS !=
  81         mca_base_framework_components_open(&oshmem_atomic_base_framework, flags)) {
  82         return OSHMEM_ERROR;
  83     }
  84 
  85     return OSHMEM_SUCCESS;
  86 }
  87 
  88 MCA_BASE_FRAMEWORK_DECLARE(oshmem, atomic,
  89                            "OSHMEM ATOMIC",
  90                            mca_atomic_base_register,
  91                            mca_atomic_base_open,
  92                            mca_atomic_base_close,
  93                            mca_atomic_base_static_components,
  94                            MCA_BASE_FRAMEWORK_FLAG_DEFAULT);

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