From 50aa143ab672d3ea94298fef7ec4d3d6df2c2e8a Mon Sep 17 00:00:00 2001 From: David Solt Date: Fri, 22 Jan 2016 12:02:01 -0500 Subject: [PATCH 1/2] Major structural changes to data types: .super infosubscriber 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 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 --- AUTHORS | 3 +- ompi/communicator/comm.c | 11 +- ompi/communicator/comm_init.c | 10 +- ompi/communicator/communicator.h | 10 +- ompi/debuggers/ompi_mpihandles_dll.c | 3 +- ompi/debuggers/predefined_gap_test.c | 15 +- ompi/dpm/dpm.c | 43 +- ompi/file/file.c | 31 +- ompi/file/file.h | 10 +- ompi/info/info.c | 499 ++---------------- ompi/info/info.h | 265 +--------- ompi/mca/common/ompio/common_ompio.h | 4 +- .../mca/common/ompio/common_ompio_file_open.c | 2 +- .../mca/common/ompio/common_ompio_file_view.c | 2 +- ompi/mca/fs/fs.h | 5 +- ompi/mca/fs/lustre/fs_lustre.h | 5 +- ompi/mca/fs/lustre/fs_lustre_file_delete.c | 3 +- ompi/mca/fs/lustre/fs_lustre_file_open.c | 7 +- ompi/mca/fs/plfs/fs_plfs.h | 5 +- ompi/mca/fs/plfs/fs_plfs_file_delete.c | 3 +- ompi/mca/fs/plfs/fs_plfs_file_open.c | 3 +- ompi/mca/fs/pvfs2/fs_pvfs2.h | 5 +- ompi/mca/fs/pvfs2/fs_pvfs2_file_delete.c | 3 +- ompi/mca/fs/pvfs2/fs_pvfs2_file_open.c | 7 +- ompi/mca/fs/ufs/fs_ufs.h | 5 +- ompi/mca/fs/ufs/fs_ufs_file_delete.c | 3 +- ompi/mca/fs/ufs/fs_ufs_file_open.c | 3 +- ompi/mca/io/base/base.h | 3 +- ompi/mca/io/base/io_base_delete.c | 28 +- ompi/mca/io/base/io_base_file_select.c | 4 +- ompi/mca/io/io.h | 17 +- ompi/mca/io/ompio/io_ompio.h | 15 +- ompi/mca/io/ompio/io_ompio_component.c | 9 +- ompi/mca/io/ompio/io_ompio_file_open.c | 42 +- ompi/mca/io/ompio/io_ompio_file_set_view.c | 3 +- ompi/mca/io/ompio/io_ompio_module.c | 3 +- ompi/mca/io/romio314/src/io_romio314.h | 11 +- .../io/romio314/src/io_romio314_component.c | 9 +- .../io/romio314/src/io_romio314_file_open.c | 9 +- ompi/mca/osc/base/base.h | 3 +- ompi/mca/osc/base/osc_base_init.c | 3 +- ompi/mca/osc/osc.h | 13 +- ompi/mca/osc/portals4/osc_portals4.h | 5 +- .../mca/osc/portals4/osc_portals4_component.c | 35 +- ompi/mca/osc/pt2pt/osc_pt2pt.h | 5 +- ompi/mca/osc/pt2pt/osc_pt2pt_component.c | 19 +- ompi/mca/osc/rdma/osc_rdma_component.c | 73 ++- ompi/mca/osc/sm/osc_sm.h | 5 +- ompi/mca/osc/sm/osc_sm_component.c | 63 ++- ompi/mca/rte/orte/rte_orte.h | 2 +- ompi/mca/sharedfp/addproc/sharedfp_addproc.h | 3 +- .../addproc/sharedfp_addproc_file_open.c | 3 +- .../sharedfp/individual/sharedfp_individual.c | 3 +- .../sharedfp/individual/sharedfp_individual.h | 3 +- .../sharedfp_individual_file_open.c | 3 +- .../sharedfp/lockedfile/sharedfp_lockedfile.h | 3 +- .../sharedfp_lockedfile_file_open.c | 3 +- ompi/mca/sharedfp/sharedfp.h | 3 +- ompi/mca/sharedfp/sm/sharedfp_sm.h | 3 +- ompi/mca/sharedfp/sm/sharedfp_sm_file_open.c | 3 +- ompi/mca/topo/base/base.h | 5 +- .../topo/base/topo_base_dist_graph_create.c | 2 +- .../topo_base_dist_graph_create_adjacent.c | 2 +- ompi/mca/topo/topo.h | 5 +- ompi/mca/topo/treematch/topo_treematch.h | 3 +- .../topo_treematch_dist_graph_create.c | 3 +- ompi/mpi/c/alloc_mem.c | 2 +- ompi/mpi/c/comm_dup_with_info.c | 3 +- ompi/mpi/c/comm_get_info.c | 15 +- ompi/mpi/c/comm_set_info.c | 9 +- ompi/mpi/c/comm_spawn.c | 3 +- ompi/mpi/c/comm_spawn_multiple.c | 5 +- ompi/mpi/c/file_get_info.c | 39 +- ompi/mpi/c/file_set_info.c | 36 +- ompi/mpi/c/info_delete.c | 3 +- ompi/mpi/c/info_dup.c | 5 +- ompi/mpi/c/info_get.c | 3 +- ompi/mpi/c/info_get_nkeys.c | 3 +- ompi/mpi/c/info_get_nthkey.c | 5 +- ompi/mpi/c/info_get_valuelen.c | 3 +- ompi/mpi/c/info_set.c | 3 +- ompi/mpi/c/lookup_name.c | 3 +- ompi/mpi/c/publish_name.c | 5 +- ompi/mpi/c/unpublish_name.c | 3 +- ompi/mpi/c/win_get_info.c | 31 +- ompi/mpi/c/win_set_info.c | 6 +- ompi/mpiext/cr/c/quiesce_start.c | 17 +- ompi/runtime/ompi_mpi_finalize.c | 3 +- ompi/runtime/ompi_mpi_init.c | 3 +- ompi/win/win.c | 21 +- ompi/win/win.h | 14 +- opal/mca/mpool/base/mpool_base_alloc.c | 17 +- opal/util/Makefile.am | 9 +- opal/util/info.c | 487 +++++++++++++++++ opal/util/info.h | 306 +++++++++++ opal/util/info_subscriber.c | 250 +++++++++ opal/util/info_subscriber.h | 83 +++ oshmem/runtime/oshmem_info_support.c | 5 +- oshmem/tools/oshmem_info/oshmem_info.c | 3 +- oshmem/tools/oshmem_info/param.c | 5 +- 100 files changed, 1686 insertions(+), 1116 deletions(-) create mode 100644 opal/util/info.c create mode 100644 opal/util/info.h create mode 100644 opal/util/info_subscriber.c create mode 100644 opal/util/info_subscriber.h diff --git a/AUTHORS b/AUTHORS index 5f48fce071b..596769dc800 100644 --- a/AUTHORS +++ b/AUTHORS @@ -8,7 +8,6 @@ Github.com pull request). Note that these email addresses are not guaranteed to be current; they are simply a unique indicator of the individual who committed them. ------ Abhishek Joshi, Broadcom abhishek.joshi@broadcom.com @@ -85,6 +84,8 @@ Dave Goodell, Cisco dgoodell@cisco.com David Daniel, Los Alamos National Laboratory ddd@lanl.gov +David Solt, IBM + dsolt@us.ibm.com Denis Dimick, Los Alamos National Laboratory dgdimick@lnal.gov Devendar Bureddy, Mellanox diff --git a/ompi/communicator/comm.c b/ompi/communicator/comm.c index 6b3ffac856b..d25405da795 100644 --- a/ompi/communicator/comm.c +++ b/ompi/communicator/comm.c @@ -22,6 +22,7 @@ * and Technology (RIST). All rights reserved. * Copyright (c) 2014-2015 Intel, Inc. All rights reserved. * Copyright (c) 2015 Mellanox Technologies. All rights reserved. + * Copyright (c) 2016 IBM Corp. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -86,7 +87,7 @@ static int ompi_comm_copy_topo (ompi_communicator_t *oldcomm, /* idup with local group and info. the local group support is provided to support ompi_comm_set_nb */ static int ompi_comm_idup_internal (ompi_communicator_t *comm, ompi_group_t *group, ompi_group_t *remote_group, - ompi_info_t *info, ompi_communicator_t **newcomm, ompi_request_t **req); + opal_info_t *info, ompi_communicator_t **newcomm, ompi_request_t **req); /**********************************************************************/ @@ -787,7 +788,7 @@ static int ompi_comm_split_verify (ompi_communicator_t *comm, int split_type, in } int ompi_comm_split_type (ompi_communicator_t *comm, int split_type, int key, - ompi_info_t *info, ompi_communicator_t **newcomm) + opal_info_t *info, ompi_communicator_t **newcomm) { bool need_split = false, no_reorder = false, no_undefined = false; ompi_communicator_t *newcomp = MPI_COMM_NULL; @@ -972,7 +973,7 @@ int ompi_comm_dup ( ompi_communicator_t * comm, ompi_communicator_t **newcomm ) /**********************************************************************/ /**********************************************************************/ /**********************************************************************/ -int ompi_comm_dup_with_info ( ompi_communicator_t * comm, ompi_info_t *info, ompi_communicator_t **newcomm ) +int ompi_comm_dup_with_info ( ompi_communicator_t * comm, opal_info_t *info, ompi_communicator_t **newcomm ) { ompi_communicator_t *newcomp = NULL; ompi_group_t *remote_group = NULL; @@ -1042,14 +1043,14 @@ int ompi_comm_idup (ompi_communicator_t *comm, ompi_communicator_t **newcomm, om return ompi_comm_idup_with_info (comm, NULL, newcomm, req); } -int ompi_comm_idup_with_info (ompi_communicator_t *comm, ompi_info_t *info, ompi_communicator_t **newcomm, ompi_request_t **req) +int ompi_comm_idup_with_info (ompi_communicator_t *comm, opal_info_t *info, ompi_communicator_t **newcomm, ompi_request_t **req) { return ompi_comm_idup_internal (comm, comm->c_local_group, comm->c_remote_group, info, newcomm, req); } /* NTH: we need a way to idup with a smaller local group so this function takes a local group */ static int ompi_comm_idup_internal (ompi_communicator_t *comm, ompi_group_t *group, ompi_group_t *remote_group, - ompi_info_t *info, ompi_communicator_t **newcomm, ompi_request_t **req) + opal_info_t *info, ompi_communicator_t **newcomm, ompi_request_t **req) { ompi_comm_idup_with_info_context_t *context; ompi_comm_request_t *request; diff --git a/ompi/communicator/comm_init.c b/ompi/communicator/comm_init.c index 2736b0f2a29..eb4258473f0 100644 --- a/ompi/communicator/comm_init.c +++ b/ompi/communicator/comm_init.c @@ -21,6 +21,7 @@ * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. * Copyright (c) 2015 Intel, Inc. All rights reserved. + * Copyright (c) 2016 IBM Corp. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -33,6 +34,7 @@ #include #include "opal/util/bit_ops.h" +#include "opal/util/info_subscriber.h" #include "ompi/constants.h" #include "ompi/mca/pml/pml.h" #include "ompi/mca/coll/base/base.h" @@ -52,9 +54,9 @@ opal_pointer_array_t ompi_mpi_communicators = {{0}}; opal_pointer_array_t ompi_comm_f_to_c_table = {{0}}; -ompi_predefined_communicator_t ompi_mpi_comm_world = {{{0}}}; -ompi_predefined_communicator_t ompi_mpi_comm_self = {{{0}}}; -ompi_predefined_communicator_t ompi_mpi_comm_null = {{{0}}}; +ompi_predefined_communicator_t ompi_mpi_comm_world = {{{{0}}}}; +ompi_predefined_communicator_t ompi_mpi_comm_self = {{{{0}}}}; +ompi_predefined_communicator_t ompi_mpi_comm_null = {{{{0}}}}; ompi_communicator_t *ompi_mpi_comm_parent = NULL; ompi_predefined_communicator_t *ompi_mpi_comm_world_addr = @@ -67,7 +69,7 @@ ompi_predefined_communicator_t *ompi_mpi_comm_null_addr = static void ompi_comm_construct(ompi_communicator_t* comm); static void ompi_comm_destruct(ompi_communicator_t* comm); -OBJ_CLASS_INSTANCE(ompi_communicator_t, opal_object_t, +OBJ_CLASS_INSTANCE(ompi_communicator_t, opal_infosubscriber_t, ompi_comm_construct, ompi_comm_destruct); diff --git a/ompi/communicator/communicator.h b/ompi/communicator/communicator.h index 5c51ffdbe7b..f268ce23372 100644 --- a/ompi/communicator/communicator.h +++ b/ompi/communicator/communicator.h @@ -33,6 +33,8 @@ #include "ompi_config.h" #include "opal/class/opal_object.h" +#include "opal/class/opal_hash_table.h" +#include "opal/util/info_subscriber.h" #include "ompi/errhandler/errhandler.h" #include "opal/threads/mutex.h" #include "ompi/communicator/comm_request.h" @@ -116,7 +118,7 @@ OMPI_DECLSPEC extern opal_pointer_array_t ompi_mpi_communicators; OMPI_DECLSPEC extern opal_pointer_array_t ompi_comm_f_to_c_table; struct ompi_communicator_t { - opal_object_t c_base; + opal_infosubscriber_t super; opal_mutex_t c_lock; /* mutex for name and potentially attributes */ char c_name[MPI_MAX_OBJECT_NAME]; @@ -442,7 +444,7 @@ OMPI_DECLSPEC int ompi_comm_split (ompi_communicator_t *comm, int color, int key */ OMPI_DECLSPEC int ompi_comm_split_type(ompi_communicator_t *comm, int split_type, int key, - struct ompi_info_t *info, + struct opal_info_t *info, ompi_communicator_t** newcomm); /** @@ -473,7 +475,7 @@ OMPI_DECLSPEC int ompi_comm_idup (ompi_communicator_t *comm, ompi_communicator_t * @param comm: input communicator * @param newcomm: the new communicator or MPI_COMM_NULL if any error is detected. */ -OMPI_DECLSPEC int ompi_comm_dup_with_info (ompi_communicator_t *comm, ompi_info_t *info, ompi_communicator_t **newcomm); +OMPI_DECLSPEC int ompi_comm_dup_with_info (ompi_communicator_t *comm, opal_info_t *info, ompi_communicator_t **newcomm); /** * dup a communicator (non-blocking) with info. @@ -483,7 +485,7 @@ OMPI_DECLSPEC int ompi_comm_dup_with_info (ompi_communicator_t *comm, ompi_info_ * @param comm: input communicator * @param newcomm: the new communicator or MPI_COMM_NULL if any error is detected. */ -OMPI_DECLSPEC int ompi_comm_idup_with_info (ompi_communicator_t *comm, ompi_info_t *info, ompi_communicator_t **newcomm, ompi_request_t **req); +OMPI_DECLSPEC int ompi_comm_idup_with_info (ompi_communicator_t *comm, opal_info_t *info, ompi_communicator_t **newcomm, ompi_request_t **req); /** * compare two communicators. diff --git a/ompi/debuggers/ompi_mpihandles_dll.c b/ompi/debuggers/ompi_mpihandles_dll.c index 05a20e113f6..131040b57fd 100644 --- a/ompi/debuggers/ompi_mpihandles_dll.c +++ b/ompi/debuggers/ompi_mpihandles_dll.c @@ -7,6 +7,7 @@ * Copyright (c) 2012-2013 Inria. All rights reserved. * Copyright (c) 2016 Research Organization for Information Science * and Technology (RIST). All rights reserved. + * Copyright (c) 2017 IBM Corp. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -237,7 +238,7 @@ int mpidbg_init_per_image(mqs_image *image, const mqs_image_callbacks *icb, mqs_find_type(image, "ompi_file_t", mqs_lang_c); handle_types->hi_c_group = i_info->ompi_group_t.type; handle_types->hi_c_info = - mqs_find_type(image, "ompi_info_t", mqs_lang_c); + mqs_find_type(image, "opal_info_t", mqs_lang_c); /* JMS: "MPI_Offset" is a typedef (see comment about MPI_Aint above) */ handle_types->hi_c_offset = mqs_find_type(image, "MPI_Offset", mqs_lang_c); diff --git a/ompi/debuggers/predefined_gap_test.c b/ompi/debuggers/predefined_gap_test.c index 69eb1c1791b..aa942348401 100644 --- a/ompi/debuggers/predefined_gap_test.c +++ b/ompi/debuggers/predefined_gap_test.c @@ -5,6 +5,7 @@ * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2012-2013 Inria. All rights reserved. + * Copyright (c) 2016 IBM Corp. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -52,8 +53,8 @@ int main(int argc, char **argv) { /* Test Predefined communicator sizes */ printf("ompi_predefined_communicator_t = %lu bytes\n", sizeof(ompi_predefined_communicator_t)); printf("ompi_communicator_t = %lu bytes\n", sizeof(ompi_communicator_t)); - GAP_CHECK("c_base", test_comm, c_base, c_base, 0); - GAP_CHECK("c_lock", test_comm, c_lock, c_base, 1); + GAP_CHECK("c_base", test_comm, super, super, 0); + GAP_CHECK("c_lock", test_comm, c_lock, super, 1); GAP_CHECK("c_name", test_comm, c_name, c_lock, 1); GAP_CHECK("c_contextid", test_comm, c_contextid, c_name, 1); GAP_CHECK("c_my_rank", test_comm, c_my_rank, c_contextid, 1); @@ -120,8 +121,8 @@ int main(int argc, char **argv) { printf("=============================================\n"); printf("ompi_predefined_win_t = %lu bytes\n", sizeof(ompi_predefined_win_t)); printf("ompi_win_t = %lu bytes\n", sizeof(ompi_win_t)); - GAP_CHECK("w_base", test_win, w_base, w_base, 0); - GAP_CHECK("w_lock", test_win, w_lock, w_base, 1); + GAP_CHECK("super", test_win, super, super, 0); + GAP_CHECK("w_lock", test_win, w_lock, super, 1); GAP_CHECK("w_name", test_win, w_name, w_lock, 1); GAP_CHECK("w_group", test_win, w_group, w_name, 1); GAP_CHECK("w_flags", test_win, w_flags, w_group, 1); @@ -137,8 +138,7 @@ int main(int argc, char **argv) { printf("ompi_info_t = %lu bytes\n", sizeof(ompi_info_t)); GAP_CHECK("super", test_info, super, super, 0); GAP_CHECK("i_f_to_c_index", test_info, i_f_to_c_index, super, 1); - GAP_CHECK("i_lock", test_info, i_lock, i_f_to_c_index, 1); - GAP_CHECK("i_freed", test_info, i_freed, i_lock, 1); + GAP_CHECK("i_freed", test_info, i_freed, i_f_to_c_index, 1); /* Test Predefined file sizes */ printf("=============================================\n"); @@ -148,8 +148,7 @@ int main(int argc, char **argv) { GAP_CHECK("f_comm", test_file, f_comm, super, 1); GAP_CHECK("f_filename", test_file, f_filename, f_comm, 1); GAP_CHECK("f_amode", test_file, f_amode, f_filename, 1); - GAP_CHECK("f_info", test_file, f_info, f_amode, 1); - GAP_CHECK("f_flags", test_file, f_flags, f_info, 1); + GAP_CHECK("f_flags", test_file, f_flags, f_amode, 1); GAP_CHECK("f_f_to_c_index", test_file, f_f_to_c_index, f_flags, 1); GAP_CHECK("error_handler", test_file, error_handler, f_f_to_c_index, 1); GAP_CHECK("errhandler_type", test_file, errhandler_type, error_handler, 1); diff --git a/ompi/dpm/dpm.c b/ompi/dpm/dpm.c index 090d8f521b7..f277805b926 100644 --- a/ompi/dpm/dpm.c +++ b/ompi/dpm/dpm.c @@ -18,6 +18,7 @@ * Copyright (c) 2013-2016 Intel, Inc. All rights reserved. * Copyright (c) 2014-2017 Research Organization for Information Science * and Technology (RIST). All rights reserved. + * Copyright (c) 2016 IBM Corp. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -703,7 +704,7 @@ int ompi_dpm_spawn(int count, const char *array_of_commands[], if ( array_of_info != NULL && array_of_info[i] != MPI_INFO_NULL ) { /* check for personality - this is a job-level key */ - ompi_info_get (array_of_info[i], "personality", sizeof(host) - 1, host, &flag); + opal_info_get (array_of_info[i], "personality", sizeof(host) - 1, host, &flag); if ( flag ) { personality = true; info = OBJ_NEW(opal_value_t); @@ -713,7 +714,7 @@ int ompi_dpm_spawn(int count, const char *array_of_commands[], } /* check for 'host' */ - ompi_info_get (array_of_info[i], "host", sizeof(host) - 1, host, &flag); + opal_info_get (array_of_info[i], "host", sizeof(host) - 1, host, &flag); if ( flag ) { info = OBJ_NEW(opal_value_t); info->key = strdup(OPAL_PMIX_HOST); @@ -722,7 +723,7 @@ int ompi_dpm_spawn(int count, const char *array_of_commands[], } /* check for 'hostfile' */ - ompi_info_get (array_of_info[i], "hostfile", sizeof(host) - 1, host, &flag); + opal_info_get (array_of_info[i], "hostfile", sizeof(host) - 1, host, &flag); if ( flag ) { info = OBJ_NEW(opal_value_t); info->key = strdup(OPAL_PMIX_HOSTFILE); @@ -731,7 +732,7 @@ int ompi_dpm_spawn(int count, const char *array_of_commands[], } /* check for 'add-hostfile' */ - ompi_info_get (array_of_info[i], "add-hostfile", sizeof(host) - 1, host, &flag); + opal_info_get (array_of_info[i], "add-hostfile", sizeof(host) - 1, host, &flag); if ( flag ) { info = OBJ_NEW(opal_value_t); info->key = strdup(OPAL_PMIX_ADD_HOSTFILE); @@ -740,7 +741,7 @@ int ompi_dpm_spawn(int count, const char *array_of_commands[], } /* check for 'add-host' */ - ompi_info_get (array_of_info[i], "add-host", sizeof(host) - 1, host, &flag); + opal_info_get (array_of_info[i], "add-host", sizeof(host) - 1, host, &flag); if ( flag ) { info = OBJ_NEW(opal_value_t); info->key = strdup(OPAL_PMIX_ADD_HOST); @@ -749,7 +750,7 @@ int ompi_dpm_spawn(int count, const char *array_of_commands[], } /* check for env */ - ompi_info_get (array_of_info[i], "env", sizeof(host)-1, host, &flag); + opal_info_get (array_of_info[i], "env", sizeof(host)-1, host, &flag); if ( flag ) { envars = opal_argv_split(host, '\n'); for (j=0; NULL != envars[j]; j++) { @@ -765,7 +766,7 @@ int ompi_dpm_spawn(int count, const char *array_of_commands[], * * This is a job-level key */ - ompi_info_get (array_of_info[i], "ompi_prefix", sizeof(prefix) - 1, prefix, &flag); + opal_info_get (array_of_info[i], "ompi_prefix", sizeof(prefix) - 1, prefix, &flag); if ( flag ) { info = OBJ_NEW(opal_value_t); info->key = strdup(OPAL_PMIX_PREFIX); @@ -774,7 +775,7 @@ int ompi_dpm_spawn(int count, const char *array_of_commands[], } /* check for 'wdir' */ - ompi_info_get (array_of_info[i], "wdir", sizeof(cwd) - 1, cwd, &flag); + opal_info_get (array_of_info[i], "wdir", sizeof(cwd) - 1, cwd, &flag); if ( flag ) { info = OBJ_NEW(opal_value_t); info->key = strdup(OPAL_PMIX_WDIR); @@ -784,7 +785,7 @@ int ompi_dpm_spawn(int count, const char *array_of_commands[], } /* check for 'mapper' - a job-level key */ - ompi_info_get(array_of_info[i], "mapper", sizeof(mapper) - 1, mapper, &flag); + opal_info_get(array_of_info[i], "mapper", sizeof(mapper) - 1, mapper, &flag); if ( flag ) { info = OBJ_NEW(opal_value_t); info->key = strdup(OPAL_PMIX_MAPPER); @@ -793,7 +794,7 @@ int ompi_dpm_spawn(int count, const char *array_of_commands[], } /* check for 'display_map' - a job-level key */ - ompi_info_get_bool(array_of_info[i], "display_map", &local_spawn, &flag); + opal_info_get_bool(array_of_info[i], "display_map", &local_spawn, &flag); if ( flag ) { info = OBJ_NEW(opal_value_t); info->key = strdup(OPAL_PMIX_DISPLAY_MAP); @@ -802,7 +803,7 @@ int ompi_dpm_spawn(int count, const char *array_of_commands[], } /* check for 'npernode' and 'ppr' - job-level key */ - ompi_info_get (array_of_info[i], "npernode", sizeof(slot_list) - 1, slot_list, &flag); + opal_info_get (array_of_info[i], "npernode", sizeof(slot_list) - 1, slot_list, &flag); if ( flag ) { info = OBJ_NEW(opal_value_t); info->key = strdup(OPAL_PMIX_PPR); @@ -810,14 +811,14 @@ int ompi_dpm_spawn(int count, const char *array_of_commands[], (void)asprintf(&(info->data.string), "%s:n", slot_list); opal_list_append(&job_info, &info->super); } - ompi_info_get (array_of_info[i], "pernode", sizeof(slot_list) - 1, slot_list, &flag); + opal_info_get (array_of_info[i], "pernode", sizeof(slot_list) - 1, slot_list, &flag); if ( flag ) { info = OBJ_NEW(opal_value_t); info->key = strdup(OPAL_PMIX_PPR); opal_value_load(info, "1:n", OPAL_STRING); opal_list_append(&job_info, &info->super); } - ompi_info_get (array_of_info[i], "ppr", sizeof(slot_list) - 1, slot_list, &flag); + opal_info_get (array_of_info[i], "ppr", sizeof(slot_list) - 1, slot_list, &flag); if ( flag ) { info = OBJ_NEW(opal_value_t); info->key = strdup(OPAL_PMIX_PPR); @@ -826,7 +827,7 @@ int ompi_dpm_spawn(int count, const char *array_of_commands[], } /* check for 'map_by' - job-level key */ - ompi_info_get(array_of_info[i], "map_by", sizeof(slot_list) - 1, slot_list, &flag); + opal_info_get(array_of_info[i], "map_by", sizeof(slot_list) - 1, slot_list, &flag); if ( flag ) { info = OBJ_NEW(opal_value_t); info->key = strdup(OPAL_PMIX_MAPBY); @@ -835,7 +836,7 @@ int ompi_dpm_spawn(int count, const char *array_of_commands[], } /* check for 'rank_by' - job-level key */ - ompi_info_get(array_of_info[i], "rank_by", sizeof(slot_list) - 1, slot_list, &flag); + opal_info_get(array_of_info[i], "rank_by", sizeof(slot_list) - 1, slot_list, &flag); if ( flag ) { info = OBJ_NEW(opal_value_t); info->key = strdup(OPAL_PMIX_RANKBY); @@ -844,7 +845,7 @@ int ompi_dpm_spawn(int count, const char *array_of_commands[], } /* check for 'bind_to' - job-level key */ - ompi_info_get(array_of_info[i], "bind_to", sizeof(slot_list) - 1, slot_list, &flag); + opal_info_get(array_of_info[i], "bind_to", sizeof(slot_list) - 1, slot_list, &flag); if ( flag ) { info = OBJ_NEW(opal_value_t); info->key = strdup(OPAL_PMIX_BINDTO); @@ -853,7 +854,7 @@ int ompi_dpm_spawn(int count, const char *array_of_commands[], } /* check for 'preload_binary' - job-level key */ - ompi_info_get_bool(array_of_info[i], "ompi_preload_binary", &local_spawn, &flag); + opal_info_get_bool(array_of_info[i], "ompi_preload_binary", &local_spawn, &flag); if ( flag ) { info = OBJ_NEW(opal_value_t); info->key = strdup(OPAL_PMIX_PRELOAD_BIN); @@ -862,7 +863,7 @@ int ompi_dpm_spawn(int count, const char *array_of_commands[], } /* check for 'preload_files' - job-level key */ - ompi_info_get (array_of_info[i], "ompi_preload_files", sizeof(cwd) - 1, cwd, &flag); + opal_info_get (array_of_info[i], "ompi_preload_files", sizeof(cwd) - 1, cwd, &flag); if ( flag ) { info = OBJ_NEW(opal_value_t); info->key = strdup(OPAL_PMIX_PRELOAD_FILES); @@ -873,7 +874,7 @@ int ompi_dpm_spawn(int count, const char *array_of_commands[], /* see if this is a non-mpi job - if so, then set the flag so ORTE * knows what to do - job-level key */ - ompi_info_get_bool(array_of_info[i], "ompi_non_mpi", &non_mpi, &flag); + opal_info_get_bool(array_of_info[i], "ompi_non_mpi", &non_mpi, &flag); if (flag && non_mpi) { info = OBJ_NEW(opal_value_t); info->key = strdup(OPAL_PMIX_NON_PMI); @@ -882,7 +883,7 @@ int ompi_dpm_spawn(int count, const char *array_of_commands[], } /* see if this is an MCA param that the user wants applied to the child job */ - ompi_info_get (array_of_info[i], "ompi_param", sizeof(params) - 1, params, &flag); + opal_info_get (array_of_info[i], "ompi_param", sizeof(params) - 1, params, &flag); if ( flag ) { opal_argv_append_unique_nosize(&app->env, params, true); } @@ -890,7 +891,7 @@ int ompi_dpm_spawn(int count, const char *array_of_commands[], /* see if user specified what to do with stdin - defaults to * not forwarding stdin to child processes - job-level key */ - ompi_info_get (array_of_info[i], "ompi_stdin_target", sizeof(stdin_target) - 1, stdin_target, &flag); + opal_info_get (array_of_info[i], "ompi_stdin_target", sizeof(stdin_target) - 1, stdin_target, &flag); if ( flag ) { if (0 == strcmp(stdin_target, "all")) { ui32 = OPAL_VPID_WILDCARD; diff --git a/ompi/file/file.c b/ompi/file/file.c index c59f039efb6..1c51fb43d44 100644 --- a/ompi/file/file.c +++ b/ompi/file/file.c @@ -15,6 +15,7 @@ * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. * Copyright (c) 2016 University of Houston. All rights reserved. + * Copyright (c) 2016 IBM Corp. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -44,7 +45,7 @@ opal_pointer_array_t ompi_file_f_to_c_table = {{0}}; /* * MPI_FILE_NULL (_addr flavor is for F03 bindings) */ -ompi_predefined_file_t ompi_mpi_file_null = {{{0}}}; +ompi_predefined_file_t ompi_mpi_file_null = {{{{0}}}}; ompi_predefined_file_t *ompi_mpi_file_null_addr = &ompi_mpi_file_null; @@ -59,7 +60,7 @@ static void file_destructor(ompi_file_t *obj); * Class instance for ompi_file_t */ OBJ_CLASS_INSTANCE(ompi_file_t, - opal_object_t, + opal_infosubscriber_t, file_constructor, file_destructor); @@ -97,7 +98,7 @@ int ompi_file_init(void) * Back end to MPI_FILE_OPEN */ int ompi_file_open(struct ompi_communicator_t *comm, const char *filename, - int amode, struct ompi_info_t *info, ompi_file_t **fh) + int amode, struct opal_info_t *info, ompi_file_t **fh) { int ret; ompi_file_t *file; @@ -113,17 +114,11 @@ int ompi_file_open(struct ompi_communicator_t *comm, const char *filename, file->f_comm = comm; OBJ_RETAIN(comm); - if (MPI_INFO_NULL != info) { - if(NULL == file->f_info) { - file->f_info = OBJ_NEW(ompi_info_t); - } - if (OMPI_SUCCESS != (ret = ompi_info_dup(info, &file->f_info))) { - OBJ_RELEASE(file); - return ret; - } - } else { - file->f_info = MPI_INFO_NULL; - OBJ_RETAIN(MPI_INFO_NULL); + /* Present the info to the info layer */ + + if (OPAL_SUCCESS != opal_infosubscribe_change_info(&file->super, info)) { + OBJ_RELEASE(file); + return ret; } file->f_amode = amode; @@ -236,7 +231,6 @@ static void file_constructor(ompi_file_t *file) file->f_comm = NULL; file->f_filename = NULL; file->f_amode = 0; - file->f_info = NULL; /* Initialize flags */ @@ -316,13 +310,6 @@ static void file_destructor(ompi_file_t *file) #endif } - if (NULL != file->f_info) { - OBJ_RELEASE(file->f_info); -#if OPAL_ENABLE_DEBUG - file->f_info = NULL; -#endif - } - /* Reset the f_to_c table entry */ if (MPI_UNDEFINED != file->f_f_to_c_index && diff --git a/ompi/file/file.h b/ompi/file/file.h index 92f49aa0581..30c606776f1 100644 --- a/ompi/file/file.h +++ b/ompi/file/file.h @@ -15,6 +15,7 @@ * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. * Copyright (c) 2016 University of Houston. All rights reserved. + * Copyright (c) 2016 IBM Corp. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -30,6 +31,7 @@ #include "opal/class/opal_list.h" #include "ompi/errhandler/errhandler.h" #include "opal/threads/mutex.h" +#include "opal/util/info_subscriber.h" #include "ompi/mca/io/io.h" /* @@ -45,7 +47,7 @@ BEGIN_C_DECLS */ struct ompi_file_t { /** Base of OBJ_* interface */ - opal_object_t super; + opal_infosubscriber_t super; /** Communicator that this file was created with */ struct ompi_communicator_t *f_comm; @@ -56,10 +58,6 @@ struct ompi_file_t { /** Amode that this file was created with */ int f_amode; - /** MPI_Info that this file was created with. Note that this is - *NOT* what should be returned from OMPI_FILE_GET_INFO! */ - struct ompi_info_t *f_info; - /** Bit flags */ int32_t f_flags; @@ -153,7 +151,7 @@ int ompi_file_init(void); * handling as well. */ int ompi_file_open(struct ompi_communicator_t *comm, const char *filename, - int amode, struct ompi_info_t *info, + int amode, struct opal_info_t *info, ompi_file_t **fh); /** diff --git a/ompi/info/info.c b/ompi/info/info.c index 9bc0d10bd6b..71cf85bf8c1 100644 --- a/ompi/info/info.c +++ b/ompi/info/info.c @@ -16,6 +16,7 @@ * reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. + * Copyright (c) 2016 IBM Corp. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -43,46 +44,33 @@ #include "opal/util/opal_getcwd.h" #include "opal/util/output.h" #include "opal/util/strncpy.h" +#include "opal/util/info.h" #include "ompi/info/info.h" #include "ompi/runtime/mpiruntime.h" #include "ompi/runtime/params.h" - /* * Global variables */ -ompi_predefined_info_t ompi_mpi_info_null = {{{{0}}}}; +ompi_predefined_info_t ompi_mpi_info_null; ompi_predefined_info_t *ompi_mpi_info_null_addr = &ompi_mpi_info_null; -ompi_predefined_info_t ompi_mpi_info_env = {{{{0}}}}; - +ompi_predefined_info_t ompi_mpi_info_env; /* * Local functions */ static void info_constructor(ompi_info_t *info); static void info_destructor(ompi_info_t *info); -static void info_entry_constructor(ompi_info_entry_t *entry); -static void info_entry_destructor(ompi_info_entry_t *entry); -static ompi_info_entry_t *info_find_key (ompi_info_t *info, const char *key); - /* * ompi_info_t classes */ OBJ_CLASS_INSTANCE(ompi_info_t, - opal_list_t, + opal_info_t, info_constructor, info_destructor); -/* - * ompi_info_entry_t classes - */ -OBJ_CLASS_INSTANCE(ompi_info_entry_t, - opal_list_item_t, - info_entry_constructor, - info_entry_destructor); - /* * The global fortran <-> C translation table */ @@ -93,7 +81,7 @@ opal_pointer_array_t ompi_info_f_to_c_table = {{0}}; * fortran to C translation table. It also fills in the values * for the MPI_INFO_GET_ENV object */ -int ompi_info_init(void) +int ompi_mpiinfo_init(void) { char val[OPAL_MAXHOSTNAMELEN]; char *cptr; @@ -118,35 +106,35 @@ int ompi_info_init(void) /* command for this app_context */ if (NULL != (cptr = getenv("OMPI_COMMAND"))) { - ompi_info_set(&ompi_mpi_info_env.info, "command", cptr); + opal_info_set(&ompi_mpi_info_env.info.super, "command", cptr); } /* space-separated list of argv for this command */ if (NULL != (cptr = getenv("OMPI_ARGV"))) { - ompi_info_set(&ompi_mpi_info_env.info, "argv", cptr); + opal_info_set(&ompi_mpi_info_env.info.super, "argv", cptr); } /* max procs for the entire job */ if (NULL != (cptr = getenv("OMPI_MCA_orte_ess_num_procs"))) { - ompi_info_set(&ompi_mpi_info_env.info, "maxprocs", cptr); + opal_info_set(&ompi_mpi_info_env.info.super, "maxprocs", cptr); /* Open MPI does not support the "soft" option, so set it to maxprocs */ - ompi_info_set(&ompi_mpi_info_env.info, "soft", cptr); + opal_info_set(&ompi_mpi_info_env.info.super, "soft", cptr); } /* local host name */ gethostname(val, sizeof(val)); - ompi_info_set(&ompi_mpi_info_env.info, "host", val); + opal_info_set(&ompi_mpi_info_env.info.super, "host", val); /* architecture name */ if (NULL != (cptr = getenv("OMPI_MCA_orte_cpu_type"))) { - ompi_info_set(&ompi_mpi_info_env.info, "arch", cptr); + opal_info_set(&ompi_mpi_info_env.info.super, "arch", cptr); } #ifdef HAVE_SYS_UTSNAME_H else { struct utsname sysname; uname(&sysname); cptr = sysname.machine; - ompi_info_set(&ompi_mpi_info_env.info, "arch", cptr); + opal_info_set(&ompi_mpi_info_env.info.super, "arch", cptr); } #endif @@ -155,7 +143,7 @@ int ompi_info_init(void) * of determining the value */ if (NULL != (cptr = getenv("OMPI_MCA_initial_wdir"))) { - ompi_info_set(&ompi_mpi_info_env.info, "wdir", cptr); + opal_info_set(&ompi_mpi_info_env.info.super, "wdir", cptr); } /* provide the REQUESTED thread level - may be different @@ -163,16 +151,16 @@ int ompi_info_init(void) * ugly, but have to do a switch to find the string representation */ switch (ompi_mpi_thread_requested) { case MPI_THREAD_SINGLE: - ompi_info_set(&ompi_mpi_info_env.info, "thread_level", "MPI_THREAD_SINGLE"); + opal_info_set(&ompi_mpi_info_env.info.super, "thread_level", "MPI_THREAD_SINGLE"); break; case MPI_THREAD_FUNNELED: - ompi_info_set(&ompi_mpi_info_env.info, "thread_level", "MPI_THREAD_FUNNELED"); + opal_info_set(&ompi_mpi_info_env.info.super, "thread_level", "MPI_THREAD_FUNNELED"); break; case MPI_THREAD_SERIALIZED: - ompi_info_set(&ompi_mpi_info_env.info, "thread_level", "MPI_THREAD_SERIALIZED"); + opal_info_set(&ompi_mpi_info_env.info.super, "thread_level", "MPI_THREAD_SERIALIZED"); break; case MPI_THREAD_MULTIPLE: - ompi_info_set(&ompi_mpi_info_env.info, "thread_level", "MPI_THREAD_MULTIPLE"); + opal_info_set(&ompi_mpi_info_env.info.super, "thread_level", "MPI_THREAD_MULTIPLE"); break; default: /* do nothing - don't know the value */ @@ -183,24 +171,24 @@ int ompi_info_init(void) /* the number of app_contexts in this job */ if (NULL != (cptr = getenv("OMPI_NUM_APP_CTX"))) { - ompi_info_set(&ompi_mpi_info_env.info, "ompi_num_apps", cptr); + opal_info_set(&ompi_mpi_info_env.info.super, "ompi_num_apps", cptr); } /* space-separated list of first MPI rank of each app_context */ if (NULL != (cptr = getenv("OMPI_FIRST_RANKS"))) { - ompi_info_set(&ompi_mpi_info_env.info, "ompi_first_rank", cptr); + opal_info_set(&ompi_mpi_info_env.info.super, "ompi_first_rank", cptr); } /* space-separated list of num procs for each app_context */ if (NULL != (cptr = getenv("OMPI_APP_CTX_NUM_PROCS"))) { - ompi_info_set(&ompi_mpi_info_env.info, "ompi_np", cptr); + opal_info_set(&ompi_mpi_info_env.info.super, "ompi_np", cptr); } /* location of the directory containing any prepositioned files * the user may have requested */ if (NULL != (cptr = getenv("OMPI_FILE_LOCATION"))) { - ompi_info_set(&ompi_mpi_info_env.info, "ompi_positioned_file_dir", cptr); + opal_info_set(&ompi_mpi_info_env.info.super, "ompi_positioned_file_dir", cptr); } /* All done */ @@ -209,313 +197,17 @@ int ompi_info_init(void) } -/* - * Duplicate an info - */ -int ompi_info_dup (ompi_info_t *info, ompi_info_t **newinfo) -{ - int err; - opal_list_item_t *item; - ompi_info_entry_t *iterator; - - OPAL_THREAD_LOCK(info->i_lock); - for (item = opal_list_get_first(&(info->super)); - item != opal_list_get_end(&(info->super)); - item = opal_list_get_next(iterator)) { - iterator = (ompi_info_entry_t *) item; - err = ompi_info_set(*newinfo, iterator->ie_key, iterator->ie_value); - if (MPI_SUCCESS != err) { - OPAL_THREAD_UNLOCK(info->i_lock); - return err; - } - } - OPAL_THREAD_UNLOCK(info->i_lock); - return MPI_SUCCESS; -} - - -/* - * Set a value on the info - */ -int ompi_info_set (ompi_info_t *info, const char *key, const char *value) -{ - char *new_value; - ompi_info_entry_t *new_info; - ompi_info_entry_t *old_info; - - new_value = strdup(value); - if (NULL == new_value) { - return MPI_ERR_NO_MEM; - } - - OPAL_THREAD_LOCK(info->i_lock); - old_info = info_find_key (info, key); - if (NULL != old_info) { - /* - * key already exists. remove the value associated with it - */ - free(old_info->ie_value); - old_info->ie_value = new_value; - } else { - new_info = OBJ_NEW(ompi_info_entry_t); - if (NULL == new_info) { - free(new_value); - OPAL_THREAD_UNLOCK(info->i_lock); - return MPI_ERR_NO_MEM; - } - strncpy (new_info->ie_key, key, MPI_MAX_INFO_KEY); - new_info->ie_value = new_value; - opal_list_append (&(info->super), (opal_list_item_t *) new_info); - } - OPAL_THREAD_UNLOCK(info->i_lock); - return MPI_SUCCESS; -} - - -int ompi_info_set_value_enum (ompi_info_t *info, const char *key, int value, - mca_base_var_enum_t *var_enum) -{ - char *string_value; - int ret; - - ret = var_enum->string_from_value (var_enum, value, &string_value); - if (OPAL_SUCCESS != ret) { - return ret; - } - - ret = ompi_info_set (info, key, string_value); - free (string_value); - return ret; -} - - - -/* - * Free an info handle and all of its keys and values. - */ -int ompi_info_free (ompi_info_t **info) -{ - (*info)->i_freed = true; - OBJ_RELEASE(*info); - *info = MPI_INFO_NULL; - return MPI_SUCCESS; -} - - -/* - * Get a value from an info - */ -int ompi_info_get (ompi_info_t *info, const char *key, int valuelen, - char *value, int *flag) -{ - ompi_info_entry_t *search; - int value_length; - - OPAL_THREAD_LOCK(info->i_lock); - search = info_find_key (info, key); - if (NULL == search){ - *flag = 0; - } else { - /* - * We have found the element, so we can return the value - * Set the flag, value_length and value - */ - *flag = 1; - value_length = strlen(search->ie_value); - /* - * If the stored value is shorter than valuelen, then - * we can copy the entire value out. Else, we have to - * copy ONLY valuelen bytes out - */ - if (value_length < valuelen ) { - strcpy(value, search->ie_value); - } else { - opal_strncpy(value, search->ie_value, valuelen); - if (MPI_MAX_INFO_VAL == valuelen) { - value[valuelen-1] = 0; - } else { - value[valuelen] = 0; - } - } - } - OPAL_THREAD_UNLOCK(info->i_lock); - return MPI_SUCCESS; -} - -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_entry_t *search; - int ret; - - *value = default_value; - - OPAL_THREAD_LOCK(info->i_lock); - search = info_find_key (info, key); - if (NULL == search){ - OPAL_THREAD_UNLOCK(info->i_lock); - *flag = 0; - return MPI_SUCCESS; - } - - /* we found a mathing key. pass the string value to the enumerator and - * return */ - *flag = 1; - - ret = var_enum->value_from_string (var_enum, search->ie_value, value); - OPAL_THREAD_UNLOCK(info->i_lock); - - return ret; -} - - -/* - * Similar to ompi_info_get(), but cast the result into a boolean - * using some well-defined rules. - */ -int ompi_info_get_bool(ompi_info_t *info, char *key, bool *value, int *flag) -{ - char *ptr; - char str[256]; - - str[sizeof(str) - 1] = '\0'; - ompi_info_get(info, key, sizeof(str) - 1, str, flag); - if (*flag) { - *value = false; - - /* Trim whitespace */ - ptr = str + sizeof(str) - 1; - while (ptr >= str && isspace(*ptr)) { - *ptr = '\0'; - --ptr; - } - ptr = str; - while (ptr < str + sizeof(str) - 1 && *ptr != '\0' && - isspace(*ptr)) { - ++ptr; - } - if ('\0' != *ptr) { - if (isdigit(*ptr)) { - *value = (bool) atoi(ptr); - } else if (0 == strcasecmp(ptr, "yes") || - 0 == strcasecmp(ptr, "true")) { - *value = true; - } else if (0 != strcasecmp(ptr, "no") && - 0 != strcasecmp(ptr, "false")) { - /* RHC unrecognized value -- print a warning? */ - } - } - } - return MPI_SUCCESS; -} - -/* - * Delete a key from an info - */ -int ompi_info_delete (ompi_info_t *info, const char *key) -{ - ompi_info_entry_t *search; - - OPAL_THREAD_LOCK(info->i_lock); - search = info_find_key (info, key); - if (NULL == search){ - OPAL_THREAD_UNLOCK(info->i_lock); - return MPI_ERR_INFO_NOKEY; - } else { - /* - * An entry with this key value was found. Remove the item - * and free the memory allocated to it. - * As this key *must* be available, we do not check for errors. - */ - opal_list_remove_item (&(info->super), - (opal_list_item_t *)search); - OBJ_RELEASE(search); - } - OPAL_THREAD_UNLOCK(info->i_lock); - return MPI_SUCCESS; -} - - -/* - * Return the length of a value - */ -int ompi_info_get_valuelen (ompi_info_t *info, const char *key, int *valuelen, - int *flag) -{ - ompi_info_entry_t *search; - - OPAL_THREAD_LOCK(info->i_lock); - search = info_find_key (info, key); - if (NULL == search){ - *flag = 0; - } else { - /* - * We have found the element, so we can return the value - * Set the flag, value_length and value - */ - *flag = 1; - *valuelen = strlen(search->ie_value); - } - OPAL_THREAD_UNLOCK(info->i_lock); - return MPI_SUCCESS; -} - - -/* - * Get the nth key - */ -int ompi_info_get_nthkey (ompi_info_t *info, int n, char *key) -{ - ompi_info_entry_t *iterator; - - /* - * Iterate over and over till we get to the nth key - */ - OPAL_THREAD_LOCK(info->i_lock); - for (iterator = (ompi_info_entry_t *)opal_list_get_first(&(info->super)); - n > 0; - --n) { - iterator = (ompi_info_entry_t *)opal_list_get_next(iterator); - if (opal_list_get_end(&(info->super)) == - (opal_list_item_t *) iterator) { - OPAL_THREAD_UNLOCK(info->i_lock); - return MPI_ERR_ARG; - } - } - /* - * iterator is of the type opal_list_item_t. We have to - * cast it to ompi_info_entry_t before we can use it to - * access the value - */ - strncpy(key, iterator->ie_key, MPI_MAX_INFO_KEY); - OPAL_THREAD_UNLOCK(info->i_lock); - return MPI_SUCCESS; -} - - /* * Shut down MPI_Info handling */ -int ompi_info_finalize(void) +int ompi_mpiinfo_finalize(void) { size_t i, max; ompi_info_t *info; opal_list_item_t *item; - ompi_info_entry_t *entry; + opal_info_entry_t *entry; bool found = false; - /* Release MPI_INFO_NULL. Do this so that we don't get a bogus - leak report on it. Plus, it's statically allocated, so we - don't want to call OBJ_RELEASE on it. */ - - OBJ_DESTRUCT(&ompi_mpi_info_null.info); - opal_pointer_array_set_item(&ompi_info_f_to_c_table, 0, NULL); - - /* ditto for MPI_INFO_GET_ENV */ - OBJ_DESTRUCT(&ompi_mpi_info_env.info); - opal_pointer_array_set_item(&ompi_info_f_to_c_table, 1, NULL); - /* Go through the f2c table and see if anything is left. Free them all. */ @@ -544,10 +236,11 @@ int ompi_info_finalize(void) if (!info->i_freed && ompi_debug_show_handle_leaks) { if (ompi_debug_show_handle_leaks) { opal_output(0, "WARNING: MPI_Info still allocated at MPI_FINALIZE"); - for (item = opal_list_get_first(&(info->super)); - opal_list_get_end(&(info->super)) != item; + + for (item = opal_list_get_first(&info->super.super); + opal_list_get_end(&(info->super.super)) != item; item = opal_list_get_next(item)) { - entry = (ompi_info_entry_t *) item; + entry = (opal_info_entry_t *) item; opal_output(0, "WARNING: key=\"%s\", value=\"%s\"", entry->ie_key, NULL != entry->ie_value ? entry->ie_value : "(null)"); @@ -570,10 +263,11 @@ int ompi_info_finalize(void) /* All done -- destroy the table */ OBJ_DESTRUCT(&ompi_info_f_to_c_table); - return OMPI_SUCCESS; + return OPAL_SUCCESS; } + /* * This function is invoked when OBJ_NEW() is called. Here, we add this * info pointer to the table and then store its index as the handle @@ -582,39 +276,26 @@ static void info_constructor(ompi_info_t *info) { info->i_f_to_c_index = opal_pointer_array_add(&ompi_info_f_to_c_table, info); - info->i_lock = OBJ_NEW(opal_mutex_t); info->i_freed = false; - /* If the user doesn't want us to ever free it, then add an extra - RETAIN here */ - +/* + * If the user doesn't want us to ever free it, then add an extra + * RETAIN here + */ if (ompi_debug_no_free_handles) { OBJ_RETAIN(&(info->super)); } } - /* - * This function is called during OBJ_DESTRUCT of "info". When this - * done, we need to remove the entry from the ompi fortran to C - * translation table - */ + * * This function is called during OBJ_DESTRUCT of "info". When this + * * done, we need to remove the entry from the opal fortran to C + * * translation table + * */ static void info_destructor(ompi_info_t *info) { - opal_list_item_t *item; - ompi_info_entry_t *iterator; - - /* Remove every key in the list */ - - for (item = opal_list_remove_first(&(info->super)); - NULL != item; - item = opal_list_remove_first(&(info->super))) { - iterator = (ompi_info_entry_t *) item; - OBJ_RELEASE(iterator); - } - - /* reset the &ompi_info_f_to_c_table entry - make sure that the - entry is in the table */ + /* reset the &ompi_info_f_to_c_table entry - make sure that the + entry is in the table */ if (MPI_UNDEFINED != info->i_f_to_c_index && NULL != opal_pointer_array_get_item(&ompi_info_f_to_c_table, @@ -623,104 +304,16 @@ static void info_destructor(ompi_info_t *info) info->i_f_to_c_index, NULL); } - /* Release the lock */ - - OBJ_RELEASE(info->i_lock); -} - - -/* - * ompi_info_entry_t interface functions - */ -static void info_entry_constructor(ompi_info_entry_t *entry) -{ - memset(entry->ie_key, 0, sizeof(entry->ie_key)); - entry->ie_key[MPI_MAX_INFO_KEY] = 0; -} - - -static void info_entry_destructor(ompi_info_entry_t *entry) -{ - if (NULL != entry->ie_value) { - free(entry->ie_value); - } } /* - * Find a key - * - * Do NOT thread lock in here -- the calling function is responsible - * for that. + * Free an info handle and all of its keys and values. */ -static ompi_info_entry_t *info_find_key (ompi_info_t *info, const char *key) -{ - ompi_info_entry_t *iterator; - - /* No thread locking in here! */ - - /* Iterate over all the entries. If the key is found, then - * return immediately. Else, the loop will fall of the edge - * and NULL is returned - */ - for (iterator = (ompi_info_entry_t *)opal_list_get_first(&(info->super)); - opal_list_get_end(&(info->super)) != (opal_list_item_t*) iterator; - iterator = (ompi_info_entry_t *)opal_list_get_next(iterator)) { - if (0 == strcmp(key, iterator->ie_key)) { - return iterator; - } - } - return NULL; -} - - -int -ompi_info_value_to_int(char *value, int *interp) -{ - long tmp; - char *endp; - - if (NULL == value || '\0' == value[0]) return OMPI_ERR_BAD_PARAM; - - errno = 0; - tmp = strtol(value, &endp, 10); - /* we found something not a number */ - if (*endp != '\0') return OMPI_ERR_BAD_PARAM; - /* underflow */ - if (tmp == 0 && errno == EINVAL) return OMPI_ERR_BAD_PARAM; - - *interp = (int) tmp; - - return OMPI_SUCCESS; -} - - -int -ompi_info_value_to_bool(char *value, bool *interp) +int ompi_info_free (ompi_info_t **info) { - int tmp; - - /* idiot case */ - if (NULL == value || NULL == interp) return OMPI_ERR_BAD_PARAM; - - /* is it true / false? */ - if (0 == strcmp(value, "true")) { - *interp = true; - return OMPI_SUCCESS; - } else if (0 == strcmp(value, "false")) { - *interp = false; - return OMPI_SUCCESS; - - /* is it a number? */ - } else if (OMPI_SUCCESS == ompi_info_value_to_int(value, &tmp)) { - if (tmp == 0) { - *interp = false; - } else { - *interp = true; - } - return OMPI_SUCCESS; - } - - return OMPI_ERR_BAD_PARAM; + (*info)->i_freed = true; + OBJ_RELEASE(*info); + *info = MPI_INFO_NULL; + return MPI_SUCCESS; } - diff --git a/ompi/info/info.h b/ompi/info/info.h index 15881273522..46b45cc0a57 100644 --- a/ompi/info/info.h +++ b/ompi/info/info.h @@ -14,6 +14,7 @@ * Copyright (c) 2009 Sun Microsystems, Inc. All rights reserved. * Copyright (c) 2012-2015 Los Alamos National Security, LLC. All rights * reserved. + * Copyright (c) 2016 IBM Corp. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -28,32 +29,25 @@ #include #include "mpi.h" +#include "opal/util/info.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 - * ompi_info_t structure. MPI_Info is a pointer to this structure - */ + struct ompi_info_t { - opal_list_t super; + 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 */ - opal_mutex_t *i_lock; /**< Mutex for thread safety */ bool i_freed; /**< Whether this info has been freed or not */ }; -/** - * \internal - * Convenience typedef - */ typedef struct ompi_info_t ompi_info_t; /** @@ -69,33 +63,8 @@ struct ompi_predefined_info_t { }; typedef struct ompi_predefined_info_t ompi_predefined_info_t; - -/** - * \internal - * - * ompi_info_entry_t object. Each item in ompi_info_list is of this - * type. It contains (key,value) pairs - */ -struct ompi_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 ompi_info_entry_t ompi_info_entry_t; - BEGIN_C_DECLS -/** - * Table for Fortran <-> C translation table - */ -extern opal_pointer_array_t ompi_info_f_to_c_table; - /** * Global instance for MPI_INFO_NULL */ @@ -106,241 +75,42 @@ OMPI_DECLSPEC extern ompi_predefined_info_t ompi_mpi_info_null; */ OMPI_DECLSPEC extern ompi_predefined_info_t *ompi_mpi_info_null_addr; -/** - * Global instance for MPI_INFO_ENV - */ -OMPI_DECLSPEC extern ompi_predefined_info_t ompi_mpi_info_env; - /** * \internal * Some declarations needed to use OBJ_NEW and OBJ_DESTRUCT macros */ OMPI_DECLSPEC OBJ_CLASS_DECLARATION(ompi_info_t); -/** - * \internal - * Some declarations needed to use OBJ_NEW and OBJ_DESTRUCT macros - */ -OMPI_DECLSPEC OBJ_CLASS_DECLARATION(ompi_info_entry_t); - /** * This function is invoked during ompi_mpi_init() and sets up * MPI_Info handling. */ -int ompi_info_init(void); - -/** - * This functions is called during ompi_mpi_finalize() and shuts - * down MPI_Info handling. - */ -int ompi_info_finalize(void); - -/** - * ompi_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 ompi_info_dup (ompi_info_t *info, ompi_info_t **newinfo); - -/** - * Set a new key,value pair on info. - * - * @param info pointer to ompi_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 ompi_info_set (ompi_info_t *info, const char *key, const char *value); +int ompi_mpiinfo_init(void); /** - * Set a new key,value pair from a variable enumerator. - * - * @param info pointer to ompi_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 ompi_info_set_value_enum (ompi_info_t *info, const char *key, int value, - mca_base_var_enum_t *var_enum); - -/** - * ompi_info_free - Free an 'MPI_Info' object. - * - * @param info pointer to info (ompi_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. + * This function is used to free a ompi level info */ int ompi_info_free (ompi_info_t **info); - /** - * Get a (key, value) pair from an 'MPI_Info' object and assign it - * into a boolen output. - * - * @param info Pointer to ompi_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 ompi_info_get_bool (ompi_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 ompi_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 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); - -/** - * Get a (key, value) pair from an 'MPI_Info' object - * - * @param info Pointer to ompi_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 ompi_info_get (ompi_info_t *info, const char *key, int valuelen, - char *value, int *flag); - -/** - * Delete a (key,value) pair from "info" - * - * @param info ompi_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 ompi_info_delete (ompi_info_t *info, const char *key); /** - * @param info - ompi_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 ompi_info_get_valuelen (ompi_info_t *info, const char *key, int *valuelen, - int *flag); - -/** - * ompi_info_get_nthkey - Get a key indexed by integer from an 'MPI_Info' o - * - * @param info Pointer to ompi_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 ompi_info_get_nthkey (ompi_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 ompi_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 + * This functions is called during ompi_mpi_finalize() and shuts + * down MPI_Info handling. */ -int ompi_info_value_to_int(char *value, int *interp); +int ompi_mpiinfo_finalize(void); END_C_DECLS /** * Return whether this info has been freed already or not. * - * @param info Pointer to ompi_info_t object. + * @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 ompi_debug_handle_never_free is + * 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 @@ -352,18 +122,5 @@ static inline bool ompi_info_is_freed(ompi_info_t *info) } -/** - * Get the number of keys defined on on an MPI_Info object - * @param info Pointer to ompi_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 -ompi_info_get_nkeys(ompi_info_t *info, int *nkeys) -{ - *nkeys = (int) opal_list_get_size(&(info->super)); - return MPI_SUCCESS; -} #endif /* OMPI_INFO_H */ diff --git a/ompi/mca/common/ompio/common_ompio.h b/ompi/mca/common/ompio/common_ompio.h index bebdcf72802..7dc940e3926 100644 --- a/ompi/mca/common/ompio/common_ompio.h +++ b/ompi/mca/common/ompio/common_ompio.h @@ -75,7 +75,7 @@ OMPI_DECLSPEC int mca_common_ompio_file_iread_at_all (mca_io_ompio_file_t *fp, O ompi_request_t **request); OMPI_DECLSPEC int mca_common_ompio_file_open (ompi_communicator_t *comm, const char *filename, - int amode, ompi_info_t *info, + int amode, opal_info_t *info, mca_io_ompio_file_t *ompio_fh, bool use_sharedfp); OMPI_DECLSPEC int mca_common_ompio_file_close (mca_io_ompio_file_t *ompio_fh); @@ -85,7 +85,7 @@ OMPI_DECLSPEC int mca_common_ompio_set_explicit_offset (mca_io_ompio_file_t *fh, OMPI_DECLSPEC int mca_common_ompio_set_file_defaults (mca_io_ompio_file_t *fh); OMPI_DECLSPEC int mca_common_ompio_set_view (mca_io_ompio_file_t *fh, OMPI_MPI_OFFSET_TYPE disp, ompi_datatype_t *etype, ompi_datatype_t *filetype, const char *datarep, - ompi_info_t *info); + opal_info_t *info); #endif /* MCA_COMMON_OMPIO_H */ diff --git a/ompi/mca/common/ompio/common_ompio_file_open.c b/ompi/mca/common/ompio/common_ompio_file_open.c index 38505ed0c2d..82dda94935e 100644 --- a/ompi/mca/common/ompio/common_ompio_file_open.c +++ b/ompi/mca/common/ompio/common_ompio_file_open.c @@ -43,7 +43,7 @@ int mca_common_ompio_file_open (ompi_communicator_t *comm, const char *filename, int amode, - ompi_info_t *info, + opal_info_t *info, mca_io_ompio_file_t *ompio_fh, bool use_sharedfp) { int ret = OMPI_SUCCESS; diff --git a/ompi/mca/common/ompio/common_ompio_file_view.c b/ompi/mca/common/ompio/common_ompio_file_view.c index 0512f9bce70..c5a1644bb15 100644 --- a/ompi/mca/common/ompio/common_ompio_file_view.c +++ b/ompi/mca/common/ompio/common_ompio_file_view.c @@ -56,7 +56,7 @@ int mca_common_ompio_set_view (mca_io_ompio_file_t *fh, ompi_datatype_t *etype, ompi_datatype_t *filetype, const char *datarep, - ompi_info_t *info) + opal_info_t *info) { size_t max_data = 0; diff --git a/ompi/mca/fs/fs.h b/ompi/mca/fs/fs.h index cdb6922827c..29cf75a9efd 100644 --- a/ompi/mca/fs/fs.h +++ b/ompi/mca/fs/fs.h @@ -15,6 +15,7 @@ * reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. + * Copyright (c) 2016 IBM Corp. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -110,10 +111,10 @@ typedef int (*mca_fs_base_module_finalize_1_0_0_fn_t) typedef int (*mca_fs_base_module_file_open_fn_t)( struct ompi_communicator_t *comm, const char *filename, int amode, - struct ompi_info_t *info, struct mca_io_ompio_file_t *fh); + struct opal_info_t *info, struct mca_io_ompio_file_t *fh); typedef int (*mca_fs_base_module_file_close_fn_t)(struct mca_io_ompio_file_t *fh); typedef int (*mca_fs_base_module_file_delete_fn_t)( - char *filename, struct ompi_info_t *info); + char *filename, struct opal_info_t *info); typedef int (*mca_fs_base_module_file_set_size_fn_t) (struct mca_io_ompio_file_t *fh, OMPI_MPI_OFFSET_TYPE size); typedef int (*mca_fs_base_module_file_get_size_fn_t) diff --git a/ompi/mca/fs/lustre/fs_lustre.h b/ompi/mca/fs/lustre/fs_lustre.h index 8e36a3933f0..9ef8a2c4d64 100644 --- a/ompi/mca/fs/lustre/fs_lustre.h +++ b/ompi/mca/fs/lustre/fs_lustre.h @@ -12,6 +12,7 @@ * Copyright (c) 2008-2016 University of Houston. All rights reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. + * Copyright (c) 2016 IBM Corp. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -60,13 +61,13 @@ OMPI_MODULE_DECLSPEC extern mca_fs_base_component_2_0_0_t mca_fs_lustre_componen int mca_fs_lustre_file_open (struct ompi_communicator_t *comm, const char *filename, int amode, - struct ompi_info_t *info, + struct opal_info_t *info, mca_io_ompio_file_t *fh); int mca_fs_lustre_file_close (mca_io_ompio_file_t *fh); int mca_fs_lustre_file_delete (char *filename, - struct ompi_info_t *info); + struct opal_info_t *info); int mca_fs_lustre_file_set_size (mca_io_ompio_file_t *fh, OMPI_MPI_OFFSET_TYPE size); diff --git a/ompi/mca/fs/lustre/fs_lustre_file_delete.c b/ompi/mca/fs/lustre/fs_lustre_file_delete.c index 1fc6da84080..3314103267d 100644 --- a/ompi/mca/fs/lustre/fs_lustre_file_delete.c +++ b/ompi/mca/fs/lustre/fs_lustre_file_delete.c @@ -10,6 +10,7 @@ * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. * Copyright (c) 2008-2011 University of Houston. All rights reserved. + * Copyright (c) 2016 IBM Corp. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -35,7 +36,7 @@ */ int mca_fs_lustre_file_delete (char* file_name, - struct ompi_info_t *info) + struct opal_info_t *info) { int ret; diff --git a/ompi/mca/fs/lustre/fs_lustre_file_open.c b/ompi/mca/fs/lustre/fs_lustre_file_open.c index 4dd23e529cd..716f2cfd8ed 100644 --- a/ompi/mca/fs/lustre/fs_lustre_file_open.c +++ b/ompi/mca/fs/lustre/fs_lustre_file_open.c @@ -12,6 +12,7 @@ * Copyright (c) 2008-2015 University of Houston. All rights reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. + * Copyright (c) 2016 IBM Corp. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -59,7 +60,7 @@ int mca_fs_lustre_file_open (struct ompi_communicator_t *comm, const char* filename, int access_mode, - struct ompi_info_t *info, + struct opal_info_t *info, mca_io_ompio_file_t *fh) { int amode; @@ -94,12 +95,12 @@ mca_fs_lustre_file_open (struct ompi_communicator_t *comm, amode = amode | O_EXCL; - ompi_info_get (info, "stripe_size", MPI_MAX_INFO_VAL, char_stripe, &flag); + opal_info_get (info, "stripe_size", MPI_MAX_INFO_VAL, char_stripe, &flag); if ( flag ) { sscanf ( char_stripe, "%d", &fs_lustre_stripe_size ); } - ompi_info_get (info, "stripe_width", MPI_MAX_INFO_VAL, char_stripe, &flag); + opal_info_get (info, "stripe_width", MPI_MAX_INFO_VAL, char_stripe, &flag); if ( flag ) { sscanf ( char_stripe, "%d", &fs_lustre_stripe_width ); } diff --git a/ompi/mca/fs/plfs/fs_plfs.h b/ompi/mca/fs/plfs/fs_plfs.h index 755a8c6b8c6..a84779636a7 100644 --- a/ompi/mca/fs/plfs/fs_plfs.h +++ b/ompi/mca/fs/plfs/fs_plfs.h @@ -12,6 +12,7 @@ * Copyright (c) 2008-2016 University of Houston. All rights reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. + * Copyright (c) 2016 IBM Corp. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -52,13 +53,13 @@ OMPI_MODULE_DECLSPEC extern mca_fs_base_component_2_0_0_t mca_fs_plfs_component; int mca_fs_plfs_file_open (struct ompi_communicator_t *comm, const char *filename, int amode, - struct ompi_info_t *info, + struct opal_info_t *info, mca_io_ompio_file_t *fh); int mca_fs_plfs_file_close (mca_io_ompio_file_t *fh); int mca_fs_plfs_file_delete (char *filename, - struct ompi_info_t *info); + struct opal_info_t *info); int mca_fs_plfs_file_set_size (mca_io_ompio_file_t *fh, OMPI_MPI_OFFSET_TYPE size); diff --git a/ompi/mca/fs/plfs/fs_plfs_file_delete.c b/ompi/mca/fs/plfs/fs_plfs_file_delete.c index d20a8e88c59..90b8edb3102 100644 --- a/ompi/mca/fs/plfs/fs_plfs_file_delete.c +++ b/ompi/mca/fs/plfs/fs_plfs_file_delete.c @@ -10,6 +10,7 @@ * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. * Copyright (c) 2008-2014 University of Houston. All rights reserved. + * Copyright (c) 2016 IBM Corp. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -35,7 +36,7 @@ */ int mca_fs_plfs_file_delete (char* file_name, - struct ompi_info_t *info) + struct opal_info_t *info) { plfs_error_t plfs_ret; char wpath[1024]; diff --git a/ompi/mca/fs/plfs/fs_plfs_file_open.c b/ompi/mca/fs/plfs/fs_plfs_file_open.c index 623a6d99004..65dc944e571 100644 --- a/ompi/mca/fs/plfs/fs_plfs_file_open.c +++ b/ompi/mca/fs/plfs/fs_plfs_file_open.c @@ -12,6 +12,7 @@ * Copyright (c) 2008-2014 University of Houston. All rights reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. + * Copyright (c) 2016 IBM Corp. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -44,7 +45,7 @@ int mca_fs_plfs_file_open (struct ompi_communicator_t *comm, const char* filename, int access_mode, - struct ompi_info_t *info, + struct opal_info_t *info, mca_io_ompio_file_t *fh) { int rank; diff --git a/ompi/mca/fs/pvfs2/fs_pvfs2.h b/ompi/mca/fs/pvfs2/fs_pvfs2.h index 2555996e861..fb8513c1ea1 100644 --- a/ompi/mca/fs/pvfs2/fs_pvfs2.h +++ b/ompi/mca/fs/pvfs2/fs_pvfs2.h @@ -12,6 +12,7 @@ * Copyright (c) 2008-2016 University of Houston. All rights reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. + * Copyright (c) 2016 IBM Corp. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -70,13 +71,13 @@ OMPI_MODULE_DECLSPEC extern mca_fs_base_component_2_0_0_t mca_fs_pvfs2_component int mca_fs_pvfs2_file_open (struct ompi_communicator_t *comm, const char *filename, int amode, - struct ompi_info_t *info, + struct opal_info_t *info, mca_io_ompio_file_t *fh); int mca_fs_pvfs2_file_close (mca_io_ompio_file_t *fh); int mca_fs_pvfs2_file_delete (char *filename, - struct ompi_info_t *info); + struct opal_info_t *info); int mca_fs_pvfs2_file_set_size (mca_io_ompio_file_t *fh, OMPI_MPI_OFFSET_TYPE size); diff --git a/ompi/mca/fs/pvfs2/fs_pvfs2_file_delete.c b/ompi/mca/fs/pvfs2/fs_pvfs2_file_delete.c index d69007fe6a1..46b5ad57e37 100644 --- a/ompi/mca/fs/pvfs2/fs_pvfs2_file_delete.c +++ b/ompi/mca/fs/pvfs2/fs_pvfs2_file_delete.c @@ -10,6 +10,7 @@ * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. * Copyright (c) 2008-2011 University of Houston. All rights reserved. + * Copyright (c) 2016 IBM Corp. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -38,7 +39,7 @@ */ int mca_fs_pvfs2_file_delete (char* file_name, - struct ompi_info_t *info) + struct opal_info_t *info) { PVFS_credentials credentials; PVFS_sysresp_getparent resp_getparent; diff --git a/ompi/mca/fs/pvfs2/fs_pvfs2_file_open.c b/ompi/mca/fs/pvfs2/fs_pvfs2_file_open.c index 211e39797be..9c0824933b7 100644 --- a/ompi/mca/fs/pvfs2/fs_pvfs2_file_open.c +++ b/ompi/mca/fs/pvfs2/fs_pvfs2_file_open.c @@ -12,6 +12,7 @@ * Copyright (c) 2008-2014 University of Houston. All rights reserved. * Copyright (c) 2015-2017 Research Organization for Information Science * and Technology (RIST). All rights reserved. + * Copyright (c) 2016 IBM Corp. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -60,7 +61,7 @@ int mca_fs_pvfs2_file_open (struct ompi_communicator_t *comm, const char* filename, int access_mode, - struct ompi_info_t *info, + struct opal_info_t *info, mca_io_ompio_file_t *fh) { int ret; @@ -108,12 +109,12 @@ mca_fs_pvfs2_file_open (struct ompi_communicator_t *comm, update mca_fs_pvfs2_stripe_width and mca_fs_pvfs2_stripe_size before calling fake_an_open() */ - ompi_info_get (info, "stripe_size", MPI_MAX_INFO_VAL, char_stripe, &flag); + opal_info_get (info, "stripe_size", MPI_MAX_INFO_VAL, char_stripe, &flag); if ( flag ) { sscanf ( char_stripe, "%d", &fs_pvfs2_stripe_size ); } - ompi_info_get (info, "stripe_width", MPI_MAX_INFO_VAL, char_stripe, &flag); + opal_info_get (info, "stripe_width", MPI_MAX_INFO_VAL, char_stripe, &flag); if ( flag ) { sscanf ( char_stripe, "%d", &fs_pvfs2_stripe_width ); } diff --git a/ompi/mca/fs/ufs/fs_ufs.h b/ompi/mca/fs/ufs/fs_ufs.h index 66ec4c6ce24..3d001c7ad3d 100644 --- a/ompi/mca/fs/ufs/fs_ufs.h +++ b/ompi/mca/fs/ufs/fs_ufs.h @@ -12,6 +12,7 @@ * Copyright (c) 2008-2016 University of Houston. All rights reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. + * Copyright (c) 2016 IBM Corp. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -50,13 +51,13 @@ OMPI_MODULE_DECLSPEC extern mca_fs_base_component_2_0_0_t mca_fs_ufs_component; int mca_fs_ufs_file_open (struct ompi_communicator_t *comm, const char *filename, int amode, - struct ompi_info_t *info, + struct opal_info_t *info, mca_io_ompio_file_t *fh); int mca_fs_ufs_file_close (mca_io_ompio_file_t *fh); int mca_fs_ufs_file_delete (char *filename, - struct ompi_info_t *info); + struct opal_info_t *info); int mca_fs_ufs_file_set_size (mca_io_ompio_file_t *fh, OMPI_MPI_OFFSET_TYPE size); diff --git a/ompi/mca/fs/ufs/fs_ufs_file_delete.c b/ompi/mca/fs/ufs/fs_ufs_file_delete.c index c585ee18da0..9630e36e1a7 100644 --- a/ompi/mca/fs/ufs/fs_ufs_file_delete.c +++ b/ompi/mca/fs/ufs/fs_ufs_file_delete.c @@ -10,6 +10,7 @@ * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. * Copyright (c) 2008-2011 University of Houston. All rights reserved. + * Copyright (c) 2016 IBM Corp. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -35,7 +36,7 @@ */ int mca_fs_ufs_file_delete (char* file_name, - struct ompi_info_t *info) + struct opal_info_t *info) { int ret; diff --git a/ompi/mca/fs/ufs/fs_ufs_file_open.c b/ompi/mca/fs/ufs/fs_ufs_file_open.c index fe8d722b8ab..208cfc0ab06 100644 --- a/ompi/mca/fs/ufs/fs_ufs_file_open.c +++ b/ompi/mca/fs/ufs/fs_ufs_file_open.c @@ -12,6 +12,7 @@ * Copyright (c) 2008-2014 University of Houston. All rights reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. + * Copyright (c) 2016 IBM Corp. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -42,7 +43,7 @@ int mca_fs_ufs_file_open (struct ompi_communicator_t *comm, const char* filename, int access_mode, - struct ompi_info_t *info, + struct opal_info_t *info, mca_io_ompio_file_t *fh) { int amode; diff --git a/ompi/mca/io/base/base.h b/ompi/mca/io/base/base.h index 19e96b56933..36d66770ba0 100644 --- a/ompi/mca/io/base/base.h +++ b/ompi/mca/io/base/base.h @@ -12,6 +12,7 @@ * Copyright (c) 2008 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. + * Copyright (c) 2016 IBM Corp. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -157,7 +158,7 @@ BEGIN_C_DECLS * module). See io.h for details. */ OMPI_DECLSPEC int mca_io_base_delete(const char *filename, - struct ompi_info_t *info); + struct opal_info_t *info); OMPI_DECLSPEC int mca_io_base_register_datarep(const char *, MPI_Datarep_conversion_function*, diff --git a/ompi/mca/io/base/io_base_delete.c b/ompi/mca/io/base/io_base_delete.c index b00b9eebe49..4ae6c9b2177 100644 --- a/ompi/mca/io/base/io_base_delete.c +++ b/ompi/mca/io/base/io_base_delete.c @@ -12,6 +12,7 @@ * Copyright (c) 2008 Sun Microsystems, Inc. All rights reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. + * Copyright (c) 2016 IBM Corp. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -29,6 +30,7 @@ #include "opal/class/opal_list.h" #include "opal/util/argv.h" #include "opal/util/output.h" +#include "opal/util/info.h" #include "ompi/mca/mca.h" #include "opal/mca/base/base.h" #include "ompi/mca/io/io.h" @@ -52,19 +54,19 @@ typedef struct avail_io_t avail_io_t; * Local functions */ static opal_list_t *check_components(opal_list_t *components, - const char *filename, struct ompi_info_t *info, + const char *filename, struct opal_info_t *info, char **names, int num_names); static avail_io_t *check_one_component(const mca_base_component_t *component, - const char *filename, struct ompi_info_t *info); + const char *filename, struct opal_info_t *info); static avail_io_t *query(const mca_base_component_t *component, - const char *filename, struct ompi_info_t *info); + const char *filename, struct opal_info_t *info); static avail_io_t *query_2_0_0(const mca_io_base_component_2_0_0_t *io_component, - const char *filename, struct ompi_info_t *info); + const char *filename, struct opal_info_t *info); -static void unquery(avail_io_t *avail, const char *filename, struct ompi_info_t *info); +static void unquery(avail_io_t *avail, const char *filename, struct opal_info_t *info); -static int delete_file(avail_io_t *avail, const char *filename, struct ompi_info_t *info); +static int delete_file(avail_io_t *avail, const char *filename, struct opal_info_t *info); /* @@ -75,7 +77,7 @@ static OBJ_CLASS_INSTANCE(avail_io_t, opal_list_item_t, NULL, NULL); /* */ -int mca_io_base_delete(const char *filename, struct ompi_info_t *info) +int mca_io_base_delete(const char *filename, struct opal_info_t *info) { int err; opal_list_t *selectable; @@ -180,7 +182,7 @@ static int avail_io_compare (opal_list_item_t **itema, * priority order. */ static opal_list_t *check_components(opal_list_t *components, - const char *filename, struct ompi_info_t *info, + const char *filename, struct opal_info_t *info, char **names, int num_names) { int i; @@ -249,7 +251,7 @@ static opal_list_t *check_components(opal_list_t *components, * Check a single component */ static avail_io_t *check_one_component(const mca_base_component_t *component, - const char *filename, struct ompi_info_t *info) + const char *filename, struct opal_info_t *info) { avail_io_t *avail; @@ -282,7 +284,7 @@ static avail_io_t *check_one_component(const mca_base_component_t *component, * module struct */ static avail_io_t *query(const mca_base_component_t *component, - const char *filename, struct ompi_info_t *info) + const char *filename, struct opal_info_t *info) { const mca_io_base_component_2_0_0_t *ioc_200; @@ -303,7 +305,7 @@ static avail_io_t *query(const mca_base_component_t *component, static avail_io_t *query_2_0_0(const mca_io_base_component_2_0_0_t *component, - const char *filename, struct ompi_info_t *info) + const char *filename, struct opal_info_t *info) { bool usable; int priority, ret; @@ -333,7 +335,7 @@ static avail_io_t *query_2_0_0(const mca_io_base_component_2_0_0_t *component, * Unquery functions **************************************************************************/ -static void unquery(avail_io_t *avail, const char *filename, struct ompi_info_t *info) +static void unquery(avail_io_t *avail, const char *filename, struct opal_info_t *info) { const mca_io_base_component_2_0_0_t *ioc_200; @@ -358,7 +360,7 @@ static void unquery(avail_io_t *avail, const char *filename, struct ompi_info_t /* * Invoke the component's delete function */ -static int delete_file(avail_io_t *avail, const char *filename, struct ompi_info_t *info) +static int delete_file(avail_io_t *avail, const char *filename, struct opal_info_t *info) { const mca_io_base_component_2_0_0_t *ioc_200; diff --git a/ompi/mca/io/base/io_base_file_select.c b/ompi/mca/io/base/io_base_file_select.c index fd91033244c..5cdd43c25a1 100644 --- a/ompi/mca/io/base/io_base_file_select.c +++ b/ompi/mca/io/base/io_base_file_select.c @@ -13,6 +13,7 @@ * Copyright (c) 2008-2011 University of Houston. All rights reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. + * Copyright (c) 2016 IBM Corp. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -30,6 +31,7 @@ #include "ompi/file/file.h" #include "opal/util/argv.h" #include "opal/util/output.h" +#include "opal/util/info.h" #include "opal/class/opal_list.h" #include "opal/class/opal_object.h" #include "ompi/mca/mca.h" @@ -459,7 +461,7 @@ static int module_init(ompi_file_t *file) case MCA_IO_BASE_V_2_0_0: iom_200 = &(file->f_io_selected_module.v2_0_0); return iom_200->io_module_file_open(file->f_comm, file->f_filename, - file->f_amode, file->f_info, + file->f_amode, file->super.s_info, file); break; diff --git a/ompi/mca/io/io.h b/ompi/mca/io/io.h index 5caa7b6079a..7e8e72939ca 100644 --- a/ompi/mca/io/io.h +++ b/ompi/mca/io/io.h @@ -16,6 +16,7 @@ * Copyright (c) 2015 University of Houston. All rights reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. + * Copyright (c) 2016 IBM Corp. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -89,14 +90,14 @@ typedef int (*mca_io_base_component_file_unquery_fn_t) (struct ompi_file_t *file, struct mca_io_base_file_t *private_data); typedef int (*mca_io_base_component_file_delete_query_fn_t) - (const char *filename, struct ompi_info_t *info, + (const char *filename, struct opal_info_t *info, struct mca_io_base_delete_t **private_data, bool *usable, int *priority); typedef int (*mca_io_base_component_file_delete_select_fn_t) - (const char *filename, struct ompi_info_t *info, + (const char *filename, struct opal_info_t *info, struct mca_io_base_delete_t *private_data); typedef int (*mca_io_base_component_file_delete_unselect_fn_t) - (const char *filename, struct ompi_info_t *info, + (const char *filename, struct opal_info_t *info, struct mca_io_base_delete_t *private_data); typedef int (*mca_io_base_component_register_datarep_fn_t)( @@ -140,7 +141,7 @@ typedef union mca_io_base_components_t mca_io_base_components_t; typedef int (*mca_io_base_module_file_open_fn_t) (struct ompi_communicator_t *comm, const char *filename, int amode, - struct ompi_info_t *info, struct ompi_file_t *fh); + struct opal_info_t *info, struct ompi_file_t *fh); typedef int (*mca_io_base_module_file_close_fn_t)(struct ompi_file_t *fh); typedef int (*mca_io_base_module_file_set_size_fn_t) @@ -151,15 +152,11 @@ typedef int (*mca_io_base_module_file_get_size_fn_t) (struct ompi_file_t *fh, MPI_Offset *size); typedef int (*mca_io_base_module_file_get_amode_fn_t) (struct ompi_file_t *fh, int *amode); -typedef int (*mca_io_base_module_file_set_info_fn_t) - (struct ompi_file_t *fh, struct ompi_info_t *info); -typedef int (*mca_io_base_module_file_get_info_fn_t) - (struct ompi_file_t *fh, struct ompi_info_t **info_used); typedef int (*mca_io_base_module_file_set_view_fn_t) (struct ompi_file_t *fh, MPI_Offset disp, struct ompi_datatype_t *etype, struct ompi_datatype_t *filetype, const char *datarep, - struct ompi_info_t *info); + struct opal_info_t *info); typedef int (*mca_io_base_module_file_get_view_fn_t) (struct ompi_file_t *fh, MPI_Offset *disp, struct ompi_datatype_t **etype, struct ompi_datatype_t **filetype, @@ -309,8 +306,6 @@ struct mca_io_base_module_2_0_0_t { mca_io_base_module_file_preallocate_fn_t io_module_file_preallocate; mca_io_base_module_file_get_size_fn_t io_module_file_get_size; mca_io_base_module_file_get_amode_fn_t io_module_file_get_amode; - mca_io_base_module_file_set_info_fn_t io_module_file_set_info; - mca_io_base_module_file_get_info_fn_t io_module_file_get_info; mca_io_base_module_file_set_view_fn_t io_module_file_set_view; mca_io_base_module_file_get_view_fn_t io_module_file_get_view; diff --git a/ompi/mca/io/ompio/io_ompio.h b/ompi/mca/io/ompio/io_ompio.h index e2b552e5340..528c66dbd9d 100644 --- a/ompi/mca/io/ompio/io_ompio.h +++ b/ompi/mca/io/ompio/io_ompio.h @@ -13,6 +13,7 @@ * Copyright (c) 2008-2016 University of Houston. All rights reserved. * Copyright (c) 2015-2017 Research Organization for Information Science * and Technology (RIST). All rights reserved. + * Copyright (c) 2016 IBM Corp. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -209,7 +210,7 @@ struct mca_io_ompio_file_t { const char *f_filename; char *f_datarep; opal_convertor_t *f_convertor; - ompi_info_t *f_info; + opal_info_t *f_info; int32_t f_flags; void *f_fs_ptr; int f_atomicity; @@ -340,7 +341,7 @@ int mca_io_ompio_file_set_view (struct ompi_file_t *fh, struct ompi_datatype_t *etype, struct ompi_datatype_t *filetype, const char *datarep, - struct ompi_info_t *info); + struct opal_info_t *info); int mca_io_ompio_file_get_view (struct ompi_file_t *fh, OMPI_MPI_OFFSET_TYPE *disp, @@ -350,11 +351,11 @@ int mca_io_ompio_file_get_view (struct ompi_file_t *fh, int mca_io_ompio_file_open (struct ompi_communicator_t *comm, const char *filename, int amode, - struct ompi_info_t *info, + struct opal_info_t *info, struct ompi_file_t *fh); int mca_io_ompio_file_close (struct ompi_file_t *fh); int mca_io_ompio_file_delete (const char *filename, - struct ompi_info_t *info); + struct opal_info_t *info); int mca_io_ompio_file_set_size (struct ompi_file_t *fh, OMPI_MPI_OFFSET_TYPE size); int mca_io_ompio_file_preallocate (struct ompi_file_t *fh, @@ -363,10 +364,6 @@ int mca_io_ompio_file_get_size (struct ompi_file_t *fh, OMPI_MPI_OFFSET_TYPE * size); int mca_io_ompio_file_get_amode (struct ompi_file_t *fh, int *amode); -int mca_io_ompio_file_set_info (struct ompi_file_t *fh, - struct ompi_info_t *info); -int mca_io_ompio_file_get_info (struct ompi_file_t *fh, - struct ompi_info_t ** info_used); int mca_io_ompio_file_sync (struct ompi_file_t *fh); int mca_io_ompio_file_seek (struct ompi_file_t *fh, OMPI_MPI_OFFSET_TYPE offet, @@ -377,7 +374,7 @@ int mca_io_ompio_file_set_view (struct ompi_file_t *fh, struct ompi_datatype_t *etype, struct ompi_datatype_t *filetype, const char *datarep, - struct ompi_info_t *info); + struct opal_info_t *info); int mca_io_ompio_file_get_view (struct ompi_file_t *fh, OMPI_MPI_OFFSET_TYPE *disp, struct ompi_datatype_t **etype, diff --git a/ompi/mca/io/ompio/io_ompio_component.c b/ompi/mca/io/ompio/io_ompio_component.c index 6a63bce0586..3aa8e7c6fe8 100644 --- a/ompi/mca/io/ompio/io_ompio_component.c +++ b/ompi/mca/io/ompio/io_ompio_component.c @@ -15,6 +15,7 @@ * reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. + * Copyright (c) 2016 IBM Corp. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -56,11 +57,11 @@ file_query (struct ompi_file_t *file, static int file_unquery(struct ompi_file_t *file, struct mca_io_base_file_t *private_data); -static int delete_query(const char *filename, struct ompi_info_t *info, +static int delete_query(const char *filename, struct opal_info_t *info, struct mca_io_base_delete_t **private_data, bool *usable, int *priorty); -static int delete_select(const char *filename, struct ompi_info_t *info, +static int delete_select(const char *filename, struct opal_info_t *info, struct mca_io_base_delete_t *private_data); static int register_datarep(const char *, @@ -321,7 +322,7 @@ static int file_unquery(struct ompi_file_t *file, } -static int delete_query(const char *filename, struct ompi_info_t *info, +static int delete_query(const char *filename, struct opal_info_t *info, struct mca_io_base_delete_t **private_data, bool *usable, int *priority) { @@ -332,7 +333,7 @@ static int delete_query(const char *filename, struct ompi_info_t *info, return OMPI_SUCCESS; } -static int delete_select(const char *filename, struct ompi_info_t *info, +static int delete_select(const char *filename, struct opal_info_t *info, struct mca_io_base_delete_t *private_data) { int ret; diff --git a/ompi/mca/io/ompio/io_ompio_file_open.c b/ompi/mca/io/ompio/io_ompio_file_open.c index b7442263897..e19805fc1f9 100644 --- a/ompi/mca/io/ompio/io_ompio_file_open.c +++ b/ompi/mca/io/ompio/io_ompio_file_open.c @@ -13,6 +13,7 @@ * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. * Copyright (c) 2016 Cisco Systems, Inc. All rights reserved. + * Copyright (c) 2016 IBM Corp. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -43,7 +44,7 @@ int mca_io_ompio_file_open (ompi_communicator_t *comm, const char *filename, int amode, - ompi_info_t *info, + opal_info_t *info, ompi_file_t *fh) { int ret = OMPI_SUCCESS; @@ -78,7 +79,6 @@ int mca_io_ompio_file_open (ompi_communicator_t *comm, return ret; } - int mca_io_ompio_file_close (ompi_file_t *fh) { int ret = OMPI_SUCCESS; @@ -103,7 +103,7 @@ int mca_io_ompio_file_close (ompi_file_t *fh) } int mca_io_ompio_file_delete (const char *filename, - struct ompi_info_t *info) + struct opal_info_t *info) { int ret = OMPI_SUCCESS; @@ -322,42 +322,6 @@ int mca_io_ompio_file_get_amode (ompi_file_t *fh, } -int mca_io_ompio_file_set_info (ompi_file_t *fh, - ompi_info_t *info) -{ - int ret = OMPI_SUCCESS; - - if ( MPI_INFO_NULL == fh->f_info ) { - /* OBJ_RELEASE(MPI_INFO_NULL); */ - } - else { - ompi_info_free ( &fh->f_info); - fh->f_info = OBJ_NEW(ompi_info_t); - ret = ompi_info_dup (info, &fh->f_info); - } - - return ret; -} - - -int mca_io_ompio_file_get_info (ompi_file_t *fh, - ompi_info_t ** info_used) -{ - int ret = OMPI_SUCCESS; - ompi_info_t *info=NULL; - - info = OBJ_NEW(ompi_info_t); - if (NULL == info) { - return MPI_ERR_INFO; - } - if (MPI_INFO_NULL != fh->f_info) { - ret = ompi_info_dup (fh->f_info, &info); - } - *info_used = info; - - return ret; -} - int mca_io_ompio_file_get_type_extent (ompi_file_t *fh, struct ompi_datatype_t *datatype, MPI_Aint *extent) diff --git a/ompi/mca/io/ompio/io_ompio_file_set_view.c b/ompi/mca/io/ompio/io_ompio_file_set_view.c index fa14360a9be..f93ca4f2ad6 100644 --- a/ompi/mca/io/ompio/io_ompio_file_set_view.c +++ b/ompi/mca/io/ompio/io_ompio_file_set_view.c @@ -12,6 +12,7 @@ * Copyright (c) 2008-2016 University of Houston. All rights reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. + * Copyright (c) 2016 IBM Corp. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -59,7 +60,7 @@ int mca_io_ompio_file_set_view (ompi_file_t *fp, ompi_datatype_t *etype, ompi_datatype_t *filetype, const char *datarep, - ompi_info_t *info) + opal_info_t *info) { int ret=OMPI_SUCCESS; mca_io_ompio_data_t *data; diff --git a/ompi/mca/io/ompio/io_ompio_module.c b/ompi/mca/io/ompio/io_ompio_module.c index cbdaf2e0dd8..c5168d0bb4b 100644 --- a/ompi/mca/io/ompio/io_ompio_module.c +++ b/ompi/mca/io/ompio/io_ompio_module.c @@ -10,6 +10,7 @@ * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. * Copyright (c) 2008-2011 University of Houston. All rights reserved. + * Copyright (c) 2016 IBM Corp. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -35,8 +36,6 @@ mca_io_base_module_2_0_0_t mca_io_ompio_module = { mca_io_ompio_file_preallocate, mca_io_ompio_file_get_size, mca_io_ompio_file_get_amode, - mca_io_ompio_file_set_info, - mca_io_ompio_file_get_info, mca_io_ompio_file_set_view, mca_io_ompio_file_get_view, diff --git a/ompi/mca/io/romio314/src/io_romio314.h b/ompi/mca/io/romio314/src/io_romio314.h index 86fd9b062a7..df640e5efce 100644 --- a/ompi/mca/io/romio314/src/io_romio314.h +++ b/ompi/mca/io/romio314/src/io_romio314.h @@ -12,6 +12,7 @@ * Copyright (c) 2008 Sun Microsystems, Inc. All rights reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. + * Copyright (c) 2016 IBM Corp. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -66,11 +67,11 @@ typedef struct mca_io_romio314_data_t mca_io_romio314_data_t; int mca_io_romio314_file_open (struct ompi_communicator_t *comm, const char *filename, int amode, - struct ompi_info_t *info, + struct opal_info_t *info, ompi_file_t *fh); int mca_io_romio314_file_close (struct ompi_file_t *fh); int mca_io_romio314_file_delete (const char *filename, - struct ompi_info_t *info); + struct opal_info_t *info); int mca_io_romio314_file_set_size (struct ompi_file_t *fh, MPI_Offset size); int mca_io_romio314_file_preallocate (struct ompi_file_t *fh, @@ -80,9 +81,9 @@ int mca_io_romio314_file_get_size (struct ompi_file_t *fh, int mca_io_romio314_file_get_amode (struct ompi_file_t *fh, int *amode); int mca_io_romio314_file_set_info (struct ompi_file_t *fh, - struct ompi_info_t *info); + struct opal_info_t *info); int mca_io_romio314_file_get_info (struct ompi_file_t *fh, - struct ompi_info_t ** info_used); + struct opal_info_t ** info_used); /* Section 9.3 */ int mca_io_romio314_file_set_view (struct ompi_file_t *fh, @@ -90,7 +91,7 @@ int mca_io_romio314_file_set_view (struct ompi_file_t *fh, struct ompi_datatype_t *etype, struct ompi_datatype_t *filetype, const char *datarep, - struct ompi_info_t *info); + struct opal_info_t *info); int mca_io_romio314_file_get_view (struct ompi_file_t *fh, MPI_Offset * disp, struct ompi_datatype_t ** etype, diff --git a/ompi/mca/io/romio314/src/io_romio314_component.c b/ompi/mca/io/romio314/src/io_romio314_component.c index 60954575760..3bb83a66c1c 100644 --- a/ompi/mca/io/romio314/src/io_romio314_component.c +++ b/ompi/mca/io/romio314/src/io_romio314_component.c @@ -15,6 +15,7 @@ * reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. + * Copyright (c) 2016 IBM Corp. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -48,10 +49,10 @@ static const struct mca_io_base_module_2_0_0_t * static int file_unquery(struct ompi_file_t *file, struct mca_io_base_file_t *private_data); -static int delete_query(const char *filename, struct ompi_info_t *info, +static int delete_query(const char *filename, struct opal_info_t *info, struct mca_io_base_delete_t **private_data, bool *usable, int *priorty); -static int delete_select(const char *filename, struct ompi_info_t *info, +static int delete_select(const char *filename, struct opal_info_t *info, struct mca_io_base_delete_t *private_data); static int register_datarep(const char *, @@ -222,7 +223,7 @@ static int file_unquery(struct ompi_file_t *file, } -static int delete_query(const char *filename, struct ompi_info_t *info, +static int delete_query(const char *filename, struct opal_info_t *info, struct mca_io_base_delete_t **private_data, bool *usable, int *priority) { @@ -234,7 +235,7 @@ static int delete_query(const char *filename, struct ompi_info_t *info, } -static int delete_select(const char *filename, struct ompi_info_t *info, +static int delete_select(const char *filename, struct opal_info_t *info, struct mca_io_base_delete_t *private_data) { int ret; diff --git a/ompi/mca/io/romio314/src/io_romio314_file_open.c b/ompi/mca/io/romio314/src/io_romio314_file_open.c index b08da7ff0c5..d4c2bba6e17 100644 --- a/ompi/mca/io/romio314/src/io_romio314_file_open.c +++ b/ompi/mca/io/romio314/src/io_romio314_file_open.c @@ -11,6 +11,7 @@ * All rights reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. + * Copyright (c) 2016 IBM Corp. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -31,7 +32,7 @@ int mca_io_romio314_file_open (ompi_communicator_t *comm, const char *filename, int amode, - ompi_info_t *info, + opal_info_t *info, ompi_file_t *fh) { int ret; @@ -149,7 +150,7 @@ mca_io_romio314_file_get_amode (ompi_file_t *fh, int mca_io_romio314_file_set_info (ompi_file_t *fh, - ompi_info_t *info) + opal_info_t *info) { int ret; mca_io_romio314_data_t *data; @@ -165,7 +166,7 @@ mca_io_romio314_file_set_info (ompi_file_t *fh, int mca_io_romio314_file_get_info (ompi_file_t *fh, - ompi_info_t ** info_used) + opal_info_t ** info_used) { int ret; mca_io_romio314_data_t *data; @@ -185,7 +186,7 @@ mca_io_romio314_file_set_view (ompi_file_t *fh, struct ompi_datatype_t *etype, struct ompi_datatype_t *filetype, const char *datarep, - ompi_info_t *info) + opal_info_t *info) { int ret; mca_io_romio314_data_t *data; diff --git a/ompi/mca/osc/base/base.h b/ompi/mca/osc/base/base.h index bb368be82b9..d2b46953eb7 100644 --- a/ompi/mca/osc/base/base.h +++ b/ompi/mca/osc/base/base.h @@ -7,6 +7,7 @@ * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. + * Copyright (c) 2016 IBM Corp. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -41,7 +42,7 @@ int ompi_osc_base_select(ompi_win_t *win, size_t size, int disp_unit, ompi_communicator_t *comm, - ompi_info_t *info, + opal_info_t *info, int flavor, int *model); diff --git a/ompi/mca/osc/base/osc_base_init.c b/ompi/mca/osc/base/osc_base_init.c index 1e0cba6629a..ca5e7a0e8d8 100644 --- a/ompi/mca/osc/base/osc_base_init.c +++ b/ompi/mca/osc/base/osc_base_init.c @@ -10,6 +10,7 @@ * All rights reserved. * Copyright (c) 2014 Los Alamos National Security, LLC. All rights * reserved. + * Copyright (c) 2016 IBM Corp. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -34,7 +35,7 @@ ompi_osc_base_select(ompi_win_t *win, size_t size, int disp_unit, ompi_communicator_t *comm, - ompi_info_t *info, + opal_info_t *info, int flavor, int *model) { diff --git a/ompi/mca/osc/osc.h b/ompi/mca/osc/osc.h index 4ab065d8888..c3d806a688e 100644 --- a/ompi/mca/osc/osc.h +++ b/ompi/mca/osc/osc.h @@ -13,6 +13,7 @@ * Copyright (c) 2010 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2015-2017 Research Organization for Information Science * and Technology (RIST). All rights reserved. + * Copyright (c) 2016 IBM Corp. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -45,7 +46,7 @@ BEGIN_C_DECLS struct ompi_win_t; -struct ompi_info_t; +struct opal_info_t; struct ompi_communicator_t; struct ompi_group_t; struct ompi_datatype_t; @@ -116,7 +117,7 @@ typedef int (*ompi_osc_base_component_query_fn_t)(struct ompi_win_t *win, size_t size, int disp_unit, struct ompi_communicator_t *comm, - struct ompi_info_t *info, + struct opal_info_t *info, int flavor); /** @@ -148,7 +149,7 @@ typedef int (*ompi_osc_base_component_select_fn_t)(struct ompi_win_t *win, size_t size, int disp_unit, struct ompi_communicator_t *comm, - struct ompi_info_t *info, + struct opal_info_t *info, int flavor, int *model); @@ -352,9 +353,6 @@ typedef int (*ompi_osc_base_module_flush_local_fn_t)(int target, struct ompi_win_t *win); typedef int (*ompi_osc_base_module_flush_local_all_fn_t)(struct ompi_win_t *win); -typedef int (*ompi_osc_base_module_set_info_fn_t)(struct ompi_win_t *win, struct ompi_info_t *info); -typedef int (*ompi_osc_base_module_get_info_fn_t)(struct ompi_win_t *win, struct ompi_info_t **info_used); - /* ******************************************************************** */ @@ -406,9 +404,6 @@ struct ompi_osc_base_module_3_0_0_t { ompi_osc_base_module_flush_all_fn_t osc_flush_all; ompi_osc_base_module_flush_local_fn_t osc_flush_local; ompi_osc_base_module_flush_local_all_fn_t osc_flush_local_all; - - ompi_osc_base_module_set_info_fn_t osc_set_info; - ompi_osc_base_module_get_info_fn_t osc_get_info; }; typedef struct ompi_osc_base_module_3_0_0_t ompi_osc_base_module_3_0_0_t; typedef ompi_osc_base_module_3_0_0_t ompi_osc_base_module_t; diff --git a/ompi/mca/osc/portals4/osc_portals4.h b/ompi/mca/osc/portals4/osc_portals4.h index 161ac4b2912..4834db5f551 100644 --- a/ompi/mca/osc/portals4/osc_portals4.h +++ b/ompi/mca/osc/portals4/osc_portals4.h @@ -5,6 +5,7 @@ * reserved. * Copyright (c) 2015-2017 Research Organization for Information Science * and Technology (RIST). All rights reserved. + * Copyright (c) 2016 IBM Corp. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -281,8 +282,8 @@ int ompi_osc_portals4_flush_local(int target, struct ompi_win_t *win); int ompi_osc_portals4_flush_local_all(struct ompi_win_t *win); -int ompi_osc_portals4_set_info(struct ompi_win_t *win, struct ompi_info_t *info); -int ompi_osc_portals4_get_info(struct ompi_win_t *win, struct ompi_info_t **info_used); +int ompi_osc_portals4_set_info(struct ompi_win_t *win, struct opal_info_t *info); +int ompi_osc_portals4_get_info(struct ompi_win_t *win, struct opal_info_t **info_used); static inline int ompi_osc_portals4_complete_all(ompi_osc_portals4_module_t *module) diff --git a/ompi/mca/osc/portals4/osc_portals4_component.c b/ompi/mca/osc/portals4/osc_portals4_component.c index 60fd088c51a..da31d72655d 100644 --- a/ompi/mca/osc/portals4/osc_portals4_component.c +++ b/ompi/mca/osc/portals4/osc_portals4_component.c @@ -8,6 +8,7 @@ * Copyright (c) 2017 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. + * Copyright (c) 2016 IBM Corp. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -30,10 +31,10 @@ static int component_register(void); static int component_init(bool enable_progress_threads, bool enable_mpi_threads); static int component_finalize(void); static int component_query(struct ompi_win_t *win, void **base, size_t size, int disp_unit, - struct ompi_communicator_t *comm, struct ompi_info_t *info, + struct ompi_communicator_t *comm, struct opal_info_t *info, int flavor); static int component_select(struct ompi_win_t *win, void **base, size_t size, int disp_unit, - struct ompi_communicator_t *comm, struct ompi_info_t *info, + struct ompi_communicator_t *comm, struct opal_info_t *info, int flavor, int *model); @@ -108,14 +109,14 @@ ompi_osc_portals4_module_t ompi_osc_portals4_module_template = { looks in the info structure passed by the user, then through mca parameters. */ static bool -check_config_value_bool(char *key, ompi_info_t *info) +check_config_value_bool(char *key, opal_info_t *info) { char *value_string; int value_len, ret, flag, param; const bool *flag_value; bool result; - ret = ompi_info_get_valuelen(info, key, &value_len, &flag); + ret = opal_info_get_valuelen(info, key, &value_len, &flag); if (OMPI_SUCCESS != ret) goto info_not_found; if (flag == 0) goto info_not_found; value_len++; @@ -123,13 +124,13 @@ check_config_value_bool(char *key, ompi_info_t *info) value_string = (char*)malloc(sizeof(char) * value_len + 1); /* Should malloc 1 char for NUL-termination */ if (NULL == value_string) goto info_not_found; - ret = ompi_info_get(info, key, value_len, value_string, &flag); + ret = opal_info_get(info, key, value_len, value_string, &flag); if (OMPI_SUCCESS != ret) { free(value_string); goto info_not_found; } assert(flag != 0); - ret = ompi_info_value_to_bool(value_string, &result); + ret = opal_info_value_to_bool(value_string, &result); free(value_string); if (OMPI_SUCCESS != ret) goto info_not_found; return result; @@ -146,14 +147,14 @@ check_config_value_bool(char *key, ompi_info_t *info) static bool -check_config_value_equal(char *key, ompi_info_t *info, char *value) +check_config_value_equal(char *key, opal_info_t *info, char *value) { char *value_string; int value_len, ret, flag, param; const bool *flag_value; bool result = false; - ret = ompi_info_get_valuelen(info, key, &value_len, &flag); + ret = opal_info_get_valuelen(info, key, &value_len, &flag); if (OMPI_SUCCESS != ret) goto info_not_found; if (flag == 0) goto info_not_found; value_len++; @@ -161,7 +162,7 @@ check_config_value_equal(char *key, ompi_info_t *info, char *value) value_string = (char*)malloc(sizeof(char) * value_len + 1); /* Should malloc 1 char for NUL-termination */ if (NULL == value_string) goto info_not_found; - ret = ompi_info_get(info, key, value_len, value_string, &flag); + ret = opal_info_get(info, key, value_len, value_string, &flag); if (OMPI_SUCCESS != ret) { free(value_string); goto info_not_found; @@ -382,7 +383,7 @@ component_finalize(void) static int component_query(struct ompi_win_t *win, void **base, size_t size, int disp_unit, - struct ompi_communicator_t *comm, struct ompi_info_t *info, + struct ompi_communicator_t *comm, struct opal_info_t *info, int flavor) { int ret; @@ -403,7 +404,7 @@ component_query(struct ompi_win_t *win, void **base, size_t size, int disp_unit, static int component_select(struct ompi_win_t *win, void **base, size_t size, int disp_unit, - struct ompi_communicator_t *comm, struct ompi_info_t *info, + struct ompi_communicator_t *comm, struct opal_info_t *info, int flavor, int *model) { ompi_osc_portals4_module_t *module = NULL; @@ -684,7 +685,7 @@ ompi_osc_portals4_free(struct ompi_win_t *win) int -ompi_osc_portals4_set_info(struct ompi_win_t *win, struct ompi_info_t *info) +ompi_osc_portals4_set_info(struct ompi_win_t *win, struct opal_info_t *info) { ompi_osc_portals4_module_t *module = (ompi_osc_portals4_module_t*) win->w_osc_module; @@ -696,19 +697,19 @@ ompi_osc_portals4_set_info(struct ompi_win_t *win, struct ompi_info_t *info) int -ompi_osc_portals4_get_info(struct ompi_win_t *win, struct ompi_info_t **info_used) +ompi_osc_portals4_get_info(struct ompi_win_t *win, struct opal_info_t **info_used) { ompi_osc_portals4_module_t *module = (ompi_osc_portals4_module_t*) win->w_osc_module; - ompi_info_t *info = OBJ_NEW(ompi_info_t); + opal_info_t *info = OBJ_NEW(opal_info_t); if (NULL == info) return OMPI_ERR_TEMP_OUT_OF_RESOURCE; - ompi_info_set(info, "no_locks", (module->state.lock == LOCK_ILLEGAL) ? "true" : "false"); + opal_info_set(info, "no_locks", (module->state.lock == LOCK_ILLEGAL) ? "true" : "false"); if (module->atomic_max < mca_osc_portals4_component.matching_atomic_max) { - ompi_info_set(info, "accumulate_ordering", "none"); + opal_info_set(info, "accumulate_ordering", "none"); } else { - ompi_info_set(info, "accumulate_ordering", "rar,war,raw,waw"); + opal_info_set(info, "accumulate_ordering", "rar,war,raw,waw"); } *info_used = info; diff --git a/ompi/mca/osc/pt2pt/osc_pt2pt.h b/ompi/mca/osc/pt2pt/osc_pt2pt.h index e3434f6504b..801975c6fef 100644 --- a/ompi/mca/osc/pt2pt/osc_pt2pt.h +++ b/ompi/mca/osc/pt2pt/osc_pt2pt.h @@ -15,6 +15,7 @@ * Copyright (c) 2015-2017 Research Organization for Information Science * and Technology (RIST). All rights reserved. * Copyright (c) 2016 FUJITSU LIMITED. All rights reserved. + * Copyright (c) 2016 IBM Corp. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -470,8 +471,8 @@ int ompi_osc_pt2pt_flush_local(int target, struct ompi_win_t *win); int ompi_osc_pt2pt_flush_local_all(struct ompi_win_t *win); -int ompi_osc_pt2pt_set_info(struct ompi_win_t *win, struct ompi_info_t *info); -int ompi_osc_pt2pt_get_info(struct ompi_win_t *win, struct ompi_info_t **info_used); +int ompi_osc_pt2pt_set_info(struct ompi_win_t *win, struct opal_info_t *info); +int ompi_osc_pt2pt_get_info(struct ompi_win_t *win, struct opal_info_t **info_used); int ompi_osc_pt2pt_component_irecv(ompi_osc_pt2pt_module_t *module, void *buf, diff --git a/ompi/mca/osc/pt2pt/osc_pt2pt_component.c b/ompi/mca/osc/pt2pt/osc_pt2pt_component.c index 10fd18137c6..3291c8a24cd 100644 --- a/ompi/mca/osc/pt2pt/osc_pt2pt_component.c +++ b/ompi/mca/osc/pt2pt/osc_pt2pt_component.c @@ -16,6 +16,7 @@ * Copyright (c) 2012-2013 Sandia National Laboratories. All rights reserved. * Copyright (c) 2015-2016 Research Organization for Information Science * and Technology (RIST). All rights reserved. + * Copyright (c) 2016 IBM Corp. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -38,10 +39,10 @@ static int component_register(void); static int component_init(bool enable_progress_threads, bool enable_mpi_threads); static int component_finalize(void); static int component_query(struct ompi_win_t *win, void **base, size_t size, int disp_unit, - struct ompi_communicator_t *comm, struct ompi_info_t *info, + struct ompi_communicator_t *comm, struct opal_info_t *info, int flavor); static int component_select(struct ompi_win_t *win, void **base, size_t size, int disp_unit, - struct ompi_communicator_t *comm, struct ompi_info_t *info, + struct ompi_communicator_t *comm, struct opal_info_t *info, int flavor, int *model); ompi_osc_pt2pt_component_t mca_osc_pt2pt_component = { @@ -114,11 +115,11 @@ bool ompi_osc_pt2pt_no_locks = false; /* look up parameters for configuring this window. The code first looks in the info structure passed by the user, then through mca parameters. */ -static bool check_config_value_bool(char *key, ompi_info_t *info, bool result) +static bool check_config_value_bool(char *key, opal_info_t *info, bool result) { int flag; - (void) ompi_info_get_bool (info, key, &result, &flag); + (void) opal_info_get_bool (info, key, &result, &flag); return result; } @@ -282,7 +283,7 @@ component_finalize(void) static int component_query(struct ompi_win_t *win, void **base, size_t size, int disp_unit, - struct ompi_communicator_t *comm, struct ompi_info_t *info, + struct ompi_communicator_t *comm, struct opal_info_t *info, int flavor) { if (MPI_WIN_FLAVOR_SHARED == flavor) return -1; @@ -293,7 +294,7 @@ component_query(struct ompi_win_t *win, void **base, size_t size, int disp_unit, static int component_select(struct ompi_win_t *win, void **base, size_t size, int disp_unit, - struct ompi_communicator_t *comm, struct ompi_info_t *info, + struct ompi_communicator_t *comm, struct opal_info_t *info, int flavor, int *model) { ompi_osc_pt2pt_module_t *module = NULL; @@ -442,7 +443,7 @@ component_select(struct ompi_win_t *win, void **base, size_t size, int disp_unit int -ompi_osc_pt2pt_set_info(struct ompi_win_t *win, struct ompi_info_t *info) +ompi_osc_pt2pt_set_info(struct ompi_win_t *win, struct opal_info_t *info) { ompi_osc_pt2pt_module_t *module = (ompi_osc_pt2pt_module_t*) win->w_osc_module; @@ -454,9 +455,9 @@ ompi_osc_pt2pt_set_info(struct ompi_win_t *win, struct ompi_info_t *info) int -ompi_osc_pt2pt_get_info(struct ompi_win_t *win, struct ompi_info_t **info_used) +ompi_osc_pt2pt_get_info(struct ompi_win_t *win, struct opal_info_t **info_used) { - ompi_info_t *info = OBJ_NEW(ompi_info_t); + opal_info_t *info = OBJ_NEW(opal_info_t); if (NULL == info) return OMPI_ERR_TEMP_OUT_OF_RESOURCE; *info_used = info; diff --git a/ompi/mca/osc/rdma/osc_rdma_component.c b/ompi/mca/osc/rdma/osc_rdma_component.c index 36afaed33e4..5d74abfa8e8 100644 --- a/ompi/mca/osc/rdma/osc_rdma_component.c +++ b/ompi/mca/osc/rdma/osc_rdma_component.c @@ -16,6 +16,7 @@ * Copyright (c) 2012-2015 Sandia National Laboratories. All rights reserved. * Copyright (c) 2015 NVIDIA Corporation. All rights reserved. * Copyright (c) 2015 Intel, Inc. All rights reserved. + * Copyright (c) 2016 IBM Corp. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -43,6 +44,7 @@ #if OPAL_CUDA_SUPPORT #include "opal/datatype/opal_datatype_cuda.h" #endif /* OPAL_CUDA_SUPPORT */ +#include "opal/util/info_subscriber.h" #include "ompi/info/info.h" #include "ompi/communicator/communicator.h" @@ -58,17 +60,19 @@ static int ompi_osc_rdma_component_register (void); static int ompi_osc_rdma_component_init (bool enable_progress_threads, bool enable_mpi_threads); static int ompi_osc_rdma_component_finalize (void); static int ompi_osc_rdma_component_query (struct ompi_win_t *win, void **base, size_t size, int disp_unit, - struct ompi_communicator_t *comm, struct ompi_info_t *info, + struct ompi_communicator_t *comm, struct opal_info_t *info, int flavor); static int ompi_osc_rdma_component_select (struct ompi_win_t *win, void **base, size_t size, int disp_unit, - struct ompi_communicator_t *comm, struct ompi_info_t *info, + struct ompi_communicator_t *comm, struct opal_info_t *info, int flavor, int *model); -static int ompi_osc_rdma_set_info (struct ompi_win_t *win, struct ompi_info_t *info); -static int ompi_osc_rdma_get_info (struct ompi_win_t *win, struct ompi_info_t **info_used); +static int ompi_osc_rdma_set_info (struct ompi_win_t *win, struct opal_info_t *info); +static int ompi_osc_rdma_get_info (struct ompi_win_t *win, struct opal_info_t **info_used); static int ompi_osc_rdma_query_btls (ompi_communicator_t *comm, struct mca_btl_base_module_t **btl); +static char* ompi_osc_rdma_set_no_lock_info(opal_infosubscriber_t *obj, char *key, char *value); + static char *ompi_osc_rdma_btl_names; ompi_osc_rdma_component_t mca_osc_rdma_component = { @@ -126,21 +130,18 @@ ompi_osc_base_module_t ompi_osc_rdma_module_rdma_template = { .osc_flush_all = ompi_osc_rdma_flush_all, .osc_flush_local = ompi_osc_rdma_flush_local, .osc_flush_local_all = ompi_osc_rdma_flush_local_all, - - .osc_set_info = ompi_osc_rdma_set_info, - .osc_get_info = ompi_osc_rdma_get_info }; /* look up parameters for configuring this window. The code first looks in the info structure passed by the user, then it checks for a matching MCA variable. */ -static bool check_config_value_bool (char *key, ompi_info_t *info) +static bool check_config_value_bool (char *key, opal_info_t *info) { int ret, flag, param; bool result = false; const bool *flag_value = &result; - ret = ompi_info_get_bool (info, key, &result, &flag); + ret = opal_info_get_bool (info, key, &result, &flag); if (OMPI_SUCCESS == ret && flag) { return result; } @@ -322,7 +323,7 @@ int ompi_osc_rdma_component_finalize (void) static int ompi_osc_rdma_component_query (struct ompi_win_t *win, void **base, size_t size, int disp_unit, - struct ompi_communicator_t *comm, struct ompi_info_t *info, + struct ompi_communicator_t *comm, struct opal_info_t *info, int flavor) { @@ -1014,7 +1015,7 @@ static int ompi_osc_rdma_check_parameters (ompi_osc_rdma_module_t *module, int d static int ompi_osc_rdma_component_select (struct ompi_win_t *win, void **base, size_t size, int disp_unit, - struct ompi_communicator_t *comm, struct ompi_info_t *info, + struct ompi_communicator_t *comm, struct opal_info_t *info, int flavor, int *model) { ompi_osc_rdma_module_t *module = NULL; @@ -1117,6 +1118,15 @@ static int ompi_osc_rdma_component_select (struct ompi_win_t *win, void **base, } else { module->state_size += mca_osc_rdma_component.max_attach * module->region_size; } +/* + * These are the info's that this module is interested in + */ + opal_infosubscribe_subscribe(&win->super, "no_locks", "false", ompi_osc_rdma_set_no_lock_info); + +/* + * TODO: same_size, same_disp_unit have w_flag entries, but do not appear + * to be used anywhere. If that changes, they should be subscribed + */ /* fill in the function pointer part */ memcpy(&module->super, &ompi_osc_rdma_module_rdma_template, sizeof(module->super)); @@ -1201,7 +1211,42 @@ static int ompi_osc_rdma_component_select (struct ompi_win_t *win, void **base, } -static int ompi_osc_rdma_set_info (struct ompi_win_t *win, struct ompi_info_t *info) +static char* ompi_osc_rdma_set_no_lock_info(opal_infosubscriber_t *obj, char *key, char *value) +{ + + struct ompi_win_t *win = (struct ompi_win_t*) obj; + ompi_osc_rdma_module_t *module = GET_MODULE(win); + bool temp; + + temp = opal_str_to_bool(value); + if (temp && !module->no_locks) { + /* clean up the lock hash. it is up to the user to ensure no lock is + * outstanding from this process when setting the info key */ + OBJ_DESTRUCT(&module->outstanding_locks); + OBJ_CONSTRUCT(&module->outstanding_locks, opal_hash_table_t); + + module->no_locks = true; + } else if (!temp && module->no_locks) { + int world_size = ompi_comm_size (module->comm); + int init_limit = world_size > 256 ? 256 : world_size; + int ret; + + ret = opal_hash_table_init (&module->outstanding_locks, init_limit); + if (OPAL_SUCCESS != ret) { + module->no_locks = true; + } + + module->no_locks = false; + } + /* enforce collectiveness... */ + module->comm->c_coll.coll_barrier(module->comm, module->comm->c_coll.coll_barrier_module); +/* + * Accept any value + */ + return module->no_locks ? "true" : "false"; +} + +static int ompi_osc_rdma_set_info (struct ompi_win_t *win, struct opal_info_t *info) { ompi_osc_rdma_module_t *module = GET_MODULE(win); bool temp; @@ -1235,9 +1280,9 @@ static int ompi_osc_rdma_set_info (struct ompi_win_t *win, struct ompi_info_t *i } -static int ompi_osc_rdma_get_info (struct ompi_win_t *win, struct ompi_info_t **info_used) +static int ompi_osc_rdma_get_info (struct ompi_win_t *win, struct opal_info_t **info_used) { - ompi_info_t *info = OBJ_NEW(ompi_info_t); + opal_info_t *info = OBJ_NEW(opal_info_t); if (NULL == info) { return OMPI_ERR_TEMP_OUT_OF_RESOURCE; diff --git a/ompi/mca/osc/sm/osc_sm.h b/ompi/mca/osc/sm/osc_sm.h index 5ed2f5731ed..339ded4ccc2 100644 --- a/ompi/mca/osc/sm/osc_sm.h +++ b/ompi/mca/osc/sm/osc_sm.h @@ -5,6 +5,7 @@ * reserved. * Copyright (c) 2015-2017 Research Organization for Information Science * and Technology (RIST). All rights reserved. + * Copyright (c) 2016 IBM Corp. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -235,7 +236,7 @@ int ompi_osc_sm_flush_local(int target, struct ompi_win_t *win); int ompi_osc_sm_flush_local_all(struct ompi_win_t *win); -int ompi_osc_sm_set_info(struct ompi_win_t *win, struct ompi_info_t *info); -int ompi_osc_sm_get_info(struct ompi_win_t *win, struct ompi_info_t **info_used); +int ompi_osc_sm_set_info(struct ompi_win_t *win, struct opal_info_t *info); +int ompi_osc_sm_get_info(struct ompi_win_t *win, struct opal_info_t **info_used); #endif diff --git a/ompi/mca/osc/sm/osc_sm_component.c b/ompi/mca/osc/sm/osc_sm_component.c index 22c1d8dd5f3..88a46094f16 100644 --- a/ompi/mca/osc/sm/osc_sm_component.c +++ b/ompi/mca/osc/sm/osc_sm_component.c @@ -10,6 +10,7 @@ * Copyright (c) 2017 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. + * Copyright (c) 2016 IBM Corp. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -25,6 +26,7 @@ #include "ompi/request/request.h" #include "opal/util/sys_limits.h" #include "opal/include/opal/align.h" +#include "opal/util/info_subscriber.h" #include "osc_sm.h" @@ -32,11 +34,13 @@ static int component_open(void); static int component_init(bool enable_progress_threads, bool enable_mpi_threads); static int component_finalize(void); static int component_query(struct ompi_win_t *win, void **base, size_t size, int disp_unit, - struct ompi_communicator_t *comm, struct ompi_info_t *info, + struct ompi_communicator_t *comm, struct opal_info_t *info, int flavor); static int component_select(struct ompi_win_t *win, void **base, size_t size, int disp_unit, - struct ompi_communicator_t *comm, struct ompi_info_t *info, + struct ompi_communicator_t *comm, struct opal_info_t *info, int flavor, int *model); +static char* component_set_blocking_fence_info(void *obj, char *key, char *val); +static char* component_set_alloc_shared_noncontig_info(void *obj, char *key, char *val); ompi_osc_sm_component_t mca_osc_sm_component = { @@ -98,9 +102,6 @@ ompi_osc_sm_module_t ompi_osc_sm_module_template = { .osc_flush_all = ompi_osc_sm_flush_all, .osc_flush_local = ompi_osc_sm_flush_local, .osc_flush_local_all = ompi_osc_sm_flush_local_all, - - .osc_set_info = ompi_osc_sm_set_info, - .osc_get_info = ompi_osc_sm_get_info } }; @@ -146,7 +147,7 @@ check_win_ok(ompi_communicator_t *comm, int flavor) static int component_query(struct ompi_win_t *win, void **base, size_t size, int disp_unit, - struct ompi_communicator_t *comm, struct ompi_info_t *info, + struct ompi_communicator_t *comm, struct opal_info_t *info, int flavor) { int ret; @@ -163,7 +164,7 @@ component_query(struct ompi_win_t *win, void **base, size_t size, int disp_unit, static int component_select(struct ompi_win_t *win, void **base, size_t size, int disp_unit, - struct ompi_communicator_t *comm, struct ompi_info_t *info, + struct ompi_communicator_t *comm, struct opal_info_t *info, int flavor, int *model) { ompi_osc_sm_module_t *module = NULL; @@ -181,6 +182,17 @@ component_select(struct ompi_win_t *win, void **base, size_t size, int disp_unit OBJ_CONSTRUCT(&module->lock, opal_mutex_t); + ret = opal_infosubscribe_subscribe(win, "blocking_fence", "false", + component_set_blocking_fence_info); + + module->global_state->use_barrier_for_fence = 1; + + if (OPAL_SUCCESS != ret) goto error; + + ret = opal_infosubscribe_subscribe(win, "alloc_shared_contig", "false", component_set_alloc_shared_noncontig_info); + + if (OPAL_SUCCESS != ret) goto error; + /* fill in the function pointer part */ memcpy(module, &ompi_osc_sm_module_template, sizeof(ompi_osc_base_module_t)); @@ -227,7 +239,7 @@ component_select(struct ompi_win_t *win, void **base, size_t size, int disp_unit if (NULL == rbuf) return OMPI_ERR_TEMP_OUT_OF_RESOURCE; module->noncontig = false; - if (OMPI_SUCCESS != ompi_info_get_bool(info, "alloc_shared_noncontig", + if (OMPI_SUCCESS != opal_info_get_bool(info, "alloc_shared_noncontig", &module->noncontig, &flag)) { goto error; } @@ -344,7 +356,7 @@ component_select(struct ompi_win_t *win, void **base, size_t size, int disp_unit bool blocking_fence=false; int flag; - if (OMPI_SUCCESS != ompi_info_get_bool(info, "blocking_fence", + if (OMPI_SUCCESS != opal_info_get_bool(info, "blocking_fence", &blocking_fence, &flag)) { goto error; } @@ -497,7 +509,7 @@ ompi_osc_sm_free(struct ompi_win_t *win) int -ompi_osc_sm_set_info(struct ompi_win_t *win, struct ompi_info_t *info) +ompi_osc_sm_set_info(struct ompi_win_t *win, struct opal_info_t *info) { ompi_osc_sm_module_t *module = (ompi_osc_sm_module_t*) win->w_osc_module; @@ -508,19 +520,42 @@ ompi_osc_sm_set_info(struct ompi_win_t *win, struct ompi_info_t *info) } +static char* +component_set_blocking_fence_info(void *obj, char *key, char *val) +{ + ompi_osc_sm_module_t *module = (ompi_osc_sm_module_t*) ((struct ompi_win_t*) obj)->w_osc_module; +/* + * Assuming that you can't change the default. + */ + return module->global_state->use_barrier_for_fence ? "true" : "false"; +} + + +static char* +component_set_alloc_shared_noncontig_info(void *obj, char *key, char *val) +{ + + ompi_osc_sm_module_t *module = (ompi_osc_sm_module_t*) ((struct ompi_win_t*) obj)->w_osc_module; +/* + * Assuming that you can't change the default. + */ + return module->noncontig ? "true" : "false"; +} + + int -ompi_osc_sm_get_info(struct ompi_win_t *win, struct ompi_info_t **info_used) +ompi_osc_sm_get_info(struct ompi_win_t *win, struct opal_info_t **info_used) { ompi_osc_sm_module_t *module = (ompi_osc_sm_module_t*) win->w_osc_module; - ompi_info_t *info = OBJ_NEW(ompi_info_t); + opal_info_t *info = OBJ_NEW(opal_info_t); if (NULL == info) return OMPI_ERR_TEMP_OUT_OF_RESOURCE; if (module->flavor == MPI_WIN_FLAVOR_SHARED) { - ompi_info_set(info, "blocking_fence", + opal_info_set(info, "blocking_fence", (1 == module->global_state->use_barrier_for_fence) ? "true" : "false"); - ompi_info_set(info, "alloc_shared_noncontig", + opal_info_set(info, "alloc_shared_noncontig", (module->noncontig) ? "true" : "false"); } diff --git a/ompi/mca/rte/orte/rte_orte.h b/ompi/mca/rte/orte/rte_orte.h index b71a6e8323a..ae2a9fce85f 100644 --- a/ompi/mca/rte/orte/rte_orte.h +++ b/ompi/mca/rte/orte/rte_orte.h @@ -6,6 +6,7 @@ * Copyright (c) 2014-2016 Research Organization for Information Science * and Technology (RIST). All rights reserved. * Copyright (c) 2015 Intel, Inc. All rights reserved. + * Copyright (c) 2016 IBM Corp. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -37,7 +38,6 @@ struct opal_proc_t; #include "orte/util/name_fns.h" #include "orte/util/proc_info.h" -#include "ompi/info/info.h" struct ompi_proc_t; struct ompi_communicator_t; diff --git a/ompi/mca/sharedfp/addproc/sharedfp_addproc.h b/ompi/mca/sharedfp/addproc/sharedfp_addproc.h index e47afda7a82..5b08b22fddd 100644 --- a/ompi/mca/sharedfp/addproc/sharedfp_addproc.h +++ b/ompi/mca/sharedfp/addproc/sharedfp_addproc.h @@ -10,6 +10,7 @@ * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. * Copyright (c) 2013-2016 University of Houston. All rights reserved. + * Copyright (c) 2016 IBM Corp. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -58,7 +59,7 @@ int mca_sharedfp_addproc_get_position (mca_io_ompio_file_t *fh, int mca_sharedfp_addproc_file_open (struct ompi_communicator_t *comm, const char* filename, int amode, - struct ompi_info_t *info, + struct opal_info_t *info, mca_io_ompio_file_t *fh); int mca_sharedfp_addproc_file_close (mca_io_ompio_file_t *fh); int mca_sharedfp_addproc_read (mca_io_ompio_file_t *fh, diff --git a/ompi/mca/sharedfp/addproc/sharedfp_addproc_file_open.c b/ompi/mca/sharedfp/addproc/sharedfp_addproc_file_open.c index 5bea7fec6b3..cbbbc0a219f 100644 --- a/ompi/mca/sharedfp/addproc/sharedfp_addproc_file_open.c +++ b/ompi/mca/sharedfp/addproc/sharedfp_addproc_file_open.c @@ -10,6 +10,7 @@ * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. * Copyright (c) 2013-2016 University of Houston. All rights reserved. + * Copyright (c) 2016 IBM Corp. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -34,7 +35,7 @@ int mca_sharedfp_addproc_file_open (struct ompi_communicator_t *comm, const char* filename, int amode, - struct ompi_info_t *info, + struct opal_info_t *info, mca_io_ompio_file_t *fh) { int ret = OMPI_SUCCESS, err; diff --git a/ompi/mca/sharedfp/individual/sharedfp_individual.c b/ompi/mca/sharedfp/individual/sharedfp_individual.c index 262e3aeefa3..0cfe45612ec 100644 --- a/ompi/mca/sharedfp/individual/sharedfp_individual.c +++ b/ompi/mca/sharedfp/individual/sharedfp_individual.c @@ -10,6 +10,7 @@ * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. * Copyright (c) 2013-2015 University of Houston. All rights reserved. + * Copyright (c) 2016 IBM Corp. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -103,7 +104,7 @@ struct mca_sharedfp_base_module_1_0_0_t * mca_sharedfp_individual_component_file info = fh->f_info; if ( info != MPI_INFO_NULL ){ valuelen = MPI_MAX_INFO_VAL; - ompi_info_get ( info,"OMPIO_SHAREDFP_RELAXED_ORDERING", valuelen, value, &flag); + opal_info_get ( info,"OMPIO_SHAREDFP_RELAXED_ORDERING", valuelen, value, &flag); if ( flag ) { if ( mca_sharedfp_individual_verbose ) { opal_output(ompi_sharedfp_base_framework.framework_output, diff --git a/ompi/mca/sharedfp/individual/sharedfp_individual.h b/ompi/mca/sharedfp/individual/sharedfp_individual.h index b5f0d5e5be6..f5d8e9451ba 100644 --- a/ompi/mca/sharedfp/individual/sharedfp_individual.h +++ b/ompi/mca/sharedfp/individual/sharedfp_individual.h @@ -12,6 +12,7 @@ * Copyright (c) 2013-2016 University of Houston. All rights reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. + * Copyright (c) 2016 IBM Corp. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -57,7 +58,7 @@ int mca_sharedfp_individual_seek (mca_io_ompio_file_t *fh, int mca_sharedfp_individual_file_open (struct ompi_communicator_t *comm, const char* filename, int amode, - struct ompi_info_t *info, + struct opal_info_t *info, mca_io_ompio_file_t *fh); int mca_sharedfp_individual_file_close (mca_io_ompio_file_t *fh); int mca_sharedfp_individual_read (mca_io_ompio_file_t *fh, diff --git a/ompi/mca/sharedfp/individual/sharedfp_individual_file_open.c b/ompi/mca/sharedfp/individual/sharedfp_individual_file_open.c index f259e8750d8..7aff5868db5 100644 --- a/ompi/mca/sharedfp/individual/sharedfp_individual_file_open.c +++ b/ompi/mca/sharedfp/individual/sharedfp_individual_file_open.c @@ -12,6 +12,7 @@ * Copyright (c) 2013-2016 University of Houston. All rights reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. + * Copyright (c) 2016 IBM Corp. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -33,7 +34,7 @@ int mca_sharedfp_individual_file_open (struct ompi_communicator_t *comm, const char* filename, int amode, - struct ompi_info_t *info, + struct opal_info_t *info, mca_io_ompio_file_t *fh) { int err = 0; diff --git a/ompi/mca/sharedfp/lockedfile/sharedfp_lockedfile.h b/ompi/mca/sharedfp/lockedfile/sharedfp_lockedfile.h index 0e1faa35842..47dd489fa99 100644 --- a/ompi/mca/sharedfp/lockedfile/sharedfp_lockedfile.h +++ b/ompi/mca/sharedfp/lockedfile/sharedfp_lockedfile.h @@ -12,6 +12,7 @@ * Copyright (c) 2013-2016 University of Houston. All rights reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. + * Copyright (c) 2016 IBM Corp. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -57,7 +58,7 @@ int mca_sharedfp_lockedfile_get_position (mca_io_ompio_file_t *fh, int mca_sharedfp_lockedfile_file_open (struct ompi_communicator_t *comm, const char* filename, int amode, - struct ompi_info_t *info, + struct opal_info_t *info, mca_io_ompio_file_t *fh); int mca_sharedfp_lockedfile_file_close (mca_io_ompio_file_t *fh); int mca_sharedfp_lockedfile_read (mca_io_ompio_file_t *fh, diff --git a/ompi/mca/sharedfp/lockedfile/sharedfp_lockedfile_file_open.c b/ompi/mca/sharedfp/lockedfile/sharedfp_lockedfile_file_open.c index 0ed762b452e..8070edf938d 100644 --- a/ompi/mca/sharedfp/lockedfile/sharedfp_lockedfile_file_open.c +++ b/ompi/mca/sharedfp/lockedfile/sharedfp_lockedfile_file_open.c @@ -12,6 +12,7 @@ * Copyright (c) 2013-2017 University of Houston. All rights reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. + * Copyright (c) 2016 IBM Corp. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -38,7 +39,7 @@ int mca_sharedfp_lockedfile_file_open (struct ompi_communicator_t *comm, const char* filename, int amode, - struct ompi_info_t *info, + struct opal_info_t *info, mca_io_ompio_file_t *fh) { int err = MPI_SUCCESS; diff --git a/ompi/mca/sharedfp/sharedfp.h b/ompi/mca/sharedfp/sharedfp.h index 1c370c00f3d..dbed698793d 100644 --- a/ompi/mca/sharedfp/sharedfp.h +++ b/ompi/mca/sharedfp/sharedfp.h @@ -15,6 +15,7 @@ * reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. + * Copyright (c) 2016 IBM Corp. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -176,7 +177,7 @@ typedef int (*mca_sharedfp_base_module_read_ordered_end_fn_t)( ompi_status_public_t *status); typedef int (*mca_sharedfp_base_module_file_open_fn_t)( struct ompi_communicator_t *comm, const char *filename, int amode, - struct ompi_info_t *info, struct mca_io_ompio_file_t *fh); + struct opal_info_t *info, struct mca_io_ompio_file_t *fh); typedef int (*mca_sharedfp_base_module_file_close_fn_t)(struct mca_io_ompio_file_t *fh); diff --git a/ompi/mca/sharedfp/sm/sharedfp_sm.h b/ompi/mca/sharedfp/sm/sharedfp_sm.h index b10bbcf141d..50b33e7cb8c 100644 --- a/ompi/mca/sharedfp/sm/sharedfp_sm.h +++ b/ompi/mca/sharedfp/sm/sharedfp_sm.h @@ -13,6 +13,7 @@ * Copyright (c) 2015 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. + * Copyright (c) 2016 IBM Corp. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -57,7 +58,7 @@ int mca_sharedfp_sm_get_position (mca_io_ompio_file_t *fh, int mca_sharedfp_sm_file_open (struct ompi_communicator_t *comm, const char* filename, int amode, - struct ompi_info_t *info, + struct opal_info_t *info, mca_io_ompio_file_t *fh); int mca_sharedfp_sm_file_close (mca_io_ompio_file_t *fh); int mca_sharedfp_sm_read (mca_io_ompio_file_t *fh, diff --git a/ompi/mca/sharedfp/sm/sharedfp_sm_file_open.c b/ompi/mca/sharedfp/sm/sharedfp_sm_file_open.c index 2d205bd23be..2453202e116 100644 --- a/ompi/mca/sharedfp/sm/sharedfp_sm_file_open.c +++ b/ompi/mca/sharedfp/sm/sharedfp_sm_file_open.c @@ -14,6 +14,7 @@ * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. * Copyright (c) 2015 Cisco Systems, Inc. All rights reserved. + * Copyright (c) 2016 IBM Corp. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -48,7 +49,7 @@ int mca_sharedfp_sm_file_open (struct ompi_communicator_t *comm, const char* filename, int amode, - struct ompi_info_t *info, + struct opal_info_t *info, mca_io_ompio_file_t *fh) { int err = OMPI_SUCCESS; diff --git a/ompi/mca/topo/base/base.h b/ompi/mca/topo/base/base.h index 5e05a8009d4..45b2a342179 100644 --- a/ompi/mca/topo/base/base.h +++ b/ompi/mca/topo/base/base.h @@ -15,6 +15,7 @@ * Copyright (c) 2012-2013 Inria. All rights reserved. * Copyright (c) 2014-2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. + * Copyright (c) 2016 IBM Corp. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -171,7 +172,7 @@ mca_topo_base_dist_graph_create(mca_topo_base_module_t* module, ompi_communicator_t *old_comm, int n, const int nodes[], const int degrees[], const int targets[], const int weights[], - ompi_info_t *info, int reorder, + opal_info_t *info, int reorder, ompi_communicator_t **new_comm); OMPI_DECLSPEC int @@ -180,7 +181,7 @@ mca_topo_base_dist_graph_create_adjacent(mca_topo_base_module_t* module, int indegree, const int sources[], const int sourceweights[], int outdegree, const int destinations[], const int destweights[], - ompi_info_t *info, int reorder, + opal_info_t *info, int reorder, ompi_communicator_t **comm_dist_graph); OMPI_DECLSPEC int diff --git a/ompi/mca/topo/base/topo_base_dist_graph_create.c b/ompi/mca/topo/base/topo_base_dist_graph_create.c index 9048d7acb90..153d545b5ec 100644 --- a/ompi/mca/topo/base/topo_base_dist_graph_create.c +++ b/ompi/mca/topo/base/topo_base_dist_graph_create.c @@ -284,7 +284,7 @@ int mca_topo_base_dist_graph_create(mca_topo_base_module_t* module, int n, const int nodes[], const int degrees[], const int targets[], const int weights[], - ompi_info_t *info, int reorder, + opal_info_t *info, int reorder, ompi_communicator_t **newcomm) { int err; diff --git a/ompi/mca/topo/base/topo_base_dist_graph_create_adjacent.c b/ompi/mca/topo/base/topo_base_dist_graph_create_adjacent.c index 6d3d9406339..9b1a17a7fc3 100644 --- a/ompi/mca/topo/base/topo_base_dist_graph_create_adjacent.c +++ b/ompi/mca/topo/base/topo_base_dist_graph_create_adjacent.c @@ -26,7 +26,7 @@ int mca_topo_base_dist_graph_create_adjacent(mca_topo_base_module_t* module, int outdegree, const int destinations[], const int destweights[], - ompi_info_t *info, int reorder, + opal_info_t *info, int reorder, ompi_communicator_t **newcomm) { mca_topo_base_comm_dist_graph_2_2_0_t *topo = NULL; diff --git a/ompi/mca/topo/topo.h b/ompi/mca/topo/topo.h index d4460793b30..ac5d159f270 100644 --- a/ompi/mca/topo/topo.h +++ b/ompi/mca/topo/topo.h @@ -16,6 +16,7 @@ * and Technology (RIST). All rights reserved. * Copyright (c) 2015 Los Alamos National Security, LLC. All rights * reserved. + * Copyright (c) 2016 IBM Corp. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -252,7 +253,7 @@ typedef int (*mca_topo_base_module_dist_graph_create_fn_t) struct ompi_communicator_t *old_comm, int n, const int nodes[], const int degrees[], const int targets[], const int weights[], - struct ompi_info_t *info, int reorder, + struct opal_info_t *info, int reorder, struct ompi_communicator_t **new_comm); /* Back end for MPI_DIST_GRAPH_CREATE_ADJACENT */ @@ -264,7 +265,7 @@ typedef int (*mca_topo_base_module_dist_graph_create_adjacent_fn_t) int outdegree, const int destinations[], const int destweights[], - struct ompi_info_t *info, int reorder, + struct opal_info_t *info, int reorder, ompi_communicator_t **comm_dist_graph); /* Back end for MPI_DIST_GRAPH_NEIGHBORS */ diff --git a/ompi/mca/topo/treematch/topo_treematch.h b/ompi/mca/topo/treematch/topo_treematch.h index 7c11cdf5421..f92f3b46d1d 100644 --- a/ompi/mca/topo/treematch/topo_treematch.h +++ b/ompi/mca/topo/treematch/topo_treematch.h @@ -6,6 +6,7 @@ * Copyright (c) 2011-2015 Bordeaux Polytechnic Institute * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. + * Copyright (c) 2016 IBM Corp. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -69,7 +70,7 @@ int mca_topo_treematch_dist_graph_create(mca_topo_base_module_t* module, int n, const int nodes[], const int degrees[], const int targets[], const int weights[], - struct ompi_info_t *info, int reorder, + struct opal_info_t *info, int reorder, ompi_communicator_t **newcomm); /* * ****************************************************************** diff --git a/ompi/mca/topo/treematch/topo_treematch_dist_graph_create.c b/ompi/mca/topo/treematch/topo_treematch_dist_graph_create.c index beadaed0e48..e6f99c9f918 100644 --- a/ompi/mca/topo/treematch/topo_treematch_dist_graph_create.c +++ b/ompi/mca/topo/treematch/topo_treematch_dist_graph_create.c @@ -11,6 +11,7 @@ * Copyright (c) 2016 Los Alamos National Security, LLC. All rights * reserved. * Copyright (c) 2017 Cisco Systems, Inc. All rights reserved + * Copyright (c) 2016 IBM Corp. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -119,7 +120,7 @@ int mca_topo_treematch_dist_graph_create(mca_topo_base_module_t* topo_module, int n, const int nodes[], const int degrees[], const int targets[], const int weights[], - struct ompi_info_t *info, int reorder, + struct opal_info_t *info, int reorder, ompi_communicator_t **newcomm) { int err; diff --git a/ompi/mpi/c/alloc_mem.c b/ompi/mpi/c/alloc_mem.c index 8c8fb8cd545..11e87987ab3 100644 --- a/ompi/mpi/c/alloc_mem.c +++ b/ompi/mpi/c/alloc_mem.c @@ -76,7 +76,7 @@ int MPI_Alloc_mem(MPI_Aint size, MPI_Info info, void *baseptr) if (MPI_INFO_NULL != info) { int flag; - (void) ompi_info_get (info, "mpool_hints", MPI_MAX_INFO_VAL, info_value, &flag); + (void) opal_info_get (info, "mpool_hints", MPI_MAX_INFO_VAL, info_value, &flag); if (flag) { mpool_hints = info_value; } diff --git a/ompi/mpi/c/comm_dup_with_info.c b/ompi/mpi/c/comm_dup_with_info.c index 81d73286133..ee3596b128f 100644 --- a/ompi/mpi/c/comm_dup_with_info.c +++ b/ompi/mpi/c/comm_dup_with_info.c @@ -16,6 +16,7 @@ * reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. + * Copyright (c) 2016 IBM Corp. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -67,7 +68,7 @@ int MPI_Comm_dup_with_info(MPI_Comm comm, MPI_Info info, MPI_Comm *newcomm) OPAL_CR_ENTER_LIBRARY(); - rc = ompi_comm_dup_with_info (comm, info, newcomm); + rc = ompi_comm_dup_with_info (comm, &info->super, newcomm); OMPI_ERRHANDLER_RETURN(rc, comm, rc, FUNC_NAME); } diff --git a/ompi/mpi/c/comm_get_info.c b/ompi/mpi/c/comm_get_info.c index 10f864c6de2..40edc0071a4 100644 --- a/ompi/mpi/c/comm_get_info.c +++ b/ompi/mpi/c/comm_get_info.c @@ -3,6 +3,7 @@ * Copyright (c) 2014 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. + * Copyright (c) 2016 IBM Corp. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -46,13 +47,21 @@ int MPI_Comm_get_info(MPI_Comm comm, MPI_Info *info_used) } } - /* At the moment, we do not support any communicator hints. So - just return a new, empty info obect handle. */ + if (NULL == comm->super.s_info) { +/* + * Setup any defaults if MPI_Win_set_info was never called + */ + opal_infosubscribe_change_info(comm, &MPI_INFO_NULL->super); + } + + (*info_used) = OBJ_NEW(ompi_info_t); if (NULL == (*info_used)) { - return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_NO_MEM, + return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_NO_MEM, FUNC_NAME); } + opal_info_dup(comm->super.s_info, &(*info_used)->super); + return MPI_SUCCESS; } diff --git a/ompi/mpi/c/comm_set_info.c b/ompi/mpi/c/comm_set_info.c index bae5c9f6977..6ac12d78260 100644 --- a/ompi/mpi/c/comm_set_info.c +++ b/ompi/mpi/c/comm_set_info.c @@ -3,6 +3,7 @@ * Copyright (c) 2014 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. + * Copyright (c) 2016 IBM Corp. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -16,7 +17,7 @@ #include "ompi/runtime/params.h" #include "ompi/communicator/communicator.h" #include "ompi/errhandler/errhandler.h" -#include "ompi/info/info.h" +#include "opal/util/info_subscriber.h" #include #include @@ -47,7 +48,9 @@ int MPI_Comm_set_info(MPI_Comm comm, MPI_Info info) } } - /* At the moment, we do not support any communicator hints. - So... do nothing */ + OPAL_CR_ENTER_LIBRARY(); + + opal_infosubscribe_change_info(comm, info); + return MPI_SUCCESS; } diff --git a/ompi/mpi/c/comm_spawn.c b/ompi/mpi/c/comm_spawn.c index 45e0f24a51e..9de5bd9d52a 100644 --- a/ompi/mpi/c/comm_spawn.c +++ b/ompi/mpi/c/comm_spawn.c @@ -17,6 +17,7 @@ * Copyright (c) 2015 Intel, Inc. All rights reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. + * Copyright (c) 2016 IBM Corp. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -109,7 +110,7 @@ int MPI_Comm_spawn(const char *command, char *argv[], int maxprocs, MPI_Info inf /* See if the info key "ompi_non_mpi" was set to true */ if (rank == root) { - ompi_info_get_bool(info, "ompi_non_mpi", &non_mpi, &flag); + opal_info_get_bool(info, "ompi_non_mpi", &non_mpi, &flag); } OPAL_CR_ENTER_LIBRARY(); diff --git a/ompi/mpi/c/comm_spawn_multiple.c b/ompi/mpi/c/comm_spawn_multiple.c index 5afdfa39ebc..0cba28ef651 100644 --- a/ompi/mpi/c/comm_spawn_multiple.c +++ b/ompi/mpi/c/comm_spawn_multiple.c @@ -17,6 +17,7 @@ * Copyright (c) 2015 Intel, Inc. All rights reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. + * Copyright (c) 2016 IBM Corp. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -105,7 +106,7 @@ int MPI_Comm_spawn_multiple(int count, char *array_of_commands[], char **array_o be set to true on all of them. Note that not setting ompi_non_mpi is the same as setting it to false. */ - ompi_info_get_bool(array_of_info[i], "ompi_non_mpi", &non_mpi, + opal_info_get_bool(array_of_info[i], "ompi_non_mpi", &non_mpi, &flag); if (flag && 0 == i) { /* If this is the first info, save its @@ -141,7 +142,7 @@ int MPI_Comm_spawn_multiple(int count, char *array_of_commands[], char **array_o if (MPI_INFO_NULL == array_of_info[0]) { non_mpi = false; } else { - ompi_info_get_bool(array_of_info[0], "ompi_non_mpi", &non_mpi, + opal_info_get_bool(array_of_info[0], "ompi_non_mpi", &non_mpi, &flag); if (!flag) { non_mpi = false; diff --git a/ompi/mpi/c/file_get_info.c b/ompi/mpi/c/file_get_info.c index 51b67a41896..0135e29dc9e 100644 --- a/ompi/mpi/c/file_get_info.c +++ b/ompi/mpi/c/file_get_info.c @@ -12,6 +12,7 @@ * Copyright (c) 2008 Sun Microsystems, Inc. All rights reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. + * Copyright (c) 2016 IBM Corp. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -24,6 +25,7 @@ #include "ompi/mpi/c/bindings.h" #include "ompi/runtime/params.h" #include "ompi/errhandler/errhandler.h" +#include "ompi/communicator/communicator.h" #include "ompi/file/file.h" #if OMPI_BUILD_MPI_PROFILING @@ -38,36 +40,33 @@ static const char FUNC_NAME[] = "MPI_File_get_info"; int MPI_File_get_info(MPI_File fh, MPI_Info *info_used) { - int rc; + OPAL_CR_NOOP_PROGRESS(); if (MPI_PARAM_CHECK) { - rc = MPI_SUCCESS; OMPI_ERR_INIT_FINALIZE(FUNC_NAME); + if (NULL == info_used) { + return OMPI_ERRHANDLER_INVOKE(fh, MPI_ERR_INFO, FUNC_NAME); + } if (ompi_file_invalid(fh)) { - rc = MPI_ERR_FILE; - fh = MPI_FILE_NULL; - } else if (NULL == info_used) { - rc = MPI_ERR_ARG; + return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_COMM, + FUNC_NAME); } - OMPI_ERRHANDLER_CHECK(rc, fh, rc, FUNC_NAME); } - OPAL_CR_ENTER_LIBRARY(); - - /* Call the back-end io component function */ + if (NULL == fh->super.s_info) { +/* + * Setup any defaults if MPI_Win_set_info was never called + */ + opal_infosubscribe_change_info(fh, &MPI_INFO_NULL->super); + } - switch (fh->f_io_version) { - case MCA_IO_BASE_V_2_0_0: - rc = fh->f_io_selected_module.v2_0_0. - io_module_file_get_info(fh, info_used); - break; - default: - rc = MPI_ERR_INTERN; - break; + (*info_used) = OBJ_NEW(ompi_info_t); + if (NULL == (*info_used)) { + return OMPI_ERRHANDLER_INVOKE(fh, MPI_ERR_NO_MEM, FUNC_NAME); } - /* All done */ + opal_info_dup(fh->super.s_info, &(*info_used)->super); - OMPI_ERRHANDLER_RETURN(rc, fh, rc, FUNC_NAME); + return OMPI_SUCCESS; } diff --git a/ompi/mpi/c/file_set_info.c b/ompi/mpi/c/file_set_info.c index a6a01d5dad6..37e9b546d45 100644 --- a/ompi/mpi/c/file_set_info.c +++ b/ompi/mpi/c/file_set_info.c @@ -12,6 +12,7 @@ * Copyright (c) 2008 Sun Microsystems, Inc. All rights reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. + * Copyright (c) 2016 IBM Corp. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -25,6 +26,8 @@ #include "ompi/runtime/params.h" #include "ompi/errhandler/errhandler.h" #include "ompi/info/info.h" +#include "ompi/communicator/communicator.h" +#include "opal/util/info_subscriber.h" #include "ompi/file/file.h" #if OMPI_BUILD_MPI_PROFILING @@ -39,34 +42,27 @@ static const char FUNC_NAME[] = "MPI_File_set_info"; int MPI_File_set_info(MPI_File fh, MPI_Info info) { - int rc; + int ret; + + OPAL_CR_NOOP_PROGRESS(); if (MPI_PARAM_CHECK) { - rc = MPI_SUCCESS; OMPI_ERR_INIT_FINALIZE(FUNC_NAME); + if (ompi_file_invalid(fh)) { - fh = MPI_FILE_NULL; - rc = MPI_ERR_FILE; + return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_FILE, FUNC_NAME); + } + + if (NULL == info || MPI_INFO_NULL == info || + ompi_info_is_freed(info)) { + return OMPI_ERRHANDLER_INVOKE(fh, MPI_ERR_INFO, + FUNC_NAME); } - OMPI_ERRHANDLER_CHECK(rc, fh, rc, FUNC_NAME); } OPAL_CR_ENTER_LIBRARY(); - /* Call the back-end io component function */ - - switch (fh->f_io_version) { - case MCA_IO_BASE_V_2_0_0: - rc = fh->f_io_selected_module.v2_0_0. - io_module_file_set_info(fh, info); - break; - - default: - rc = MPI_ERR_INTERN; - break; - } - - /* All done */ + ret = opal_infosubscribe_change_info(fh, &info->super); - OMPI_ERRHANDLER_RETURN(rc, fh, rc, FUNC_NAME); + OMPI_ERRHANDLER_RETURN(ret, fh, ret, FUNC_NAME); } diff --git a/ompi/mpi/c/info_delete.c b/ompi/mpi/c/info_delete.c index dc246ea3288..7800884aa0b 100644 --- a/ompi/mpi/c/info_delete.c +++ b/ompi/mpi/c/info_delete.c @@ -14,6 +14,7 @@ * reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. + * Copyright (c) 2016 IBM Corp. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -77,6 +78,6 @@ int MPI_Info_delete(MPI_Info info, const char *key) { OPAL_CR_ENTER_LIBRARY(); - err = ompi_info_delete (info, key); + err = opal_info_delete (info, key); OMPI_ERRHANDLER_RETURN(err, MPI_COMM_WORLD, err, FUNC_NAME); } diff --git a/ompi/mpi/c/info_dup.c b/ompi/mpi/c/info_dup.c index 5d3c2f5cdeb..f772fab3a56 100644 --- a/ompi/mpi/c/info_dup.c +++ b/ompi/mpi/c/info_dup.c @@ -11,6 +11,7 @@ * All rights reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. + * Copyright (c) 2016 IBM Corp. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -73,7 +74,7 @@ int MPI_Info_dup(MPI_Info info, MPI_Info *newinfo) { } } - *newinfo = OBJ_NEW(ompi_info_t); + *newinfo = OBJ_NEW(opal_info_t); if (NULL == *newinfo) { return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_NO_MEM, FUNC_NAME); @@ -84,6 +85,6 @@ int MPI_Info_dup(MPI_Info info, MPI_Info *newinfo) { /* * Now to actually duplicate all the values */ - err = ompi_info_dup (info, newinfo); + err = opal_info_dup (info, newinfo); OMPI_ERRHANDLER_RETURN(err, MPI_COMM_WORLD, err, FUNC_NAME); } diff --git a/ompi/mpi/c/info_get.c b/ompi/mpi/c/info_get.c index e7185975e0a..ad1c284d40f 100644 --- a/ompi/mpi/c/info_get.c +++ b/ompi/mpi/c/info_get.c @@ -14,6 +14,7 @@ * reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. + * Copyright (c) 2016 IBM Corp. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -100,6 +101,6 @@ int MPI_Info_get(MPI_Info info, const char *key, int valuelen, OPAL_CR_ENTER_LIBRARY(); - err = ompi_info_get (info, key, valuelen, value, flag); + err = opal_info_get(info, key, valuelen, value, flag); OMPI_ERRHANDLER_RETURN(err, MPI_COMM_WORLD, err, FUNC_NAME); } diff --git a/ompi/mpi/c/info_get_nkeys.c b/ompi/mpi/c/info_get_nkeys.c index db0887466e5..57e2944748e 100644 --- a/ompi/mpi/c/info_get_nkeys.c +++ b/ompi/mpi/c/info_get_nkeys.c @@ -11,6 +11,7 @@ * All rights reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. + * Copyright (c) 2016 IBM Corp. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -69,6 +70,6 @@ int MPI_Info_get_nkeys(MPI_Info info, int *nkeys) OPAL_CR_ENTER_LIBRARY(); - err = ompi_info_get_nkeys(info, nkeys); + err = opal_info_get_nkeys(info, nkeys); OMPI_ERRHANDLER_RETURN(err, MPI_COMM_WORLD, err, FUNC_NAME); } diff --git a/ompi/mpi/c/info_get_nthkey.c b/ompi/mpi/c/info_get_nthkey.c index 59da2bd0001..1bb0165a4ba 100644 --- a/ompi/mpi/c/info_get_nthkey.c +++ b/ompi/mpi/c/info_get_nthkey.c @@ -11,6 +11,7 @@ * All rights reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. + * Copyright (c) 2016 IBM Corp. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -82,7 +83,7 @@ int MPI_Info_get_nthkey(MPI_Info info, int n, char *key) 1 from the value returned by get_nkeys(). So be sure to compare appropriately. */ - err = ompi_info_get_nkeys(info, &nkeys); + err = opal_info_get_nkeys(info, &nkeys); OMPI_ERRHANDLER_CHECK(err, MPI_COMM_WORLD, err, FUNC_NAME); if (n > (nkeys - 1)) { OPAL_CR_EXIT_LIBRARY(); @@ -92,6 +93,6 @@ int MPI_Info_get_nthkey(MPI_Info info, int n, char *key) /* Everything seems alright. Call the back end key copy */ - err = ompi_info_get_nthkey (info, n, key); + err = opal_info_get_nthkey (info, n, key); OMPI_ERRHANDLER_RETURN(err, MPI_COMM_WORLD, err, FUNC_NAME); } diff --git a/ompi/mpi/c/info_get_valuelen.c b/ompi/mpi/c/info_get_valuelen.c index 3e55ee05b03..4a0605e70f1 100644 --- a/ompi/mpi/c/info_get_valuelen.c +++ b/ompi/mpi/c/info_get_valuelen.c @@ -14,6 +14,7 @@ * reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. + * Copyright (c) 2016 IBM Corp. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -90,6 +91,6 @@ int MPI_Info_get_valuelen(MPI_Info info, const char *key, int *valuelen, OPAL_CR_ENTER_LIBRARY(); - err = ompi_info_get_valuelen (info, key, valuelen, flag); + err = opal_info_get_valuelen (info, key, valuelen, flag); OMPI_ERRHANDLER_RETURN(err, MPI_COMM_WORLD, err, FUNC_NAME); } diff --git a/ompi/mpi/c/info_set.c b/ompi/mpi/c/info_set.c index 0b4874c211e..c0242bf1a52 100644 --- a/ompi/mpi/c/info_set.c +++ b/ompi/mpi/c/info_set.c @@ -12,6 +12,7 @@ * Copyright (c) 2012-2013 Inria. All rights reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. + * Copyright (c) 2016 IBM Corp. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -104,6 +105,6 @@ int MPI_Info_set(MPI_Info info, const char *key, const char *value) * allocator. */ - err = ompi_info_set (info, key, value); + err = opal_info_set (info, key, value); OMPI_ERRHANDLER_RETURN(err, MPI_COMM_WORLD, err, FUNC_NAME); } diff --git a/ompi/mpi/c/lookup_name.c b/ompi/mpi/c/lookup_name.c index 42a71c367c4..0e790e727f4 100644 --- a/ompi/mpi/c/lookup_name.c +++ b/ompi/mpi/c/lookup_name.c @@ -16,6 +16,7 @@ * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. * Copyright (c) 2015 Cisco Systems, Inc. All rights reserved. + * Copyright (c) 2016 IBM Corp. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -88,7 +89,7 @@ int MPI_Lookup_name(const char *service_name, MPI_Info info, char *port_name) /* OMPI supports info keys to pass the range to * be searched for the given key */ if (MPI_INFO_NULL != info) { - ompi_info_get (info, "range", sizeof(range) - 1, range, &flag); + opal_info_get (info, "range", sizeof(range) - 1, range, &flag); if (flag) { if (0 == strcmp(range, "nspace")) { rng = OBJ_NEW(opal_value_t); diff --git a/ompi/mpi/c/publish_name.c b/ompi/mpi/c/publish_name.c index 24270cea8f0..f7c40aa91a5 100644 --- a/ompi/mpi/c/publish_name.c +++ b/ompi/mpi/c/publish_name.c @@ -16,6 +16,7 @@ * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. * Copyright (c) 2015 Cisco Systems, Inc. All rights reserved. + * Copyright (c) 2016 IBM Corp. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -88,7 +89,7 @@ int MPI_Publish_name(const char *service_name, MPI_Info info, /* OMPI supports info keys to pass the range and persistence to * be used for the given key */ if (MPI_INFO_NULL != info) { - ompi_info_get (info, "range", sizeof(range) - 1, range, &flag); + opal_info_get (info, "range", sizeof(range) - 1, range, &flag); if (flag) { if (0 == strcmp(range, "nspace")) { rng = OBJ_NEW(opal_value_t); @@ -110,7 +111,7 @@ int MPI_Publish_name(const char *service_name, MPI_Info info, FUNC_NAME); } } - ompi_info_get (info, "persistence", sizeof(range) - 1, range, &flag); + opal_info_get (info, "persistence", sizeof(range) - 1, range, &flag); if (flag) { if (0 == strcmp(range, "indef")) { rng = OBJ_NEW(opal_value_t); diff --git a/ompi/mpi/c/unpublish_name.c b/ompi/mpi/c/unpublish_name.c index 019d7106fe6..aa103ae11c4 100644 --- a/ompi/mpi/c/unpublish_name.c +++ b/ompi/mpi/c/unpublish_name.c @@ -16,6 +16,7 @@ * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. * Copyright (c) 2015 Cisco Systems, Inc. All rights reserved. + * Copyright (c) 2016 IBM Corp. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -90,7 +91,7 @@ int MPI_Unpublish_name(const char *service_name, MPI_Info info, /* OMPI supports info keys to pass the range to * be searched for the given key */ if (MPI_INFO_NULL != info) { - ompi_info_get (info, "range", sizeof(range) - 1, range, &flag); + opal_info_get (info, "range", sizeof(range) - 1, range, &flag); if (flag) { if (0 == strcmp(range, "nspace")) { rng = OBJ_NEW(opal_value_t); diff --git a/ompi/mpi/c/win_get_info.c b/ompi/mpi/c/win_get_info.c index ed686eb18c8..8b5a03f536e 100644 --- a/ompi/mpi/c/win_get_info.c +++ b/ompi/mpi/c/win_get_info.c @@ -5,6 +5,7 @@ * reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. + * Copyright (c) 2016 IBM Corp. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -18,6 +19,8 @@ #include "ompi/runtime/params.h" #include "ompi/errhandler/errhandler.h" #include "ompi/win/win.h" +#include "opal/util/info.h" +#include "opal/util/info_subscriber.h" #if OMPI_BUILD_MPI_PROFILING #if OPAL_HAVE_WEAK_SYMBOLS @@ -28,15 +31,12 @@ static const char FUNC_NAME[] = "MPI_Win_get_info"; -static void _win_info_set (ompi_info_t *info, const char *key, int set) -{ - ompi_info_set (info, key, set ? "true" : "false"); -} - int MPI_Win_get_info(MPI_Win win, MPI_Info *info_used) { int ret; + OPAL_CR_NOOP_PROGRESS(); + if (MPI_PARAM_CHECK) { OMPI_ERR_INIT_FINALIZE(FUNC_NAME); @@ -49,18 +49,19 @@ int MPI_Win_get_info(MPI_Win win, MPI_Info *info_used) } } - OPAL_CR_ENTER_LIBRARY(); - - ret = win->w_osc_module->osc_get_info(win, info_used); - - if (OMPI_SUCCESS == ret && *info_used) { - /* set standard info keys based on what the OSC module is using */ + if (NULL == win->super.s_info) { +/* + * Setup any defaults if MPI_Win_set_info was never called + */ + opal_infosubscribe_change_info(win, &MPI_INFO_NULL->super); + } - _win_info_set (*info_used, "no_locks", win->w_flags & OMPI_WIN_NO_LOCKS); - _win_info_set (*info_used, "same_size", win->w_flags & OMPI_WIN_SAME_SIZE); - _win_info_set (*info_used, "same_disp_unit", win->w_flags & OMPI_WIN_SAME_DISP); - ompi_info_set_value_enum (*info_used, "accumulate_ops", win->w_acc_ops, ompi_win_accumulate_ops); + (*info_used) = OBJ_NEW(ompi_info_t); + if (NULL == (*info_used)) { + return OMPI_ERRHANDLER_INVOKE(win, MPI_ERR_NO_MEM, FUNC_NAME); } + ret = opal_info_dup(&win->super.s_info, &(*info_used)->super); + OMPI_ERRHANDLER_RETURN(ret, win, ret, FUNC_NAME); } diff --git a/ompi/mpi/c/win_set_info.c b/ompi/mpi/c/win_set_info.c index 677488366c0..20a3a584750 100644 --- a/ompi/mpi/c/win_set_info.c +++ b/ompi/mpi/c/win_set_info.c @@ -2,6 +2,7 @@ * Copyright (c) 2013 Sandia National Laboratories. All rights reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. + * Copyright (c) 2016 IBM Corp. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -15,6 +16,8 @@ #include "ompi/runtime/params.h" #include "ompi/errhandler/errhandler.h" #include "ompi/win/win.h" +#include "ompi/communicator/communicator.h" +#include "opal/util/info_subscriber.h" #if OMPI_BUILD_MPI_PROFILING #if OPAL_HAVE_WEAK_SYMBOLS @@ -45,6 +48,7 @@ int MPI_Win_set_info(MPI_Win win, MPI_Info info) OPAL_CR_ENTER_LIBRARY(); - ret = win->w_osc_module->osc_set_info(win, info); + ret = opal_infosubscribe_change_info(win, info); + OMPI_ERRHANDLER_RETURN(ret, win, ret, FUNC_NAME); } diff --git a/ompi/mpiext/cr/c/quiesce_start.c b/ompi/mpiext/cr/c/quiesce_start.c index 9b61ebe6d0a..ba835ad1085 100644 --- a/ompi/mpiext/cr/c/quiesce_start.c +++ b/ompi/mpiext/cr/c/quiesce_start.c @@ -6,6 +6,7 @@ * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2012 Cisco Systems, Inc. All rights reserved. + * Copyright (c) 2016 IBM Corp. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -76,7 +77,7 @@ int OMPI_CR_Quiesce_start(MPI_Comm commP, MPI_Info *info) /* * (Old) info logic */ - /*ompi_info_set((ompi_info_t*)*info, "target", cur_datum.target_dir);*/ + /*opal_info_set((opal_info_t*)*info, "target", cur_datum.target_dir);*/ return ret; } @@ -123,7 +124,7 @@ int OMPI_CR_Quiesce_start(MPI_Comm commP, MPI_Info *info) * 1 = Memory must be in user space (i.e., not on network card * */ -static int extract_info_into_datum(ompi_info_t *info, orte_snapc_base_quiesce_t *datum) +static int extract_info_into_datum(opal_info_t *info, orte_snapc_base_quiesce_t *datum) { int info_flag = false; int max_crs_len = 32; @@ -135,7 +136,7 @@ static int extract_info_into_datum(ompi_info_t *info, orte_snapc_base_quiesce_t /* * Key: crs */ - ompi_info_get(info, "crs", max_crs_len, info_char, &info_flag); + opal_info_get(info, "crs", max_crs_len, info_char, &info_flag); if( info_flag) { datum->crs_name = strdup(info_char); } @@ -143,7 +144,7 @@ static int extract_info_into_datum(ompi_info_t *info, orte_snapc_base_quiesce_t /* * Key: cmdline */ - ompi_info_get(info, "cmdline", OPAL_PATH_MAX, info_char, &info_flag); + opal_info_get(info, "cmdline", OPAL_PATH_MAX, info_char, &info_flag); if( info_flag) { datum->cmdline = strdup(info_char); } @@ -151,7 +152,7 @@ static int extract_info_into_datum(ompi_info_t *info, orte_snapc_base_quiesce_t /* * Key: handle */ - ompi_info_get(info, "handle", OPAL_PATH_MAX, info_char, &info_flag); + opal_info_get(info, "handle", OPAL_PATH_MAX, info_char, &info_flag); if( info_flag) { datum->handle = strdup(info_char); } @@ -159,7 +160,7 @@ static int extract_info_into_datum(ompi_info_t *info, orte_snapc_base_quiesce_t /* * Key: target */ - ompi_info_get(info, "target", OPAL_PATH_MAX, info_char, &info_flag); + opal_info_get(info, "target", OPAL_PATH_MAX, info_char, &info_flag); if( info_flag) { datum->target_dir = strdup(info_char); } @@ -167,7 +168,7 @@ static int extract_info_into_datum(ompi_info_t *info, orte_snapc_base_quiesce_t /* * Key: restarting */ - ompi_info_get_bool(info, "restarting", &info_bool, &info_flag); + opal_info_get_bool(info, "restarting", &info_bool, &info_flag); if( info_flag ) { datum->restarting = info_bool; } else { @@ -177,7 +178,7 @@ static int extract_info_into_datum(ompi_info_t *info, orte_snapc_base_quiesce_t /* * Key: checkpointing */ - ompi_info_get_bool(info, "checkpointing", &info_bool, &info_flag); + opal_info_get_bool(info, "checkpointing", &info_bool, &info_flag); if( info_flag ) { datum->checkpointing = info_bool; } else { diff --git a/ompi/runtime/ompi_mpi_finalize.c b/ompi/runtime/ompi_mpi_finalize.c index 2101232e748..cd56bad30fd 100644 --- a/ompi/runtime/ompi_mpi_finalize.c +++ b/ompi/runtime/ompi_mpi_finalize.c @@ -20,6 +20,7 @@ * Copyright (c) 2016 Research Organization for Information Science * and Technology (RIST). All rights reserved. * + * Copyright (c) 2016 IBM Corp. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -426,7 +427,7 @@ int ompi_mpi_finalize(void) } /* free info resources */ - if (OMPI_SUCCESS != (ret = ompi_info_finalize())) { + if (OMPI_SUCCESS != (ret = ompi_mpiinfo_finalize())) { goto done; } diff --git a/ompi/runtime/ompi_mpi_init.c b/ompi/runtime/ompi_mpi_init.c index 1ba380974b8..40c13eb638d 100644 --- a/ompi/runtime/ompi_mpi_init.c +++ b/ompi/runtime/ompi_mpi_init.c @@ -22,6 +22,7 @@ * and Technology (RIST). All rights reserved. * Copyright (c) 2016 Mellanox Technologies Ltd. All rights reserved. * + * Copyright (c) 2016 IBM Corp. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -748,7 +749,7 @@ int ompi_mpi_init(int argc, char **argv, int requested, int *provided) } /* initialize info */ - if (OMPI_SUCCESS != (ret = ompi_info_init())) { + if (OMPI_SUCCESS != (ret = ompi_mpiinfo_init())) { error = "ompi_info_init() failed"; goto error; } diff --git a/ompi/win/win.c b/ompi/win/win.c index af55a2d7149..082e4ab6669 100644 --- a/ompi/win/win.c +++ b/ompi/win/win.c @@ -16,6 +16,7 @@ * reserved. * Copyright (c) 2015-2016 Research Organization for Information Science * and Technology (RIST). All rights reserved. + * Copyright (c) 2016 IBM Corp. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -25,6 +26,8 @@ #include "ompi_config.h" +#include "opal/util/info_subscriber.h" + #include "mpi.h" #include "ompi/win/win.h" #include "ompi/errhandler/errhandler.h" @@ -43,7 +46,7 @@ */ opal_pointer_array_t ompi_mpi_windows = {{0}}; -ompi_predefined_win_t ompi_mpi_win_null = {{{0}}}; +ompi_predefined_win_t ompi_mpi_win_null = {{{{0}}}}; ompi_predefined_win_t *ompi_mpi_win_null_addr = &ompi_mpi_win_null; mca_base_var_enum_t *ompi_win_accumulate_ops = NULL; mca_base_var_enum_flag_t *ompi_win_accumulate_order = NULL; @@ -67,7 +70,7 @@ static mca_base_var_enum_value_flag_t accumulate_order_flags[] = { static void ompi_win_construct(ompi_win_t *win); static void ompi_win_destruct(ompi_win_t *win); -OBJ_CLASS_INSTANCE(ompi_win_t, opal_object_t, +OBJ_CLASS_INSTANCE(ompi_win_t, opal_infosubscriber_t, ompi_win_construct, ompi_win_destruct); int @@ -136,7 +139,7 @@ int ompi_win_finalize(void) return OMPI_SUCCESS; } -static int alloc_window(struct ompi_communicator_t *comm, ompi_info_t *info, int flavor, ompi_win_t **win_out) +static int alloc_window(struct ompi_communicator_t *comm, opal_info_t *info, int flavor, ompi_win_t **win_out) { ompi_win_t *win; ompi_group_t *group; @@ -148,7 +151,7 @@ static int alloc_window(struct ompi_communicator_t *comm, ompi_info_t *info, int return OMPI_ERR_OUT_OF_RESOURCE; } - ret = ompi_info_get_value_enum (info, "accumulate_ops", &acc_ops, + ret = opal_info_get_value_enum (info, "accumulate_ops", &acc_ops, OMPI_WIN_ACCUMULATE_OPS_SAME_OP_NO_OP, ompi_win_accumulate_ops, &flag); if (OMPI_SUCCESS != ret) { @@ -158,7 +161,7 @@ static int alloc_window(struct ompi_communicator_t *comm, ompi_info_t *info, int win->w_acc_ops = (ompi_win_accumulate_ops_t)acc_ops; - ret = ompi_info_get_value_enum (info, "accumulate_order", &acc_order, + ret = opal_info_get_value_enum (info, "accumulate_order", &acc_order, OMPI_WIN_ACC_ORDER_RAR | OMPI_WIN_ACC_ORDER_WAR | OMPI_WIN_ACC_ORDER_RAW | OMPI_WIN_ACC_ORDER_WAW, &(ompi_win_accumulate_order->super), &flag); @@ -221,7 +224,7 @@ config_window(void *base, size_t size, int disp_unit, int ompi_win_create(void *base, size_t size, int disp_unit, ompi_communicator_t *comm, - ompi_info_t *info, + opal_info_t *info, ompi_win_t** newwin) { ompi_win_t *win; @@ -252,7 +255,7 @@ ompi_win_create(void *base, size_t size, int -ompi_win_allocate(size_t size, int disp_unit, ompi_info_t *info, +ompi_win_allocate(size_t size, int disp_unit, opal_info_t *info, ompi_communicator_t *comm, void *baseptr, ompi_win_t **newwin) { ompi_win_t *win; @@ -285,7 +288,7 @@ ompi_win_allocate(size_t size, int disp_unit, ompi_info_t *info, int -ompi_win_allocate_shared(size_t size, int disp_unit, ompi_info_t *info, +ompi_win_allocate_shared(size_t size, int disp_unit, opal_info_t *info, ompi_communicator_t *comm, void *baseptr, ompi_win_t **newwin) { ompi_win_t *win; @@ -318,7 +321,7 @@ ompi_win_allocate_shared(size_t size, int disp_unit, ompi_info_t *info, int -ompi_win_create_dynamic(ompi_info_t *info, ompi_communicator_t *comm, ompi_win_t **newwin) +ompi_win_create_dynamic(opal_info_t *info, ompi_communicator_t *comm, ompi_win_t **newwin) { ompi_win_t *win; int model; diff --git a/ompi/win/win.h b/ompi/win/win.h index bd49bb69279..d93951c0945 100644 --- a/ompi/win/win.h +++ b/ompi/win/win.h @@ -14,6 +14,7 @@ * Copyright (c) 2009 Sun Microsystems, Inc. All rights reserved. * Copyright (c) 2013-2015 Los Alamos National Security, LLC. All rights * reserved. + * Copyright (c) 2016 IBM Corp. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -29,6 +30,7 @@ #include "opal/class/opal_object.h" #include "opal/class/opal_hash_table.h" +#include "opal/util/info_subscriber.h" #include "ompi/errhandler/errhandler.h" #include "ompi/info/info.h" #include "ompi/communicator/communicator.h" @@ -73,12 +75,12 @@ OMPI_DECLSPEC extern mca_base_var_enum_flag_t *ompi_win_accumulate_order; OMPI_DECLSPEC extern opal_pointer_array_t ompi_mpi_windows; struct ompi_win_t { - opal_object_t w_base; + opal_infosubscriber_t super; opal_mutex_t w_lock; char w_name[MPI_MAX_OBJECT_NAME]; - + /* Group associated with this window. */ ompi_group_t *w_group; @@ -132,13 +134,13 @@ int ompi_win_init(void); int ompi_win_finalize(void); int ompi_win_create(void *base, size_t size, int disp_unit, - ompi_communicator_t *comm, ompi_info_t *info, + ompi_communicator_t *comm, opal_info_t *info, ompi_win_t **newwin); -int ompi_win_allocate(size_t size, int disp_unit, ompi_info_t *info, +int ompi_win_allocate(size_t size, int disp_unit, opal_info_t *info, ompi_communicator_t *comm, void *baseptr, ompi_win_t **newwin); -int ompi_win_allocate_shared(size_t size, int disp_unit, ompi_info_t *info, +int ompi_win_allocate_shared(size_t size, int disp_unit, opal_info_t *info, ompi_communicator_t *comm, void *baseptr, ompi_win_t **newwin); -int ompi_win_create_dynamic(ompi_info_t *info, ompi_communicator_t *comm, ompi_win_t **newwin); +int ompi_win_create_dynamic(opal_info_t *info, ompi_communicator_t *comm, ompi_win_t **newwin); int ompi_win_free(ompi_win_t *win); diff --git a/opal/mca/mpool/base/mpool_base_alloc.c b/opal/mca/mpool/base/mpool_base_alloc.c index 605ffbdf280..af396191c1d 100644 --- a/opal/mca/mpool/base/mpool_base_alloc.c +++ b/opal/mca/mpool/base/mpool_base_alloc.c @@ -11,7 +11,7 @@ * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. * Copyright (c) 2009 Sun Microsystems, Inc. All rights reserved. - * Copyright (c) 2010 IBM Corporation. All rights reserved. + * Copyright (c) 2010-2016 IBM Corp. All rights reserved. * Copyright (c) 2015 Los Alamos National Security, LLC. All rights * reserved. * $COPYRIGHT$ @@ -28,20 +28,7 @@ #include "base.h" #include "mpool_base_tree.h" #include "opal/threads/mutex.h" - -struct opal_info_t { - opal_list_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 */ - opal_mutex_t *i_lock; - /**< Mutex for thread safety */ - bool i_freed; - /**< Whether this info has been freed or not */ -}; -typedef struct opal_info_t opal_info_t; +#include "opal/util/info.h" static void unregister_tree_item(mca_mpool_base_tree_item_t *mpool_tree_item) diff --git a/opal/util/Makefile.am b/opal/util/Makefile.am index edaec77742d..5a396a4dfc6 100644 --- a/opal/util/Makefile.am +++ b/opal/util/Makefile.am @@ -16,6 +16,7 @@ # reserved. # Copyright (c) 2016 Research Organization for Information Science # and Technology (RIST). All rights reserved. +# Copyright (c) 2016 IBM Corp. All rights reserved. # $COPYRIGHT$ # # Additional copyrights may follow @@ -70,7 +71,9 @@ headers = \ strncpy.h \ sys_limits.h \ timings.h \ - uri.h + uri.h \ + info_subscriber.h \ + info.h libopalutil_la_SOURCES = \ $(headers) \ @@ -105,7 +108,9 @@ libopalutil_la_SOURCES = \ stacktrace.c \ strncpy.c \ sys_limits.c \ - uri.c + uri.c \ + info_subscriber.c \ + info.c if OPAL_COMPILE_TIMING libopalutil_la_SOURCES += timings.c diff --git a/opal/util/info.c b/opal/util/info.c new file mode 100644 index 00000000000..c7232562e7e --- /dev/null +++ b/opal/util/info.c @@ -0,0 +1,487 @@ +/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ +/* + * Copyright (c) 2004-2005 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-2015 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) 2015 Research Organization for Information Science + * and Technology (RIST). All rights reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + +#include +#include +#include +#ifdef HAVE_UNISTD_H +#include +#endif +#include +#include +#ifdef HAVE_SYS_UTSNAME_H +#include +#endif +#include + +#include "opal/util/argv.h" +#include "opal/util/opal_getcwd.h" +#include "opal/util/output.h" +#include "opal/util/strncpy.h" + +#include "opal/util/info.h" +#ifdef XXX +#include "ompi/runtime/mpiruntime.h" +#include "ompi/runtime/params.h" +#endif + + +/* + * Local functions + */ +static void info_constructor(opal_info_t *info); +static void info_destructor(opal_info_t *info); +static void info_entry_constructor(opal_info_entry_t *entry); +static void info_entry_destructor(opal_info_entry_t *entry); +static opal_info_entry_t *info_find_key (opal_info_t *info, const char *key); + + +/* + * opal_info_t classes + */ +OBJ_CLASS_INSTANCE(opal_info_t, + opal_list_t, + info_constructor, + info_destructor); + +/* + * opal_info_entry_t classes + */ +OBJ_CLASS_INSTANCE(opal_info_entry_t, + opal_list_item_t, + info_entry_constructor, + info_entry_destructor); + + + +/* + * Duplicate an info + */ +int opal_info_dup (opal_info_t *info, opal_info_t **newinfo) +{ + int err; + opal_list_item_t *item; + opal_info_entry_t *iterator; + + OPAL_THREAD_LOCK(info->i_lock); + for (item = opal_list_get_first(&(info->super)); + item != opal_list_get_end(&(info->super)); + item = opal_list_get_next(iterator)) { + iterator = (opal_info_entry_t *) item; + err = opal_info_set(*newinfo, iterator->ie_key, iterator->ie_value); + if (MPI_SUCCESS != err) { + OPAL_THREAD_UNLOCK(info->i_lock); + return err; + } + } + OPAL_THREAD_UNLOCK(info->i_lock); + return MPI_SUCCESS; +} + + +/* + * Set a value on the info + */ +int opal_info_set (opal_info_t *info, const char *key, const char *value) +{ + char *new_value; + opal_info_entry_t *new_info; + opal_info_entry_t *old_info; + + new_value = strdup(value); + if (NULL == new_value) { + return MPI_ERR_NO_MEM; + } + + OPAL_THREAD_LOCK(info->i_lock); + old_info = info_find_key (info, key); + if (NULL != old_info) { + /* + * key already exists. remove the value associated with it + */ + free(old_info->ie_value); + old_info->ie_value = new_value; + } else { + new_info = OBJ_NEW(opal_info_entry_t); + if (NULL == new_info) { + free(new_value); + OPAL_THREAD_UNLOCK(info->i_lock); + return MPI_ERR_NO_MEM; + } + strncpy (new_info->ie_key, key, MPI_MAX_INFO_KEY); + new_info->ie_value = new_value; + opal_list_append (&(info->super), (opal_list_item_t *) new_info); + } + OPAL_THREAD_UNLOCK(info->i_lock); + return MPI_SUCCESS; +} + + +int opal_info_set_value_enum (opal_info_t *info, const char *key, int value, + mca_base_var_enum_t *var_enum) +{ + char *string_value; + int ret; + + ret = var_enum->string_from_value (var_enum, value, &string_value); + if (OPAL_SUCCESS != ret) { + return ret; + } + + return opal_info_set (info, key, string_value); +} + + +/* + * Get a value from an info + */ +int opal_info_get (opal_info_t *info, const char *key, int valuelen, + char *value, int *flag) +{ + opal_info_entry_t *search; + int value_length; + + OPAL_THREAD_LOCK(info->i_lock); + search = info_find_key (info, key); + if (NULL == search){ + *flag = 0; + } else { + /* + * We have found the element, so we can return the value + * Set the flag, value_length and value + */ + *flag = 1; + value_length = strlen(search->ie_value); + /* + * If the stored value is shorter than valuelen, then + * we can copy the entire value out. Else, we have to + * copy ONLY valuelen bytes out + */ + if (value_length < valuelen ) { + strcpy(value, search->ie_value); + } else { + opal_strncpy(value, search->ie_value, valuelen); + if (MPI_MAX_INFO_VAL == valuelen) { + value[valuelen-1] = 0; + } else { + value[valuelen] = 0; + } + } + } + OPAL_THREAD_UNLOCK(info->i_lock); + return MPI_SUCCESS; +} + +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) +{ + opal_info_entry_t *search; + int ret; + + *value = default_value; + + OPAL_THREAD_LOCK(info->i_lock); + search = info_find_key (info, key); + if (NULL == search){ + OPAL_THREAD_UNLOCK(info->i_lock); + *flag = 0; + return MPI_SUCCESS; + } + + /* we found a mathing key. pass the string value to the enumerator and + * return */ + *flag = 1; + + ret = var_enum->value_from_string (var_enum, search->ie_value, value); + OPAL_THREAD_UNLOCK(info->i_lock); + + return ret; +} + + +/* + * Similar to opal_info_get(), but cast the result into a boolean + * using some well-defined rules. + */ +int opal_info_get_bool(opal_info_t *info, char *key, bool *value, int *flag) +{ + char str[256]; + + str[sizeof(str) - 1] = '\0'; + opal_info_get(info, key, sizeof(str) - 1, str, flag); + if (*flag) { + *value = opal_str_to_bool(str); + } + + return MPI_SUCCESS; +} + + +bool +opal_str_to_bool(char *str) +{ + bool result = false; + char *ptr; + + /* Trim whitespace */ + ptr = str + sizeof(str) - 1; + while (ptr >= str && isspace(*ptr)) { + *ptr = '\0'; + --ptr; + } + ptr = str; + while (ptr < str + sizeof(str) - 1 && *ptr != '\0' && + isspace(*ptr)) { + ++ptr; + } + if ('\0' != *ptr) { + if (isdigit(*ptr)) { + result = (bool) atoi(ptr); + } else if (0 == strcasecmp(ptr, "yes") || + 0 == strcasecmp(ptr, "true")) { + result = true; + } else if (0 != strcasecmp(ptr, "no") && + 0 != strcasecmp(ptr, "false")) { + /* RHC unrecognized value -- print a warning? */ + } + } + return result; +} + +/* + * Delete a key from an info + */ +int opal_info_delete(opal_info_t *info, const char *key) +{ + opal_info_entry_t *search; + + OPAL_THREAD_LOCK(info->i_lock); + search = info_find_key (info, key); + if (NULL == search){ + OPAL_THREAD_UNLOCK(info->i_lock); + return MPI_ERR_INFO_NOKEY; + } else { + /* + * An entry with this key value was found. Remove the item + * and free the memory allocated to it. + * As this key *must* be available, we do not check for errors. + */ + opal_list_remove_item (&(info->super), + (opal_list_item_t *)search); + OBJ_RELEASE(search); + } + OPAL_THREAD_UNLOCK(info->i_lock); + return MPI_SUCCESS; +} + + +/* + * Return the length of a value + */ +int opal_info_get_valuelen (opal_info_t *info, const char *key, int *valuelen, + int *flag) +{ + opal_info_entry_t *search; + + OPAL_THREAD_LOCK(info->i_lock); + search = info_find_key (info, key); + if (NULL == search){ + *flag = 0; + } else { + /* + * We have found the element, so we can return the value + * Set the flag, value_length and value + */ + *flag = 1; + *valuelen = strlen(search->ie_value); + } + OPAL_THREAD_UNLOCK(info->i_lock); + return MPI_SUCCESS; +} + + +/* + * Get the nth key + */ +int opal_info_get_nthkey (opal_info_t *info, int n, char *key) +{ + opal_info_entry_t *iterator; + + /* + * Iterate over and over till we get to the nth key + */ + OPAL_THREAD_LOCK(info->i_lock); + for (iterator = (opal_info_entry_t *)opal_list_get_first(&(info->super)); + n > 0; + --n) { + iterator = (opal_info_entry_t *)opal_list_get_next(iterator); + if (opal_list_get_end(&(info->super)) == + (opal_list_item_t *) iterator) { + OPAL_THREAD_UNLOCK(info->i_lock); + return MPI_ERR_ARG; + } + } + /* + * iterator is of the type opal_list_item_t. We have to + * cast it to opal_info_entry_t before we can use it to + * access the value + */ + strncpy(key, iterator->ie_key, MPI_MAX_INFO_KEY); + OPAL_THREAD_UNLOCK(info->i_lock); + return MPI_SUCCESS; +} + + + +/* + * This function is invoked when OBJ_NEW() is called. Here, we add this + * info pointer to the table and then store its index as the handle + */ +static void info_constructor(opal_info_t *info) +{ + info->i_lock = OBJ_NEW(opal_mutex_t); +} + +/* + * This function is called during OBJ_DESTRUCT of "info". When this + * done, we need to remove the entry from the opal fortran to C + * translation table + */ +static void info_destructor(opal_info_t *info) +{ + opal_list_item_t *item; + opal_info_entry_t *iterator; + + /* Remove every key in the list */ + + for (item = opal_list_remove_first(&(info->super)); + NULL != item; + item = opal_list_remove_first(&(info->super))) { + iterator = (opal_info_entry_t *) item; + OBJ_RELEASE(iterator); + } + + /* Release the lock */ + + OBJ_RELEASE(info->i_lock); +} + + +/* + * opal_info_entry_t interface functions + */ +static void info_entry_constructor(opal_info_entry_t *entry) +{ + memset(entry->ie_key, 0, sizeof(entry->ie_key)); + entry->ie_key[MPI_MAX_INFO_KEY] = 0; +} + + +static void info_entry_destructor(opal_info_entry_t *entry) +{ + if (NULL != entry->ie_value) { + free(entry->ie_value); + } +} + + +/* + * Find a key + * + * Do NOT thread lock in here -- the calling function is responsible + * for that. + */ +static opal_info_entry_t *info_find_key (opal_info_t *info, const char *key) +{ + opal_info_entry_t *iterator; + + /* No thread locking in here! */ + + /* Iterate over all the entries. If the key is found, then + * return immediately. Else, the loop will fall of the edge + * and NULL is returned + */ + for (iterator = (opal_info_entry_t *)opal_list_get_first(&(info->super)); + opal_list_get_end(&(info->super)) != (opal_list_item_t*) iterator; + iterator = (opal_info_entry_t *)opal_list_get_next(iterator)) { + if (0 == strcmp(key, iterator->ie_key)) { + return iterator; + } + } + return NULL; +} + + +int +opal_info_value_to_int(char *value, int *interp) +{ + long tmp; + char *endp; + + if (NULL == value || '\0' == value[0]) return OPAL_ERR_BAD_PARAM; + + errno = 0; + tmp = strtol(value, &endp, 10); + /* we found something not a number */ + if (*endp != '\0') return OPAL_ERR_BAD_PARAM; + /* underflow */ + if (tmp == 0 && errno == EINVAL) return OPAL_ERR_BAD_PARAM; + + *interp = (int) tmp; + + return OPAL_SUCCESS; +} + + +int +opal_info_value_to_bool(char *value, bool *interp) +{ + int tmp; + + /* idiot case */ + if (NULL == value || NULL == interp) return OPAL_ERR_BAD_PARAM; + + /* is it true / false? */ + if (0 == strcmp(value, "true")) { + *interp = true; + return OPAL_SUCCESS; + } else if (0 == strcmp(value, "false")) { + *interp = false; + return OPAL_SUCCESS; + + /* is it a number? */ + } else if (OPAL_SUCCESS == opal_info_value_to_int(value, &tmp)) { + if (tmp == 0) { + *interp = false; + } else { + *interp = true; + } + return OPAL_SUCCESS; + } + + return OPAL_ERR_BAD_PARAM; +} + diff --git a/opal/util/info.h b/opal/util/info.h new file mode 100644 index 00000000000..fedeab626ee --- /dev/null +++ b/opal/util/info.h @@ -0,0 +1,306 @@ +/* -*- 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 + +#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 */ diff --git a/opal/util/info_subscriber.c b/opal/util/info_subscriber.c new file mode 100644 index 00000000000..845538c1865 --- /dev/null +++ b/opal/util/info_subscriber.c @@ -0,0 +1,250 @@ +/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ +/* + * Copyright (c) 2004-2005 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-2015 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) 2015 Research Organization for Information Science + * and Technology (RIST). All rights reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + +#include +#include +#include +#ifdef HAVE_UNISTD_H +#include +#endif +#include +#include +#ifdef HAVE_SYS_UTSNAME_H +#include +#endif +#include + +#include "opal/util/argv.h" +#include "opal/util/opal_getcwd.h" +#include "opal/util/output.h" +#include "opal/util/strncpy.h" +#include "opal/util/info_subscriber.h" + +static char* opal_infosubscribe_inform_subscribers(opal_infosubscriber_t * object, char *key, char *new_value); +static void infosubscriber_construct(opal_infosubscriber_t *obj); +static void infosubscriber_destruct(opal_infosubscriber_t *obj); + +/* + * Local structures + */ + +typedef struct opal_callback_list_t opal_callback_list_t; + +struct opal_callback_list_item_t { + opal_list_item_t super; + char *default_value; + opal_key_interest_callback_t *callback; +}; +typedef struct opal_callback_list_item_t opal_callback_list_item_t; + +OPAL_DECLSPEC OBJ_CLASS_DECLARATION(opal_infosubscriber_t); +OBJ_CLASS_INSTANCE(opal_infosubscriber_t, + opal_object_t, + infosubscriber_construct, + infosubscriber_destruct); + +OPAL_DECLSPEC OBJ_CLASS_DECLARATION(opal_callback_list_item_t); +OBJ_CLASS_INSTANCE(opal_callback_list_item_t, + opal_list_item_t, + NULL, + NULL); + +static void infosubscriber_construct(opal_infosubscriber_t *obj) { + OBJ_CONSTRUCT(&obj->s_subscriber_table, opal_hash_table_t); + opal_hash_table_init(&obj->s_subscriber_table, 10); +} + +static void infosubscriber_destruct(opal_infosubscriber_t *obj) { + OBJ_DESTRUCT(&obj->s_subscriber_table); +} + +static char* opal_infosubscribe_inform_subscribers(opal_infosubscriber_t *object, char *key, char *new_value) +{ + opal_hash_table_t *table = &object->s_subscriber_table; + opal_list_t *list = NULL; + opal_callback_list_item_t *item; + char *updated_value = NULL; + +/* + * Present the new value to each subscriber. They can decide to accept it, ignore it, or + * over-ride it with their own value (like ignore, but they specify what value they want it to have). + * + * Since multiple subscribers could set values, only the last setting is kept as the + * returned value. + */ + if (table) { + opal_hash_table_get_value_ptr(table, key, strlen(key), (void**) &list); + + if (list) { + updated_value = new_value; + OPAL_LIST_FOREACH(item, list, opal_callback_list_item_t) { + updated_value = item->callback(object, key, updated_value); + } + } + } + + return updated_value; +} + + + + +int +opal_infosubscribe_change_info(opal_infosubscriber_t *object, opal_info_t *new_info) +{ + int err; + size_t key_size; + int flag; + opal_info_entry_t *iterator; + opal_info_t **old_info = &object->s_info; + opal_info_t *real_info; + char *updated_value; + void *node = NULL; + char *next_key; + opal_hash_table_t *table = &object->s_subscriber_table; + opal_callback_list_item_t *item; + opal_list_t *list = NULL; + + /* for each key/value in new info, let subscribers know of new value */ + + real_info = OBJ_NEW(opal_info_t); + + OPAL_LIST_FOREACH(iterator, &new_info->super, opal_info_entry_t) { + + if ((updated_value = opal_infosubscribe_inform_subscribers(object, iterator->ie_key, iterator->ie_value))) { + err = opal_info_set(real_info, iterator->ie_key, updated_value); + if (MPI_SUCCESS != err) { + return err; + } + } + } + +/* + * Now any values in the old_info that were not included in the new info we should + * tell them that they are going away and give a chance to set them in the new info + * SOLT: TODO: This should be a compare with MPI_INFO_NULL?? + */ + if (NULL != *old_info) { + + /* let subscribers know it is going away, they may set a new value for it */ + + OPAL_LIST_FOREACH(iterator, &(*old_info)->super, opal_info_entry_t) { + +/* + * See if this is updated in the new_info. If so, we don't need to tell them about it + * going away, we already told them about the value change. + */ + err = opal_info_get (new_info, iterator->ie_key, 0, NULL, &flag); + if (MPI_SUCCESS != err) { + return err; + } + + if (!flag && (updated_value = opal_infosubscribe_inform_subscribers(object, iterator->ie_key, NULL))) { + err = opal_info_set(real_info, iterator->ie_key, updated_value); + if (MPI_SUCCESS != err) { + return err; + } + } + } + + /* Clear old info */ + OBJ_DESTRUCT(old_info); + + } else { +/* + * If there is no old_info, then this is the first time that we are setting something and we should set all + * defaults that were not changed in new_info + */ + err = opal_hash_table_get_first_key_ptr(table, (void**) &next_key, &key_size, (void**) &list, &node); + + + while (list && err == OPAL_SUCCESS) { + + err = opal_info_get (new_info, next_key, 0, NULL, &flag); + if (MPI_SUCCESS != err) { + return err; + } +/* + * Figure out which subscriber's default value we will take. (Psst, we are going to + * take the first one we see) + */ + updated_value = NULL; + OPAL_LIST_FOREACH(item, list, opal_callback_list_item_t) { + if (item->default_value) { + updated_value = item->default_value; + break; + } + } + + if (updated_value) { + err = opal_info_set(real_info, next_key, updated_value); + } + } + + err = opal_hash_table_get_next_key_ptr(table, (void**) next_key, &key_size, (void**) &list, node, &node); + } + + *old_info = real_info; + + return OPAL_SUCCESS; +} + +int opal_infosubscribe_subscribe(opal_infosubscriber_t *object, char *key, char *value, opal_key_interest_callback_t *callback) +{ + opal_list_t *list = NULL; + opal_hash_table_t *table = &object->s_subscriber_table; + opal_callback_list_item_t *callback_list_item; + + if (table) { + opal_hash_table_get_value_ptr(table, key, strlen(key), (void**) &list); + + if (!list) { + list = OBJ_NEW(opal_list_t); + opal_hash_table_set_value_ptr(table, key, strlen(key), list); + } + + callback_list_item = OBJ_NEW(opal_callback_list_item_t); + callback_list_item->callback = callback; + if (value) { + callback_list_item->default_value = strdup(value); + } else { + callback_list_item->default_value = NULL; + } + + opal_list_append(list, (opal_list_item_t*) callback_list_item); + } else { +/* + * TODO: This should not happen + */ + } + + return OPAL_SUCCESS; +} + +/* + OBJ_DESTRUCT(&opal_comm_info_hashtable); + OBJ_DESTRUCT(&opal_win_info_hashtable); + OBJ_DESTRUCT(&opal_file_info_hashtable); +*/ diff --git a/opal/util/info_subscriber.h b/opal/util/info_subscriber.h new file mode 100644 index 00000000000..e3c856d34e0 --- /dev/null +++ b/opal/util/info_subscriber.h @@ -0,0 +1,83 @@ +/* -*- 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 OMPI_INFOSUBSCRIBE_H +#define OMPI_INFOSUBSCRIBE_H + +#include + +#include "opal/class/opal_list.h" +#include "opal/class/opal_pointer_array.h" +#include "opal/class/opal_hash_table.h" +#include "opal/threads/mutex.h" +#include "opal/util/info.h" + +#include "opal/mca/base/mca_base_var_enum.h" + + +#define INFO_SUBSCRIBER_SIZE 5 + +struct opal_infosubscriber_t { + opal_object_t s_base; + opal_hash_table_t s_subscriber_table; + opal_info_t *s_info; +}; +typedef struct opal_infosubscriber_t opal_infosubscriber_t; + +OPAL_DECLSPEC OBJ_CLASS_DECLARATION(opal_infosubscriber_t); + +typedef char*(opal_key_interest_callback_t)(opal_infosubscriber_t*, char*, char*); + +/** + * opal_infosubscribe_change_info - Make changes to a Comm/Win/File Info + * + * @param type Comm/Win/File + * @param object corresponding Com/Win/File object + * @param old_info previous info setting + * @param new_info new info setting + * + * @retval OPAL status + * + * Notifies subscribers of info's that have gone away and new info settings + */ +int opal_infosubscribe_change_info(opal_infosubscriber_t*, opal_info_t *); + + +/** + * opal_infosubscribe_subscribe - Request to be updated about info changes to a Comm/Win/File Info + * + * @param type Comm/Win/File of obj + * @param obj either a comm, win or file + * @param key info key being set + * @param initial_value default value (or NULL if none) + * @param callback callback to be called when key changes + * + * @retval OPAL status + * + * Notifies subscribers of info's that have gone away and new info settings + * Does not try to optimize settings that are the same between old and new + * info's. + */ +int opal_infosubscribe_subscribe(opal_infosubscriber_t*, char *, char *, opal_key_interest_callback_t); + +#endif /* OMPI_INFO_H */ diff --git a/oshmem/runtime/oshmem_info_support.c b/oshmem/runtime/oshmem_info_support.c index 3a80690e37e..033fe47a73d 100644 --- a/oshmem/runtime/oshmem_info_support.c +++ b/oshmem/runtime/oshmem_info_support.c @@ -2,6 +2,7 @@ * Copyright (c) 2013 Mellanox Technologies, Inc. * All rights reserved. * Copyright (c) 2014 Cisco Systems, Inc. All rights reserved. + * Copyright (c) 2016 IBM Corp. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -57,7 +58,7 @@ int oshmem_info_register_framework_params(opal_pointer_array_t *component_map) } /* Do OMPI interface call */ - rc = ompi_info_register_framework_params(component_map); + rc = opal_info_register_framework_params(component_map); if (OMPI_SUCCESS != rc) { return rc; } @@ -74,7 +75,7 @@ void oshmem_info_close_components(void) } /* Do OMPI interface call */ - ompi_info_close_components(); + opal_info_close_components(); } void oshmem_info_show_oshmem_version(const char *scope) diff --git a/oshmem/tools/oshmem_info/oshmem_info.c b/oshmem/tools/oshmem_info/oshmem_info.c index d51658db4d3..991609c9b13 100644 --- a/oshmem/tools/oshmem_info/oshmem_info.c +++ b/oshmem/tools/oshmem_info/oshmem_info.c @@ -3,6 +3,7 @@ * All rights reserved. * Copyright (c) 2014 Intel, Inc. All rights reserved. * + * Copyright (c) 2016 IBM Corp. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -111,7 +112,7 @@ int main(int argc, char *argv[]) #endif /* add in the ompi frameworks */ - ompi_info_register_types(&mca_types); + opal_info_register_types(&mca_types); /* add in the oshmem frameworks */ oshmem_info_register_types(&mca_types); diff --git a/oshmem/tools/oshmem_info/param.c b/oshmem/tools/oshmem_info/param.c index b3c802276fe..aedd844ed8f 100644 --- a/oshmem/tools/oshmem_info/param.c +++ b/oshmem/tools/oshmem_info/param.c @@ -5,6 +5,7 @@ * Copyright (c) 2014-2015 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2014-2016 Research Organization for Information Science * and Technology (RIST). All rights reserved. + * Copyright (c) 2016 IBM Corp. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -46,7 +47,7 @@ #include "oshmem/tools/oshmem_info/oshmem_info.h" -const char *ompi_info_deprecated_value = "deprecated-ompi-info-value"; +const char *opal_info_deprecated_value = "deprecated-ompi-info-value"; static void append(char *dest, size_t max, int *first, char *src) { @@ -297,7 +298,7 @@ void oshmem_info_do_config(bool want_all) opal_info_out("Fort use mpi", "bindings:use_mpi", fortran_usempi); opal_info_out("Fort use mpi size", "bindings:use_mpi:size", - ompi_info_deprecated_value); + opal_info_deprecated_value); opal_info_out("Fort use mpi_f08", "bindings:use_mpi_f08", fortran_usempif08); opal_info_out("Fort mpi_f08 compliance", "bindings:use_mpi_f08:compliance", From 482d84b6e54126eb025fbacc9f6f454c4ea14041 Mon Sep 17 00:00:00 2001 From: Mark Allen Date: Mon, 30 Jan 2017 20:29:50 -0500 Subject: [PATCH 2/2] fixes for Dave's get/set info code The expected sequence of events for processing info during object creation is that if there's an incoming info arg, it is opal_info_dup()ed into the obj at obj->s_info first. Then interested components register callbacks for keys they want to know about using opal_infosubscribe_infosubscribe(). Inside info_subscribe_subscribe() the specified callback() is called with whatever matching k/v is in the object's info, or with the default. The return string from the callback goes into the new k/v stored in info, and the input k/v is saved as __IN_/. It's saved the same way whether the input came from info or whether it was a default. A null return from the callback indicates an ignored key/val, and no k/v is stored for it, but an __IN_/ is still kept so we still have access to the original. At MPI_*_set_info() time, opal_infosubscribe_change_info() is used. That function calls the registered callbacks for each item in the provided info. If the callback returns non-null, the info is updated with that k/v, or if the callback returns null, that key is deleted from info. An __IN_/ is saved either way, and overwrites any previously saved value. When MPI_*_get_info() is called, opal_info_dup_mpistandard() is used, which allows relatively easy changes in interpretation of the standard, by looking at both the / and __IN_/ in info. Right now it does 1. includes system extras, eg k/v defaults not expliclty set by the user 2. omits ignored keys 3. shows input values, not callback modifications, eg not the internal values Currently the callbacks are doing things like return some_condition ? "true" : "false" that is, returning static strings that are not to be freed. If the return strings start becoming more dynamic in the future I don't see how unallocated strings could support that, so I'd propose a change for the future that the callback()s registered with info_subscribe_subscribe() do a strdup on their return, and we change the callers of callback() to free the strings it returns (there are only two callers). Rough outline of the smaller changes spread over the less central files: comm.c initialize comm->super.s_info to NULL copy into comm->super.s_info in comm creation calls that provide info OBJ_RELEASE comm->super.s_info at free time comm_init.c initialize comm->super.s_info to NULL file.c copy into file->super.s_info if file creation provides info OBJ_RELEASE file->super.s_info at free time win.c copy into win->super.s_info if win creation provides info OBJ_RELEASE win->super.s_info at free time comm_get_info.c file_get_info.c win_get_info.c change_info() if there's no info attached (shouldn't happen if callbacks are registered) copy the info for the user The other category of change is generally addressing compiler warnings where ompi_info_t and opal_info_t were being used a little too interchangably. An ompi_info_t* contains an opal_info_t*, at &(ompi_info->super) Also this commit updates the copyrights. Signed-off-by: Mark Allen --- AUTHORS | 2 - ompi/communicator/comm.c | 28 +- ompi/communicator/comm_init.c | 3 +- ompi/communicator/communicator.h | 2 +- ompi/debuggers/predefined_gap_test.c | 2 +- ompi/dpm/dpm.c | 43 ++- ompi/file/file.c | 18 +- ompi/file/file.h | 2 +- ompi/info/info.c | 57 ++- ompi/info/info.h | 57 ++- ompi/interlib/interlib.c | 2 + .../mca/common/ompio/common_ompio_file_open.c | 3 +- .../mca/common/ompio/common_ompio_file_view.c | 1 + ompi/mca/fs/fs.h | 3 +- ompi/mca/fs/lustre/fs_lustre.h | 2 +- ompi/mca/fs/lustre/fs_lustre_file_delete.c | 2 +- ompi/mca/fs/lustre/fs_lustre_file_open.c | 2 +- ompi/mca/fs/plfs/fs_plfs.h | 2 +- ompi/mca/fs/plfs/fs_plfs_file_delete.c | 2 +- ompi/mca/fs/plfs/fs_plfs_file_open.c | 2 +- ompi/mca/fs/pvfs2/fs_pvfs2.h | 2 +- ompi/mca/fs/pvfs2/fs_pvfs2_file_delete.c | 2 +- ompi/mca/fs/pvfs2/fs_pvfs2_file_open.c | 2 +- ompi/mca/fs/ufs/fs_ufs.h | 2 +- ompi/mca/fs/ufs/fs_ufs_file_delete.c | 2 +- ompi/mca/fs/ufs/fs_ufs_file_open.c | 2 +- ompi/mca/io/base/base.h | 2 +- ompi/mca/io/base/io_base_delete.c | 2 +- ompi/mca/io/base/io_base_file_select.c | 2 +- ompi/mca/io/io.h | 3 +- ompi/mca/io/ompio/io_ompio.h | 2 +- ompi/mca/io/ompio/io_ompio_component.c | 2 +- ompi/mca/io/ompio/io_ompio_file_open.c | 2 +- ompi/mca/io/ompio/io_ompio_file_set_view.c | 2 +- ompi/mca/io/ompio/io_ompio_module.c | 2 +- ompi/mca/io/romio314/src/io_romio314.h | 2 +- .../io/romio314/src/io_romio314_component.c | 14 +- .../io/romio314/src/io_romio314_file_open.c | 49 ++- ompi/mca/io/romio314/src/io_romio314_module.c | 3 +- ompi/mca/osc/base/base.h | 2 +- ompi/mca/osc/base/osc_base_init.c | 2 +- ompi/mca/osc/osc.h | 2 +- ompi/mca/osc/portals4/osc_portals4.h | 2 +- .../mca/osc/portals4/osc_portals4_component.c | 2 +- ompi/mca/osc/pt2pt/osc_pt2pt.h | 2 +- ompi/mca/osc/pt2pt/osc_pt2pt_component.c | 5 +- ompi/mca/osc/rdma/osc_rdma_component.c | 4 +- ompi/mca/osc/sm/osc_sm.h | 2 +- ompi/mca/osc/sm/osc_sm_component.c | 14 +- ompi/mca/rte/orte/rte_orte.h | 2 +- ompi/mca/sharedfp/addproc/sharedfp_addproc.h | 2 +- .../addproc/sharedfp_addproc_file_open.c | 2 +- .../sharedfp/individual/sharedfp_individual.c | 6 +- .../sharedfp/individual/sharedfp_individual.h | 2 +- .../sharedfp_individual_file_open.c | 6 +- .../sharedfp/lockedfile/sharedfp_lockedfile.h | 2 +- .../sharedfp_lockedfile_file_open.c | 4 +- ompi/mca/sharedfp/sharedfp.h | 3 +- ompi/mca/sharedfp/sm/sharedfp_sm.h | 2 +- ompi/mca/sharedfp/sm/sharedfp_sm_file_open.c | 4 +- ompi/mca/topo/base/base.h | 2 +- .../topo/base/topo_base_dist_graph_create.c | 10 +- .../topo_base_dist_graph_create_adjacent.c | 10 + ompi/mca/topo/topo.h | 2 +- ompi/mca/topo/treematch/topo_treematch.h | 2 +- .../topo_treematch_dist_graph_create.c | 2 +- ompi/mpi/c/alloc_mem.c | 2 +- ompi/mpi/c/comm_dup_with_info.c | 2 +- ompi/mpi/c/comm_get_info.c | 7 +- ompi/mpi/c/comm_set_info.c | 4 +- ompi/mpi/c/comm_spawn.c | 3 +- ompi/mpi/c/comm_spawn_multiple.c | 5 +- ompi/mpi/c/comm_split_type.c | 3 +- ompi/mpi/c/dist_graph_create.c | 3 +- ompi/mpi/c/dist_graph_create_adjacent.c | 3 +- ompi/mpi/c/file_delete.c | 3 +- ompi/mpi/c/file_get_info.c | 7 +- ompi/mpi/c/file_open.c | 3 +- ompi/mpi/c/file_set_info.c | 4 +- ompi/mpi/c/file_set_view.c | 3 +- ompi/mpi/c/info_delete.c | 3 +- ompi/mpi/c/info_dup.c | 5 +- ompi/mpi/c/info_get.c | 4 +- ompi/mpi/c/info_get_nkeys.c | 3 +- ompi/mpi/c/info_get_nthkey.c | 5 +- ompi/mpi/c/info_get_valuelen.c | 3 +- ompi/mpi/c/info_set.c | 3 +- ompi/mpi/c/lookup_name.c | 3 +- ompi/mpi/c/publish_name.c | 5 +- ompi/mpi/c/unpublish_name.c | 3 +- ompi/mpi/c/win_allocate.c | 3 +- ompi/mpi/c/win_allocate_shared.c | 3 +- ompi/mpi/c/win_create.c | 3 +- ompi/mpi/c/win_create_dynamic.c | 3 +- ompi/mpi/c/win_get_info.c | 7 +- ompi/mpi/c/win_set_info.c | 4 +- ompi/mpiext/cr/c/quiesce_start.c | 2 +- ompi/runtime/ompi_mpi_finalize.c | 2 +- ompi/runtime/ompi_mpi_init.c | 2 +- ompi/win/win.c | 12 +- ompi/win/win.h | 2 +- opal/mca/mpool/base/mpool_base_alloc.c | 2 +- opal/util/Makefile.am | 2 +- opal/util/info.c | 121 ++++++- opal/util/info.h | 29 ++ opal/util/info_subscriber.c | 331 +++++++++++++----- opal/util/info_subscriber.h | 1 + oshmem/runtime/oshmem_info_support.c | 2 +- oshmem/tools/oshmem_info/oshmem_info.c | 2 +- oshmem/tools/oshmem_info/param.c | 2 +- 110 files changed, 800 insertions(+), 258 deletions(-) diff --git a/AUTHORS b/AUTHORS index 596769dc800..0455dfb910f 100644 --- a/AUTHORS +++ b/AUTHORS @@ -84,8 +84,6 @@ Dave Goodell, Cisco dgoodell@cisco.com David Daniel, Los Alamos National Laboratory ddd@lanl.gov -David Solt, IBM - dsolt@us.ibm.com Denis Dimick, Los Alamos National Laboratory dgdimick@lnal.gov Devendar Bureddy, Mellanox diff --git a/ompi/communicator/comm.c b/ompi/communicator/comm.c index d25405da795..0c23d515853 100644 --- a/ompi/communicator/comm.c +++ b/ompi/communicator/comm.c @@ -22,7 +22,7 @@ * and Technology (RIST). All rights reserved. * Copyright (c) 2014-2015 Intel, Inc. All rights reserved. * Copyright (c) 2015 Mellanox Technologies. All rights reserved. - * Copyright (c) 2016 IBM Corp. All rights reserved. + * Copyright (c) 2017 IBM Corporation. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -158,6 +158,7 @@ int ompi_comm_set_nb ( ompi_communicator_t **ncomm, /* ompi_comm_allocate */ newcomm = OBJ_NEW(ompi_communicator_t); + newcomm->super.s_info = NULL; /* fill in the inscribing hyper-cube dimensions */ newcomm->c_cube_dim = opal_cube_dim(local_size); newcomm->c_id_available = MPI_UNDEFINED; @@ -918,6 +919,12 @@ int ompi_comm_split_type (ompi_communicator_t *comm, int split_type, int key, break; } + // Copy info if there is one. + newcomp->super.s_info = OBJ_NEW(opal_info_t); + if (info) { + opal_info_dup(info, &(newcomp->super.s_info)); + } + /* Activate the communicator and init coll-component */ rc = ompi_comm_activate (&newcomp, comm, NULL, NULL, NULL, false, mode); if (OPAL_UNLIKELY(OMPI_SUCCESS != rc)) { @@ -1015,6 +1022,12 @@ int ompi_comm_dup_with_info ( ompi_communicator_t * comm, opal_info_t *info, omp snprintf(newcomp->c_name, MPI_MAX_OBJECT_NAME, "MPI COMMUNICATOR %d DUP FROM %d", newcomp->c_contextid, comm->c_contextid ); + // Copy info if there is one. + newcomp->super.s_info = OBJ_NEW(opal_info_t); + if (info) { + opal_info_dup(info, &(newcomp->super.s_info)); + } + /* activate communicator and init coll-module */ rc = ompi_comm_activate (&newcomp, comm, NULL, NULL, NULL, false, mode); if ( OMPI_SUCCESS != rc ) { @@ -1095,6 +1108,15 @@ static int ompi_comm_idup_internal (ompi_communicator_t *comm, ompi_group_t *gro return rc; } + // Copy info if there is one. + { + ompi_communicator_t *newcomp = context->newcomp; + newcomp->super.s_info = OBJ_NEW(opal_info_t); + if (info) { + opal_info_dup(info, &(newcomp->super.s_info)); + } + } + ompi_comm_request_schedule_append (request, ompi_comm_idup_getcid, subreq, subreq[0] ? 1 : 0); /* assign the newcomm now */ @@ -1472,6 +1494,10 @@ int ompi_comm_free( ompi_communicator_t **comm ) ompi_mpi_comm_parent = &ompi_mpi_comm_null.comm; } + if (NULL != ((*comm)->super.s_info)) { + OBJ_RELEASE((*comm)->super.s_info); + } + /* Release the communicator */ if ( OMPI_COMM_IS_DYNAMIC (*comm) ) { ompi_comm_num_dyncomm --; diff --git a/ompi/communicator/comm_init.c b/ompi/communicator/comm_init.c index eb4258473f0..feb66fa052a 100644 --- a/ompi/communicator/comm_init.c +++ b/ompi/communicator/comm_init.c @@ -21,7 +21,7 @@ * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. * Copyright (c) 2015 Intel, Inc. All rights reserved. - * Copyright (c) 2016 IBM Corp. All rights reserved. + * Copyright (c) 2016-2017 IBM Corporation. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -221,6 +221,7 @@ ompi_communicator_t *ompi_comm_allocate ( int local_size, int remote_size ) /* create new communicator element */ new_comm = OBJ_NEW(ompi_communicator_t); + new_comm->super.s_info = NULL; new_comm->c_local_group = ompi_group_allocate ( local_size ); if ( 0 < remote_size ) { new_comm->c_remote_group = ompi_group_allocate (remote_size); diff --git a/ompi/communicator/communicator.h b/ompi/communicator/communicator.h index f268ce23372..bbfaae7cb78 100644 --- a/ompi/communicator/communicator.h +++ b/ompi/communicator/communicator.h @@ -20,7 +20,7 @@ * Copyright (c) 2014-2015 Intel, Inc. All rights reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. - * Copyright (c) 2017 IBM Corporation. All rights reserved. + * Copyright (c) 2016-2017 IBM Corporation. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow diff --git a/ompi/debuggers/predefined_gap_test.c b/ompi/debuggers/predefined_gap_test.c index aa942348401..0129eb63a23 100644 --- a/ompi/debuggers/predefined_gap_test.c +++ b/ompi/debuggers/predefined_gap_test.c @@ -5,7 +5,7 @@ * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2012-2013 Inria. All rights reserved. - * Copyright (c) 2016 IBM Corp. All rights reserved. + * Copyright (c) 2016-2017 IBM Corporation. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow diff --git a/ompi/dpm/dpm.c b/ompi/dpm/dpm.c index f277805b926..090d8f521b7 100644 --- a/ompi/dpm/dpm.c +++ b/ompi/dpm/dpm.c @@ -18,7 +18,6 @@ * Copyright (c) 2013-2016 Intel, Inc. All rights reserved. * Copyright (c) 2014-2017 Research Organization for Information Science * and Technology (RIST). All rights reserved. - * Copyright (c) 2016 IBM Corp. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -704,7 +703,7 @@ int ompi_dpm_spawn(int count, const char *array_of_commands[], if ( array_of_info != NULL && array_of_info[i] != MPI_INFO_NULL ) { /* check for personality - this is a job-level key */ - opal_info_get (array_of_info[i], "personality", sizeof(host) - 1, host, &flag); + ompi_info_get (array_of_info[i], "personality", sizeof(host) - 1, host, &flag); if ( flag ) { personality = true; info = OBJ_NEW(opal_value_t); @@ -714,7 +713,7 @@ int ompi_dpm_spawn(int count, const char *array_of_commands[], } /* check for 'host' */ - opal_info_get (array_of_info[i], "host", sizeof(host) - 1, host, &flag); + ompi_info_get (array_of_info[i], "host", sizeof(host) - 1, host, &flag); if ( flag ) { info = OBJ_NEW(opal_value_t); info->key = strdup(OPAL_PMIX_HOST); @@ -723,7 +722,7 @@ int ompi_dpm_spawn(int count, const char *array_of_commands[], } /* check for 'hostfile' */ - opal_info_get (array_of_info[i], "hostfile", sizeof(host) - 1, host, &flag); + ompi_info_get (array_of_info[i], "hostfile", sizeof(host) - 1, host, &flag); if ( flag ) { info = OBJ_NEW(opal_value_t); info->key = strdup(OPAL_PMIX_HOSTFILE); @@ -732,7 +731,7 @@ int ompi_dpm_spawn(int count, const char *array_of_commands[], } /* check for 'add-hostfile' */ - opal_info_get (array_of_info[i], "add-hostfile", sizeof(host) - 1, host, &flag); + ompi_info_get (array_of_info[i], "add-hostfile", sizeof(host) - 1, host, &flag); if ( flag ) { info = OBJ_NEW(opal_value_t); info->key = strdup(OPAL_PMIX_ADD_HOSTFILE); @@ -741,7 +740,7 @@ int ompi_dpm_spawn(int count, const char *array_of_commands[], } /* check for 'add-host' */ - opal_info_get (array_of_info[i], "add-host", sizeof(host) - 1, host, &flag); + ompi_info_get (array_of_info[i], "add-host", sizeof(host) - 1, host, &flag); if ( flag ) { info = OBJ_NEW(opal_value_t); info->key = strdup(OPAL_PMIX_ADD_HOST); @@ -750,7 +749,7 @@ int ompi_dpm_spawn(int count, const char *array_of_commands[], } /* check for env */ - opal_info_get (array_of_info[i], "env", sizeof(host)-1, host, &flag); + ompi_info_get (array_of_info[i], "env", sizeof(host)-1, host, &flag); if ( flag ) { envars = opal_argv_split(host, '\n'); for (j=0; NULL != envars[j]; j++) { @@ -766,7 +765,7 @@ int ompi_dpm_spawn(int count, const char *array_of_commands[], * * This is a job-level key */ - opal_info_get (array_of_info[i], "ompi_prefix", sizeof(prefix) - 1, prefix, &flag); + ompi_info_get (array_of_info[i], "ompi_prefix", sizeof(prefix) - 1, prefix, &flag); if ( flag ) { info = OBJ_NEW(opal_value_t); info->key = strdup(OPAL_PMIX_PREFIX); @@ -775,7 +774,7 @@ int ompi_dpm_spawn(int count, const char *array_of_commands[], } /* check for 'wdir' */ - opal_info_get (array_of_info[i], "wdir", sizeof(cwd) - 1, cwd, &flag); + ompi_info_get (array_of_info[i], "wdir", sizeof(cwd) - 1, cwd, &flag); if ( flag ) { info = OBJ_NEW(opal_value_t); info->key = strdup(OPAL_PMIX_WDIR); @@ -785,7 +784,7 @@ int ompi_dpm_spawn(int count, const char *array_of_commands[], } /* check for 'mapper' - a job-level key */ - opal_info_get(array_of_info[i], "mapper", sizeof(mapper) - 1, mapper, &flag); + ompi_info_get(array_of_info[i], "mapper", sizeof(mapper) - 1, mapper, &flag); if ( flag ) { info = OBJ_NEW(opal_value_t); info->key = strdup(OPAL_PMIX_MAPPER); @@ -794,7 +793,7 @@ int ompi_dpm_spawn(int count, const char *array_of_commands[], } /* check for 'display_map' - a job-level key */ - opal_info_get_bool(array_of_info[i], "display_map", &local_spawn, &flag); + ompi_info_get_bool(array_of_info[i], "display_map", &local_spawn, &flag); if ( flag ) { info = OBJ_NEW(opal_value_t); info->key = strdup(OPAL_PMIX_DISPLAY_MAP); @@ -803,7 +802,7 @@ int ompi_dpm_spawn(int count, const char *array_of_commands[], } /* check for 'npernode' and 'ppr' - job-level key */ - opal_info_get (array_of_info[i], "npernode", sizeof(slot_list) - 1, slot_list, &flag); + ompi_info_get (array_of_info[i], "npernode", sizeof(slot_list) - 1, slot_list, &flag); if ( flag ) { info = OBJ_NEW(opal_value_t); info->key = strdup(OPAL_PMIX_PPR); @@ -811,14 +810,14 @@ int ompi_dpm_spawn(int count, const char *array_of_commands[], (void)asprintf(&(info->data.string), "%s:n", slot_list); opal_list_append(&job_info, &info->super); } - opal_info_get (array_of_info[i], "pernode", sizeof(slot_list) - 1, slot_list, &flag); + ompi_info_get (array_of_info[i], "pernode", sizeof(slot_list) - 1, slot_list, &flag); if ( flag ) { info = OBJ_NEW(opal_value_t); info->key = strdup(OPAL_PMIX_PPR); opal_value_load(info, "1:n", OPAL_STRING); opal_list_append(&job_info, &info->super); } - opal_info_get (array_of_info[i], "ppr", sizeof(slot_list) - 1, slot_list, &flag); + ompi_info_get (array_of_info[i], "ppr", sizeof(slot_list) - 1, slot_list, &flag); if ( flag ) { info = OBJ_NEW(opal_value_t); info->key = strdup(OPAL_PMIX_PPR); @@ -827,7 +826,7 @@ int ompi_dpm_spawn(int count, const char *array_of_commands[], } /* check for 'map_by' - job-level key */ - opal_info_get(array_of_info[i], "map_by", sizeof(slot_list) - 1, slot_list, &flag); + ompi_info_get(array_of_info[i], "map_by", sizeof(slot_list) - 1, slot_list, &flag); if ( flag ) { info = OBJ_NEW(opal_value_t); info->key = strdup(OPAL_PMIX_MAPBY); @@ -836,7 +835,7 @@ int ompi_dpm_spawn(int count, const char *array_of_commands[], } /* check for 'rank_by' - job-level key */ - opal_info_get(array_of_info[i], "rank_by", sizeof(slot_list) - 1, slot_list, &flag); + ompi_info_get(array_of_info[i], "rank_by", sizeof(slot_list) - 1, slot_list, &flag); if ( flag ) { info = OBJ_NEW(opal_value_t); info->key = strdup(OPAL_PMIX_RANKBY); @@ -845,7 +844,7 @@ int ompi_dpm_spawn(int count, const char *array_of_commands[], } /* check for 'bind_to' - job-level key */ - opal_info_get(array_of_info[i], "bind_to", sizeof(slot_list) - 1, slot_list, &flag); + ompi_info_get(array_of_info[i], "bind_to", sizeof(slot_list) - 1, slot_list, &flag); if ( flag ) { info = OBJ_NEW(opal_value_t); info->key = strdup(OPAL_PMIX_BINDTO); @@ -854,7 +853,7 @@ int ompi_dpm_spawn(int count, const char *array_of_commands[], } /* check for 'preload_binary' - job-level key */ - opal_info_get_bool(array_of_info[i], "ompi_preload_binary", &local_spawn, &flag); + ompi_info_get_bool(array_of_info[i], "ompi_preload_binary", &local_spawn, &flag); if ( flag ) { info = OBJ_NEW(opal_value_t); info->key = strdup(OPAL_PMIX_PRELOAD_BIN); @@ -863,7 +862,7 @@ int ompi_dpm_spawn(int count, const char *array_of_commands[], } /* check for 'preload_files' - job-level key */ - opal_info_get (array_of_info[i], "ompi_preload_files", sizeof(cwd) - 1, cwd, &flag); + ompi_info_get (array_of_info[i], "ompi_preload_files", sizeof(cwd) - 1, cwd, &flag); if ( flag ) { info = OBJ_NEW(opal_value_t); info->key = strdup(OPAL_PMIX_PRELOAD_FILES); @@ -874,7 +873,7 @@ int ompi_dpm_spawn(int count, const char *array_of_commands[], /* see if this is a non-mpi job - if so, then set the flag so ORTE * knows what to do - job-level key */ - opal_info_get_bool(array_of_info[i], "ompi_non_mpi", &non_mpi, &flag); + ompi_info_get_bool(array_of_info[i], "ompi_non_mpi", &non_mpi, &flag); if (flag && non_mpi) { info = OBJ_NEW(opal_value_t); info->key = strdup(OPAL_PMIX_NON_PMI); @@ -883,7 +882,7 @@ int ompi_dpm_spawn(int count, const char *array_of_commands[], } /* see if this is an MCA param that the user wants applied to the child job */ - opal_info_get (array_of_info[i], "ompi_param", sizeof(params) - 1, params, &flag); + ompi_info_get (array_of_info[i], "ompi_param", sizeof(params) - 1, params, &flag); if ( flag ) { opal_argv_append_unique_nosize(&app->env, params, true); } @@ -891,7 +890,7 @@ int ompi_dpm_spawn(int count, const char *array_of_commands[], /* see if user specified what to do with stdin - defaults to * not forwarding stdin to child processes - job-level key */ - opal_info_get (array_of_info[i], "ompi_stdin_target", sizeof(stdin_target) - 1, stdin_target, &flag); + ompi_info_get (array_of_info[i], "ompi_stdin_target", sizeof(stdin_target) - 1, stdin_target, &flag); if ( flag ) { if (0 == strcmp(stdin_target, "all")) { ui32 = OPAL_VPID_WILDCARD; diff --git a/ompi/file/file.c b/ompi/file/file.c index 1c51fb43d44..53d8eb809d5 100644 --- a/ompi/file/file.c +++ b/ompi/file/file.c @@ -15,7 +15,7 @@ * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. * Copyright (c) 2016 University of Houston. All rights reserved. - * Copyright (c) 2016 IBM Corp. All rights reserved. + * Copyright (c) 2016-2017 IBM Corporation. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -114,11 +114,10 @@ int ompi_file_open(struct ompi_communicator_t *comm, const char *filename, file->f_comm = comm; OBJ_RETAIN(comm); - /* Present the info to the info layer */ - - if (OPAL_SUCCESS != opal_infosubscribe_change_info(&file->super, info)) { - OBJ_RELEASE(file); - return ret; + /* Copy the info for the info layer */ + file->super.s_info = OBJ_NEW(opal_info_t); + if (info) { + opal_info_dup(info, &(file->super.s_info)); } file->f_amode = amode; @@ -310,6 +309,13 @@ static void file_destructor(ompi_file_t *file) #endif } + if (NULL != file->super.s_info) { + OBJ_RELEASE(file->super.s_info); +#if OPAL_ENABLE_DEBUG + file->super.s_info = NULL; +#endif + } + /* Reset the f_to_c table entry */ if (MPI_UNDEFINED != file->f_f_to_c_index && diff --git a/ompi/file/file.h b/ompi/file/file.h index 30c606776f1..73d2cf9ae55 100644 --- a/ompi/file/file.h +++ b/ompi/file/file.h @@ -15,7 +15,7 @@ * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. * Copyright (c) 2016 University of Houston. All rights reserved. - * Copyright (c) 2016 IBM Corp. All rights reserved. + * Copyright (c) 2016-2017 IBM Corporation. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow diff --git a/ompi/info/info.c b/ompi/info/info.c index 71cf85bf8c1..f209ca00574 100644 --- a/ompi/info/info.c +++ b/ompi/info/info.c @@ -16,7 +16,7 @@ * reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. - * Copyright (c) 2016 IBM Corp. All rights reserved. + * Copyright (c) 2016-2017 IBM Corporation. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -53,9 +53,9 @@ /* * Global variables */ -ompi_predefined_info_t ompi_mpi_info_null; +ompi_predefined_info_t ompi_mpi_info_null = {{{{{0}}}}}; ompi_predefined_info_t *ompi_mpi_info_null_addr = &ompi_mpi_info_null; -ompi_predefined_info_t ompi_mpi_info_env; +ompi_predefined_info_t ompi_mpi_info_env = {{{{{0}}}}}; /* * Local functions @@ -196,6 +196,57 @@ int ompi_mpiinfo_init(void) return OMPI_SUCCESS; } +// Generally ompi_info_t processing is handled by opal_info_t now. +// But to avoid compiler warnings and to avoid having to constantly +// change code to mpiinfo->super to make MPI code use the opal_info_t +// it's convenient to have ompi_info_t wrappers for some of the opal_info_t +// related calls: + +int ompi_info_dup (ompi_info_t *info, ompi_info_t **newinfo) { + return opal_info_dup (&(info->super), (opal_info_t **)newinfo); +} +int ompi_info_dup_mpistandard (ompi_info_t *info, ompi_info_t **newinfo) { + return opal_info_dup_mpistandard (&(info->super), (opal_info_t **)newinfo); +} +int ompi_info_set (ompi_info_t *info, const char *key, const char *value) { + return opal_info_set (&(info->super), key, value); +} +int ompi_info_set_value_enum (ompi_info_t *info, const char *key, int value, + mca_base_var_enum_t *var_enum) +{ + return opal_info_set_value_enum (&(info->super), key, value, var_enum); +} +int ompi_info_get (ompi_info_t *info, const char *key, int valuelen, + char *value, int *flag) +{ + return opal_info_get (&(info->super), key, valuelen, value, flag); +} +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) +{ + return opal_info_get_value_enum (&(info->super), key, value, + default_value, var_enum, flag); +} +int ompi_info_get_bool(ompi_info_t *info, char *key, bool *value, int *flag) { + return opal_info_get_bool(&(info->super), key, value, flag); +} +int ompi_info_delete (ompi_info_t *info, const char *key) { + return opal_info_delete (&(info->super), key); +} +int ompi_info_get_valuelen (ompi_info_t *info, const char *key, int *valuelen, + int *flag) +{ + return opal_info_get_valuelen (&(info->super), key, valuelen, flag); +} +int ompi_info_get_nthkey (ompi_info_t *info, int n, char *key) { + return opal_info_get_nthkey (&(info->super), n, key); +} +int ompi_info_get_nkeys(ompi_info_t *info, int *nkeys) +{ + return opal_info_get_nkeys (&(info->super), nkeys); +} + /* * Shut down MPI_Info handling diff --git a/ompi/info/info.h b/ompi/info/info.h index 46b45cc0a57..e240f96fe8e 100644 --- a/ompi/info/info.h +++ b/ompi/info/info.h @@ -14,7 +14,7 @@ * Copyright (c) 2009 Sun Microsystems, Inc. All rights reserved. * Copyright (c) 2012-2015 Los Alamos National Security, LLC. All rights * reserved. - * Copyright (c) 2016 IBM Corp. All rights reserved. + * Copyright (c) 2016-2017 IBM Corporation. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -99,6 +99,61 @@ int ompi_info_free (ompi_info_t **info); */ 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, 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, int valuelen, + char *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, char *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); + + END_C_DECLS /** diff --git a/ompi/interlib/interlib.c b/ompi/interlib/interlib.c index 9e01d189c39..2015f6ec6aa 100644 --- a/ompi/interlib/interlib.c +++ b/ompi/interlib/interlib.c @@ -15,6 +15,7 @@ * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. * Copyright (c) 2015-2017 Intel, Inc. All rights reserved. + * Copyright (c) 2017 IBM Corporation. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -30,6 +31,7 @@ #include "ompi/mca/rte/rte.h" #include "ompi/interlib/interlib.h" +#include "mpi.h" typedef struct { int status; diff --git a/ompi/mca/common/ompio/common_ompio_file_open.c b/ompi/mca/common/ompio/common_ompio_file_open.c index 82dda94935e..137aa1771c4 100644 --- a/ompi/mca/common/ompio/common_ompio_file_open.c +++ b/ompi/mca/common/ompio/common_ompio_file_open.c @@ -13,6 +13,7 @@ * Copyright (c) 2015-2017 Research Organization for Information Science * and Technology (RIST). All rights reserved. * Copyright (c) 2016 Cisco Systems, Inc. All rights reserved. + * Copyright (c) 2017 IBM Corporation. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -281,7 +282,7 @@ int mca_common_ompio_file_close (mca_io_ompio_file_t *ompio_fh) ret = ompio_fh->f_fs->fs_file_close (ompio_fh); } if ( delete_flag && 0 == ompio_fh->f_rank ) { - mca_io_ompio_file_delete ( ompio_fh->f_filename, MPI_INFO_NULL ); + mca_io_ompio_file_delete ( ompio_fh->f_filename, &(MPI_INFO_NULL->super) ); } if ( NULL != ompio_fh->f_fs ) { diff --git a/ompi/mca/common/ompio/common_ompio_file_view.c b/ompi/mca/common/ompio/common_ompio_file_view.c index c5a1644bb15..25387392630 100644 --- a/ompi/mca/common/ompio/common_ompio_file_view.c +++ b/ompi/mca/common/ompio/common_ompio_file_view.c @@ -12,6 +12,7 @@ * Copyright (c) 2008-2016 University of Houston. All rights reserved. * Copyright (c) 2017 Research Organization for Information Science * and Technology (RIST). All rights reserved. + * Copyright (c) 2017 IBM Corporation. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow diff --git a/ompi/mca/fs/fs.h b/ompi/mca/fs/fs.h index 29cf75a9efd..b5a5aee7018 100644 --- a/ompi/mca/fs/fs.h +++ b/ompi/mca/fs/fs.h @@ -15,7 +15,7 @@ * reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. - * Copyright (c) 2016 IBM Corp. All rights reserved. + * Copyright (c) 2016-2017 IBM Corporation. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -30,6 +30,7 @@ #include "mpi.h" #include "ompi/mca/mca.h" #include "opal/mca/base/base.h" +#include "ompi/info/info.h" BEGIN_C_DECLS diff --git a/ompi/mca/fs/lustre/fs_lustre.h b/ompi/mca/fs/lustre/fs_lustre.h index 9ef8a2c4d64..3e4ab284ef3 100644 --- a/ompi/mca/fs/lustre/fs_lustre.h +++ b/ompi/mca/fs/lustre/fs_lustre.h @@ -12,7 +12,7 @@ * Copyright (c) 2008-2016 University of Houston. All rights reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. - * Copyright (c) 2016 IBM Corp. All rights reserved. + * Copyright (c) 2016-2017 IBM Corporation. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow diff --git a/ompi/mca/fs/lustre/fs_lustre_file_delete.c b/ompi/mca/fs/lustre/fs_lustre_file_delete.c index 3314103267d..eb293b2021f 100644 --- a/ompi/mca/fs/lustre/fs_lustre_file_delete.c +++ b/ompi/mca/fs/lustre/fs_lustre_file_delete.c @@ -10,7 +10,7 @@ * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. * Copyright (c) 2008-2011 University of Houston. All rights reserved. - * Copyright (c) 2016 IBM Corp. All rights reserved. + * Copyright (c) 2016-2017 IBM Corporation. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow diff --git a/ompi/mca/fs/lustre/fs_lustre_file_open.c b/ompi/mca/fs/lustre/fs_lustre_file_open.c index 716f2cfd8ed..7cefe3cddbd 100644 --- a/ompi/mca/fs/lustre/fs_lustre_file_open.c +++ b/ompi/mca/fs/lustre/fs_lustre_file_open.c @@ -12,7 +12,7 @@ * Copyright (c) 2008-2015 University of Houston. All rights reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. - * Copyright (c) 2016 IBM Corp. All rights reserved. + * Copyright (c) 2016-2017 IBM Corporation. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow diff --git a/ompi/mca/fs/plfs/fs_plfs.h b/ompi/mca/fs/plfs/fs_plfs.h index a84779636a7..e9bd3fe29df 100644 --- a/ompi/mca/fs/plfs/fs_plfs.h +++ b/ompi/mca/fs/plfs/fs_plfs.h @@ -12,7 +12,7 @@ * Copyright (c) 2008-2016 University of Houston. All rights reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. - * Copyright (c) 2016 IBM Corp. All rights reserved. + * Copyright (c) 2016-2017 IBM Corporation. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow diff --git a/ompi/mca/fs/plfs/fs_plfs_file_delete.c b/ompi/mca/fs/plfs/fs_plfs_file_delete.c index 90b8edb3102..2e499658d52 100644 --- a/ompi/mca/fs/plfs/fs_plfs_file_delete.c +++ b/ompi/mca/fs/plfs/fs_plfs_file_delete.c @@ -10,7 +10,7 @@ * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. * Copyright (c) 2008-2014 University of Houston. All rights reserved. - * Copyright (c) 2016 IBM Corp. All rights reserved. + * Copyright (c) 2016-2017 IBM Corporation. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow diff --git a/ompi/mca/fs/plfs/fs_plfs_file_open.c b/ompi/mca/fs/plfs/fs_plfs_file_open.c index 65dc944e571..8512bc4cd1c 100644 --- a/ompi/mca/fs/plfs/fs_plfs_file_open.c +++ b/ompi/mca/fs/plfs/fs_plfs_file_open.c @@ -12,7 +12,7 @@ * Copyright (c) 2008-2014 University of Houston. All rights reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. - * Copyright (c) 2016 IBM Corp. All rights reserved. + * Copyright (c) 2016-2017 IBM Corporation. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow diff --git a/ompi/mca/fs/pvfs2/fs_pvfs2.h b/ompi/mca/fs/pvfs2/fs_pvfs2.h index fb8513c1ea1..dc4e724f3db 100644 --- a/ompi/mca/fs/pvfs2/fs_pvfs2.h +++ b/ompi/mca/fs/pvfs2/fs_pvfs2.h @@ -12,7 +12,7 @@ * Copyright (c) 2008-2016 University of Houston. All rights reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. - * Copyright (c) 2016 IBM Corp. All rights reserved. + * Copyright (c) 2016-2017 IBM Corporation. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow diff --git a/ompi/mca/fs/pvfs2/fs_pvfs2_file_delete.c b/ompi/mca/fs/pvfs2/fs_pvfs2_file_delete.c index 46b5ad57e37..1033e895b71 100644 --- a/ompi/mca/fs/pvfs2/fs_pvfs2_file_delete.c +++ b/ompi/mca/fs/pvfs2/fs_pvfs2_file_delete.c @@ -10,7 +10,7 @@ * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. * Copyright (c) 2008-2011 University of Houston. All rights reserved. - * Copyright (c) 2016 IBM Corp. All rights reserved. + * Copyright (c) 2016-2017 IBM Corporation. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow diff --git a/ompi/mca/fs/pvfs2/fs_pvfs2_file_open.c b/ompi/mca/fs/pvfs2/fs_pvfs2_file_open.c index 9c0824933b7..754cd815bd5 100644 --- a/ompi/mca/fs/pvfs2/fs_pvfs2_file_open.c +++ b/ompi/mca/fs/pvfs2/fs_pvfs2_file_open.c @@ -12,7 +12,7 @@ * Copyright (c) 2008-2014 University of Houston. All rights reserved. * Copyright (c) 2015-2017 Research Organization for Information Science * and Technology (RIST). All rights reserved. - * Copyright (c) 2016 IBM Corp. All rights reserved. + * Copyright (c) 2016-2017 IBM Corporation. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow diff --git a/ompi/mca/fs/ufs/fs_ufs.h b/ompi/mca/fs/ufs/fs_ufs.h index 3d001c7ad3d..b03ea669d32 100644 --- a/ompi/mca/fs/ufs/fs_ufs.h +++ b/ompi/mca/fs/ufs/fs_ufs.h @@ -12,7 +12,7 @@ * Copyright (c) 2008-2016 University of Houston. All rights reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. - * Copyright (c) 2016 IBM Corp. All rights reserved. + * Copyright (c) 2016-2017 IBM Corporation. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow diff --git a/ompi/mca/fs/ufs/fs_ufs_file_delete.c b/ompi/mca/fs/ufs/fs_ufs_file_delete.c index 9630e36e1a7..d6be6c32246 100644 --- a/ompi/mca/fs/ufs/fs_ufs_file_delete.c +++ b/ompi/mca/fs/ufs/fs_ufs_file_delete.c @@ -10,7 +10,7 @@ * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. * Copyright (c) 2008-2011 University of Houston. All rights reserved. - * Copyright (c) 2016 IBM Corp. All rights reserved. + * Copyright (c) 2016-2017 IBM Corporation. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow diff --git a/ompi/mca/fs/ufs/fs_ufs_file_open.c b/ompi/mca/fs/ufs/fs_ufs_file_open.c index 208cfc0ab06..8f0ea650c9c 100644 --- a/ompi/mca/fs/ufs/fs_ufs_file_open.c +++ b/ompi/mca/fs/ufs/fs_ufs_file_open.c @@ -12,7 +12,7 @@ * Copyright (c) 2008-2014 University of Houston. All rights reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. - * Copyright (c) 2016 IBM Corp. All rights reserved. + * Copyright (c) 2016-2017 IBM Corporation. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow diff --git a/ompi/mca/io/base/base.h b/ompi/mca/io/base/base.h index 36d66770ba0..e81f8e94c90 100644 --- a/ompi/mca/io/base/base.h +++ b/ompi/mca/io/base/base.h @@ -12,7 +12,7 @@ * Copyright (c) 2008 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. - * Copyright (c) 2016 IBM Corp. All rights reserved. + * Copyright (c) 2016-2017 IBM Corporation. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow diff --git a/ompi/mca/io/base/io_base_delete.c b/ompi/mca/io/base/io_base_delete.c index 4ae6c9b2177..48265b23478 100644 --- a/ompi/mca/io/base/io_base_delete.c +++ b/ompi/mca/io/base/io_base_delete.c @@ -12,7 +12,7 @@ * Copyright (c) 2008 Sun Microsystems, Inc. All rights reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. - * Copyright (c) 2016 IBM Corp. All rights reserved. + * Copyright (c) 2016-2017 IBM Corporation. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow diff --git a/ompi/mca/io/base/io_base_file_select.c b/ompi/mca/io/base/io_base_file_select.c index 5cdd43c25a1..2a30f097437 100644 --- a/ompi/mca/io/base/io_base_file_select.c +++ b/ompi/mca/io/base/io_base_file_select.c @@ -13,7 +13,7 @@ * Copyright (c) 2008-2011 University of Houston. All rights reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. - * Copyright (c) 2016 IBM Corp. All rights reserved. + * Copyright (c) 2016-2017 IBM Corporation. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow diff --git a/ompi/mca/io/io.h b/ompi/mca/io/io.h index 7e8e72939ca..54eac054ecf 100644 --- a/ompi/mca/io/io.h +++ b/ompi/mca/io/io.h @@ -16,7 +16,7 @@ * Copyright (c) 2015 University of Houston. All rights reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. - * Copyright (c) 2016 IBM Corp. All rights reserved. + * Copyright (c) 2016-2017 IBM Corporation. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -30,6 +30,7 @@ #include "mpi.h" #include "ompi/mca/mca.h" #include "ompi/request/request.h" +#include "ompi/info/info.h" /* * Forward declaration for private data on io components and modules. diff --git a/ompi/mca/io/ompio/io_ompio.h b/ompi/mca/io/ompio/io_ompio.h index 528c66dbd9d..417863a0bf6 100644 --- a/ompi/mca/io/ompio/io_ompio.h +++ b/ompi/mca/io/ompio/io_ompio.h @@ -13,7 +13,7 @@ * Copyright (c) 2008-2016 University of Houston. All rights reserved. * Copyright (c) 2015-2017 Research Organization for Information Science * and Technology (RIST). All rights reserved. - * Copyright (c) 2016 IBM Corp. All rights reserved. + * Copyright (c) 2016-2017 IBM Corporation. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow diff --git a/ompi/mca/io/ompio/io_ompio_component.c b/ompi/mca/io/ompio/io_ompio_component.c index 3aa8e7c6fe8..e0b89ab0088 100644 --- a/ompi/mca/io/ompio/io_ompio_component.c +++ b/ompi/mca/io/ompio/io_ompio_component.c @@ -15,7 +15,7 @@ * reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. - * Copyright (c) 2016 IBM Corp. All rights reserved. + * Copyright (c) 2016-2017 IBM Corporation. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow diff --git a/ompi/mca/io/ompio/io_ompio_file_open.c b/ompi/mca/io/ompio/io_ompio_file_open.c index e19805fc1f9..52a6058193f 100644 --- a/ompi/mca/io/ompio/io_ompio_file_open.c +++ b/ompi/mca/io/ompio/io_ompio_file_open.c @@ -13,7 +13,7 @@ * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. * Copyright (c) 2016 Cisco Systems, Inc. All rights reserved. - * Copyright (c) 2016 IBM Corp. All rights reserved. + * Copyright (c) 2016-2017 IBM Corporation. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow diff --git a/ompi/mca/io/ompio/io_ompio_file_set_view.c b/ompi/mca/io/ompio/io_ompio_file_set_view.c index f93ca4f2ad6..56fbe018c87 100644 --- a/ompi/mca/io/ompio/io_ompio_file_set_view.c +++ b/ompi/mca/io/ompio/io_ompio_file_set_view.c @@ -12,7 +12,7 @@ * Copyright (c) 2008-2016 University of Houston. All rights reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. - * Copyright (c) 2016 IBM Corp. All rights reserved. + * Copyright (c) 2016-2017 IBM Corporation. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow diff --git a/ompi/mca/io/ompio/io_ompio_module.c b/ompi/mca/io/ompio/io_ompio_module.c index c5168d0bb4b..109b99c82ef 100644 --- a/ompi/mca/io/ompio/io_ompio_module.c +++ b/ompi/mca/io/ompio/io_ompio_module.c @@ -10,7 +10,7 @@ * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. * Copyright (c) 2008-2011 University of Houston. All rights reserved. - * Copyright (c) 2016 IBM Corp. All rights reserved. + * Copyright (c) 2016-2017 IBM Corporation. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow diff --git a/ompi/mca/io/romio314/src/io_romio314.h b/ompi/mca/io/romio314/src/io_romio314.h index df640e5efce..74bfbf55f64 100644 --- a/ompi/mca/io/romio314/src/io_romio314.h +++ b/ompi/mca/io/romio314/src/io_romio314.h @@ -12,7 +12,7 @@ * Copyright (c) 2008 Sun Microsystems, Inc. All rights reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. - * Copyright (c) 2016 IBM Corp. All rights reserved. + * Copyright (c) 2016-2017 IBM Corporation. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow diff --git a/ompi/mca/io/romio314/src/io_romio314_component.c b/ompi/mca/io/romio314/src/io_romio314_component.c index 3bb83a66c1c..6d53940b2cd 100644 --- a/ompi/mca/io/romio314/src/io_romio314_component.c +++ b/ompi/mca/io/romio314/src/io_romio314_component.c @@ -15,7 +15,7 @@ * reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. - * Copyright (c) 2016 IBM Corp. All rights reserved. + * Copyright (c) 2016-2017 IBM Corporation. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -240,10 +240,20 @@ static int delete_select(const char *filename, struct opal_info_t *info, { int ret; +// An opal_info_t isn't a full ompi_info_t. so if we're using an MPI call +// below with an MPI_Info, we need to create an equivalent MPI_Info. This +// isn't ideal but it only happens a few places. + ompi_info_t *ompi_info; + ompi_info = OBJ_NEW(ompi_info_t); + if (!ompi_info) { return(MPI_ERR_NO_MEM); } + opal_info_t *opal_info = &(ompi_info->super); + opal_info_dup (info, &opal_info); + OPAL_THREAD_LOCK (&mca_io_romio314_mutex); - ret = ROMIO_PREFIX(MPI_File_delete)(filename, info); + ret = ROMIO_PREFIX(MPI_File_delete)(filename, ompi_info); OPAL_THREAD_UNLOCK (&mca_io_romio314_mutex); + ompi_info_free(&ompi_info); return ret; } diff --git a/ompi/mca/io/romio314/src/io_romio314_file_open.c b/ompi/mca/io/romio314/src/io_romio314_file_open.c index d4c2bba6e17..0fdd3841668 100644 --- a/ompi/mca/io/romio314/src/io_romio314_file_open.c +++ b/ompi/mca/io/romio314/src/io_romio314_file_open.c @@ -11,7 +11,7 @@ * All rights reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. - * Copyright (c) 2016 IBM Corp. All rights reserved. + * Copyright (c) 2016-2017 IBM Corporation. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -38,12 +38,22 @@ mca_io_romio314_file_open (ompi_communicator_t *comm, int ret; mca_io_romio314_data_t *data; +// An opal_info_t isn't a full ompi_info_t. so if we're using an MPI call +// below with an MPI_Info, we need to create an equivalent MPI_Info. This +// isn't ideal but it only happens a few places. + ompi_info_t *ompi_info; + ompi_info = OBJ_NEW(ompi_info_t); + if (!ompi_info) { return(MPI_ERR_NO_MEM); } + opal_info_t *opal_info = &(ompi_info->super); + opal_info_dup (info, &opal_info); + data = (mca_io_romio314_data_t *) fh->f_io_selected_data; // OPAL_THREAD_LOCK (&mca_io_romio314_mutex); - ret = ROMIO_PREFIX(MPI_File_open)(comm, filename, amode, info, + ret = ROMIO_PREFIX(MPI_File_open)(comm, filename, amode, ompi_info, &data->romio_fh); // OPAL_THREAD_UNLOCK (&mca_io_romio314_mutex); + ompi_info_free(&ompi_info); return ret; } @@ -155,11 +165,21 @@ mca_io_romio314_file_set_info (ompi_file_t *fh, int ret; mca_io_romio314_data_t *data; +// An opal_info_t isn't a full ompi_info_t. so if we're using an MPI call +// below with an MPI_Info, we need to create an equivalent MPI_Info. This +// isn't ideal but it only happens a few places. + ompi_info_t *ompi_info; + ompi_info = OBJ_NEW(ompi_info_t); + if (!ompi_info) { return(MPI_ERR_NO_MEM); } + opal_info_t *opal_info = &(ompi_info->super); + opal_info_dup (info, &opal_info); + data = (mca_io_romio314_data_t *) fh->f_io_selected_data; OPAL_THREAD_LOCK (&mca_io_romio314_mutex); - ret = ROMIO_PREFIX(MPI_File_set_info) (data->romio_fh, info); + ret = ROMIO_PREFIX(MPI_File_set_info) (data->romio_fh, ompi_info); OPAL_THREAD_UNLOCK (&mca_io_romio314_mutex); + ompi_info_free(&ompi_info); return ret; } @@ -171,11 +191,20 @@ mca_io_romio314_file_get_info (ompi_file_t *fh, int ret; mca_io_romio314_data_t *data; +// An opal_info_t isn't a full ompi_info_t. so if we're using an MPI call +// below with an MPI_Info, we need to create an equivalent MPI_Info. This +// isn't ideal but it only happens a few places. + ompi_info_t *ompi_info; + ompi_info = OBJ_NEW(ompi_info_t); + if (!ompi_info) { return(MPI_ERR_NO_MEM); } + data = (mca_io_romio314_data_t *) fh->f_io_selected_data; OPAL_THREAD_LOCK (&mca_io_romio314_mutex); - ret = ROMIO_PREFIX(MPI_File_get_info) (data->romio_fh, info_used); + ret = ROMIO_PREFIX(MPI_File_get_info) (data->romio_fh, &ompi_info); OPAL_THREAD_UNLOCK (&mca_io_romio314_mutex); + opal_info_dup (&(ompi_info->super), info_used); + ompi_info_free(&ompi_info); return ret; } @@ -191,13 +220,23 @@ mca_io_romio314_file_set_view (ompi_file_t *fh, int ret; mca_io_romio314_data_t *data; +// An opal_info_t isn't a full ompi_info_t. so if we're using an MPI call +// below with an MPI_Info, we need to create an equivalent MPI_Info. This +// isn't ideal but it only happens a few places. + ompi_info_t *ompi_info; + ompi_info = OBJ_NEW(ompi_info_t); + if (!ompi_info) { return(MPI_ERR_NO_MEM); } + opal_info_t *opal_info = &(ompi_info->super); + opal_info_dup (info, &opal_info); + data = (mca_io_romio314_data_t *) fh->f_io_selected_data; OPAL_THREAD_LOCK (&mca_io_romio314_mutex); ret = ROMIO_PREFIX(MPI_File_set_view) (data->romio_fh, disp, etype, filetype, - datarep, info); + datarep, ompi_info); OPAL_THREAD_UNLOCK (&mca_io_romio314_mutex); + ompi_info_free(&ompi_info); return ret; } diff --git a/ompi/mca/io/romio314/src/io_romio314_module.c b/ompi/mca/io/romio314/src/io_romio314_module.c index 3a40046cbdf..bc1b3c0b84a 100644 --- a/ompi/mca/io/romio314/src/io_romio314_module.c +++ b/ompi/mca/io/romio314/src/io_romio314_module.c @@ -11,6 +11,7 @@ * All rights reserved. * Copyright (c) 2008 Sun Microsystems, Inc. All rights reserved. * Copyright (c) 2008 Cisco Systems, Inc. All rights reserved. + * Copyright (c) 2017 IBM Corp. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -47,8 +48,6 @@ mca_io_base_module_2_0_0_t mca_io_romio314_module = { mca_io_romio314_file_preallocate, mca_io_romio314_file_get_size, mca_io_romio314_file_get_amode, - mca_io_romio314_file_set_info, - mca_io_romio314_file_get_info, mca_io_romio314_file_set_view, mca_io_romio314_file_get_view, diff --git a/ompi/mca/osc/base/base.h b/ompi/mca/osc/base/base.h index d2b46953eb7..1445510ee65 100644 --- a/ompi/mca/osc/base/base.h +++ b/ompi/mca/osc/base/base.h @@ -7,7 +7,7 @@ * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. - * Copyright (c) 2016 IBM Corp. All rights reserved. + * Copyright (c) 2016-2017 IBM Corporation. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow diff --git a/ompi/mca/osc/base/osc_base_init.c b/ompi/mca/osc/base/osc_base_init.c index ca5e7a0e8d8..7d1aaaf6a5f 100644 --- a/ompi/mca/osc/base/osc_base_init.c +++ b/ompi/mca/osc/base/osc_base_init.c @@ -10,7 +10,7 @@ * All rights reserved. * Copyright (c) 2014 Los Alamos National Security, LLC. All rights * reserved. - * Copyright (c) 2016 IBM Corp. All rights reserved. + * Copyright (c) 2016-2017 IBM Corporation. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow diff --git a/ompi/mca/osc/osc.h b/ompi/mca/osc/osc.h index c3d806a688e..a7892dfc7b0 100644 --- a/ompi/mca/osc/osc.h +++ b/ompi/mca/osc/osc.h @@ -13,7 +13,7 @@ * Copyright (c) 2010 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2015-2017 Research Organization for Information Science * and Technology (RIST). All rights reserved. - * Copyright (c) 2016 IBM Corp. All rights reserved. + * Copyright (c) 2016-2017 IBM Corporation. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow diff --git a/ompi/mca/osc/portals4/osc_portals4.h b/ompi/mca/osc/portals4/osc_portals4.h index 4834db5f551..682003b40fe 100644 --- a/ompi/mca/osc/portals4/osc_portals4.h +++ b/ompi/mca/osc/portals4/osc_portals4.h @@ -5,7 +5,7 @@ * reserved. * Copyright (c) 2015-2017 Research Organization for Information Science * and Technology (RIST). All rights reserved. - * Copyright (c) 2016 IBM Corp. All rights reserved. + * Copyright (c) 2016-2017 IBM Corporation. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow diff --git a/ompi/mca/osc/portals4/osc_portals4_component.c b/ompi/mca/osc/portals4/osc_portals4_component.c index da31d72655d..38c36fec6d9 100644 --- a/ompi/mca/osc/portals4/osc_portals4_component.c +++ b/ompi/mca/osc/portals4/osc_portals4_component.c @@ -8,7 +8,7 @@ * Copyright (c) 2017 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. - * Copyright (c) 2016 IBM Corp. All rights reserved. + * Copyright (c) 2016-2017 IBM Corporation. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow diff --git a/ompi/mca/osc/pt2pt/osc_pt2pt.h b/ompi/mca/osc/pt2pt/osc_pt2pt.h index 801975c6fef..51bc1e34ce1 100644 --- a/ompi/mca/osc/pt2pt/osc_pt2pt.h +++ b/ompi/mca/osc/pt2pt/osc_pt2pt.h @@ -15,7 +15,7 @@ * Copyright (c) 2015-2017 Research Organization for Information Science * and Technology (RIST). All rights reserved. * Copyright (c) 2016 FUJITSU LIMITED. All rights reserved. - * Copyright (c) 2016 IBM Corp. All rights reserved. + * Copyright (c) 2016-2017 IBM Corporation. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow diff --git a/ompi/mca/osc/pt2pt/osc_pt2pt_component.c b/ompi/mca/osc/pt2pt/osc_pt2pt_component.c index 3291c8a24cd..c8ac4e73f98 100644 --- a/ompi/mca/osc/pt2pt/osc_pt2pt_component.c +++ b/ompi/mca/osc/pt2pt/osc_pt2pt_component.c @@ -16,7 +16,7 @@ * Copyright (c) 2012-2013 Sandia National Laboratories. All rights reserved. * Copyright (c) 2015-2016 Research Organization for Information Science * and Technology (RIST). All rights reserved. - * Copyright (c) 2016 IBM Corp. All rights reserved. + * Copyright (c) 2016-2017 IBM Corporation. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -104,9 +104,6 @@ ompi_osc_pt2pt_module_t ompi_osc_pt2pt_module_template = { ompi_osc_pt2pt_flush_all, ompi_osc_pt2pt_flush_local, ompi_osc_pt2pt_flush_local_all, - - ompi_osc_pt2pt_set_info, - ompi_osc_pt2pt_get_info } }; diff --git a/ompi/mca/osc/rdma/osc_rdma_component.c b/ompi/mca/osc/rdma/osc_rdma_component.c index 5d74abfa8e8..db50e01fabe 100644 --- a/ompi/mca/osc/rdma/osc_rdma_component.c +++ b/ompi/mca/osc/rdma/osc_rdma_component.c @@ -16,7 +16,7 @@ * Copyright (c) 2012-2015 Sandia National Laboratories. All rights reserved. * Copyright (c) 2015 NVIDIA Corporation. All rights reserved. * Copyright (c) 2015 Intel, Inc. All rights reserved. - * Copyright (c) 2016 IBM Corp. All rights reserved. + * Copyright (c) 2016-2017 IBM Corporation. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -1239,7 +1239,7 @@ static char* ompi_osc_rdma_set_no_lock_info(opal_infosubscriber_t *obj, char *ke module->no_locks = false; } /* enforce collectiveness... */ - module->comm->c_coll.coll_barrier(module->comm, module->comm->c_coll.coll_barrier_module); + module->comm->c_coll->coll_barrier(module->comm, module->comm->c_coll->coll_barrier_module); /* * Accept any value */ diff --git a/ompi/mca/osc/sm/osc_sm.h b/ompi/mca/osc/sm/osc_sm.h index 339ded4ccc2..3a52224f20b 100644 --- a/ompi/mca/osc/sm/osc_sm.h +++ b/ompi/mca/osc/sm/osc_sm.h @@ -5,7 +5,7 @@ * reserved. * Copyright (c) 2015-2017 Research Organization for Information Science * and Technology (RIST). All rights reserved. - * Copyright (c) 2016 IBM Corp. All rights reserved. + * Copyright (c) 2016-2017 IBM Corporation. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow diff --git a/ompi/mca/osc/sm/osc_sm_component.c b/ompi/mca/osc/sm/osc_sm_component.c index 88a46094f16..ea732ab2496 100644 --- a/ompi/mca/osc/sm/osc_sm_component.c +++ b/ompi/mca/osc/sm/osc_sm_component.c @@ -10,7 +10,7 @@ * Copyright (c) 2017 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. - * Copyright (c) 2016 IBM Corp. All rights reserved. + * Copyright (c) 2016-2017 IBM Corporation. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -39,8 +39,8 @@ static int component_query(struct ompi_win_t *win, void **base, size_t size, int static int component_select(struct ompi_win_t *win, void **base, size_t size, int disp_unit, struct ompi_communicator_t *comm, struct opal_info_t *info, int flavor, int *model); -static char* component_set_blocking_fence_info(void *obj, char *key, char *val); -static char* component_set_alloc_shared_noncontig_info(void *obj, char *key, char *val); +static char* component_set_blocking_fence_info(opal_infosubscriber_t *obj, char *key, char *val); +static char* component_set_alloc_shared_noncontig_info(opal_infosubscriber_t *obj, char *key, char *val); ompi_osc_sm_component_t mca_osc_sm_component = { @@ -182,14 +182,14 @@ component_select(struct ompi_win_t *win, void **base, size_t size, int disp_unit OBJ_CONSTRUCT(&module->lock, opal_mutex_t); - ret = opal_infosubscribe_subscribe(win, "blocking_fence", "false", + ret = opal_infosubscribe_subscribe(&(win->super), "blocking_fence", "false", component_set_blocking_fence_info); module->global_state->use_barrier_for_fence = 1; if (OPAL_SUCCESS != ret) goto error; - ret = opal_infosubscribe_subscribe(win, "alloc_shared_contig", "false", component_set_alloc_shared_noncontig_info); + ret = opal_infosubscribe_subscribe(&(win->super), "alloc_shared_contig", "false", component_set_alloc_shared_noncontig_info); if (OPAL_SUCCESS != ret) goto error; @@ -521,7 +521,7 @@ ompi_osc_sm_set_info(struct ompi_win_t *win, struct opal_info_t *info) static char* -component_set_blocking_fence_info(void *obj, char *key, char *val) +component_set_blocking_fence_info(opal_infosubscriber_t *obj, char *key, char *val) { ompi_osc_sm_module_t *module = (ompi_osc_sm_module_t*) ((struct ompi_win_t*) obj)->w_osc_module; /* @@ -532,7 +532,7 @@ component_set_blocking_fence_info(void *obj, char *key, char *val) static char* -component_set_alloc_shared_noncontig_info(void *obj, char *key, char *val) +component_set_alloc_shared_noncontig_info(opal_infosubscriber_t *obj, char *key, char *val) { ompi_osc_sm_module_t *module = (ompi_osc_sm_module_t*) ((struct ompi_win_t*) obj)->w_osc_module; diff --git a/ompi/mca/rte/orte/rte_orte.h b/ompi/mca/rte/orte/rte_orte.h index ae2a9fce85f..530b1313b6a 100644 --- a/ompi/mca/rte/orte/rte_orte.h +++ b/ompi/mca/rte/orte/rte_orte.h @@ -6,7 +6,7 @@ * Copyright (c) 2014-2016 Research Organization for Information Science * and Technology (RIST). All rights reserved. * Copyright (c) 2015 Intel, Inc. All rights reserved. - * Copyright (c) 2016 IBM Corp. All rights reserved. + * Copyright (c) 2016-2017 IBM Corporation. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow diff --git a/ompi/mca/sharedfp/addproc/sharedfp_addproc.h b/ompi/mca/sharedfp/addproc/sharedfp_addproc.h index 5b08b22fddd..3e0441b3e44 100644 --- a/ompi/mca/sharedfp/addproc/sharedfp_addproc.h +++ b/ompi/mca/sharedfp/addproc/sharedfp_addproc.h @@ -10,7 +10,7 @@ * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. * Copyright (c) 2013-2016 University of Houston. All rights reserved. - * Copyright (c) 2016 IBM Corp. All rights reserved. + * Copyright (c) 2016-2017 IBM Corporation. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow diff --git a/ompi/mca/sharedfp/addproc/sharedfp_addproc_file_open.c b/ompi/mca/sharedfp/addproc/sharedfp_addproc_file_open.c index cbbbc0a219f..b55a7f965af 100644 --- a/ompi/mca/sharedfp/addproc/sharedfp_addproc_file_open.c +++ b/ompi/mca/sharedfp/addproc/sharedfp_addproc_file_open.c @@ -10,7 +10,7 @@ * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. * Copyright (c) 2013-2016 University of Houston. All rights reserved. - * Copyright (c) 2016 IBM Corp. All rights reserved. + * Copyright (c) 2016-2017 IBM Corporation. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow diff --git a/ompi/mca/sharedfp/individual/sharedfp_individual.c b/ompi/mca/sharedfp/individual/sharedfp_individual.c index 0cfe45612ec..9eea5c1263a 100644 --- a/ompi/mca/sharedfp/individual/sharedfp_individual.c +++ b/ompi/mca/sharedfp/individual/sharedfp_individual.c @@ -10,7 +10,7 @@ * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. * Copyright (c) 2013-2015 University of Houston. All rights reserved. - * Copyright (c) 2016 IBM Corp. All rights reserved. + * Copyright (c) 2016-2017 IBM Corporation. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -73,7 +73,7 @@ struct mca_sharedfp_base_module_1_0_0_t * mca_sharedfp_individual_component_file int amode; bool wronly_flag=false; bool relaxed_order_flag=false; - MPI_Info info; + opal_info_t *info; int flag; int valuelen; char value[MPI_MAX_INFO_VAL+1]; @@ -102,7 +102,7 @@ struct mca_sharedfp_base_module_1_0_0_t * mca_sharedfp_individual_component_file /*---------------------------------------------------------*/ /* 2. Did the user specify MPI_INFO relaxed ordering flag? */ info = fh->f_info; - if ( info != MPI_INFO_NULL ){ + if ( info != &(MPI_INFO_NULL->super) ){ valuelen = MPI_MAX_INFO_VAL; opal_info_get ( info,"OMPIO_SHAREDFP_RELAXED_ORDERING", valuelen, value, &flag); if ( flag ) { diff --git a/ompi/mca/sharedfp/individual/sharedfp_individual.h b/ompi/mca/sharedfp/individual/sharedfp_individual.h index f5d8e9451ba..8674711cbb7 100644 --- a/ompi/mca/sharedfp/individual/sharedfp_individual.h +++ b/ompi/mca/sharedfp/individual/sharedfp_individual.h @@ -12,7 +12,7 @@ * Copyright (c) 2013-2016 University of Houston. All rights reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. - * Copyright (c) 2016 IBM Corp. All rights reserved. + * Copyright (c) 2016-2017 IBM Corporation. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow diff --git a/ompi/mca/sharedfp/individual/sharedfp_individual_file_open.c b/ompi/mca/sharedfp/individual/sharedfp_individual_file_open.c index 7aff5868db5..90e106700a2 100644 --- a/ompi/mca/sharedfp/individual/sharedfp_individual_file_open.c +++ b/ompi/mca/sharedfp/individual/sharedfp_individual_file_open.c @@ -12,7 +12,7 @@ * Copyright (c) 2013-2016 University of Houston. All rights reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. - * Copyright (c) 2016 IBM Corp. All rights reserved. + * Copyright (c) 2016-2017 IBM Corporation. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -114,7 +114,7 @@ int mca_sharedfp_individual_file_open (struct ompi_communicator_t *comm, } err = mca_common_ompio_file_open(MPI_COMM_SELF, datafilename, MPI_MODE_RDWR | MPI_MODE_CREATE | MPI_MODE_DELETE_ON_CLOSE, - MPI_INFO_NULL, datafilehandle, false); + &(MPI_INFO_NULL->super), datafilehandle, false); if ( OMPI_SUCCESS != err) { opal_output(0, "mca_sharedfp_individual_file_open: Error during datafile file open\n"); free (shfileHandle ); @@ -157,7 +157,7 @@ int mca_sharedfp_individual_file_open (struct ompi_communicator_t *comm, } err = mca_common_ompio_file_open ( MPI_COMM_SELF,metadatafilename, MPI_MODE_RDWR | MPI_MODE_CREATE | MPI_MODE_DELETE_ON_CLOSE, - MPI_INFO_NULL, metadatafilehandle, false); + &(MPI_INFO_NULL->super), metadatafilehandle, false); if ( OMPI_SUCCESS != err) { opal_output(0, "mca_sharedfp_individual_file_open: Error during metadatafile file open\n"); free (shfileHandle ); diff --git a/ompi/mca/sharedfp/lockedfile/sharedfp_lockedfile.h b/ompi/mca/sharedfp/lockedfile/sharedfp_lockedfile.h index 47dd489fa99..2eede80bb78 100644 --- a/ompi/mca/sharedfp/lockedfile/sharedfp_lockedfile.h +++ b/ompi/mca/sharedfp/lockedfile/sharedfp_lockedfile.h @@ -12,7 +12,7 @@ * Copyright (c) 2013-2016 University of Houston. All rights reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. - * Copyright (c) 2016 IBM Corp. All rights reserved. + * Copyright (c) 2016-2017 IBM Corporation. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow diff --git a/ompi/mca/sharedfp/lockedfile/sharedfp_lockedfile_file_open.c b/ompi/mca/sharedfp/lockedfile/sharedfp_lockedfile_file_open.c index 8070edf938d..89bdf56aa45 100644 --- a/ompi/mca/sharedfp/lockedfile/sharedfp_lockedfile_file_open.c +++ b/ompi/mca/sharedfp/lockedfile/sharedfp_lockedfile_file_open.c @@ -12,7 +12,7 @@ * Copyright (c) 2013-2017 University of Houston. All rights reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. - * Copyright (c) 2016 IBM Corp. All rights reserved. + * Copyright (c) 2016-2017 IBM Corporation. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -68,7 +68,7 @@ int mca_sharedfp_lockedfile_file_open (struct ompi_communicator_t *comm, ompio_fh->f_etype, ompio_fh->f_orig_filetype, ompio_fh->f_datarep, - MPI_INFO_NULL); + &(MPI_INFO_NULL->super)); /*Memory is allocated here for the sh structure*/ diff --git a/ompi/mca/sharedfp/sharedfp.h b/ompi/mca/sharedfp/sharedfp.h index dbed698793d..2d5d969315b 100644 --- a/ompi/mca/sharedfp/sharedfp.h +++ b/ompi/mca/sharedfp/sharedfp.h @@ -15,7 +15,7 @@ * reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. - * Copyright (c) 2016 IBM Corp. All rights reserved. + * Copyright (c) 2016-2017 IBM Corporation. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -31,6 +31,7 @@ #include "ompi/mca/mca.h" #include "opal/mca/base/base.h" #include "ompi/request/request.h" +#include "ompi/info/info.h" BEGIN_C_DECLS diff --git a/ompi/mca/sharedfp/sm/sharedfp_sm.h b/ompi/mca/sharedfp/sm/sharedfp_sm.h index 50b33e7cb8c..ec8d0f4ed6f 100644 --- a/ompi/mca/sharedfp/sm/sharedfp_sm.h +++ b/ompi/mca/sharedfp/sm/sharedfp_sm.h @@ -13,7 +13,7 @@ * Copyright (c) 2015 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. - * Copyright (c) 2016 IBM Corp. All rights reserved. + * Copyright (c) 2016-2017 IBM Corporation. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow diff --git a/ompi/mca/sharedfp/sm/sharedfp_sm_file_open.c b/ompi/mca/sharedfp/sm/sharedfp_sm_file_open.c index 2453202e116..f58cbba56bd 100644 --- a/ompi/mca/sharedfp/sm/sharedfp_sm_file_open.c +++ b/ompi/mca/sharedfp/sm/sharedfp_sm_file_open.c @@ -14,7 +14,7 @@ * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. * Copyright (c) 2015 Cisco Systems, Inc. All rights reserved. - * Copyright (c) 2016 IBM Corp. All rights reserved. + * Copyright (c) 2016-2017 IBM Corporation. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -87,7 +87,7 @@ int mca_sharedfp_sm_file_open (struct ompi_communicator_t *comm, ompio_fh->f_etype, ompio_fh->f_orig_filetype, ompio_fh->f_datarep, - MPI_INFO_NULL); + &(MPI_INFO_NULL->super)); /*Memory is allocated here for the sh structure*/ if ( mca_sharedfp_sm_verbose ) { diff --git a/ompi/mca/topo/base/base.h b/ompi/mca/topo/base/base.h index 45b2a342179..7d6df52609b 100644 --- a/ompi/mca/topo/base/base.h +++ b/ompi/mca/topo/base/base.h @@ -15,7 +15,7 @@ * Copyright (c) 2012-2013 Inria. All rights reserved. * Copyright (c) 2014-2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. - * Copyright (c) 2016 IBM Corp. All rights reserved. + * Copyright (c) 2016-2017 IBM Corporation. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow diff --git a/ompi/mca/topo/base/topo_base_dist_graph_create.c b/ompi/mca/topo/base/topo_base_dist_graph_create.c index 153d545b5ec..fdc202f879a 100644 --- a/ompi/mca/topo/base/topo_base_dist_graph_create.c +++ b/ompi/mca/topo/base/topo_base_dist_graph_create.c @@ -10,7 +10,7 @@ * Copyright (c) 2011-2013 Université Bordeaux 1 * Copyright (c) 2014-2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. - * Copyright (c) 2016 IBM Corporation. All rights reserved. + * Copyright (c) 2016-2017 IBM Corporation. All rights reserved. */ #include "ompi_config.h" @@ -295,6 +295,14 @@ int mca_topo_base_dist_graph_create(mca_topo_base_module_t* module, OBJ_RELEASE(module); return err; } + // But if there is an info object, the above call didn't make use + // of it, so we'll do a dup-with-info to get the final comm and + // free the above intermediate newcomm: + if (info && info != &(MPI_INFO_NULL->super)) { + ompi_communicator_t *intermediate_comm = *newcomm; + ompi_comm_dup_with_info (intermediate_comm, info, newcomm); + ompi_comm_free(&intermediate_comm); + } assert(NULL == (*newcomm)->c_topo); (*newcomm)->c_topo = module; diff --git a/ompi/mca/topo/base/topo_base_dist_graph_create_adjacent.c b/ompi/mca/topo/base/topo_base_dist_graph_create_adjacent.c index 9b1a17a7fc3..5b12042708b 100644 --- a/ompi/mca/topo/base/topo_base_dist_graph_create_adjacent.c +++ b/ompi/mca/topo/base/topo_base_dist_graph_create_adjacent.c @@ -10,6 +10,7 @@ * Copyright (c) 2011-2013 Université Bordeaux 1 * Copyright (c) 2014-2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. + * Copyright (c) 2017 IBM Corp. All rights reserved. */ #include "ompi_config.h" @@ -37,6 +38,15 @@ int mca_topo_base_dist_graph_create_adjacent(mca_topo_base_module_t* module, newcomm)) ) { return err; } + // But if there is an info object, the above call didn't make use + // of it, so we'll do a dup-with-info to get the final comm and + // free the above intermediate newcomm: + if (info && info != &(MPI_INFO_NULL->super)) { + ompi_communicator_t *intermediate_comm = *newcomm; + ompi_comm_dup_with_info (intermediate_comm, info, newcomm); + ompi_comm_free(&intermediate_comm); + } + err = OMPI_ERR_OUT_OF_RESOURCE; /* suppose by default something bad will happens */ assert( NULL == (*newcomm)->c_topo ); diff --git a/ompi/mca/topo/topo.h b/ompi/mca/topo/topo.h index ac5d159f270..7735250f290 100644 --- a/ompi/mca/topo/topo.h +++ b/ompi/mca/topo/topo.h @@ -16,7 +16,7 @@ * and Technology (RIST). All rights reserved. * Copyright (c) 2015 Los Alamos National Security, LLC. All rights * reserved. - * Copyright (c) 2016 IBM Corp. All rights reserved. + * Copyright (c) 2016-2017 IBM Corporation. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow diff --git a/ompi/mca/topo/treematch/topo_treematch.h b/ompi/mca/topo/treematch/topo_treematch.h index f92f3b46d1d..bcc4d748bfd 100644 --- a/ompi/mca/topo/treematch/topo_treematch.h +++ b/ompi/mca/topo/treematch/topo_treematch.h @@ -6,7 +6,7 @@ * Copyright (c) 2011-2015 Bordeaux Polytechnic Institute * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. - * Copyright (c) 2016 IBM Corp. All rights reserved. + * Copyright (c) 2016-2017 IBM Corporation. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow diff --git a/ompi/mca/topo/treematch/topo_treematch_dist_graph_create.c b/ompi/mca/topo/treematch/topo_treematch_dist_graph_create.c index e6f99c9f918..cbf3e08ac0d 100644 --- a/ompi/mca/topo/treematch/topo_treematch_dist_graph_create.c +++ b/ompi/mca/topo/treematch/topo_treematch_dist_graph_create.c @@ -11,7 +11,7 @@ * Copyright (c) 2016 Los Alamos National Security, LLC. All rights * reserved. * Copyright (c) 2017 Cisco Systems, Inc. All rights reserved - * Copyright (c) 2016 IBM Corp. All rights reserved. + * Copyright (c) 2016-2017 IBM Corporation. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow diff --git a/ompi/mpi/c/alloc_mem.c b/ompi/mpi/c/alloc_mem.c index 11e87987ab3..8c8fb8cd545 100644 --- a/ompi/mpi/c/alloc_mem.c +++ b/ompi/mpi/c/alloc_mem.c @@ -76,7 +76,7 @@ int MPI_Alloc_mem(MPI_Aint size, MPI_Info info, void *baseptr) if (MPI_INFO_NULL != info) { int flag; - (void) opal_info_get (info, "mpool_hints", MPI_MAX_INFO_VAL, info_value, &flag); + (void) ompi_info_get (info, "mpool_hints", MPI_MAX_INFO_VAL, info_value, &flag); if (flag) { mpool_hints = info_value; } diff --git a/ompi/mpi/c/comm_dup_with_info.c b/ompi/mpi/c/comm_dup_with_info.c index ee3596b128f..4f8269c31d7 100644 --- a/ompi/mpi/c/comm_dup_with_info.c +++ b/ompi/mpi/c/comm_dup_with_info.c @@ -16,7 +16,7 @@ * reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. - * Copyright (c) 2016 IBM Corp. All rights reserved. + * Copyright (c) 2016-2017 IBM Corporation. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow diff --git a/ompi/mpi/c/comm_get_info.c b/ompi/mpi/c/comm_get_info.c index 40edc0071a4..403f54fdc3b 100644 --- a/ompi/mpi/c/comm_get_info.c +++ b/ompi/mpi/c/comm_get_info.c @@ -3,7 +3,7 @@ * Copyright (c) 2014 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. - * Copyright (c) 2016 IBM Corp. All rights reserved. + * Copyright (c) 2016-2017 IBM Corporation. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -51,7 +51,7 @@ int MPI_Comm_get_info(MPI_Comm comm, MPI_Info *info_used) /* * Setup any defaults if MPI_Win_set_info was never called */ - opal_infosubscribe_change_info(comm, &MPI_INFO_NULL->super); + opal_infosubscribe_change_info(&comm->super, &MPI_INFO_NULL->super); } @@ -60,8 +60,9 @@ int MPI_Comm_get_info(MPI_Comm comm, MPI_Info *info_used) return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_NO_MEM, FUNC_NAME); } + opal_info_t *opal_info_used = &(*info_used)->super; - opal_info_dup(comm->super.s_info, &(*info_used)->super); + opal_info_dup_mpistandard(comm->super.s_info, &opal_info_used); return MPI_SUCCESS; } diff --git a/ompi/mpi/c/comm_set_info.c b/ompi/mpi/c/comm_set_info.c index 6ac12d78260..cca48a67f21 100644 --- a/ompi/mpi/c/comm_set_info.c +++ b/ompi/mpi/c/comm_set_info.c @@ -3,7 +3,7 @@ * Copyright (c) 2014 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. - * Copyright (c) 2016 IBM Corp. All rights reserved. + * Copyright (c) 2016-2017 IBM Corporation. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -50,7 +50,7 @@ int MPI_Comm_set_info(MPI_Comm comm, MPI_Info info) OPAL_CR_ENTER_LIBRARY(); - opal_infosubscribe_change_info(comm, info); + opal_infosubscribe_change_info(&(comm->super), &(info->super)); return MPI_SUCCESS; } diff --git a/ompi/mpi/c/comm_spawn.c b/ompi/mpi/c/comm_spawn.c index 9de5bd9d52a..45e0f24a51e 100644 --- a/ompi/mpi/c/comm_spawn.c +++ b/ompi/mpi/c/comm_spawn.c @@ -17,7 +17,6 @@ * Copyright (c) 2015 Intel, Inc. All rights reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. - * Copyright (c) 2016 IBM Corp. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -110,7 +109,7 @@ int MPI_Comm_spawn(const char *command, char *argv[], int maxprocs, MPI_Info inf /* See if the info key "ompi_non_mpi" was set to true */ if (rank == root) { - opal_info_get_bool(info, "ompi_non_mpi", &non_mpi, &flag); + ompi_info_get_bool(info, "ompi_non_mpi", &non_mpi, &flag); } OPAL_CR_ENTER_LIBRARY(); diff --git a/ompi/mpi/c/comm_spawn_multiple.c b/ompi/mpi/c/comm_spawn_multiple.c index 0cba28ef651..5afdfa39ebc 100644 --- a/ompi/mpi/c/comm_spawn_multiple.c +++ b/ompi/mpi/c/comm_spawn_multiple.c @@ -17,7 +17,6 @@ * Copyright (c) 2015 Intel, Inc. All rights reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. - * Copyright (c) 2016 IBM Corp. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -106,7 +105,7 @@ int MPI_Comm_spawn_multiple(int count, char *array_of_commands[], char **array_o be set to true on all of them. Note that not setting ompi_non_mpi is the same as setting it to false. */ - opal_info_get_bool(array_of_info[i], "ompi_non_mpi", &non_mpi, + ompi_info_get_bool(array_of_info[i], "ompi_non_mpi", &non_mpi, &flag); if (flag && 0 == i) { /* If this is the first info, save its @@ -142,7 +141,7 @@ int MPI_Comm_spawn_multiple(int count, char *array_of_commands[], char **array_o if (MPI_INFO_NULL == array_of_info[0]) { non_mpi = false; } else { - opal_info_get_bool(array_of_info[0], "ompi_non_mpi", &non_mpi, + ompi_info_get_bool(array_of_info[0], "ompi_non_mpi", &non_mpi, &flag); if (!flag) { non_mpi = false; diff --git a/ompi/mpi/c/comm_split_type.c b/ompi/mpi/c/comm_split_type.c index 7bce9ad890c..535c3897652 100644 --- a/ompi/mpi/c/comm_split_type.c +++ b/ompi/mpi/c/comm_split_type.c @@ -13,6 +13,7 @@ * Copyright (c) 2012 Sandia National Laboratories. All rights reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. + * Copyright (c) 2017 IBM Corporation. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -92,7 +93,7 @@ int MPI_Comm_split_type(MPI_Comm comm, int split_type, int key, *newcomm = MPI_COMM_NULL; rc = MPI_SUCCESS; } else { - rc = ompi_comm_split_type( (ompi_communicator_t*)comm, split_type, key, info, + rc = ompi_comm_split_type( (ompi_communicator_t*)comm, split_type, key, &(info->super), (ompi_communicator_t**)newcomm); } OMPI_ERRHANDLER_RETURN ( rc, comm, rc, FUNC_NAME); diff --git a/ompi/mpi/c/dist_graph_create.c b/ompi/mpi/c/dist_graph_create.c index efb3eb1857f..2200d155e77 100644 --- a/ompi/mpi/c/dist_graph_create.c +++ b/ompi/mpi/c/dist_graph_create.c @@ -8,6 +8,7 @@ * reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. + * Copyright (c) 2017 IBM Corporation. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -88,7 +89,7 @@ int MPI_Dist_graph_create(MPI_Comm comm_old, int n, const int sources[], } err = topo->topo.dist_graph.dist_graph_create(topo, comm_old, n, sources, degrees, - destinations, weights, info, + destinations, weights, &(info->super), reorder, newcomm); OMPI_ERRHANDLER_RETURN(err, comm_old, err, FUNC_NAME); } diff --git a/ompi/mpi/c/dist_graph_create_adjacent.c b/ompi/mpi/c/dist_graph_create_adjacent.c index bf2f2cfa979..67ced39011c 100644 --- a/ompi/mpi/c/dist_graph_create_adjacent.c +++ b/ompi/mpi/c/dist_graph_create_adjacent.c @@ -12,6 +12,7 @@ * Copyright (c) 2012-2013 Inria. All rights reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. + * Copyright (c) 2017 IBM Corporation. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -100,7 +101,7 @@ int MPI_Dist_graph_create_adjacent(MPI_Comm comm_old, err = topo->topo.dist_graph.dist_graph_create_adjacent(topo, comm_old, indegree, sources, sourceweights, outdegree, - destinations, destweights, info, + destinations, destweights, &(info->super), reorder, comm_dist_graph); OMPI_ERRHANDLER_RETURN(err, comm_old, err, FUNC_NAME); } diff --git a/ompi/mpi/c/file_delete.c b/ompi/mpi/c/file_delete.c index cad11c4c35a..652b6843284 100644 --- a/ompi/mpi/c/file_delete.c +++ b/ompi/mpi/c/file_delete.c @@ -14,6 +14,7 @@ * reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. + * Copyright (c) 2017 IBM Corporation. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -78,6 +79,6 @@ int MPI_File_delete(const char *filename, MPI_Info info) /* Since there is no MPI_File handle associated with this function, the MCA has to do a selection and perform the action */ - rc = mca_io_base_delete(filename, info); + rc = mca_io_base_delete(filename, &(info->super)); OMPI_ERRHANDLER_RETURN(rc, MPI_FILE_NULL, rc, FUNC_NAME); } diff --git a/ompi/mpi/c/file_get_info.c b/ompi/mpi/c/file_get_info.c index 0135e29dc9e..976cbdbed1b 100644 --- a/ompi/mpi/c/file_get_info.c +++ b/ompi/mpi/c/file_get_info.c @@ -12,7 +12,7 @@ * Copyright (c) 2008 Sun Microsystems, Inc. All rights reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. - * Copyright (c) 2016 IBM Corp. All rights reserved. + * Copyright (c) 2016-2017 IBM Corporation. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -57,7 +57,7 @@ int MPI_File_get_info(MPI_File fh, MPI_Info *info_used) /* * Setup any defaults if MPI_Win_set_info was never called */ - opal_infosubscribe_change_info(fh, &MPI_INFO_NULL->super); + opal_infosubscribe_change_info(&fh->super, &MPI_INFO_NULL->super); } @@ -65,8 +65,9 @@ int MPI_File_get_info(MPI_File fh, MPI_Info *info_used) if (NULL == (*info_used)) { return OMPI_ERRHANDLER_INVOKE(fh, MPI_ERR_NO_MEM, FUNC_NAME); } + opal_info_t *opal_info_used = &(*info_used)->super; - opal_info_dup(fh->super.s_info, &(*info_used)->super); + opal_info_dup_mpistandard(fh->super.s_info, &opal_info_used); return OMPI_SUCCESS; } diff --git a/ompi/mpi/c/file_open.c b/ompi/mpi/c/file_open.c index 74d63e16a95..13f003dad23 100644 --- a/ompi/mpi/c/file_open.c +++ b/ompi/mpi/c/file_open.c @@ -16,6 +16,7 @@ * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. * Copyright (c) 2016 University of Houston. All rights reserved. + * Copyright (c) 2017 IBM Corporation. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -105,7 +106,7 @@ int MPI_File_open(MPI_Comm comm, const char *filename, int amode, /* Create an empty MPI_File handle */ *fh = MPI_FILE_NULL; - rc = ompi_file_open(comm, filename, amode, info, fh); + rc = ompi_file_open(comm, filename, amode, &(info->super), fh); /* Creating the file handle also selects a component to use, creates a module, and calls file_open() on the module. So diff --git a/ompi/mpi/c/file_set_info.c b/ompi/mpi/c/file_set_info.c index 37e9b546d45..ff56aa70c75 100644 --- a/ompi/mpi/c/file_set_info.c +++ b/ompi/mpi/c/file_set_info.c @@ -12,7 +12,7 @@ * Copyright (c) 2008 Sun Microsystems, Inc. All rights reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. - * Copyright (c) 2016 IBM Corp. All rights reserved. + * Copyright (c) 2016-2017 IBM Corporation. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -62,7 +62,7 @@ int MPI_File_set_info(MPI_File fh, MPI_Info info) OPAL_CR_ENTER_LIBRARY(); - ret = opal_infosubscribe_change_info(fh, &info->super); + ret = opal_infosubscribe_change_info(&fh->super, &info->super); OMPI_ERRHANDLER_RETURN(ret, fh, ret, FUNC_NAME); } diff --git a/ompi/mpi/c/file_set_view.c b/ompi/mpi/c/file_set_view.c index 5200418c686..ed0883650e4 100644 --- a/ompi/mpi/c/file_set_view.c +++ b/ompi/mpi/c/file_set_view.c @@ -15,6 +15,7 @@ * reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. + * Copyright (c) 2017 IBM Corporation. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -73,7 +74,7 @@ int MPI_File_set_view(MPI_File fh, MPI_Offset disp, MPI_Datatype etype, switch (fh->f_io_version) { case MCA_IO_BASE_V_2_0_0: rc = fh->f_io_selected_module.v2_0_0. - io_module_file_set_view(fh, disp, etype, filetype, datarep, info); + io_module_file_set_view(fh, disp, etype, filetype, datarep, &(info->super)); break; default: diff --git a/ompi/mpi/c/info_delete.c b/ompi/mpi/c/info_delete.c index 7800884aa0b..dc246ea3288 100644 --- a/ompi/mpi/c/info_delete.c +++ b/ompi/mpi/c/info_delete.c @@ -14,7 +14,6 @@ * reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. - * Copyright (c) 2016 IBM Corp. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -78,6 +77,6 @@ int MPI_Info_delete(MPI_Info info, const char *key) { OPAL_CR_ENTER_LIBRARY(); - err = opal_info_delete (info, key); + err = ompi_info_delete (info, key); OMPI_ERRHANDLER_RETURN(err, MPI_COMM_WORLD, err, FUNC_NAME); } diff --git a/ompi/mpi/c/info_dup.c b/ompi/mpi/c/info_dup.c index f772fab3a56..5d3c2f5cdeb 100644 --- a/ompi/mpi/c/info_dup.c +++ b/ompi/mpi/c/info_dup.c @@ -11,7 +11,6 @@ * All rights reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. - * Copyright (c) 2016 IBM Corp. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -74,7 +73,7 @@ int MPI_Info_dup(MPI_Info info, MPI_Info *newinfo) { } } - *newinfo = OBJ_NEW(opal_info_t); + *newinfo = OBJ_NEW(ompi_info_t); if (NULL == *newinfo) { return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_NO_MEM, FUNC_NAME); @@ -85,6 +84,6 @@ int MPI_Info_dup(MPI_Info info, MPI_Info *newinfo) { /* * Now to actually duplicate all the values */ - err = opal_info_dup (info, newinfo); + err = ompi_info_dup (info, newinfo); OMPI_ERRHANDLER_RETURN(err, MPI_COMM_WORLD, err, FUNC_NAME); } diff --git a/ompi/mpi/c/info_get.c b/ompi/mpi/c/info_get.c index ad1c284d40f..cbc2d127f00 100644 --- a/ompi/mpi/c/info_get.c +++ b/ompi/mpi/c/info_get.c @@ -14,7 +14,7 @@ * reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. - * Copyright (c) 2016 IBM Corp. All rights reserved. + * Copyright (c) 2016-2017 IBM Corporation. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -101,6 +101,6 @@ int MPI_Info_get(MPI_Info info, const char *key, int valuelen, OPAL_CR_ENTER_LIBRARY(); - err = opal_info_get(info, key, valuelen, value, flag); + err = ompi_info_get(info, key, valuelen, value, flag); OMPI_ERRHANDLER_RETURN(err, MPI_COMM_WORLD, err, FUNC_NAME); } diff --git a/ompi/mpi/c/info_get_nkeys.c b/ompi/mpi/c/info_get_nkeys.c index 57e2944748e..db0887466e5 100644 --- a/ompi/mpi/c/info_get_nkeys.c +++ b/ompi/mpi/c/info_get_nkeys.c @@ -11,7 +11,6 @@ * All rights reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. - * Copyright (c) 2016 IBM Corp. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -70,6 +69,6 @@ int MPI_Info_get_nkeys(MPI_Info info, int *nkeys) OPAL_CR_ENTER_LIBRARY(); - err = opal_info_get_nkeys(info, nkeys); + err = ompi_info_get_nkeys(info, nkeys); OMPI_ERRHANDLER_RETURN(err, MPI_COMM_WORLD, err, FUNC_NAME); } diff --git a/ompi/mpi/c/info_get_nthkey.c b/ompi/mpi/c/info_get_nthkey.c index 1bb0165a4ba..59da2bd0001 100644 --- a/ompi/mpi/c/info_get_nthkey.c +++ b/ompi/mpi/c/info_get_nthkey.c @@ -11,7 +11,6 @@ * All rights reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. - * Copyright (c) 2016 IBM Corp. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -83,7 +82,7 @@ int MPI_Info_get_nthkey(MPI_Info info, int n, char *key) 1 from the value returned by get_nkeys(). So be sure to compare appropriately. */ - err = opal_info_get_nkeys(info, &nkeys); + err = ompi_info_get_nkeys(info, &nkeys); OMPI_ERRHANDLER_CHECK(err, MPI_COMM_WORLD, err, FUNC_NAME); if (n > (nkeys - 1)) { OPAL_CR_EXIT_LIBRARY(); @@ -93,6 +92,6 @@ int MPI_Info_get_nthkey(MPI_Info info, int n, char *key) /* Everything seems alright. Call the back end key copy */ - err = opal_info_get_nthkey (info, n, key); + err = ompi_info_get_nthkey (info, n, key); OMPI_ERRHANDLER_RETURN(err, MPI_COMM_WORLD, err, FUNC_NAME); } diff --git a/ompi/mpi/c/info_get_valuelen.c b/ompi/mpi/c/info_get_valuelen.c index 4a0605e70f1..3e55ee05b03 100644 --- a/ompi/mpi/c/info_get_valuelen.c +++ b/ompi/mpi/c/info_get_valuelen.c @@ -14,7 +14,6 @@ * reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. - * Copyright (c) 2016 IBM Corp. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -91,6 +90,6 @@ int MPI_Info_get_valuelen(MPI_Info info, const char *key, int *valuelen, OPAL_CR_ENTER_LIBRARY(); - err = opal_info_get_valuelen (info, key, valuelen, flag); + err = ompi_info_get_valuelen (info, key, valuelen, flag); OMPI_ERRHANDLER_RETURN(err, MPI_COMM_WORLD, err, FUNC_NAME); } diff --git a/ompi/mpi/c/info_set.c b/ompi/mpi/c/info_set.c index c0242bf1a52..0b4874c211e 100644 --- a/ompi/mpi/c/info_set.c +++ b/ompi/mpi/c/info_set.c @@ -12,7 +12,6 @@ * Copyright (c) 2012-2013 Inria. All rights reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. - * Copyright (c) 2016 IBM Corp. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -105,6 +104,6 @@ int MPI_Info_set(MPI_Info info, const char *key, const char *value) * allocator. */ - err = opal_info_set (info, key, value); + err = ompi_info_set (info, key, value); OMPI_ERRHANDLER_RETURN(err, MPI_COMM_WORLD, err, FUNC_NAME); } diff --git a/ompi/mpi/c/lookup_name.c b/ompi/mpi/c/lookup_name.c index 0e790e727f4..42a71c367c4 100644 --- a/ompi/mpi/c/lookup_name.c +++ b/ompi/mpi/c/lookup_name.c @@ -16,7 +16,6 @@ * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. * Copyright (c) 2015 Cisco Systems, Inc. All rights reserved. - * Copyright (c) 2016 IBM Corp. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -89,7 +88,7 @@ int MPI_Lookup_name(const char *service_name, MPI_Info info, char *port_name) /* OMPI supports info keys to pass the range to * be searched for the given key */ if (MPI_INFO_NULL != info) { - opal_info_get (info, "range", sizeof(range) - 1, range, &flag); + ompi_info_get (info, "range", sizeof(range) - 1, range, &flag); if (flag) { if (0 == strcmp(range, "nspace")) { rng = OBJ_NEW(opal_value_t); diff --git a/ompi/mpi/c/publish_name.c b/ompi/mpi/c/publish_name.c index f7c40aa91a5..24270cea8f0 100644 --- a/ompi/mpi/c/publish_name.c +++ b/ompi/mpi/c/publish_name.c @@ -16,7 +16,6 @@ * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. * Copyright (c) 2015 Cisco Systems, Inc. All rights reserved. - * Copyright (c) 2016 IBM Corp. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -89,7 +88,7 @@ int MPI_Publish_name(const char *service_name, MPI_Info info, /* OMPI supports info keys to pass the range and persistence to * be used for the given key */ if (MPI_INFO_NULL != info) { - opal_info_get (info, "range", sizeof(range) - 1, range, &flag); + ompi_info_get (info, "range", sizeof(range) - 1, range, &flag); if (flag) { if (0 == strcmp(range, "nspace")) { rng = OBJ_NEW(opal_value_t); @@ -111,7 +110,7 @@ int MPI_Publish_name(const char *service_name, MPI_Info info, FUNC_NAME); } } - opal_info_get (info, "persistence", sizeof(range) - 1, range, &flag); + ompi_info_get (info, "persistence", sizeof(range) - 1, range, &flag); if (flag) { if (0 == strcmp(range, "indef")) { rng = OBJ_NEW(opal_value_t); diff --git a/ompi/mpi/c/unpublish_name.c b/ompi/mpi/c/unpublish_name.c index aa103ae11c4..019d7106fe6 100644 --- a/ompi/mpi/c/unpublish_name.c +++ b/ompi/mpi/c/unpublish_name.c @@ -16,7 +16,6 @@ * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. * Copyright (c) 2015 Cisco Systems, Inc. All rights reserved. - * Copyright (c) 2016 IBM Corp. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -91,7 +90,7 @@ int MPI_Unpublish_name(const char *service_name, MPI_Info info, /* OMPI supports info keys to pass the range to * be searched for the given key */ if (MPI_INFO_NULL != info) { - opal_info_get (info, "range", sizeof(range) - 1, range, &flag); + ompi_info_get (info, "range", sizeof(range) - 1, range, &flag); if (flag) { if (0 == strcmp(range, "nspace")) { rng = OBJ_NEW(opal_value_t); diff --git a/ompi/mpi/c/win_allocate.c b/ompi/mpi/c/win_allocate.c index f259c3c8ae6..f0d1dbd5e9a 100644 --- a/ompi/mpi/c/win_allocate.c +++ b/ompi/mpi/c/win_allocate.c @@ -12,6 +12,7 @@ * Copyright (c) 2006 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. + * Copyright (c) 2017 IBM Corporation. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -77,7 +78,7 @@ int MPI_Win_allocate(MPI_Aint size, int disp_unit, MPI_Info info, OPAL_CR_ENTER_LIBRARY(); /* create window and return */ - ret = ompi_win_allocate((size_t)size, disp_unit, info, + ret = ompi_win_allocate((size_t)size, disp_unit, &(info->super), comm, baseptr, win); if (OMPI_SUCCESS != ret) { *win = MPI_WIN_NULL; diff --git a/ompi/mpi/c/win_allocate_shared.c b/ompi/mpi/c/win_allocate_shared.c index 5179a5d0955..36d26df0c21 100644 --- a/ompi/mpi/c/win_allocate_shared.c +++ b/ompi/mpi/c/win_allocate_shared.c @@ -15,6 +15,7 @@ * reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. + * Copyright (c) 2017 IBM Corporation. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -78,7 +79,7 @@ int MPI_Win_allocate_shared(MPI_Aint size, int disp_unit, MPI_Info info, OPAL_CR_ENTER_LIBRARY(); /* create window and return */ - ret = ompi_win_allocate_shared((size_t)size, disp_unit, info, + ret = ompi_win_allocate_shared((size_t)size, disp_unit, &(info->super), comm, baseptr, win); if (OMPI_SUCCESS != ret) { *win = MPI_WIN_NULL; diff --git a/ompi/mpi/c/win_create.c b/ompi/mpi/c/win_create.c index c5e7f9d463e..7b322c690bd 100644 --- a/ompi/mpi/c/win_create.c +++ b/ompi/mpi/c/win_create.c @@ -12,6 +12,7 @@ * Copyright (c) 2006 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. + * Copyright (c) 2017 IBM Corporation. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -78,7 +79,7 @@ int MPI_Win_create(void *base, MPI_Aint size, int disp_unit, /* create window and return */ ret = ompi_win_create(base, (size_t)size, disp_unit, comm, - info, win); + &(info->super), win); if (OMPI_SUCCESS != ret) { *win = MPI_WIN_NULL; OPAL_CR_EXIT_LIBRARY(); diff --git a/ompi/mpi/c/win_create_dynamic.c b/ompi/mpi/c/win_create_dynamic.c index dfafed94c29..438b5900325 100644 --- a/ompi/mpi/c/win_create_dynamic.c +++ b/ompi/mpi/c/win_create_dynamic.c @@ -12,6 +12,7 @@ * Copyright (c) 2006 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. + * Copyright (c) 2017 IBM Corporation. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -73,7 +74,7 @@ int MPI_Win_create_dynamic(MPI_Info info, MPI_Comm comm, MPI_Win *win) OPAL_CR_ENTER_LIBRARY(); /* create_dynamic window and return */ - ret = ompi_win_create_dynamic(info, comm, win); + ret = ompi_win_create_dynamic(&(info->super), comm, win); if (OMPI_SUCCESS != ret) { *win = MPI_WIN_NULL; OPAL_CR_EXIT_LIBRARY(); diff --git a/ompi/mpi/c/win_get_info.c b/ompi/mpi/c/win_get_info.c index 8b5a03f536e..512ab1c213b 100644 --- a/ompi/mpi/c/win_get_info.c +++ b/ompi/mpi/c/win_get_info.c @@ -5,7 +5,7 @@ * reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. - * Copyright (c) 2016 IBM Corp. All rights reserved. + * Copyright (c) 2016-2017 IBM Corporation. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -53,15 +53,16 @@ int MPI_Win_get_info(MPI_Win win, MPI_Info *info_used) /* * Setup any defaults if MPI_Win_set_info was never called */ - opal_infosubscribe_change_info(win, &MPI_INFO_NULL->super); + opal_infosubscribe_change_info(&win->super, &MPI_INFO_NULL->super); } (*info_used) = OBJ_NEW(ompi_info_t); if (NULL == (*info_used)) { return OMPI_ERRHANDLER_INVOKE(win, MPI_ERR_NO_MEM, FUNC_NAME); } + opal_info_t *opal_info_used = &(*info_used)->super; - ret = opal_info_dup(&win->super.s_info, &(*info_used)->super); + ret = opal_info_dup_mpistandard(win->super.s_info, &opal_info_used); OMPI_ERRHANDLER_RETURN(ret, win, ret, FUNC_NAME); } diff --git a/ompi/mpi/c/win_set_info.c b/ompi/mpi/c/win_set_info.c index 20a3a584750..31eca8f378b 100644 --- a/ompi/mpi/c/win_set_info.c +++ b/ompi/mpi/c/win_set_info.c @@ -2,7 +2,7 @@ * Copyright (c) 2013 Sandia National Laboratories. All rights reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. - * Copyright (c) 2016 IBM Corp. All rights reserved. + * Copyright (c) 2016-2017 IBM Corporation. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -48,7 +48,7 @@ int MPI_Win_set_info(MPI_Win win, MPI_Info info) OPAL_CR_ENTER_LIBRARY(); - ret = opal_infosubscribe_change_info(win, info); + ret = opal_infosubscribe_change_info(&(win->super), &(info->super)); OMPI_ERRHANDLER_RETURN(ret, win, ret, FUNC_NAME); } diff --git a/ompi/mpiext/cr/c/quiesce_start.c b/ompi/mpiext/cr/c/quiesce_start.c index ba835ad1085..3c15ab2964a 100644 --- a/ompi/mpiext/cr/c/quiesce_start.c +++ b/ompi/mpiext/cr/c/quiesce_start.c @@ -6,7 +6,7 @@ * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2012 Cisco Systems, Inc. All rights reserved. - * Copyright (c) 2016 IBM Corp. All rights reserved. + * Copyright (c) 2016-2017 IBM Corporation. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow diff --git a/ompi/runtime/ompi_mpi_finalize.c b/ompi/runtime/ompi_mpi_finalize.c index cd56bad30fd..da8a406adb9 100644 --- a/ompi/runtime/ompi_mpi_finalize.c +++ b/ompi/runtime/ompi_mpi_finalize.c @@ -20,7 +20,7 @@ * Copyright (c) 2016 Research Organization for Information Science * and Technology (RIST). All rights reserved. * - * Copyright (c) 2016 IBM Corp. All rights reserved. + * Copyright (c) 2016-2017 IBM Corporation. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow diff --git a/ompi/runtime/ompi_mpi_init.c b/ompi/runtime/ompi_mpi_init.c index 40c13eb638d..0aa346a66cf 100644 --- a/ompi/runtime/ompi_mpi_init.c +++ b/ompi/runtime/ompi_mpi_init.c @@ -22,7 +22,7 @@ * and Technology (RIST). All rights reserved. * Copyright (c) 2016 Mellanox Technologies Ltd. All rights reserved. * - * Copyright (c) 2016 IBM Corp. All rights reserved. + * Copyright (c) 2016-2017 IBM Corporation. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow diff --git a/ompi/win/win.c b/ompi/win/win.c index 082e4ab6669..8389acb1f9b 100644 --- a/ompi/win/win.c +++ b/ompi/win/win.c @@ -16,7 +16,7 @@ * reserved. * Copyright (c) 2015-2016 Research Organization for Information Science * and Technology (RIST). All rights reserved. - * Copyright (c) 2016 IBM Corp. All rights reserved. + * Copyright (c) 2016-2017 IBM Corporation. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -179,6 +179,12 @@ static int alloc_window(struct ompi_communicator_t *comm, opal_info_t *info, int OBJ_RETAIN(group); win->w_group = group; + /* Copy the info for the info layer */ + win->super.s_info = OBJ_NEW(opal_info_t); + if (info) { + opal_info_dup(info, &(win->super.s_info)); + } + *win_out = win; return OMPI_SUCCESS; @@ -361,6 +367,10 @@ ompi_win_free(ompi_win_t *win) NULL); } + if (NULL != (win->super.s_info)) { + OBJ_RELEASE(win->super.s_info); + } + if (OMPI_SUCCESS == ret) { OBJ_RELEASE(win); } diff --git a/ompi/win/win.h b/ompi/win/win.h index d93951c0945..2bb03ab1a33 100644 --- a/ompi/win/win.h +++ b/ompi/win/win.h @@ -14,7 +14,7 @@ * Copyright (c) 2009 Sun Microsystems, Inc. All rights reserved. * Copyright (c) 2013-2015 Los Alamos National Security, LLC. All rights * reserved. - * Copyright (c) 2016 IBM Corp. All rights reserved. + * Copyright (c) 2016-2017 IBM Corporation. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow diff --git a/opal/mca/mpool/base/mpool_base_alloc.c b/opal/mca/mpool/base/mpool_base_alloc.c index af396191c1d..95a6ac3a115 100644 --- a/opal/mca/mpool/base/mpool_base_alloc.c +++ b/opal/mca/mpool/base/mpool_base_alloc.c @@ -11,7 +11,7 @@ * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. * Copyright (c) 2009 Sun Microsystems, Inc. All rights reserved. - * Copyright (c) 2010-2016 IBM Corp. All rights reserved. + * Copyright (c) 2010-2017 IBM Corporation. All rights reserved. * Copyright (c) 2015 Los Alamos National Security, LLC. All rights * reserved. * $COPYRIGHT$ diff --git a/opal/util/Makefile.am b/opal/util/Makefile.am index 5a396a4dfc6..934fb90c198 100644 --- a/opal/util/Makefile.am +++ b/opal/util/Makefile.am @@ -16,7 +16,7 @@ # reserved. # Copyright (c) 2016 Research Organization for Information Science # and Technology (RIST). All rights reserved. -# Copyright (c) 2016 IBM Corp. All rights reserved. +# Copyright (c) 2016-2017 IBM Corporation. All rights reserved. # $COPYRIGHT$ # # Additional copyrights may follow diff --git a/opal/util/info.c b/opal/util/info.c index c7232562e7e..39a5d88374c 100644 --- a/opal/util/info.c +++ b/opal/util/info.c @@ -16,6 +16,7 @@ * reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. + * Copyright (c) 2016-2017 IBM Corporation. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -100,6 +101,124 @@ int opal_info_dup (opal_info_t *info, opal_info_t **newinfo) return MPI_SUCCESS; } +/* + * An object's info can be set, but those settings can be modified by + * system callbacks. When those callbacks happen, we save a "__IN_"/"val" + * copy of changed or erased values. + * + * extra options for how to dup: + * include_system_extras (default 1) + * omit_ignored (default 1) + * show_modifications (default 0) + */ +static +int opal_info_dup_mode (opal_info_t *info, opal_info_t **newinfo, + int include_system_extras, // (k/v with no corresponding __IN_k) + int omit_ignored, // (__IN_k with no k/v) + int show_modifications) // (pick v from k/v or __IN_k/v) +{ + int err, flag; + opal_list_item_t *item; + opal_info_entry_t *iterator; + char savedkey[MPI_MAX_INFO_KEY]; + char savedval[MPI_MAX_INFO_VAL]; + char *valptr, *pkey; + int is_IN_key; + int exists_IN_key, exists_reg_key; + + OPAL_THREAD_LOCK(info->i_lock); + for (item = opal_list_get_first(&(info->super)); + item != opal_list_get_end(&(info->super)); + item = opal_list_get_next(iterator)) { + iterator = (opal_info_entry_t *) item; + +// If we see an __IN_ key but no , decide what to do based on mode. +// If we see an __IN_ and a , skip since it'll be handled when +// we process . + is_IN_key = 0; + exists_IN_key = 0; + exists_reg_key = 0; + pkey = iterator->ie_key; + if (0 == strncmp(iterator->ie_key, "__IN_", 5)) { + pkey += 5; + + is_IN_key = 1; + exists_IN_key = 1; + opal_info_get (info, pkey, 0, NULL, &flag); + if (flag) { + exists_reg_key = 1; + } + } else { + is_IN_key = 0; + exists_reg_key = 1; + +// see if there is an __IN_ for the current + if (strlen(iterator->ie_key) + 5 < MPI_MAX_INFO_KEY) { + sprintf(savedkey, "__IN_%s", iterator->ie_key); + err = opal_info_get (info, savedkey, MPI_MAX_INFO_VAL, + savedval, &flag); + } else { + flag = 0; + } + if (flag) { + exists_IN_key = 1; + } + } + + if (is_IN_key) { + if (exists_reg_key) { +// we're processing __IN_ and there exists a so we'll handle it then + continue; + } else { +// we're processing __IN_ and no exists +// this would mean was set by the user but ignored by the system +// so base our behavior on the omit_ignored + if (!omit_ignored) { + err = opal_info_set(*newinfo, pkey, iterator->ie_value); + if (MPI_SUCCESS != err) { + OPAL_THREAD_UNLOCK(info->i_lock); + return err; + } + } + } + } else { + valptr = 0; + if (!exists_IN_key) { +// we're processing and no __IN_ exists +// this would mean it's a system setting, not something that came from the user + if (include_system_extras) { + valptr = iterator->ie_value; + } + } else { +// we're processing and __IN_ also exists +// pick which value to use + if (!show_modifications) { + valptr = savedval; + } else { + valptr = iterator->ie_value; + } + } + if (valptr) { + err = opal_info_set(*newinfo, pkey, valptr); + if (MPI_SUCCESS != err) { + OPAL_THREAD_UNLOCK(info->i_lock); + return err; + } + } + } + } + OPAL_THREAD_UNLOCK(info->i_lock); + return MPI_SUCCESS; +} + +/* + * Implement opal_info_dup_mpistandard by using whatever mode + * settings represent our interpretation of the standard + */ +int opal_info_dup_mpistandard (opal_info_t *info, opal_info_t **newinfo) +{ + return opal_info_dup_mode (info, newinfo, 1, 1, 0); +} /* * Set a value on the info @@ -167,7 +286,7 @@ int opal_info_get (opal_info_t *info, const char *key, int valuelen, search = info_find_key (info, key); if (NULL == search){ *flag = 0; - } else { + } else if (value && valuelen) { /* * We have found the element, so we can return the value * Set the flag, value_length and value diff --git a/opal/util/info.h b/opal/util/info.h index fedeab626ee..b030fd180db 100644 --- a/opal/util/info.h +++ b/opal/util/info.h @@ -14,6 +14,7 @@ * Copyright (c) 2009 Sun Microsystems, Inc. All rights reserved. * Copyright (c) 2012-2015 Los Alamos National Security, LLC. All rights * reserved. + * Copyright (c) 2017 IBM Corporation. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -107,6 +108,34 @@ int opal_mpiinfo_init(void*); */ int opal_info_dup (opal_info_t *info, opal_info_t **newinfo); +/** + * opal_info_dup_mpistandard - 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 + * + * The user sets an info object with key/value pairs and once processed, + * we keep key/val pairs that might have been modified vs what the user + * provided, and some user inputs might have been ignored too. The original + * user inpust are kept as __IN_/. + * + * This routine then outputs key/value pairs as: + * + * if and __IN_ both exist: + * This means the user set a k/v pair and it was used. + * output: / value(__IN_), the original user input + * if exists but __IN_ doesn't: + * This is a system-provided setting. + * output: /value() + * if __IN_ exists but doesn't: + * The user provided a setting that was rejected (ignored) by the system + * output: nothing for this key + */ +int opal_info_dup_mpistandard (opal_info_t *info, opal_info_t **newinfo); + /** * Set a new key,value pair on info. * diff --git a/opal/util/info_subscriber.c b/opal/util/info_subscriber.c index 845538c1865..0b8a8c475ed 100644 --- a/opal/util/info_subscriber.c +++ b/opal/util/info_subscriber.c @@ -16,6 +16,7 @@ * reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. + * Copyright (c) 2016-2017 IBM Corporation. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -42,7 +43,7 @@ #include "opal/util/strncpy.h" #include "opal/util/info_subscriber.h" -static char* opal_infosubscribe_inform_subscribers(opal_infosubscriber_t * object, char *key, char *new_value); +static char* opal_infosubscribe_inform_subscribers(opal_infosubscriber_t * object, char *key, char *new_value, int *found_callback); static void infosubscriber_construct(opal_infosubscriber_t *obj); static void infosubscriber_destruct(opal_infosubscriber_t *obj); @@ -66,10 +67,11 @@ OBJ_CLASS_INSTANCE(opal_infosubscriber_t, infosubscriber_destruct); OPAL_DECLSPEC OBJ_CLASS_DECLARATION(opal_callback_list_item_t); +static void opal_callback_list_item_destruct(opal_callback_list_item_t *obj); OBJ_CLASS_INSTANCE(opal_callback_list_item_t, opal_list_item_t, NULL, - NULL); + opal_callback_list_item_destruct); static void infosubscriber_construct(opal_infosubscriber_t *obj) { OBJ_CONSTRUCT(&obj->s_subscriber_table, opal_hash_table_t); @@ -77,16 +79,39 @@ static void infosubscriber_construct(opal_infosubscriber_t *obj) { } static void infosubscriber_destruct(opal_infosubscriber_t *obj) { + opal_hash_table_t *table = &obj->s_subscriber_table; + void *node = NULL; + int err; + char *next_key; + size_t key_size; + opal_list_t *list = NULL; + + err = opal_hash_table_get_first_key_ptr(table, + (void**) &next_key, &key_size, (void**) &list, &node); + while (list && err == OPAL_SUCCESS) { + OPAL_LIST_RELEASE(list); + + err = opal_hash_table_get_next_key_ptr(table, + (void**) &next_key, &key_size, (void**) &list, node, &node); + } + OBJ_DESTRUCT(&obj->s_subscriber_table); } -static char* opal_infosubscribe_inform_subscribers(opal_infosubscriber_t *object, char *key, char *new_value) +static void opal_callback_list_item_destruct(opal_callback_list_item_t *obj) { + if (obj->default_value) { + free(obj->default_value); // came from a strdup() + } +} + +static char* opal_infosubscribe_inform_subscribers(opal_infosubscriber_t *object, char *key, char *new_value, int *found_callback) { opal_hash_table_t *table = &object->s_subscriber_table; opal_list_t *list = NULL; opal_callback_list_item_t *item; char *updated_value = NULL; + if (found_callback) { *found_callback = 0; } /* * Present the new value to each subscriber. They can decide to accept it, ignore it, or * over-ride it with their own value (like ignore, but they specify what value they want it to have). @@ -101,6 +126,7 @@ static char* opal_infosubscribe_inform_subscribers(opal_infosubscriber_t *object updated_value = new_value; OPAL_LIST_FOREACH(item, list, opal_callback_list_item_t) { updated_value = item->callback(object, key, updated_value); + if (found_callback) { *found_callback = 1; } } } } @@ -111,106 +137,210 @@ static char* opal_infosubscribe_inform_subscribers(opal_infosubscriber_t *object +/* + * Testing-only static data, all paths using this code should be + * inactive in a normal run. In particular ntesting_callbacks is 0 + * unless testing is in play. + */ +static int ntesting_callbacks = 0; +static opal_key_interest_callback_t *testing_callbacks[5]; +static char *testing_keys[5]; +static char *testing_initialvals[5]; +// User-level call, user adds their own callback function to be subscribed +// to every object: +int opal_infosubscribe_testcallback(opal_key_interest_callback_t *callback, + char *key, char *val); + int -opal_infosubscribe_change_info(opal_infosubscriber_t *object, opal_info_t *new_info) +opal_infosubscribe_testcallback(opal_key_interest_callback_t *callback, + char *key, char *val) +{ + int i = ntesting_callbacks; + if (ntesting_callbacks >= 5) { return -1; } + + testing_callbacks[i] = callback; + testing_keys[i] = key; + testing_initialvals[i] = val; + ++ntesting_callbacks; + return 0; +} + +int opal_infosubscribe_testregister(opal_infosubscriber_t *object); +int +opal_infosubscribe_testregister(opal_infosubscriber_t *object) { - int err; - size_t key_size; - int flag; - opal_info_entry_t *iterator; - opal_info_t **old_info = &object->s_info; - opal_info_t *real_info; - char *updated_value; - void *node = NULL; - char *next_key; opal_hash_table_t *table = &object->s_subscriber_table; opal_callback_list_item_t *item; opal_list_t *list = NULL; - /* for each key/value in new info, let subscribers know of new value */ +// The testing section should only ever be activated if the testing callback +// above is used. + if (ntesting_callbacks != 0) { + int i; + for (i=0; idefault_value, testing_initialvals[i]) + && + item->callback == testing_callbacks[i]) + { + found = 1; + } + } + } + list = NULL; - real_info = OBJ_NEW(opal_info_t); - - OPAL_LIST_FOREACH(iterator, &new_info->super, opal_info_entry_t) { - - if ((updated_value = opal_infosubscribe_inform_subscribers(object, iterator->ie_key, iterator->ie_value))) { - err = opal_info_set(real_info, iterator->ie_key, updated_value); - if (MPI_SUCCESS != err) { - return err; + if (!found) { + opal_infosubscribe_subscribe(object, + testing_keys[i], + testing_initialvals[i], testing_callbacks[i]); } } } -/* - * Now any values in the old_info that were not included in the new info we should - * tell them that they are going away and give a chance to set them in the new info - * SOLT: TODO: This should be a compare with MPI_INFO_NULL?? - */ - if (NULL != *old_info) { - - /* let subscribers know it is going away, they may set a new value for it */ - - OPAL_LIST_FOREACH(iterator, &(*old_info)->super, opal_info_entry_t) { - -/* - * See if this is updated in the new_info. If so, we don't need to tell them about it - * going away, we already told them about the value change. - */ - err = opal_info_get (new_info, iterator->ie_key, 0, NULL, &flag); - if (MPI_SUCCESS != err) { - return err; - } - - if (!flag && (updated_value = opal_infosubscribe_inform_subscribers(object, iterator->ie_key, NULL))) { - err = opal_info_set(real_info, iterator->ie_key, updated_value); - if (MPI_SUCCESS != err) { - return err; +// For testing-mode only, while we're here, lets walk the whole list +// to see if there are any duplicates. + if (ntesting_callbacks != 0) { + int err; + void *node = NULL; + size_t key_size; + char *next_key; + opal_callback_list_item_t *item1, *item2; + + err = opal_hash_table_get_first_key_ptr(table, (void**) &next_key, + &key_size, (void**) &list, &node); + while (list && err == OPAL_SUCCESS) { + int counter = 0; + OPAL_LIST_FOREACH(item1, list, opal_callback_list_item_t) { + OPAL_LIST_FOREACH(item2, list, opal_callback_list_item_t) { + if (0 == + strcmp(item1->default_value, item2->default_value) + && + item1->callback == item2->callback) + { + ++counter; + } } } + if (counter > 1) { + printf("ERROR: duplicate info key/val subscription found " + "in hash table\n"); + exit(-1); + } + + err = opal_hash_table_get_next_key_ptr(table, + (void**) &next_key, &key_size, (void**) &list, node, &node); } + } - /* Clear old info */ - OBJ_DESTRUCT(old_info); - - } else { -/* - * If there is no old_info, then this is the first time that we are setting something and we should set all - * defaults that were not changed in new_info - */ - err = opal_hash_table_get_first_key_ptr(table, (void**) &next_key, &key_size, (void**) &list, &node); - - - while (list && err == OPAL_SUCCESS) { + return OPAL_SUCCESS; +} - err = opal_info_get (new_info, next_key, 0, NULL, &flag); +// This routine is to be used after making a callback for a +// key/val pair. The callback would have ggiven a new value to associate +// with , and this function saves the previous value under +// __IN_. +// +// The last argument indicates whether to overwrite a previous +// __IN_ or not. +static int +save_original_key_val(opal_info_t *info, char *key, char *val, int overwrite) +{ + char modkey[MPI_MAX_INFO_KEY]; + int flag, err; + + // Checking strlen, even though it should be unnecessary. + // This should only happen on predefined keys with short lengths. + if (strlen(key) + 5 < MPI_MAX_INFO_KEY) { + sprintf(modkey, "__IN_%s", key); + + flag = 0; + opal_info_get(info, modkey, 0, NULL, &flag); + if (!flag || overwrite) { + err = opal_info_set(info, modkey, val); if (MPI_SUCCESS != err) { return err; } -/* - * Figure out which subscriber's default value we will take. (Psst, we are going to - * take the first one we see) - */ - updated_value = NULL; - OPAL_LIST_FOREACH(item, list, opal_callback_list_item_t) { - if (item->default_value) { - updated_value = item->default_value; - break; - } - } - - if (updated_value) { - err = opal_info_set(real_info, next_key, updated_value); - } } +// FIXME: use whatever the Open MPI convention is for DEBUG options like this +// Even though I don't expect this codepath to happen, if it somehow DID happen +// in a real run with user-keys, I'd rather it be silent at that point rather +// being noisy and/or aborting. +#ifdef OMPI_DEBUG + } else { + printf("WARNING: Unexpected key length [%s]\n", key); +#endif + } + return MPI_SUCCESS; +} + +int +opal_infosubscribe_change_info(opal_infosubscriber_t *object, opal_info_t *new_info) +{ + int err; + opal_info_entry_t *iterator; + char *updated_value; - err = opal_hash_table_get_next_key_ptr(table, (void**) next_key, &key_size, (void**) &list, node, &node); + /* for each key/value in new info, let subscribers know of new value */ + int found_callback; + + if (!object->s_info) { + object->s_info = OBJ_NEW(opal_info_t); } + + if (NULL != new_info) { + OPAL_LIST_FOREACH(iterator, &new_info->super, opal_info_entry_t) { + + updated_value = opal_infosubscribe_inform_subscribers(object, iterator->ie_key, iterator->ie_value, &found_callback); + if (updated_value) { + err = opal_info_set(object->s_info, iterator->ie_key, updated_value); + } else { +// This path would happen if there was no callback for this key, +// or if there was a callback and it returned null. One way the +// setting was unrecognized the other way it was recognized and ignored, +// either way it shouldn't be set, which we'll ensure with an unset +// in case a previous value exists. + err = opal_info_delete(object->s_info, iterator->ie_key); + err = MPI_SUCCESS; // we don't care if the key was found or not + } + if (MPI_SUCCESS != err) { + return err; + } +// Save the original at "__IN_":"original" +// And if multiple set-info calls happen, the last would be the most relevant +// to save, so overwrite a previously saved value if there is one. + save_original_key_val(object->s_info, + iterator->ie_key, iterator->ie_value, 1); + }} - *old_info = real_info; - - return OPAL_SUCCESS; + return OPAL_SUCCESS; } +// Callers can provide a callback for processing info k/v pairs. +// +// Currently the callback() is expected to return a static string, and the +// callers of callback() do not try to free the string it returns. for example +// current callbacks do things like +// return some_condition ? "true" : "false"; +// the caller of callback() uses the return value in an opal_info_set() which +// strdups the string. The string returned from callback() is not kept beyond +// that. Currently if the callback() did malloc/strdup/etc for its return value +// the caller of callback() would have no way to know whether it needed freeing +// or not, so that string would be leaked. +// +// For future consideration I'd propose a model where callback() is expected +// to always strdup() its return value, so the value returned by callback() +// would either be NULL or it would be a string that needs free()ed. It seems +// to me this might be required if the strings become more dynamic than the +// simple true/false values seen in the current code. It'll be an easy change, +// callback() is only used two places. int opal_infosubscribe_subscribe(opal_infosubscriber_t *object, char *key, char *value, opal_key_interest_callback_t *callback) { opal_list_t *list = NULL; @@ -234,6 +364,51 @@ int opal_infosubscribe_subscribe(opal_infosubscriber_t *object, char *key, char } opal_list_append(list, (opal_list_item_t*) callback_list_item); + +// Trigger callback() on either the default value or the info that's in the +// object if there is one. Unfortunately there's some code duplication as +// this is similar to the job of opal_infosubscribe_change_info(). +// +// The value we store for key is whatever the callback() returns. +// We also leave a backup __IN_* key with the previous value. + +// - is there an info object yet attached to this object + if (NULL == object->s_info) { + object->s_info = OBJ_NEW(opal_info_t); + } +// - is there a value already associated with key in this obj's info: +// to use in the callback() + char *buffer = malloc(MPI_MAX_INFO_VAL+1); // (+1 shouldn't be needed) + char *val = value; // start as default value + int flag = 0; + char *updated_value; + int err; + opal_info_get(object->s_info, key, MPI_MAX_INFO_VAL, buffer, &flag); + if (flag) { + val = buffer; // become info value if this key was in info + } +// - callback() and modify the val in info + updated_value = callback(object, key, val); + if (updated_value) { + err = opal_info_set(object->s_info, key, updated_value); + } else { + err = opal_info_delete(object->s_info, key); + err = MPI_SUCCESS; // we don't care if the key was found or not + } + if (MPI_SUCCESS != err) { + free(buffer); + return err; + } +// - save the previous val under key __IN_* +// This function might be called separately for the same key multiple +// times (multiple modules might register an interest in the same key), +// so we only save __IN_ for the first. +// Note we're saving the first k/v regardless of whether it was the default +// or whether it came from info. This means system settings will show +// up if the user queries later with get_info. + save_original_key_val(object->s_info, key, val, 0); + + free(buffer); } else { /* * TODO: This should not happen diff --git a/opal/util/info_subscriber.h b/opal/util/info_subscriber.h index e3c856d34e0..c676ab0338e 100644 --- a/opal/util/info_subscriber.h +++ b/opal/util/info_subscriber.h @@ -14,6 +14,7 @@ * Copyright (c) 2009 Sun Microsystems, Inc. All rights reserved. * Copyright (c) 2012-2015 Los Alamos National Security, LLC. All rights * reserved. + * Copyright (c) 2017 IBM Corporation. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow diff --git a/oshmem/runtime/oshmem_info_support.c b/oshmem/runtime/oshmem_info_support.c index 033fe47a73d..5c2ddddc3e4 100644 --- a/oshmem/runtime/oshmem_info_support.c +++ b/oshmem/runtime/oshmem_info_support.c @@ -2,7 +2,7 @@ * Copyright (c) 2013 Mellanox Technologies, Inc. * All rights reserved. * Copyright (c) 2014 Cisco Systems, Inc. All rights reserved. - * Copyright (c) 2016 IBM Corp. All rights reserved. + * Copyright (c) 2016-2017 IBM Corporation. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow diff --git a/oshmem/tools/oshmem_info/oshmem_info.c b/oshmem/tools/oshmem_info/oshmem_info.c index 991609c9b13..d925f1b6853 100644 --- a/oshmem/tools/oshmem_info/oshmem_info.c +++ b/oshmem/tools/oshmem_info/oshmem_info.c @@ -3,7 +3,7 @@ * All rights reserved. * Copyright (c) 2014 Intel, Inc. All rights reserved. * - * Copyright (c) 2016 IBM Corp. All rights reserved. + * Copyright (c) 2016-2017 IBM Corporation. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow diff --git a/oshmem/tools/oshmem_info/param.c b/oshmem/tools/oshmem_info/param.c index aedd844ed8f..018026139e6 100644 --- a/oshmem/tools/oshmem_info/param.c +++ b/oshmem/tools/oshmem_info/param.c @@ -5,7 +5,7 @@ * Copyright (c) 2014-2015 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2014-2016 Research Organization for Information Science * and Technology (RIST). All rights reserved. - * Copyright (c) 2016 IBM Corp. All rights reserved. + * Copyright (c) 2016-2017 IBM Corporation. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow