Skip to content

MPI_*_get_info/set_info() #2941

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 22, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 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
[email protected]
Expand Down
37 changes: 32 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) 2017 IBM Corporation. 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 @@ -157,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;
Expand Down Expand Up @@ -787,7 +789,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 @@ -917,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)) {
Expand Down Expand Up @@ -972,7 +980,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 @@ -1014,6 +1022,12 @@ int ompi_comm_dup_with_info ( ompi_communicator_t * comm, ompi_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 ) {
Expand Down Expand Up @@ -1042,14 +1056,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 Expand Up @@ -1094,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 */
Expand Down Expand Up @@ -1471,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 --;
Expand Down
11 changes: 7 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-2017 IBM Corporation. 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 Expand Up @@ -219,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);
Expand Down
12 changes: 7 additions & 5 deletions ompi/communicator/communicator.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This retroactive copyright addition seems odd...?

* $COPYRIGHT$
*
* Additional copyrights may follow
Expand All @@ -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-2017 IBM Corporation. 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
29 changes: 11 additions & 18 deletions ompi/file/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -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-2017 IBM Corporation. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
Expand Down Expand Up @@ -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;


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

Expand Down Expand Up @@ -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;
Expand All @@ -113,17 +114,10 @@ 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);
/* 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;
Expand Down Expand Up @@ -236,7 +230,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 */

Expand Down Expand Up @@ -316,10 +309,10 @@ static void file_destructor(ompi_file_t *file)
#endif
}

if (NULL != file->f_info) {
OBJ_RELEASE(file->f_info);
if (NULL != file->super.s_info) {
OBJ_RELEASE(file->super.s_info);
#if OPAL_ENABLE_DEBUG
file->f_info = NULL;
file->super.s_info = NULL;
#endif
}

Expand Down
Loading