
ompi_communicator_t, ompi_win_t, ompi_file_t all have a super class of type opal_infosubscriber_t instead of a base/super type of opal_object_t (in previous code comm used c_base, but file used super). It may be a bit bold to say that being a subscriber of MPI_Info is the foundational piece that ties these three things together, but if you object, then I would prefer to turn infosubscriber into a more general name that encompasses other common features rather than create a different super class. The key here is that we want to be able to pass comm, win and file objects as if they were opal_infosubscriber_t, so that one routine can heandle all 3 types of objects being passed to it. MPI_INFO_NULL is still an ompi_predefined_info_t type since an MPI_Info is part of ompi but the internal details of the underlying information concept is part of opal. An ompi_info_t type still exists for exposure to the user, but it is simply a wrapper for the opal object. Routines such as ompi_info_dup, etc have all been moved to opal_info_dup and related to the opal directory. Fortran to C translation tables are only used for MPI_Info that is exposed to the application and are therefore part of the ompi_info_t and not the opal_info_t The data structure changes are primarily in the following files: communicator/communicator.h ompi/info/info.h ompi/win/win.h ompi/file/file.h The following new files were created: opal/util/info.h opal/util/info.c opal/util/info_subscriber.h opal/util/info_subscriber.c This infosubscriber concept is that communicators, files and windows can have subscribers that subscribe to any changes in the info associated with the comm/file/window. When xxx_set_info is called, the new info is presented to each subscriber who can modify the info in any way they want. The new value is presented to the next subscriber and so on until all subscribers have had a chance to modify the value. Therefore, the order of subscribers can make a difference but we hope that there is generally only one subscriber that cares or modifies any given key/value pair. The final info is then stored and returned by a call to xxx_get_info. The new model can be seen in the following files: ompi/mpi/c/comm_get_info.c ompi/mpi/c/comm_set_info.c ompi/mpi/c/file_get_info.c ompi/mpi/c/file_set_info.c ompi/mpi/c/win_get_info.c ompi/mpi/c/win_set_info.c The current subscribers where changed as follows: mca/io/ompio/io_ompio_file_open.c mca/io/ompio/io_ompio_module.c mca/osc/rmda/osc_rdma_component.c (This one actually subscribes to "no_locks") mca/osc/sm/osc_sm_component.c (This one actually subscribes to "blocking_fence" and "alloc_shared_contig") Signed-off-by: Mark Allen <markalle@us.ibm.com> Conflicts: AUTHORS ompi/communicator/comm.c ompi/debuggers/ompi_mpihandles_dll.c ompi/file/file.c ompi/file/file.h ompi/info/info.c ompi/mca/io/ompio/io_ompio.h ompi/mca/io/ompio/io_ompio_file_open.c ompi/mca/io/ompio/io_ompio_file_set_view.c ompi/mca/osc/pt2pt/osc_pt2pt.h ompi/mca/sharedfp/addproc/sharedfp_addproc.h ompi/mca/sharedfp/addproc/sharedfp_addproc_file_open.c ompi/mca/topo/treematch/topo_treematch_dist_graph_create.c ompi/mpi/c/lookup_name.c ompi/mpi/c/publish_name.c ompi/mpi/c/unpublish_name.c opal/mca/mpool/base/mpool_base_alloc.c opal/util/Makefile.am
307 строки
9.6 KiB
C
307 строки
9.6 KiB
C
/* -*- 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-2012 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$
|
|
*
|
|
* Additional copyrights may follow
|
|
*
|
|
* $HEADER$
|
|
*/
|
|
|
|
#ifndef OPAL_INFO_H
|
|
#define OPAL_INFO_H
|
|
|
|
#include <string.h>
|
|
|
|
#include "mpi.h"
|
|
#include "opal/class/opal_list.h"
|
|
#include "opal/class/opal_pointer_array.h"
|
|
#include "opal/threads/mutex.h"
|
|
#include "opal/mca/base/mca_base_var_enum.h"
|
|
|
|
/**
|
|
* \internal
|
|
* opal_info_t structure. MPI_Info is a pointer to this structure
|
|
*/
|
|
|
|
struct opal_info_t {
|
|
opal_list_t super;
|
|
opal_mutex_t *i_lock;
|
|
};
|
|
|
|
/**
|
|
* \internal
|
|
* Convenience typedef
|
|
*/
|
|
typedef struct opal_info_t opal_info_t;
|
|
|
|
|
|
/**
|
|
* Table for Fortran <-> C translation table
|
|
*/
|
|
extern opal_pointer_array_t ompi_info_f_to_c_table;
|
|
|
|
|
|
/**
|
|
* \internal
|
|
*
|
|
* opal_info_entry_t object. Each item in opal_info_list is of this
|
|
* type. It contains (key,value) pairs
|
|
*/
|
|
struct opal_info_entry_t {
|
|
opal_list_item_t super; /**< required for opal_list_t type */
|
|
char *ie_value; /**< value part of the (key, value) pair.
|
|
* Maximum length is MPI_MAX_INFO_VAL */
|
|
char ie_key[MPI_MAX_INFO_KEY + 1]; /**< "key" part of the (key, value)
|
|
* pair */
|
|
};
|
|
/**
|
|
* \internal
|
|
* Convenience typedef
|
|
*/
|
|
typedef struct opal_info_entry_t opal_info_entry_t;
|
|
|
|
BEGIN_C_DECLS
|
|
|
|
/**
|
|
* \internal
|
|
* Some declarations needed to use OBJ_NEW and OBJ_DESTRUCT macros
|
|
*/
|
|
OMPI_DECLSPEC OBJ_CLASS_DECLARATION(opal_info_t);
|
|
|
|
/**
|
|
* \internal
|
|
* Some declarations needed to use OBJ_NEW and OBJ_DESTRUCT macros
|
|
*/
|
|
OMPI_DECLSPEC OBJ_CLASS_DECLARATION(opal_info_entry_t);
|
|
|
|
|
|
int opal_mpiinfo_init(void*);
|
|
|
|
/**
|
|
* opal_info_dup - Duplicate an 'MPI_Info' object
|
|
*
|
|
* @param info source info object (handle)
|
|
* @param newinfo pointer to the new info object (handle)
|
|
*
|
|
* @retval MPI_SUCCESS upon success
|
|
* @retval MPI_ERR_NO_MEM if out of memory
|
|
*
|
|
* Not only will the (key, value) pairs be duplicated, the order
|
|
* of keys will be the same in 'newinfo' as it is in 'info'. When
|
|
* an info object is no longer being used, it should be freed with
|
|
* 'MPI_Info_free'.
|
|
*/
|
|
int opal_info_dup (opal_info_t *info, opal_info_t **newinfo);
|
|
|
|
/**
|
|
* Set a new key,value pair on info.
|
|
*
|
|
* @param info pointer to opal_info_t object
|
|
* @param key pointer to the new key object
|
|
* @param value pointer to the new value object
|
|
*
|
|
* @retval MPI_SUCCESS upon success
|
|
* @retval MPI_ERR_NO_MEM if out of memory
|
|
*/
|
|
OMPI_DECLSPEC int opal_info_set (opal_info_t *info, const char *key, const char *value);
|
|
|
|
/**
|
|
* Set a new key,value pair from a variable enumerator.
|
|
*
|
|
* @param info pointer to opal_info_t object
|
|
* @param key pointer to the new key object
|
|
* @param value integer value of the info key (must be valid in var_enum)
|
|
* @param var_enum variable enumerator
|
|
*
|
|
* @retval MPI_SUCCESS upon success
|
|
* @retval MPI_ERR_NO_MEM if out of memory
|
|
* @retval OPAL_ERR_VALUE_OUT_OF_BOUNDS if the value is not valid in the enumerator
|
|
*/
|
|
OMPI_DECLSPEC int opal_info_set_value_enum (opal_info_t *info, const char *key, int value,
|
|
mca_base_var_enum_t *var_enum);
|
|
|
|
/**
|
|
* opal_info_free - Free an 'MPI_Info' object.
|
|
*
|
|
* @param info pointer to info (opal_info_t *) object to be freed (handle)
|
|
*
|
|
* @retval MPI_SUCCESS
|
|
* @retval MPI_ERR_ARG
|
|
*
|
|
* Upon successful completion, 'info' will be set to
|
|
* 'MPI_INFO_NULL'. Free the info handle and all of its keys and
|
|
* values.
|
|
*/
|
|
int opal_info_free (opal_info_t **info);
|
|
|
|
/**
|
|
* Get a (key, value) pair from an 'MPI_Info' object and assign it
|
|
* into a boolen output.
|
|
*
|
|
* @param info Pointer to opal_info_t object
|
|
* @param key null-terminated character string of the index key
|
|
* @param value Boolean output value
|
|
* @param flag true (1) if 'key' defined on 'info', false (0) if not
|
|
* (logical)
|
|
*
|
|
* @retval MPI_SUCCESS
|
|
*
|
|
* If found, the string value will be cast to the boolen output in
|
|
* the following manner:
|
|
*
|
|
* - If the string value is digits, the return value is "(bool)
|
|
* atoi(value)"
|
|
* - If the string value is (case-insensitive) "yes" or "true", the
|
|
* result is true
|
|
* - If the string value is (case-insensitive) "no" or "false", the
|
|
* result is false
|
|
* - All other values are false
|
|
*/
|
|
OMPI_DECLSPEC int opal_info_get_bool (opal_info_t *info, char *key, bool *value,
|
|
int *flag);
|
|
|
|
/**
|
|
* Get a (key, value) pair from an 'MPI_Info' object and assign it
|
|
* into an integer output based on the enumerator value.
|
|
*
|
|
* @param info Pointer to opal_info_t object
|
|
* @param key null-terminated character string of the index key
|
|
* @param value integer output value
|
|
* @param default_value value to use if the string does not conform to the
|
|
* values accepted by the enumerator
|
|
* @param var_enum variable enumerator for the value
|
|
* @param flag true (1) if 'key' defined on 'info', false (0) if not
|
|
* (logical)
|
|
*
|
|
* @retval MPI_SUCCESS
|
|
*/
|
|
|
|
OMPI_DECLSPEC int opal_info_get_value_enum (opal_info_t *info, const char *key,
|
|
int *value, int default_value,
|
|
mca_base_var_enum_t *var_enum, int *flag);
|
|
|
|
/**
|
|
* Get a (key, value) pair from an 'MPI_Info' object
|
|
*
|
|
* @param info Pointer to opal_info_t object
|
|
* @param key null-terminated character string of the index key
|
|
* @param valuelen maximum length of 'value' (integer)
|
|
* @param value null-terminated character string of the value
|
|
* @param flag true (1) if 'key' defined on 'info', false (0) if not
|
|
* (logical)
|
|
*
|
|
* @retval MPI_SUCCESS
|
|
*
|
|
* In C and C++, 'valuelen' should be one less than the allocated
|
|
* space to allow for for the null terminator.
|
|
*/
|
|
OMPI_DECLSPEC int opal_info_get (opal_info_t *info, const char *key, int valuelen,
|
|
char *value, int *flag);
|
|
|
|
/**
|
|
* Delete a (key,value) pair from "info"
|
|
*
|
|
* @param info opal_info_t pointer on which we need to operate
|
|
* @param key The key portion of the (key,value) pair that
|
|
* needs to be deleted
|
|
*
|
|
* @retval MPI_SUCCESS
|
|
* @retval MPI_ERR_NOKEY
|
|
*/
|
|
int opal_info_delete(opal_info_t *info, const char *key);
|
|
|
|
/**
|
|
* @param info - opal_info_t pointer object (handle)
|
|
* @param key - null-terminated character string of the index key
|
|
* @param valuelen - length of the value associated with 'key' (integer)
|
|
* @param flag - true (1) if 'key' defined on 'info', false (0) if not
|
|
* (logical)
|
|
*
|
|
* @retval MPI_SUCCESS
|
|
* @retval MPI_ERR_ARG
|
|
* @retval MPI_ERR_INFO_KEY
|
|
*
|
|
* The length returned in C and C++ does not include the end-of-string
|
|
* character. If the 'key' is not found on 'info', 'valuelen' is left
|
|
* alone.
|
|
*/
|
|
OMPI_DECLSPEC int opal_info_get_valuelen (opal_info_t *info, const char *key, int *valuelen,
|
|
int *flag);
|
|
|
|
/**
|
|
* opal_info_get_nthkey - Get a key indexed by integer from an 'MPI_Info' o
|
|
*
|
|
* @param info Pointer to opal_info_t object
|
|
* @param n index of key to retrieve (integer)
|
|
* @param key character string of at least 'MPI_MAX_INFO_KEY' characters
|
|
*
|
|
* @retval MPI_SUCCESS
|
|
* @retval MPI_ERR_ARG
|
|
*/
|
|
int opal_info_get_nthkey (opal_info_t *info, int n, char *key);
|
|
|
|
/**
|
|
* Convert value string to boolean
|
|
*
|
|
* Convert value string \c value into a boolean, using the
|
|
* interpretation rules specified in MPI-2 Section 4.10. The
|
|
* strings "true", "false", and integer numbers can be converted
|
|
* into booleans. All others will return \c OMPI_ERR_BAD_PARAM
|
|
*
|
|
* @param value Value string for info key to interpret
|
|
* @param interp returned interpretation of the value key
|
|
*
|
|
* @retval OMPI_SUCCESS string was successfully interpreted
|
|
* @retval OMPI_ERR_BAD_PARAM string was not able to be interpreted
|
|
*/
|
|
OMPI_DECLSPEC int opal_info_value_to_bool(char *value, bool *interp);
|
|
|
|
/**
|
|
* Convert value string to integer
|
|
*
|
|
* Convert value string \c value into a integer, using the
|
|
* interpretation rules specified in MPI-2 Section 4.10.
|
|
* All others will return \c OMPI_ERR_BAD_PARAM
|
|
*
|
|
* @param value Value string for info key to interpret
|
|
* @param interp returned interpretation of the value key
|
|
*
|
|
* @retval OMPI_SUCCESS string was successfully interpreted
|
|
* @retval OMPI_ERR_BAD_PARAM string was not able to be interpreted
|
|
*/
|
|
int opal_info_value_to_int(char *value, int *interp);
|
|
|
|
END_C_DECLS
|
|
|
|
/**
|
|
* Get the number of keys defined on on an MPI_Info object
|
|
* @param info Pointer to opal_info_t object.
|
|
* @param nkeys Pointer to nkeys, which needs to be filled up.
|
|
*
|
|
* @retval The number of keys defined on info
|
|
*/
|
|
static inline int
|
|
opal_info_get_nkeys(opal_info_t *info, int *nkeys)
|
|
{
|
|
*nkeys = (int) opal_list_get_size(&(info->super));
|
|
return MPI_SUCCESS;
|
|
}
|
|
|
|
bool opal_str_to_bool(char*);
|
|
|
|
#endif /* OPAL_INFO_H */
|