Skip to content

Commit d712645

Browse files
bosilcajsquyres
authored andcommitted
Fix the atomic management of the bcast and reduce freelist
API consistent with other collective modules Add comments Other minor cleanups. Signed-off-by: George Bosilca <bosilca@icl.utk.edu>
1 parent a4be3bb commit d712645

16 files changed

+185
-329
lines changed

ompi/communicator/communicator.h

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
44
* University Research and Technology
55
* Corporation. All rights reserved.
6-
* Copyright (c) 2004-2017 The University of Tennessee and The University
6+
* Copyright (c) 2004-2020 The University of Tennessee and The University
77
* of Tennessee Research Foundation. All rights
88
* reserved.
99
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
@@ -187,10 +187,14 @@ struct ompi_communicator_t {
187187

188188
/* Collectives module interface and data */
189189
mca_coll_base_comm_coll_t *c_coll;
190-
191-
/* Non-blocking collective tag */
192-
_Atomic int32_t c_ibcast_tag;
193-
_Atomic int32_t c_ireduce_tag;
190+
191+
/* Non-blocking collective tag. These are added here as they should be
192+
* shared between all non-blocking collective modules (to avoid message
193+
* collisions between them in the case where multiple outstanding
194+
* non-blocking collective coexists using multiple backends).
195+
*/
196+
opal_atomic_int32_t c_ibcast_tag;
197+
opal_atomic_int32_t c_ireduce_tag;
194198
};
195199
typedef struct ompi_communicator_t ompi_communicator_t;
196200

ompi/mca/coll/adapt/Makefile.am

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#
2-
# Copyright (c) 2014 The University of Tennessee and The University
2+
# Copyright (c) 2014-2020 The University of Tennessee and The University
33
# of Tennessee Research Foundation. All rights
44
# reserved.
55
# $COPYRIGHT$
@@ -13,11 +13,11 @@
1313
sources = \
1414
coll_adapt_component.c \
1515
coll_adapt_module.c \
16-
coll_adapt_bcast.c \
16+
coll_adapt_bcast.c \
1717
coll_adapt_ibcast.c \
1818
coll_adapt_reduce.c \
1919
coll_adapt_ireduce.c \
20-
coll_adapt.h \
20+
coll_adapt.h \
2121
coll_adapt_algorithms.h \
2222
coll_adapt_context.h \
2323
coll_adapt_context.c \

ompi/mca/coll/adapt/coll_adapt.h

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,9 @@ typedef struct mca_coll_adapt_component_t {
3838
/* MCA parameter: Priority of this component */
3939
int adapt_priority;
4040

41-
/* MCA parameter: Output verbose level */
41+
/* MCA parameter: Output stream and verbose level */
4242
int adapt_output;
43+
int adapt_verbose;
4344

4445
/* MCA parameter: Maximum number of segment in context free list */
4546
int adapt_context_free_list_max;
@@ -57,7 +58,6 @@ typedef struct mca_coll_adapt_component_t {
5758
int adapt_ibcast_max_recv_requests;
5859
/* Bcast free list */
5960
opal_free_list_t *adapt_ibcast_context_free_list;
60-
opal_atomic_int32_t adapt_ibcast_context_free_list_enabled;
6161

6262
/* Reduce MCA parameter */
6363
int adapt_ireduce_algorithm;
@@ -70,7 +70,6 @@ typedef struct mca_coll_adapt_component_t {
7070

7171
/* Reduce free list */
7272
opal_free_list_t *adapt_ireduce_context_free_list;
73-
opal_atomic_int32_t adapt_ireduce_context_free_list_enabled;
7473

7574
} mca_coll_adapt_component_t;
7675

@@ -91,7 +90,7 @@ OMPI_MODULE_DECLSPEC extern mca_coll_adapt_component_t mca_coll_adapt_component;
9190
int ompi_coll_adapt_init_query(bool enable_progress_threads, bool enable_mpi_threads);
9291
mca_coll_base_module_t * ompi_coll_adapt_comm_query(struct ompi_communicator_t *comm, int *priority);
9392

94-
/* Free ADAPT quest */
93+
/* ADAPT request free */
9594
int ompi_coll_adapt_request_free(ompi_request_t **request);
9695

9796
#endif /* MCA_COLL_ADAPT_EXPORT_H */

ompi/mca/coll/adapt/coll_adapt_algorithms.h

Lines changed: 38 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -20,82 +20,45 @@ typedef struct ompi_coll_adapt_algorithm_index_s {
2020
} ompi_coll_adapt_algorithm_index_t;
2121

2222
/* Bcast */
23-
int ompi_coll_adapt_ibcast_init(void);
23+
int ompi_coll_adapt_ibcast_register(void);
2424
int ompi_coll_adapt_ibcast_fini(void);
25-
int ompi_coll_adapt_bcast(void *buff, int count, struct ompi_datatype_t *datatype, int root,
26-
struct ompi_communicator_t *comm, mca_coll_base_module_t * module);
27-
int ompi_coll_adapt_ibcast(void *buff, int count, struct ompi_datatype_t *datatype, int root,
28-
struct ompi_communicator_t *comm, ompi_request_t ** request,
29-
mca_coll_base_module_t * module);
30-
int ompi_coll_adapt_ibcast_generic(void *buff, int count, struct ompi_datatype_t *datatype, int root,
31-
struct ompi_communicator_t *comm, ompi_request_t ** request,
32-
mca_coll_base_module_t * module, ompi_coll_tree_t * tree,
33-
size_t seg_size, int ibcast_tag);
34-
int ompi_coll_adapt_ibcast_binomial(void *buff, int count, struct ompi_datatype_t *datatype,
35-
int root, struct ompi_communicator_t *comm,
36-
ompi_request_t ** request, mca_coll_base_module_t * module,
37-
int ibcast_tag);
38-
int ompi_coll_adapt_ibcast_in_order_binomial(void *buff, int count, struct ompi_datatype_t *datatype,
39-
int root, struct ompi_communicator_t *comm,
40-
ompi_request_t ** request,
41-
mca_coll_base_module_t * module, int ibcast_tag);
42-
int ompi_coll_adapt_ibcast_binary(void *buff, int count, struct ompi_datatype_t *datatype, int root,
43-
struct ompi_communicator_t *comm, ompi_request_t ** request,
44-
mca_coll_base_module_t * module, int ibcast_tag);
45-
int ompi_coll_adapt_ibcast_pipeline(void *buff, int count, struct ompi_datatype_t *datatype,
46-
int root, struct ompi_communicator_t *comm,
47-
ompi_request_t ** request, mca_coll_base_module_t * module,
48-
int ibcast_tag);
49-
int ompi_coll_adapt_ibcast_chain(void *buff, int count, struct ompi_datatype_t *datatype, int root,
50-
struct ompi_communicator_t *comm, ompi_request_t ** request,
51-
mca_coll_base_module_t * module, int ibcast_tag);
52-
int ompi_coll_adapt_ibcast_linear(void *buff, int count, struct ompi_datatype_t *datatype, int root,
53-
struct ompi_communicator_t *comm, ompi_request_t ** request,
54-
mca_coll_base_module_t * module, int ibcast_tag);
55-
int ompi_coll_adapt_ibcast_tuned(void *buff, int count, struct ompi_datatype_t *datatype, int root,
56-
struct ompi_communicator_t *comm, ompi_request_t ** request,
57-
mca_coll_base_module_t *module, int ibcast_tag);
25+
int ompi_coll_adapt_bcast(BCAST_ARGS);
26+
int ompi_coll_adapt_ibcast(IBCAST_ARGS);
27+
int ompi_coll_adapt_ibcast_generic(IBCAST_ARGS,
28+
ompi_coll_tree_t * tree, size_t seg_size, int ibcast_tag);
29+
int ompi_coll_adapt_ibcast_binomial(IBCAST_ARGS,
30+
int ibcast_tag);
31+
int ompi_coll_adapt_ibcast_in_order_binomial(IBCAST_ARGS,
32+
int ibcast_tag);
33+
int ompi_coll_adapt_ibcast_binary(IBCAST_ARGS,
34+
int ibcast_tag);
35+
int ompi_coll_adapt_ibcast_pipeline(IBCAST_ARGS,
36+
int ibcast_tag);
37+
int ompi_coll_adapt_ibcast_chain(IBCAST_ARGS,
38+
int ibcast_tag);
39+
int ompi_coll_adapt_ibcast_linear(IBCAST_ARGS,
40+
int ibcast_tag);
41+
int ompi_coll_adapt_ibcast_tuned(IBCAST_ARGS,
42+
int ibcast_tag);
5843

5944
/* Reduce */
60-
int ompi_coll_adapt_ireduce_init(void);
45+
int ompi_coll_adapt_ireduce_register(void);
6146
int ompi_coll_adapt_ireduce_fini(void);
62-
int ompi_coll_adapt_reduce(const void *sbuf, void *rbuf, int count, struct ompi_datatype_t *dtype,
63-
struct ompi_op_t *op, int root, struct ompi_communicator_t *comm,
64-
mca_coll_base_module_t * module);
65-
int ompi_coll_adapt_ireduce(const void *sbuf, void *rbuf, int count, struct ompi_datatype_t *dtype,
66-
struct ompi_op_t *op, int root, struct ompi_communicator_t *comm,
67-
ompi_request_t ** request, mca_coll_base_module_t * module);
68-
int ompi_coll_adapt_ireduce_generic(const void *sbuf, void *rbuf, int count,
69-
struct ompi_datatype_t *dtype, struct ompi_op_t *op, int root,
70-
struct ompi_communicator_t *comm, ompi_request_t ** request,
71-
mca_coll_base_module_t * module, ompi_coll_tree_t * tree,
72-
size_t seg_size, int ireduce_tag);
73-
int ompi_coll_adapt_ireduce_tuned(const void *sbuf, void *rbuf, int count,
74-
struct ompi_datatype_t *dtype, struct ompi_op_t *op, int root,
75-
struct ompi_communicator_t *comm, ompi_request_t ** request,
76-
mca_coll_base_module_t *module, int ireduce_tag);
77-
int ompi_coll_adapt_ireduce_binomial(const void *sbuf, void *rbuf, int count,
78-
struct ompi_datatype_t *dtype, struct ompi_op_t *op, int root,
79-
struct ompi_communicator_t *comm, ompi_request_t ** request,
80-
mca_coll_base_module_t * module, int ireduce_tag);
81-
int ompi_coll_adapt_ireduce_in_order_binomial(const void *sbuf, void *rbuf, int count,
82-
struct ompi_datatype_t *dtype, struct ompi_op_t *op,
83-
int root, struct ompi_communicator_t *comm,
84-
ompi_request_t ** request,
85-
mca_coll_base_module_t * module, int ireduce_tag);
86-
int ompi_coll_adapt_ireduce_binary(const void *sbuf, void *rbuf, int count,
87-
struct ompi_datatype_t *dtype, struct ompi_op_t *op, int root,
88-
struct ompi_communicator_t *comm, ompi_request_t ** request,
89-
mca_coll_base_module_t * module, int ireduce_tag);
90-
int ompi_coll_adapt_ireduce_pipeline(const void *sbuf, void *rbuf, int count,
91-
struct ompi_datatype_t *dtype, struct ompi_op_t *op, int root,
92-
struct ompi_communicator_t *comm, ompi_request_t ** request,
93-
mca_coll_base_module_t * module, int ireduce_tag);
94-
int ompi_coll_adapt_ireduce_chain(const void *sbuf, void *rbuf, int count,
95-
struct ompi_datatype_t *dtype, struct ompi_op_t *op, int root,
96-
struct ompi_communicator_t *comm, ompi_request_t ** request,
97-
mca_coll_base_module_t * module, int ireduce_tag);
98-
int ompi_coll_adapt_ireduce_linear(const void *sbuf, void *rbuf, int count,
99-
struct ompi_datatype_t *dtype, struct ompi_op_t *op, int root,
100-
struct ompi_communicator_t *comm, ompi_request_t ** request,
101-
mca_coll_base_module_t * module, int ireduce_tag);
47+
int ompi_coll_adapt_reduce(REDUCE_ARGS);
48+
int ompi_coll_adapt_ireduce(IREDUCE_ARGS);
49+
int ompi_coll_adapt_ireduce_generic(IREDUCE_ARGS,
50+
ompi_coll_tree_t * tree, size_t seg_size, int ireduce_tag);
51+
int ompi_coll_adapt_ireduce_tuned(IREDUCE_ARGS,
52+
int ireduce_tag);
53+
int ompi_coll_adapt_ireduce_binomial(IREDUCE_ARGS,
54+
int ireduce_tag);
55+
int ompi_coll_adapt_ireduce_in_order_binomial(IREDUCE_ARGS,
56+
int ireduce_tag);
57+
int ompi_coll_adapt_ireduce_binary(IREDUCE_ARGS,
58+
int ireduce_tag);
59+
int ompi_coll_adapt_ireduce_pipeline(IREDUCE_ARGS,
60+
int ireduce_tag);
61+
int ompi_coll_adapt_ireduce_chain(IREDUCE_ARGS,
62+
int ireduce_tag);
63+
int ompi_coll_adapt_ireduce_linear(IREDUCE_ARGS,
64+
int ireduce_tag);

ompi/mca/coll/adapt/coll_adapt_bcast.c

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,13 @@ int ompi_coll_adapt_bcast(void *buff, int count, struct ompi_datatype_t *datatyp
1717
{
1818
if (count == 0) {
1919
return MPI_SUCCESS;
20-
} else {
21-
ompi_request_t *request;
22-
int err = ompi_coll_adapt_ibcast(buff, count, datatype, root, comm, &request, module);
23-
ompi_request_wait(&request, MPI_STATUS_IGNORE);
24-
return err;
2520
}
21+
ompi_request_t *request = NULL;
22+
int err = ompi_coll_adapt_ibcast(buff, count, datatype, root, comm, &request, module);
23+
if( MPI_SUCCESS != err ) {
24+
if( NULL == request )
25+
return err;
26+
}
27+
ompi_request_wait(&request, MPI_STATUS_IGNORE);
28+
return err;
2629
}

ompi/mca/coll/adapt/coll_adapt_component.c

Lines changed: 14 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,10 @@ mca_coll_adapt_component_t mca_coll_adapt_component = {
6565

6666
/* adapt-component specific information */
6767

68-
/* (default) priority */
69-
0,
68+
0, /* (default) priority */
7069

71-
/* (default) verbose level */
72-
0,
70+
0, /* (default) output stream */
71+
0, /* (default) verbose level */
7372

7473
/* default values for non-MCA parameters */
7574
/* Not specifying values here gives us all 0's */
@@ -78,25 +77,13 @@ mca_coll_adapt_component_t mca_coll_adapt_component = {
7877
/* Open the component */
7978
static int adapt_open(void)
8079
{
81-
int param;
8280
mca_coll_adapt_component_t *cs = &mca_coll_adapt_component;
8381

84-
/*
85-
* Get the global coll verbosity: it will be ours
86-
*/
87-
param = mca_base_var_find("ompi", "coll", "base", "verbose");
88-
if (param >= 0) {
89-
const int *verbose = NULL;
90-
mca_base_var_get_value(param, &verbose, NULL, NULL);
91-
if (verbose && verbose[0] > 0) {
92-
cs->adapt_output = opal_output_open(NULL);
93-
opal_output_set_verbosity(cs->adapt_output, verbose[0]);
94-
}
82+
if (cs->adapt_verbose > 0) {
83+
cs->adapt_output = opal_output_open(NULL);
84+
opal_output_set_verbosity(cs->adapt_output, cs->adapt_verbose);
9585
}
9686

97-
opal_output_verbose(1, cs->adapt_output,
98-
"coll:adapt:component_open: done!");
99-
10087
return OMPI_SUCCESS;
10188
}
10289

@@ -131,40 +118,38 @@ static int adapt_register(void)
131118
OPAL_INFO_LVL_9,
132119
MCA_BASE_VAR_SCOPE_READONLY, &cs->adapt_priority);
133120

134-
int adapt_verbose = 0;
121+
cs->adapt_verbose = ompi_coll_base_framework.framework_verbose;
135122
(void) mca_base_component_var_register(c, "verbose",
136-
"Verbose level",
123+
"Verbose level (default set to the collective framework verbosity)",
137124
MCA_BASE_VAR_TYPE_INT, NULL, 0, 0,
138125
OPAL_INFO_LVL_9,
139-
MCA_BASE_VAR_SCOPE_READONLY, &adapt_verbose);
140-
cs->adapt_output = opal_output_open(NULL);
141-
opal_output_set_verbosity(cs->adapt_output, adapt_verbose);
126+
MCA_BASE_VAR_SCOPE_READONLY, &cs->adapt_verbose);
142127

143-
cs->adapt_context_free_list_min = 10;
128+
cs->adapt_context_free_list_min = 64;
144129
(void) mca_base_component_var_register(c, "context_free_list_min",
145130
"Minimum number of segments in context free list",
146131
MCA_BASE_VAR_TYPE_INT, NULL, 0, 0,
147132
OPAL_INFO_LVL_9,
148133
MCA_BASE_VAR_SCOPE_READONLY,
149134
&cs->adapt_context_free_list_min);
150135

151-
cs->adapt_context_free_list_max = 10000;
136+
cs->adapt_context_free_list_max = 1024;
152137
(void) mca_base_component_var_register(c, "context_free_list_max",
153138
"Maximum number of segments in context free list",
154139
MCA_BASE_VAR_TYPE_INT, NULL, 0, 0,
155140
OPAL_INFO_LVL_9,
156141
MCA_BASE_VAR_SCOPE_READONLY,
157142
&cs->adapt_context_free_list_max);
158143

159-
cs->adapt_context_free_list_inc = 10;
144+
cs->adapt_context_free_list_inc = 32;
160145
(void) mca_base_component_var_register(c, "context_free_list_inc",
161146
"Increasement number of segments in context free list",
162147
MCA_BASE_VAR_TYPE_INT, NULL, 0, 0,
163148
OPAL_INFO_LVL_9,
164149
MCA_BASE_VAR_SCOPE_READONLY,
165150
&cs->adapt_context_free_list_inc);
166-
ompi_coll_adapt_ibcast_init();
167-
ompi_coll_adapt_ireduce_init();
151+
ompi_coll_adapt_ibcast_register();
152+
ompi_coll_adapt_ireduce_register();
168153

169154
return adapt_verify_mca_variables();
170155
}

ompi/mca/coll/adapt/coll_adapt_context.c

Lines changed: 4 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -12,58 +12,15 @@
1212
#include "ompi/mca/coll/coll.h"
1313
#include "coll_adapt_context.h"
1414

15-
static void ompi_coll_adapt_bcast_context_constructor(ompi_coll_adapt_bcast_context_t * bcast_context)
16-
{
17-
}
18-
19-
static void ompi_coll_adapt_bcast_context_destructor(ompi_coll_adapt_bcast_context_t * bcast_context)
20-
{
21-
}
22-
23-
static void
24-
ompi_coll_adapt_constant_bcast_context_constructor(ompi_coll_adapt_constant_bcast_context_t * con)
25-
{
26-
}
27-
28-
static void ompi_coll_adapt_constant_bcast_context_destructor(ompi_coll_adapt_constant_bcast_context_t
29-
* con)
30-
{
31-
}
32-
3315

3416
OBJ_CLASS_INSTANCE(ompi_coll_adapt_bcast_context_t, opal_free_list_item_t,
35-
ompi_coll_adapt_bcast_context_constructor,
36-
ompi_coll_adapt_bcast_context_destructor);
17+
NULL, NULL);
3718

3819
OBJ_CLASS_INSTANCE(ompi_coll_adapt_constant_bcast_context_t, opal_object_t,
39-
ompi_coll_adapt_constant_bcast_context_constructor,
40-
ompi_coll_adapt_constant_bcast_context_destructor);
41-
42-
static void ompi_coll_adapt_reduce_context_constructor(ompi_coll_adapt_reduce_context_t *
43-
reduce_context)
44-
{
45-
}
46-
47-
static void ompi_coll_adapt_reduce_context_destructor(ompi_coll_adapt_reduce_context_t *
48-
reduce_context)
49-
{
50-
}
51-
52-
static void
53-
ompi_coll_adapt_constant_reduce_context_constructor(ompi_coll_adapt_constant_reduce_context_t * con)
54-
{
55-
}
56-
57-
static void
58-
ompi_coll_adapt_constant_reduce_context_destructor(ompi_coll_adapt_constant_reduce_context_t * con)
59-
{
60-
}
61-
20+
NULL, NULL);
6221

6322
OBJ_CLASS_INSTANCE(ompi_coll_adapt_reduce_context_t, opal_free_list_item_t,
64-
ompi_coll_adapt_reduce_context_constructor,
65-
ompi_coll_adapt_reduce_context_destructor);
23+
NULL, NULL);
6624

6725
OBJ_CLASS_INSTANCE(ompi_coll_adapt_constant_reduce_context_t, opal_object_t,
68-
ompi_coll_adapt_constant_reduce_context_constructor,
69-
ompi_coll_adapt_constant_reduce_context_destructor);
26+
NULL, NULL);

0 commit comments

Comments
 (0)