root/oshmem/mca/sshmem/base/base.h

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

INCLUDED FROM


   1 /*
   2  * Copyright (c) 2014      Mellanox Technologies, Inc.
   3  *                         All rights reserved.
   4  * Copyright (c) 2015      Cisco Systems, Inc.  All rights reserved.
   5  * Copyright (c) 2019      Research Organization for Information Science
   6  *                         and Technology (RIST).  All rights reserved.
   7  * $COPYRIGHT$
   8  *
   9  * Additional copyrights may follow
  10  *
  11  * $HEADER$
  12  */
  13 
  14 #ifndef MCA_SSHMEM_BASE_H
  15 #define MCA_SSHMEM_BASE_H
  16 
  17 #include "oshmem_config.h"
  18 #include "oshmem/mca/sshmem/sshmem.h"
  19 #include "oshmem/proc/proc.h"
  20 
  21 #include "opal/mca/base/mca_base_framework.h"
  22 
  23 BEGIN_C_DECLS
  24 
  25 extern void* mca_sshmem_base_start_address;
  26 extern char* mca_sshmem_base_backing_file_dir;
  27 
  28 /* ////////////////////////////////////////////////////////////////////////// */
  29 /* Public API for the sshmem framework */
  30 /* ////////////////////////////////////////////////////////////////////////// */
  31 OSHMEM_DECLSPEC int
  32 mca_sshmem_segment_create(map_segment_t *ds_buf,
  33                           const char *file_name,
  34                           size_t size, long hint);
  35 
  36 OSHMEM_DECLSPEC void *
  37 mca_sshmem_segment_attach(map_segment_t *ds_buf, sshmem_mkey_t *mkey);
  38 
  39 OSHMEM_DECLSPEC int
  40 mca_sshmem_segment_detach(map_segment_t *ds_buf, sshmem_mkey_t *mkey);
  41 
  42 OSHMEM_DECLSPEC int
  43 mca_sshmem_unlink(map_segment_t *ds_buf);
  44 /* ////////////////////////////////////////////////////////////////////////// */
  45 /* End Public API for the sshmem framework */
  46 /* ////////////////////////////////////////////////////////////////////////// */
  47 
  48 /*
  49  * Global functions for MCA overall sshmem open and close
  50  */
  51 
  52 /**
  53  * Select an available component.
  54  *
  55  * @return OSHMEM_SUCCESS Upon success.
  56  * @return OSHMEM_NOT_FOUND If no component can be selected.
  57  * @return OSHMEM_ERROR Upon other failure.
  58  *
  59  * This function invokes the selection process for shmem components,
  60  * which works as follows:
  61  *
  62  * - If the \em sshmem MCA parameter is not specified, the
  63  *   selection set is all available shmem components.
  64  * - If the \em sshmem MCA parameter is specified, the
  65  *   selection set is just that component.
  66  * - All components in the selection set are queried to see if
  67  *   they want to run.  All components that want to run are ranked
  68  *   by their priority and the highest priority component is
  69  *   selected.  All non-selected components have their "close"
  70  *   function invoked to let them know that they were not selected.
  71  * - The selected component will have its "init" function invoked to
  72  *   let it know that it was selected.
  73  *
  74  * If we fall through this entire process and no component is
  75  * selected, then return OSHMEM_NOT_FOUND (this is not a fatal
  76  * error).
  77  *
  78  * At the end of this process, we'll either have a single
  79  * component that is selected and initialized, or no component was
  80  * selected.  If no component was selected, subsequent invocation
  81  * of the shmem wrapper functions will return an error.
  82  */
  83 OSHMEM_DECLSPEC int
  84 mca_sshmem_base_select(void);
  85 
  86 /**
  87  * Shut down the sshmem MCA framework.
  88  *
  89  * @retval OSHMEM_SUCCESS Always
  90  *
  91  * This function shuts down everything in the sshmem MCA
  92  * framework, and is called during opal_finalize().
  93  *
  94  * It must be the last function invoked on the sshmem MCA
  95  * framework.
  96  */
  97 OSHMEM_DECLSPEC int
  98 mca_sshmem_base_close(void);
  99 
 100 /**
 101  * Indication of whether a component was successfully selected or
 102  * not
 103  */
 104 OSHMEM_DECLSPEC extern bool mca_sshmem_base_selected;
 105 
 106 /**
 107  * Global component struct for the selected component
 108  */
 109 OSHMEM_DECLSPEC extern const mca_sshmem_base_component_2_0_0_t
 110 *mca_sshmem_base_component;
 111 
 112 /**
 113  * Global module struct for the selected module
 114  */
 115 OSHMEM_DECLSPEC extern const mca_sshmem_base_module_2_0_0_t
 116 *mca_sshmem_base_module;
 117 
 118 /**
 119  * Framework structure declaration
 120  */
 121 OSHMEM_DECLSPEC extern mca_base_framework_t oshmem_sshmem_base_framework;
 122 
 123 /* ******************************************************************** */
 124 #ifdef __BASE_FILE__
 125 #define __SSHMEM_FILE__ __BASE_FILE__
 126 #else
 127 #define __SSHMEM_FILE__ __FILE__
 128 #endif
 129 
 130 #if OPAL_ENABLE_DEBUG
 131 #define SSHMEM_VERBOSE(level, ...) \
 132     oshmem_output_verbose(level, oshmem_sshmem_base_framework.framework_output, \
 133         "%s:%d - %s()", __SSHMEM_FILE__, __LINE__, __func__, __VA_ARGS__)
 134 #else
 135 #define SSHMEM_VERBOSE(level, ...)
 136 #endif
 137 
 138 #define SSHMEM_ERROR(...) \
 139     oshmem_output(oshmem_sshmem_base_framework.framework_output, \
 140         "Error %s:%d - %s()", __SSHMEM_FILE__, __LINE__, __func__, __VA_ARGS__)
 141 
 142 #define SSHMEM_WARN(...) \
 143     oshmem_output_verbose(0, oshmem_sshmem_base_framework.framework_output, \
 144         "Warning %s:%d - %s()", __SSHMEM_FILE__, __LINE__, __func__, __VA_ARGS__)
 145 
 146 
 147 OSHMEM_DECLSPEC extern void shmem_ds_reset(map_segment_t *ds_buf);
 148 
 149 /*
 150  * Get unique file name
 151  */
 152 OSHMEM_DECLSPEC extern char * oshmem_get_unique_file_name(uint64_t pe);
 153 
 154 END_C_DECLS
 155 
 156 #endif /* MCA_SSHMEM_BASE_H */

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