Skip to content

Commit 50f9287

Browse files
authored
Merge pull request #2941 from markalle/pr/mpi-info-update2
Finally Merging this in. MPI_*_get_info/set_info(). Targeting v3.1 release. @hjelmn were you interested in switching some internal pieces to begin using this? Should we target v3.1 (or whatever we call the Oct 15th release?)
2 parents b59eb76 + 482d84b commit 50f9287

File tree

99 files changed

+2159
-1047
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

99 files changed

+2159
-1047
lines changed

AUTHORS

-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ Github.com pull request). Note that these email addresses are not
88
guaranteed to be current; they are simply a unique indicator of the
99
individual who committed them.
1010

11-
-----
1211

1312
Abhishek Joshi, Broadcom
1413

ompi/communicator/comm.c

+32-5
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
* and Technology (RIST). All rights reserved.
2323
* Copyright (c) 2014-2015 Intel, Inc. All rights reserved.
2424
* Copyright (c) 2015 Mellanox Technologies. All rights reserved.
25+
* Copyright (c) 2017 IBM Corporation. All rights reserved.
2526
* $COPYRIGHT$
2627
*
2728
* Additional copyrights may follow
@@ -86,7 +87,7 @@ static int ompi_comm_copy_topo (ompi_communicator_t *oldcomm,
8687

8788
/* idup with local group and info. the local group support is provided to support ompi_comm_set_nb */
8889
static int ompi_comm_idup_internal (ompi_communicator_t *comm, ompi_group_t *group, ompi_group_t *remote_group,
89-
ompi_info_t *info, ompi_communicator_t **newcomm, ompi_request_t **req);
90+
opal_info_t *info, ompi_communicator_t **newcomm, ompi_request_t **req);
9091

9192

9293
/**********************************************************************/
@@ -157,6 +158,7 @@ int ompi_comm_set_nb ( ompi_communicator_t **ncomm,
157158

158159
/* ompi_comm_allocate */
159160
newcomm = OBJ_NEW(ompi_communicator_t);
161+
newcomm->super.s_info = NULL;
160162
/* fill in the inscribing hyper-cube dimensions */
161163
newcomm->c_cube_dim = opal_cube_dim(local_size);
162164
newcomm->c_id_available = MPI_UNDEFINED;
@@ -787,7 +789,7 @@ static int ompi_comm_split_verify (ompi_communicator_t *comm, int split_type, in
787789
}
788790

789791
int ompi_comm_split_type (ompi_communicator_t *comm, int split_type, int key,
790-
ompi_info_t *info, ompi_communicator_t **newcomm)
792+
opal_info_t *info, ompi_communicator_t **newcomm)
791793
{
792794
bool need_split = false, no_reorder = false, no_undefined = false;
793795
ompi_communicator_t *newcomp = MPI_COMM_NULL;
@@ -917,6 +919,12 @@ int ompi_comm_split_type (ompi_communicator_t *comm, int split_type, int key,
917919
break;
918920
}
919921

922+
// Copy info if there is one.
923+
newcomp->super.s_info = OBJ_NEW(opal_info_t);
924+
if (info) {
925+
opal_info_dup(info, &(newcomp->super.s_info));
926+
}
927+
920928
/* Activate the communicator and init coll-component */
921929
rc = ompi_comm_activate (&newcomp, comm, NULL, NULL, NULL, false, mode);
922930
if (OPAL_UNLIKELY(OMPI_SUCCESS != rc)) {
@@ -972,7 +980,7 @@ int ompi_comm_dup ( ompi_communicator_t * comm, ompi_communicator_t **newcomm )
972980
/**********************************************************************/
973981
/**********************************************************************/
974982
/**********************************************************************/
975-
int ompi_comm_dup_with_info ( ompi_communicator_t * comm, ompi_info_t *info, ompi_communicator_t **newcomm )
983+
int ompi_comm_dup_with_info ( ompi_communicator_t * comm, opal_info_t *info, ompi_communicator_t **newcomm )
976984
{
977985
ompi_communicator_t *newcomp = NULL;
978986
ompi_group_t *remote_group = NULL;
@@ -1014,6 +1022,12 @@ int ompi_comm_dup_with_info ( ompi_communicator_t * comm, ompi_info_t *info, omp
10141022
snprintf(newcomp->c_name, MPI_MAX_OBJECT_NAME, "MPI COMMUNICATOR %d DUP FROM %d",
10151023
newcomp->c_contextid, comm->c_contextid );
10161024

1025+
// Copy info if there is one.
1026+
newcomp->super.s_info = OBJ_NEW(opal_info_t);
1027+
if (info) {
1028+
opal_info_dup(info, &(newcomp->super.s_info));
1029+
}
1030+
10171031
/* activate communicator and init coll-module */
10181032
rc = ompi_comm_activate (&newcomp, comm, NULL, NULL, NULL, false, mode);
10191033
if ( OMPI_SUCCESS != rc ) {
@@ -1042,14 +1056,14 @@ int ompi_comm_idup (ompi_communicator_t *comm, ompi_communicator_t **newcomm, om
10421056
return ompi_comm_idup_with_info (comm, NULL, newcomm, req);
10431057
}
10441058

1045-
int ompi_comm_idup_with_info (ompi_communicator_t *comm, ompi_info_t *info, ompi_communicator_t **newcomm, ompi_request_t **req)
1059+
int ompi_comm_idup_with_info (ompi_communicator_t *comm, opal_info_t *info, ompi_communicator_t **newcomm, ompi_request_t **req)
10461060
{
10471061
return ompi_comm_idup_internal (comm, comm->c_local_group, comm->c_remote_group, info, newcomm, req);
10481062
}
10491063

10501064
/* NTH: we need a way to idup with a smaller local group so this function takes a local group */
10511065
static int ompi_comm_idup_internal (ompi_communicator_t *comm, ompi_group_t *group, ompi_group_t *remote_group,
1052-
ompi_info_t *info, ompi_communicator_t **newcomm, ompi_request_t **req)
1066+
opal_info_t *info, ompi_communicator_t **newcomm, ompi_request_t **req)
10531067
{
10541068
ompi_comm_idup_with_info_context_t *context;
10551069
ompi_comm_request_t *request;
@@ -1094,6 +1108,15 @@ static int ompi_comm_idup_internal (ompi_communicator_t *comm, ompi_group_t *gro
10941108
return rc;
10951109
}
10961110

1111+
// Copy info if there is one.
1112+
{
1113+
ompi_communicator_t *newcomp = context->newcomp;
1114+
newcomp->super.s_info = OBJ_NEW(opal_info_t);
1115+
if (info) {
1116+
opal_info_dup(info, &(newcomp->super.s_info));
1117+
}
1118+
}
1119+
10971120
ompi_comm_request_schedule_append (request, ompi_comm_idup_getcid, subreq, subreq[0] ? 1 : 0);
10981121

10991122
/* assign the newcomm now */
@@ -1471,6 +1494,10 @@ int ompi_comm_free( ompi_communicator_t **comm )
14711494
ompi_mpi_comm_parent = &ompi_mpi_comm_null.comm;
14721495
}
14731496

1497+
if (NULL != ((*comm)->super.s_info)) {
1498+
OBJ_RELEASE((*comm)->super.s_info);
1499+
}
1500+
14741501
/* Release the communicator */
14751502
if ( OMPI_COMM_IS_DYNAMIC (*comm) ) {
14761503
ompi_comm_num_dyncomm --;

ompi/communicator/comm_init.c

+7-4
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
* Copyright (c) 2015 Research Organization for Information Science
2222
* and Technology (RIST). All rights reserved.
2323
* Copyright (c) 2015 Intel, Inc. All rights reserved.
24+
* Copyright (c) 2016-2017 IBM Corporation. All rights reserved.
2425
* $COPYRIGHT$
2526
*
2627
* Additional copyrights may follow
@@ -33,6 +34,7 @@
3334
#include <stdio.h>
3435

3536
#include "opal/util/bit_ops.h"
37+
#include "opal/util/info_subscriber.h"
3638
#include "ompi/constants.h"
3739
#include "ompi/mca/pml/pml.h"
3840
#include "ompi/mca/coll/base/base.h"
@@ -52,9 +54,9 @@
5254
opal_pointer_array_t ompi_mpi_communicators = {{0}};
5355
opal_pointer_array_t ompi_comm_f_to_c_table = {{0}};
5456

55-
ompi_predefined_communicator_t ompi_mpi_comm_world = {{{0}}};
56-
ompi_predefined_communicator_t ompi_mpi_comm_self = {{{0}}};
57-
ompi_predefined_communicator_t ompi_mpi_comm_null = {{{0}}};
57+
ompi_predefined_communicator_t ompi_mpi_comm_world = {{{{0}}}};
58+
ompi_predefined_communicator_t ompi_mpi_comm_self = {{{{0}}}};
59+
ompi_predefined_communicator_t ompi_mpi_comm_null = {{{{0}}}};
5860
ompi_communicator_t *ompi_mpi_comm_parent = NULL;
5961

6062
ompi_predefined_communicator_t *ompi_mpi_comm_world_addr =
@@ -67,7 +69,7 @@ ompi_predefined_communicator_t *ompi_mpi_comm_null_addr =
6769
static void ompi_comm_construct(ompi_communicator_t* comm);
6870
static void ompi_comm_destruct(ompi_communicator_t* comm);
6971

70-
OBJ_CLASS_INSTANCE(ompi_communicator_t, opal_object_t,
72+
OBJ_CLASS_INSTANCE(ompi_communicator_t, opal_infosubscriber_t,
7173
ompi_comm_construct,
7274
ompi_comm_destruct);
7375

@@ -219,6 +221,7 @@ ompi_communicator_t *ompi_comm_allocate ( int local_size, int remote_size )
219221

220222
/* create new communicator element */
221223
new_comm = OBJ_NEW(ompi_communicator_t);
224+
new_comm->super.s_info = NULL;
222225
new_comm->c_local_group = ompi_group_allocate ( local_size );
223226
if ( 0 < remote_size ) {
224227
new_comm->c_remote_group = ompi_group_allocate (remote_size);

ompi/communicator/communicator.h

+7-5
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
* Copyright (c) 2014-2015 Intel, Inc. All rights reserved.
2121
* Copyright (c) 2015 Research Organization for Information Science
2222
* and Technology (RIST). All rights reserved.
23-
* Copyright (c) 2017 IBM Corporation. All rights reserved.
23+
* Copyright (c) 2016-2017 IBM Corporation. All rights reserved.
2424
* $COPYRIGHT$
2525
*
2626
* Additional copyrights may follow
@@ -33,6 +33,8 @@
3333

3434
#include "ompi_config.h"
3535
#include "opal/class/opal_object.h"
36+
#include "opal/class/opal_hash_table.h"
37+
#include "opal/util/info_subscriber.h"
3638
#include "ompi/errhandler/errhandler.h"
3739
#include "opal/threads/mutex.h"
3840
#include "ompi/communicator/comm_request.h"
@@ -116,7 +118,7 @@ OMPI_DECLSPEC extern opal_pointer_array_t ompi_mpi_communicators;
116118
OMPI_DECLSPEC extern opal_pointer_array_t ompi_comm_f_to_c_table;
117119

118120
struct ompi_communicator_t {
119-
opal_object_t c_base;
121+
opal_infosubscriber_t super;
120122
opal_mutex_t c_lock; /* mutex for name and potentially
121123
attributes */
122124
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
442444
*/
443445
OMPI_DECLSPEC int ompi_comm_split_type(ompi_communicator_t *comm,
444446
int split_type, int key,
445-
struct ompi_info_t *info,
447+
struct opal_info_t *info,
446448
ompi_communicator_t** newcomm);
447449

448450
/**
@@ -473,7 +475,7 @@ OMPI_DECLSPEC int ompi_comm_idup (ompi_communicator_t *comm, ompi_communicator_t
473475
* @param comm: input communicator
474476
* @param newcomm: the new communicator or MPI_COMM_NULL if any error is detected.
475477
*/
476-
OMPI_DECLSPEC int ompi_comm_dup_with_info (ompi_communicator_t *comm, ompi_info_t *info, ompi_communicator_t **newcomm);
478+
OMPI_DECLSPEC int ompi_comm_dup_with_info (ompi_communicator_t *comm, opal_info_t *info, ompi_communicator_t **newcomm);
477479

478480
/**
479481
* 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_
483485
* @param comm: input communicator
484486
* @param newcomm: the new communicator or MPI_COMM_NULL if any error is detected.
485487
*/
486-
OMPI_DECLSPEC int ompi_comm_idup_with_info (ompi_communicator_t *comm, ompi_info_t *info, ompi_communicator_t **newcomm, ompi_request_t **req);
488+
OMPI_DECLSPEC int ompi_comm_idup_with_info (ompi_communicator_t *comm, opal_info_t *info, ompi_communicator_t **newcomm, ompi_request_t **req);
487489

488490
/**
489491
* compare two communicators.

ompi/debuggers/ompi_mpihandles_dll.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
* Copyright (c) 2012-2013 Inria. All rights reserved.
88
* Copyright (c) 2016 Research Organization for Information Science
99
* and Technology (RIST). All rights reserved.
10+
* Copyright (c) 2017 IBM Corp. All rights reserved.
1011
* $COPYRIGHT$
1112
*
1213
* Additional copyrights may follow
@@ -237,7 +238,7 @@ int mpidbg_init_per_image(mqs_image *image, const mqs_image_callbacks *icb,
237238
mqs_find_type(image, "ompi_file_t", mqs_lang_c);
238239
handle_types->hi_c_group = i_info->ompi_group_t.type;
239240
handle_types->hi_c_info =
240-
mqs_find_type(image, "ompi_info_t", mqs_lang_c);
241+
mqs_find_type(image, "opal_info_t", mqs_lang_c);
241242
/* JMS: "MPI_Offset" is a typedef (see comment about MPI_Aint above) */
242243
handle_types->hi_c_offset =
243244
mqs_find_type(image, "MPI_Offset", mqs_lang_c);

ompi/debuggers/predefined_gap_test.c

+7-8
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
* of Tennessee Research Foundation. All rights
66
* reserved.
77
* Copyright (c) 2012-2013 Inria. All rights reserved.
8+
* Copyright (c) 2016-2017 IBM Corporation. All rights reserved.
89
* $COPYRIGHT$
910
*
1011
* Additional copyrights may follow
@@ -52,8 +53,8 @@ int main(int argc, char **argv) {
5253
/* Test Predefined communicator sizes */
5354
printf("ompi_predefined_communicator_t = %lu bytes\n", sizeof(ompi_predefined_communicator_t));
5455
printf("ompi_communicator_t = %lu bytes\n", sizeof(ompi_communicator_t));
55-
GAP_CHECK("c_base", test_comm, c_base, c_base, 0);
56-
GAP_CHECK("c_lock", test_comm, c_lock, c_base, 1);
56+
GAP_CHECK("c_base", test_comm, super, super, 0);
57+
GAP_CHECK("c_lock", test_comm, c_lock, super, 1);
5758
GAP_CHECK("c_name", test_comm, c_name, c_lock, 1);
5859
GAP_CHECK("c_contextid", test_comm, c_contextid, c_name, 1);
5960
GAP_CHECK("c_my_rank", test_comm, c_my_rank, c_contextid, 1);
@@ -120,8 +121,8 @@ int main(int argc, char **argv) {
120121
printf("=============================================\n");
121122
printf("ompi_predefined_win_t = %lu bytes\n", sizeof(ompi_predefined_win_t));
122123
printf("ompi_win_t = %lu bytes\n", sizeof(ompi_win_t));
123-
GAP_CHECK("w_base", test_win, w_base, w_base, 0);
124-
GAP_CHECK("w_lock", test_win, w_lock, w_base, 1);
124+
GAP_CHECK("super", test_win, super, super, 0);
125+
GAP_CHECK("w_lock", test_win, w_lock, super, 1);
125126
GAP_CHECK("w_name", test_win, w_name, w_lock, 1);
126127
GAP_CHECK("w_group", test_win, w_group, w_name, 1);
127128
GAP_CHECK("w_flags", test_win, w_flags, w_group, 1);
@@ -137,8 +138,7 @@ int main(int argc, char **argv) {
137138
printf("ompi_info_t = %lu bytes\n", sizeof(ompi_info_t));
138139
GAP_CHECK("super", test_info, super, super, 0);
139140
GAP_CHECK("i_f_to_c_index", test_info, i_f_to_c_index, super, 1);
140-
GAP_CHECK("i_lock", test_info, i_lock, i_f_to_c_index, 1);
141-
GAP_CHECK("i_freed", test_info, i_freed, i_lock, 1);
141+
GAP_CHECK("i_freed", test_info, i_freed, i_f_to_c_index, 1);
142142

143143
/* Test Predefined file sizes */
144144
printf("=============================================\n");
@@ -148,8 +148,7 @@ int main(int argc, char **argv) {
148148
GAP_CHECK("f_comm", test_file, f_comm, super, 1);
149149
GAP_CHECK("f_filename", test_file, f_filename, f_comm, 1);
150150
GAP_CHECK("f_amode", test_file, f_amode, f_filename, 1);
151-
GAP_CHECK("f_info", test_file, f_info, f_amode, 1);
152-
GAP_CHECK("f_flags", test_file, f_flags, f_info, 1);
151+
GAP_CHECK("f_flags", test_file, f_flags, f_amode, 1);
153152
GAP_CHECK("f_f_to_c_index", test_file, f_f_to_c_index, f_flags, 1);
154153
GAP_CHECK("error_handler", test_file, error_handler, f_f_to_c_index, 1);
155154
GAP_CHECK("errhandler_type", test_file, errhandler_type, error_handler, 1);

ompi/file/file.c

+11-18
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
* Copyright (c) 2015 Research Organization for Information Science
1616
* and Technology (RIST). All rights reserved.
1717
* Copyright (c) 2016 University of Houston. All rights reserved.
18+
* Copyright (c) 2016-2017 IBM Corporation. All rights reserved.
1819
* $COPYRIGHT$
1920
*
2021
* Additional copyrights may follow
@@ -44,7 +45,7 @@ opal_pointer_array_t ompi_file_f_to_c_table = {{0}};
4445
/*
4546
* MPI_FILE_NULL (_addr flavor is for F03 bindings)
4647
*/
47-
ompi_predefined_file_t ompi_mpi_file_null = {{{0}}};
48+
ompi_predefined_file_t ompi_mpi_file_null = {{{{0}}}};
4849
ompi_predefined_file_t *ompi_mpi_file_null_addr = &ompi_mpi_file_null;
4950

5051

@@ -59,7 +60,7 @@ static void file_destructor(ompi_file_t *obj);
5960
* Class instance for ompi_file_t
6061
*/
6162
OBJ_CLASS_INSTANCE(ompi_file_t,
62-
opal_object_t,
63+
opal_infosubscriber_t,
6364
file_constructor,
6465
file_destructor);
6566

@@ -97,7 +98,7 @@ int ompi_file_init(void)
9798
* Back end to MPI_FILE_OPEN
9899
*/
99100
int ompi_file_open(struct ompi_communicator_t *comm, const char *filename,
100-
int amode, struct ompi_info_t *info, ompi_file_t **fh)
101+
int amode, struct opal_info_t *info, ompi_file_t **fh)
101102
{
102103
int ret;
103104
ompi_file_t *file;
@@ -113,17 +114,10 @@ int ompi_file_open(struct ompi_communicator_t *comm, const char *filename,
113114
file->f_comm = comm;
114115
OBJ_RETAIN(comm);
115116

116-
if (MPI_INFO_NULL != info) {
117-
if(NULL == file->f_info) {
118-
file->f_info = OBJ_NEW(ompi_info_t);
119-
}
120-
if (OMPI_SUCCESS != (ret = ompi_info_dup(info, &file->f_info))) {
121-
OBJ_RELEASE(file);
122-
return ret;
123-
}
124-
} else {
125-
file->f_info = MPI_INFO_NULL;
126-
OBJ_RETAIN(MPI_INFO_NULL);
117+
/* Copy the info for the info layer */
118+
file->super.s_info = OBJ_NEW(opal_info_t);
119+
if (info) {
120+
opal_info_dup(info, &(file->super.s_info));
127121
}
128122

129123
file->f_amode = amode;
@@ -236,7 +230,6 @@ static void file_constructor(ompi_file_t *file)
236230
file->f_comm = NULL;
237231
file->f_filename = NULL;
238232
file->f_amode = 0;
239-
file->f_info = NULL;
240233

241234
/* Initialize flags */
242235

@@ -316,10 +309,10 @@ static void file_destructor(ompi_file_t *file)
316309
#endif
317310
}
318311

319-
if (NULL != file->f_info) {
320-
OBJ_RELEASE(file->f_info);
312+
if (NULL != file->super.s_info) {
313+
OBJ_RELEASE(file->super.s_info);
321314
#if OPAL_ENABLE_DEBUG
322-
file->f_info = NULL;
315+
file->super.s_info = NULL;
323316
#endif
324317
}
325318

0 commit comments

Comments
 (0)