Skip to content

Commit 70471ae

Browse files
committed
Address comments on the PR.
Signed-off-by: George Bosilca <[email protected]>
1 parent 1290951 commit 70471ae

21 files changed

+564
-714
lines changed

ompi/mca/coll/base/coll_base_util.c

Lines changed: 52 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
33
* University Research and Technology
44
* Corporation. All rights reserved.
5-
* Copyright (c) 2004-2016 The University of Tennessee and The University
5+
* Copyright (c) 2004-2020 The University of Tennessee and The University
66
* of Tennessee Research Foundation. All rights
77
* reserved.
88
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
@@ -268,7 +268,7 @@ int ompi_coll_base_retain_datatypes_w( ompi_request_t *req,
268268
} else {
269269
scount = rcount = OMPI_COMM_IS_INTER(comm)?ompi_comm_remote_size(comm):ompi_comm_size(comm);
270270
}
271-
271+
272272
for (int i=0; i<scount; i++) {
273273
if (NULL != stypes && NULL != stypes[i] && !ompi_datatype_is_predefined(stypes[i])) {
274274
OBJ_RETAIN(stypes[i]);
@@ -297,7 +297,8 @@ int ompi_coll_base_retain_datatypes_w( ompi_request_t *req,
297297
return OMPI_SUCCESS;
298298
}
299299

300-
static void nbc_req_cons(ompi_coll_base_nbc_request_t *req) {
300+
static void nbc_req_cons(ompi_coll_base_nbc_request_t *req)
301+
{
301302
req->cb.req_complete_cb = NULL;
302303
req->req_complete_cb_data = NULL;
303304
req->data.objs.objs[0] = NULL;
@@ -309,35 +310,67 @@ OBJ_CLASS_INSTANCE(ompi_coll_base_nbc_request_t, ompi_request_t, nbc_req_cons, N
309310
/* File reading functions */
310311
static void skiptonewline (FILE *fptr, int *fileline)
311312
{
312-
do {
313-
char val;
314-
int rc;
313+
char val;
314+
int rc;
315315

316+
do {
316317
rc = fread(&val, 1, 1, fptr);
317-
if (0 == rc) return;
318-
if ((1 == rc)&&('\n' == val)) {
318+
if (0 == rc) {
319+
return;
320+
}
321+
if ('\n' == val) {
319322
(*fileline)++;
320323
return;
321-
}
324+
}
322325
} while (1);
323326
}
324327

325-
long ompi_coll_base_file_getnext (FILE *fptr, int *fileline)
328+
int ompi_coll_base_file_getnext_long(FILE *fptr, int *fileline, long* val)
326329
{
330+
char trash;
331+
int rc;
332+
327333
do {
328-
long val;
329-
int rc;
330-
char trash;
334+
rc = fscanf(fptr, "%li", val);
335+
if (rc == EOF) {
336+
return -1;
337+
}
338+
if (1 == rc) {
339+
return 0;
340+
}
341+
/* in all other cases, skip to the end of the token */
342+
rc = fread(&trash, sizeof(char), 1, fptr);
343+
if (rc == EOF) {
344+
return -1;
345+
}
346+
if ('\n' == trash) (*fileline)++;
347+
if ('#' == trash) {
348+
skiptonewline (fptr, fileline);
349+
}
350+
} while (1);
351+
}
352+
353+
int ompi_coll_base_file_getnext_size_t(FILE *fptr, int *fileline, size_t* val)
354+
{
355+
char trash;
356+
int rc;
331357

332-
rc = fscanf(fptr, "%li", &val);
333-
if (rc == EOF) return MYEOF;
334-
if (1 == rc) return val;
335-
/* in all other cases, skip to the end */
358+
do {
359+
rc = fscanf(fptr, "%" PRIsize_t, val);
360+
if (rc == EOF) {
361+
return -1;
362+
}
363+
if (1 == rc) {
364+
return 0;
365+
}
366+
/* in all other cases, skip to the end of the token */
336367
rc = fread(&trash, sizeof(char), 1, fptr);
337-
if (rc == EOF) return MYEOF;
368+
if (rc == EOF) {
369+
return -1;
370+
}
338371
if ('\n' == trash) (*fileline)++;
339372
if ('#' == trash) {
340373
skiptonewline (fptr, fileline);
341-
}
374+
}
342375
} while (1);
343376
}

ompi/mca/coll/base/coll_base_util.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
33
* University Research and Technology
44
* Corporation. All rights reserved.
5-
* Copyright (c) 2004-2015 The University of Tennessee and The University
5+
* Copyright (c) 2004-2020 The University of Tennessee and The University
66
* of Tennessee Research Foundation. All rights
77
* reserved.
88
* Copyright (c) 2004-2007 High Performance Computing Center Stuttgart,
@@ -141,8 +141,8 @@ int ompi_coll_base_retain_datatypes_w( ompi_request_t *request,
141141
ompi_datatype_t * const rtypes[]);
142142

143143
/* File reading function */
144-
#define MYEOF -999
145-
long ompi_coll_base_file_getnext(FILE *fptr, int *fileline);
144+
int ompi_coll_base_file_getnext_long(FILE *fptr, int *filelinei, long* val);
145+
int ompi_coll_base_file_getnext_size_t(FILE *fptr, int *fileline, size_t* val);
146146

147147
END_C_DECLS
148148
#endif /* MCA_COLL_BASE_UTIL_EXPORT_H */

ompi/mca/coll/han/Makefile.am

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,7 @@ coll_han_trigger.c \
2626
coll_han_dynamic.c \
2727
coll_han_dynamic_file.c \
2828
coll_han_topo.c \
29-
coll_han_subcomms.c \
30-
coll_han_utils.c
29+
coll_han_subcomms.c
3130

3231
# Make the output library in this directory, and name it either
3332
# mca_<type>_<name>.la (for DSO builds) or libmca_<type>_<name>.la

0 commit comments

Comments
 (0)