Skip to content

Commit a680b3a

Browse files
authored
Merge pull request #3853 from clementFoyer/master
OMPI monitoring: Simplify the communicator's name caching management + misc test changes
2 parents 60a810c + d5c192c commit a680b3a

File tree

3 files changed

+19
-33
lines changed

3 files changed

+19
-33
lines changed

ompi/mca/common/monitoring/common_monitoring_coll.c

Lines changed: 10 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -41,33 +41,20 @@ struct mca_monitoring_coll_data_t {
4141
/* Collectives operation monitoring */
4242
static opal_hash_table_t *comm_data = NULL;
4343

44-
/* Check whether the communicator's name have been changed. Update the
45-
* data->comm_name field if so.
46-
*/
47-
static inline void mca_common_monitoring_coll_check_name(mca_monitoring_coll_data_t*data)
48-
{
49-
if( data->comm_name && data->p_comm && (data->p_comm->c_flags & OMPI_COMM_NAMEISSET)
50-
&& 0 < strlen(data->p_comm->c_name)
51-
&& 0 != strncmp(data->p_comm->c_name, data->comm_name, OPAL_MAX_OBJECT_NAME - 1) )
52-
{
53-
free(data->comm_name);
54-
data->comm_name = strdup(data->p_comm->c_name);
55-
}
56-
}
57-
5844
static inline void mca_common_monitoring_coll_cache(mca_monitoring_coll_data_t*data)
5945
{
60-
if( NULL == data->comm_name && 0 < strlen(data->p_comm->c_name) ) {
46+
if( data->is_released ) {
47+
/* As long as the data struct is not released, we still have the communicator to
48+
immediately fetch the communicator's name */
6149
data->comm_name = strdup(data->p_comm->c_name);
62-
} else {
63-
mca_common_monitoring_coll_check_name(data);
6450
}
6551
if( -1 == data->world_rank ) {
6652
/* Get current process world_rank */
6753
mca_common_monitoring_get_world_rank(ompi_comm_rank(data->p_comm), data->p_comm,
6854
&data->world_rank);
6955
}
70-
/* Only list procs if the hashtable is already initialized, ie if the previous call worked */
56+
/* Only list procs if the hashtable is already initialized,
57+
i.e. if the previous call worked */
7158
if( (-1 != data->world_rank) && (NULL == data->procs || 0 == strlen(data->procs)) ) {
7259
int i, pos = 0, size, world_size = -1, max_length, world_rank;
7360
char*tmp_procs;
@@ -100,9 +87,7 @@ mca_monitoring_coll_data_t*mca_common_monitoring_coll_new( ompi_communicator_t*c
10087
return NULL;
10188
}
10289

103-
data->procs = NULL;
104-
data->comm_name = NULL;
105-
data->p_comm = comm;
90+
data->p_comm = comm;
10691

10792
/* Allocate hashtable */
10893
if( NULL == comm_data ) {
@@ -137,8 +122,8 @@ void mca_common_monitoring_coll_release(mca_monitoring_coll_data_t*data)
137122
#endif /* OPAL_ENABLE_DEBUG */
138123

139124
/* not flushed yet */
140-
mca_common_monitoring_coll_cache(data);
141125
data->is_released = 1;
126+
mca_common_monitoring_coll_cache(data);
142127
}
143128

144129
static void mca_common_monitoring_coll_cond_release(mca_monitoring_coll_data_t*data)
@@ -169,16 +154,15 @@ void mca_common_monitoring_coll_finalize( void )
169154

170155
void mca_common_monitoring_coll_flush(FILE *pf, mca_monitoring_coll_data_t*data)
171156
{
172-
/* Check for any change in the communicator's name */
173-
mca_common_monitoring_coll_check_name(data);
174-
175157
/* Flush data */
176158
fprintf(pf,
177159
"D\t%s\tprocs: %s\n"
178160
"O2A\t%" PRId32 "\t%zu bytes\t%zu msgs sent\n"
179161
"A2O\t%" PRId32 "\t%zu bytes\t%zu msgs sent\n"
180162
"A2A\t%" PRId32 "\t%zu bytes\t%zu msgs sent\n",
181-
data->comm_name ? data->comm_name : "(no-name)", data->procs,
163+
data->p_comm ? data->p_comm->c_name
164+
: data->comm_name ? data->comm_name : "(no-name)",
165+
data->procs,
182166
data->world_rank, data->o2a_size, data->o2a_count,
183167
data->world_rank, data->a2o_size, data->a2o_count,
184168
data->world_rank, data->a2a_size, data->a2a_count);

test/monitoring/test_overhead.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
*/
1111

1212
/*
13-
Measurement for thze pml_monitoring component overhead
13+
Measurement for the pml_monitoring component overhead
1414
1515
Designed by Clement Foyer <[email protected]>
1616
Contact the authors for questions.
@@ -85,7 +85,7 @@ static inline void op_send(double*res, void*sbuf, int size, int tagno, void*rbuf
8585
MPI_Irecv(rbuf, size, MPI_BYTE, from, tagno, MPI_COMM_WORLD, &request);
8686

8787
/* Token ring to synchronize */
88-
/* We send to the sender to make him know we are ready to
88+
/* We message the sender to make him know we are ready to
8989
receive (even for non-eager mode sending) */
9090
if( 0 == rank_world ) {
9191
MPI_Send(NULL, 0, MPI_BYTE, from, 100, MPI_COMM_WORLD);
@@ -235,17 +235,17 @@ int main(int argc, char* argv[])
235235
sprintf(name, "MPI_Alltoall");
236236
break;
237237
case 3:
238+
op = op_send_pingpong;
239+
sprintf(name, "MPI_Send_pp");
240+
break;
241+
case 4:
238242
op = op_put;
239243
sprintf(name, "MPI_Put");
240244
break;
241-
case 4:
245+
case 5:
242246
op = op_get;
243247
sprintf(name, "MPI_Get");
244248
break;
245-
case 5:
246-
op = op_send_pingpong;
247-
sprintf(name, "MPI_Send_pp");
248-
break;
249249
}
250250

251251
if( 0 == rank_world )

test/monitoring/test_overhead.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,8 @@ order by nbprocs, datasize;
147147
EOF
148148
done
149149
cat >> $dbscript <<EOF
150+
-- reset output to stdout
151+
.output stdout
150152
-- create view for all overheads
151153
create temporary view medians as
152154
select NULL as ovh

0 commit comments

Comments
 (0)