Skip to content

Commit

Permalink
Major structural changes to data types: .super infosubscriber
Browse files Browse the repository at this point in the history
ompi_communicator_t, ompi_win_t, ompi_file_t all have a super class of type opal_infosubscriber_t instead of a base/super type of opal_object_t (in previous code comm used c_base, but file used super).  It may be a bit bold to say that being a subscriber of MPI_Info is the foundational piece that ties these three things together, but if you object, then I would prefer to turn infosubscriber into a more general name that encompasses other common features rather than create a different super class.  The key here is that we want to be able to pass comm, win and file objects as if they were opal_infosubscriber_t, so that one routine can heandle all 3 types of objects being passed to it.

MPI_INFO_NULL is still an ompi_predefined_info_t type since an MPI_Info is part of ompi but the internal details of the underlying information concept is part of opal.

An ompi_info_t type still exists for exposure to the user, but it is simply a wrapper for the opal object.

Routines such as ompi_info_dup, etc have all been moved to opal_info_dup and related to the opal directory.

Fortran to C translation tables are only used for MPI_Info that is exposed to the application and are therefore part of the ompi_info_t and not the opal_info_t

The data structure changes are primarily in the following files:

    communicator/communicator.h
    ompi/info/info.h
    ompi/win/win.h
    ompi/file/file.h

The following new files were created:

    opal/util/info.h
    opal/util/info.c
    opal/util/info_subscriber.h
    opal/util/info_subscriber.c

This infosubscriber concept is that communicators, files and windows can have subscribers that subscribe to any changes in the info associated with the comm/file/window.  When xxx_set_info is called, the new info is presented to each subscriber who can modify the info in any way they want.  The new value is presented to the next subscriber and so on until all subscribers have had a chance to modify the value.  Therefore, the order of subscribers can make a difference but we hope that there is generally only one subscriber that cares or modifies any given key/value pair.  The final info is then stored and returned by a call to xxx_get_info.

The new model can be seen in the following files:

    ompi/mpi/c/comm_get_info.c
    ompi/mpi/c/comm_set_info.c
    ompi/mpi/c/file_get_info.c
    ompi/mpi/c/file_set_info.c
    ompi/mpi/c/win_get_info.c
    ompi/mpi/c/win_set_info.c

The current subscribers where changed as follows:

    mca/io/ompio/io_ompio_file_open.c
    mca/io/ompio/io_ompio_module.c
    mca/osc/rmda/osc_rdma_component.c (This one actually subscribes to "no_locks")
    mca/osc/sm/osc_sm_component.c (This one actually subscribes to "blocking_fence" and "alloc_shared_contig")

Signed-off-by: Mark Allen <markalle@us.ibm.com>

Conflicts:
	AUTHORS
	ompi/communicator/comm.c
	ompi/debuggers/ompi_mpihandles_dll.c
	ompi/file/file.c
	ompi/file/file.h
	ompi/info/info.c
	ompi/mca/io/ompio/io_ompio.h
	ompi/mca/io/ompio/io_ompio_file_open.c
	ompi/mca/io/ompio/io_ompio_file_set_view.c
	ompi/mca/osc/pt2pt/osc_pt2pt.h
	ompi/mca/sharedfp/addproc/sharedfp_addproc.h
	ompi/mca/sharedfp/addproc/sharedfp_addproc_file_open.c
	ompi/mca/topo/treematch/topo_treematch_dist_graph_create.c
	ompi/mpi/c/lookup_name.c
	ompi/mpi/c/publish_name.c
	ompi/mpi/c/unpublish_name.c
	opal/mca/mpool/base/mpool_base_alloc.c
	opal/util/Makefile.am
  • Loading branch information
dsolt authored and markalle committed Feb 15, 2017
1 parent 578d881 commit 4d01bcc
Show file tree
Hide file tree
Showing 100 changed files with 1,686 additions and 1,116 deletions.
3 changes: 2 additions & 1 deletion AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -81,6 +80,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
Expand Down
11 changes: 6 additions & 5 deletions ompi/communicator/comm.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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);


/**********************************************************************/
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
10 changes: 6 additions & 4 deletions ompi/communicator/comm_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -33,6 +34,7 @@
#include <stdio.h>

#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"
Expand All @@ -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 =
Expand All @@ -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);

Expand Down
10 changes: 6 additions & 4 deletions ompi/communicator/communicator.h
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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];
Expand Down Expand Up @@ -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);

/**
Expand Down Expand Up @@ -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.
Expand All @@ -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.
Expand Down
3 changes: 2 additions & 1 deletion ompi/debuggers/ompi_mpihandles_dll.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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);
Expand Down
15 changes: 7 additions & 8 deletions ompi/debuggers/predefined_gap_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand All @@ -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");
Expand All @@ -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);
Expand Down
Loading

0 comments on commit 4d01bcc

Please sign in to comment.