root/ompi/info/info.h

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

INCLUDED FROM


DEFINITIONS

This source file includes following definitions.
  1. ompi_info_is_freed

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

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