1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200
|
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
/*
* Copyright (c) 2004-2010 The Trustees of Indiana University and Indiana
* University Research and Technology
* Corporation. All rights reserved.
* Copyright (c) 2004-2007 The University of Tennessee and The University
* of Tennessee Research Foundation. All rights
* reserved.
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2007-2017 Cisco Systems, Inc. All rights reserved
* Copyright (c) 2009 Sun Microsystems, Inc. All rights reserved.
* Copyright (c) 2012-2015 Los Alamos National Security, LLC. All rights
* reserved.
* Copyright (c) 2016-2017 IBM Corporation. All rights reserved.
* Copyright (c) 2020 Intel, Inc. All rights reserved.
* Copyright (c) 2020 Triad National Security, LLC. All rights
* reserved.
*
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#ifndef OMPI_INFO_H
#define OMPI_INFO_H
#include "ompi_config.h"
#include <string.h>
#include "mpi.h"
#include "opal/util/info.h"
#include "opal/class/opal_list.h"
#include "opal/class/opal_pointer_array.h"
#include "opal/mca/threads/mutex.h"
#include "opal/mca/base/mca_base_var_enum.h"
struct ompi_info_t {
struct opal_info_t super;
/**< generic list pointer which is the container for (key,value)
pairs */
int i_f_to_c_index;
/**< fortran handle for info. This is needed for translation from
fortran to C and vice versa */
/**< Mutex for thread safety */
bool i_freed;
/**< Whether this info has been freed or not */
};
typedef struct ompi_info_t ompi_info_t;
/**
* Padded struct to maintain back compatibility.
* See ompi/communicator/communicator.h comments with struct ompi_communicator_t
* for full explanation why we chose the following padding construct for predefines.
*/
#define PREDEFINED_INFO_PAD 256
struct ompi_predefined_info_t {
struct ompi_info_t info;
char padding[PREDEFINED_INFO_PAD - sizeof(ompi_info_t)];
};
typedef struct ompi_predefined_info_t ompi_predefined_info_t;
BEGIN_C_DECLS
/**
* Global instance for MPI_INFO_NULL
*/
OMPI_DECLSPEC extern ompi_predefined_info_t ompi_mpi_info_null;
/**
* Symbol for Fortran 03 bindings to bind to
*/
OMPI_DECLSPEC extern ompi_predefined_info_t *ompi_mpi_info_null_addr;
/**
* \internal
* Some declarations needed to use OBJ_NEW and OBJ_DESTRUCT macros
*/
OMPI_DECLSPEC OBJ_CLASS_DECLARATION(ompi_info_t);
/**
* This function is invoked during ompi_instance_retain() and sets up
* MPI_Info handling.
*/
int ompi_mpiinfo_init(void);
/**
* Fill in an info object with ENV info. Used for setting
* MPI_INFO_ENV and by invocation of MPI_Info_create_env.
*/
int ompi_mpiinfo_init_env(int argc, char *argv[], ompi_info_t *info);
/**
* This function is used to free a ompi level info
*/
int ompi_info_free (ompi_info_t **info);
/**
* This functions is called during ompi_mpi_finalize() and shuts
* down MPI_Info handling.
*/
int ompi_mpiinfo_finalize(void);
/**
* ompi_info_foo() wrapper around various opal_info_foo() calls
*/
OMPI_DECLSPEC int ompi_info_dup (ompi_info_t *info, ompi_info_t **newinfo);
/**
* ompi_info_foo() wrapper around various opal_info_foo() calls
*/
OMPI_DECLSPEC int ompi_info_dup_mpistandard (ompi_info_t *info, ompi_info_t **newinfo);
/**
* ompi_info_foo() wrapper around various opal_info_foo() calls
*/
OMPI_DECLSPEC int ompi_info_set (ompi_info_t *info, const char *key, const char *value);
/**
* ompi_info_foo() wrapper around various opal_info_foo() calls
*/
OMPI_DECLSPEC int ompi_info_set_value_enum (ompi_info_t *info, const char *key, int value,
mca_base_var_enum_t *var_enum);
/**
* ompi_info_foo() wrapper around various opal_info_foo() calls
*/
OMPI_DECLSPEC int ompi_info_get_bool (ompi_info_t *info, const char *key, bool *value, int *flag);
/**
* ompi_info_foo() wrapper around various opal_info_foo() calls
*/
OMPI_DECLSPEC int ompi_info_get_value_enum (ompi_info_t *info, const char *key,
int *value, int default_value,
mca_base_var_enum_t *var_enum, int *flag);
/**
* ompi_info_foo() wrapper around various opal_info_foo() calls
*/
OMPI_DECLSPEC int ompi_info_get (ompi_info_t *info, const char *key,
opal_cstring_t **value, int *flag);
/**
* ompi_info_foo() wrapper around various opal_info_foo() calls
*/
OMPI_DECLSPEC int ompi_info_delete (ompi_info_t *info, const char *key);
/**
* ompi_info_foo() wrapper around various opal_info_foo() calls
*/
OMPI_DECLSPEC int ompi_info_get_valuelen (ompi_info_t *info, const char *key, int *valuelen,
int *flag);
/**
* ompi_info_foo() wrapper around various opal_info_foo() calls
*/
OMPI_DECLSPEC int ompi_info_get_nthkey (ompi_info_t *info, int n, opal_cstring_t **key);
/**
* ompi_info_foo() wrapper around various opal_info_foo() calls
*/
OMPI_DECLSPEC int ompi_info_value_to_bool(char *value, bool *interp);
/**
* ompi_info_foo() wrapper around various opal_info_foo() calls
*/
OMPI_DECLSPEC int ompi_info_get_nkeys(ompi_info_t *info, int *nkeys);
/**
* @brief Allocate a new info object
*
* This helper function ensures that the minimum infrastructure is initialized
* for creation/modification/destruction of an info object. Do not call
* OBJ_NEW(opal_info_t) directly.
*/
OMPI_DECLSPEC ompi_info_t *ompi_info_allocate (void);
END_C_DECLS
/**
* Return whether this info has been freed already or not.
*
* @param info Pointer to opal_info_t object.
*
* @retval true If the info has already been freed
* @retval false If the info has not yet been freed
*
* If the info has been freed, return true. This will likely only
* happen in a reliable manner if opal_debug_handle_never_free is
* true, in which case an extra OBJ_RETAIN is set on the object during
* OBJ_NEW, meaning that the user will never be able to actually free
* the underlying object. It's a good way to find out if a process is
* unintentionally using a freed handle.
*/
static inline bool ompi_info_is_freed(ompi_info_t *info)
{
return info->i_freed;
}
#endif /* OMPI_INFO_H */
|