1 /* 2 * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana 3 * University Research and Technology 4 * Corporation. All rights reserved. 5 * Copyright (c) 2004-2006 The University of Tennessee and The University 6 * of Tennessee Research Foundation. All rights 7 * reserved. 8 * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, 9 * University of Stuttgart. All rights reserved. 10 * Copyright (c) 2004-2005 The Regents of the University of California. 11 * All rights reserved. 12 * Copyright (c) 2007-2015 Cisco Systems, Inc. All rights reserved. 13 * Copyright (c) 2010-2011 Los Alamos National Security, LLC. 14 * All rights reserved. 15 * $COPYRIGHT$ 16 * 17 * Additional copyrights may follow 18 * 19 * $HEADER$ 20 */ 21 22 #ifndef OPAL_SHMEM_BASE_H 23 #define OPAL_SHMEM_BASE_H 24 25 #include "opal_config.h" 26 #include "opal/mca/base/mca_base_framework.h" 27 #include "opal/mca/shmem/shmem.h" 28 29 BEGIN_C_DECLS 30 31 /* ////////////////////////////////////////////////////////////////////////// */ 32 /* Public API for the shmem framework */ 33 /* ////////////////////////////////////////////////////////////////////////// */ 34 OPAL_DECLSPEC int 35 opal_shmem_segment_create(opal_shmem_ds_t *ds_buf, 36 const char *file_name, 37 size_t size); 38 39 OPAL_DECLSPEC int 40 opal_shmem_ds_copy(const opal_shmem_ds_t *from, 41 opal_shmem_ds_t *to); 42 43 OPAL_DECLSPEC void * 44 opal_shmem_segment_attach(opal_shmem_ds_t *ds_buf); 45 46 OPAL_DECLSPEC int 47 opal_shmem_segment_detach(opal_shmem_ds_t *ds_buf); 48 49 OPAL_DECLSPEC int 50 opal_shmem_unlink(opal_shmem_ds_t *ds_buf); 51 /* ////////////////////////////////////////////////////////////////////////// */ 52 /* End Public API for the shmem framework */ 53 /* ////////////////////////////////////////////////////////////////////////// */ 54 55 /* 56 * Global functions for MCA overall shmem open and close 57 */ 58 59 /** 60 * returns the name of the best, runnable shmem component. the caller is 61 * responsible for freeing returned resources. 62 * 63 * @retval name of best component. NULL if no component is found. 64 * 65 * see: orte/mca/odls/base/odls_base_default_fns.c 66 */ 67 OPAL_DECLSPEC char * 68 opal_shmem_base_best_runnable_component_name(void); 69 70 /** 71 * Select an available component. 72 * 73 * @return OPAL_SUCCESS Upon success. 74 * @return OPAL_NOT_FOUND If no component can be selected. 75 * @return OPAL_ERROR Upon other failure. 76 * 77 * This function invokes the selection process for shmem components, 78 * which works as follows: 79 * 80 * - If the \em shmem MCA parameter is not specified, the 81 * selection set is all available shmem components. 82 * - If the \em shmem MCA parameter is specified, the 83 * selection set is just that component. 84 * - All components in the selection set are queried to see if 85 * they want to run. All components that want to run are ranked 86 * by their priority and the highest priority component is 87 * selected. All non-selected components have their "close" 88 * function invoked to let them know that they were not selected. 89 * - The selected component will have its "init" function invoked to 90 * let it know that it was selected. 91 * 92 * If we fall through this entire process and no component is 93 * selected, then return OPAL_NOT_FOUND (this is not a fatal 94 * error). 95 * 96 * At the end of this process, we'll either have a single 97 * component that is selected and initialized, or no component was 98 * selected. If no component was selected, subsequent invocation 99 * of the shmem wrapper functions will return an error. 100 */ 101 OPAL_DECLSPEC int 102 opal_shmem_base_select(void); 103 104 /** 105 * Shut down the shmem MCA framework. 106 * 107 * @retval OPAL_SUCCESS Always 108 * 109 * This function shuts down everything in the shmem MCA 110 * framework, and is called during opal_finalize(). 111 * 112 * It must be the last function invoked on the shmem MCA 113 * framework. 114 */ 115 OPAL_DECLSPEC int 116 opal_shmem_base_close(void); 117 118 /** 119 * Indication of whether a component was successfully selected or 120 * not 121 */ 122 OPAL_DECLSPEC extern bool opal_shmem_base_selected; 123 124 /** 125 * Global component struct for the selected component 126 */ 127 OPAL_DECLSPEC extern opal_shmem_base_component_t *opal_shmem_base_component; 128 129 /** 130 * Global module struct for the selected module 131 */ 132 OPAL_DECLSPEC extern opal_shmem_base_module_t *opal_shmem_base_module; 133 134 /** 135 * Runtime hint 136 */ 137 OPAL_DECLSPEC extern char *opal_shmem_base_RUNTIME_QUERY_hint; 138 139 /** 140 * Framework structure declaration 141 */ 142 OPAL_DECLSPEC extern mca_base_framework_t opal_shmem_base_framework; 143 144 END_C_DECLS 145 146 #endif /* OPAL_BASE_SHMEM_H */