Skip to content

Commit dee185d

Browse files
author
Mamzi Bayatpour mbayatpour@nvidia.com ()
committed
OSHMEM: Fixing coverity-related comments (prints, outputs, comments, etc)
Signed-off-by: Mamzi Bayatpour <mbayatpour@nvidia.com>
1 parent abeb91a commit dee185d

File tree

11 files changed

+89
-75
lines changed

11 files changed

+89
-75
lines changed

oshmem/mca/spml/spml.h

Lines changed: 29 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -332,9 +332,9 @@ typedef int (*mca_spml_base_module_put_signal_nb_fn_t) (shmem_ctx_t ctx,
332332
* which elements in ivars are excluded from the wait set.
333333
* @param datatype Type of the objects
334334
*
335-
* @return OSHMEM_SUCCESS or failure status.
335+
* @return None
336336
*/
337-
typedef int (*mca_spml_base_module_wait_until_all_fn_t)(void *ivars,
337+
typedef void(*mca_spml_base_module_wait_until_all_fn_t)(void *ivars,
338338
int cmp,
339339
void *cmp_value,
340340
size_t nelems,
@@ -355,9 +355,10 @@ typedef int (*mca_spml_base_module_wait_until_all_fn_t)(void *ivars,
355355
* which elements in ivars are excluded from the wait set.
356356
* @param datatype Type of the objects
357357
*
358-
* @return OSHMEM_SUCCESS or failure status.
358+
* @return Returns the index of an element in the ivars array that satisfies the
359+
* wait condition. If the wait set is empty, this routine returns SIZE_MAX.
359360
*/
360-
typedef int (*mca_spml_base_module_wait_until_any_fn_t)(void *ivars,
361+
typedef size_t (*mca_spml_base_module_wait_until_any_fn_t)(void *ivars,
361362
int cmp,
362363
void *cmp_value,
363364
size_t nelems,
@@ -381,9 +382,10 @@ typedef int (*mca_spml_base_module_wait_until_any_fn_t)(void *ivars,
381382
* which elements in ivars are excluded from the wait set.
382383
* @param datatype Type of the objects
383384
*
384-
* @return OSHMEM_SUCCESS or failure status.
385+
* @return Returns the number of indices returned in the indices array. If the wait
386+
* set is empty, this routine returns 0.
385387
*/
386-
typedef int (*mca_spml_base_module_wait_until_some_fn_t)(void *ivars,
388+
typedef size_t (*mca_spml_base_module_wait_until_some_fn_t)(void *ivars,
387389
int cmp,
388390
void *cmp_value,
389391
size_t nelems,
@@ -408,9 +410,10 @@ typedef int (*mca_spml_base_module_wait_until_some_fn_t)(void *ivars,
408410
* which elements in ivars are excluded from the wait set.
409411
* @param datatype Type of the objects
410412
*
411-
* @return OSHMEM_SUCCESS or failure status.
413+
* @return None
414+
*
412415
*/
413-
typedef int (*mca_spml_base_module_wait_until_all_vector_fn_t)(void *ivars,
416+
typedef void (*mca_spml_base_module_wait_until_all_vector_fn_t)(void *ivars,
414417
int cmp,
415418
void *cmp_values,
416419
size_t nelems,
@@ -431,9 +434,11 @@ typedef int (*mca_spml_base_module_wait_until_all_vector_fn_t)(void *ivars,
431434
* which elements in ivars are excluded from the wait set.
432435
* @param datatype Type of the objects
433436
*
434-
* @return OSHMEM_SUCCESS or failure status.
437+
* @return Returns the index of an element in the ivars array that satisfies the
438+
* test condition. If the test set is empty or no conditions in the test
439+
* set are satisfied, this routine returns SIZE_MAX.
435440
*/
436-
typedef int (*mca_spml_base_module_wait_until_any_vector_fn_t)(void *ivars,
441+
typedef size_t (*mca_spml_base_module_wait_until_any_vector_fn_t)(void *ivars,
437442
int cmp,
438443
void *cmp_value,
439444
size_t nelems,
@@ -458,9 +463,10 @@ typedef int (*mca_spml_base_module_wait_until_any_vector_fn_t)(void *ivars,
458463
* which elements in ivars are excluded from the wait set.
459464
* @param datatype Type of the objects
460465
*
461-
* @return OSHMEM_SUCCESS or failure status.
466+
* @return Returns the number of indices returned in the indices array. If the test
467+
* set is empty, this routine returns 0.
462468
*/
463-
typedef int (*mca_spml_base_module_wait_until_some_vector_fn_t)(void *ivars,
469+
typedef size_t (*mca_spml_base_module_wait_until_some_vector_fn_t)(void *ivars,
464470
int cmp,
465471
void *cmp_value,
466472
size_t nelems,
@@ -484,7 +490,8 @@ typedef int (*mca_spml_base_module_wait_until_some_vector_fn_t)(void *ivars,
484490
* which elements in ivars are excluded from the test set.
485491
* @param datatype Type of the objects
486492
*
487-
* @return OSHMEM_SUCCESS or failure status.
493+
* @return Returns 1 if all variables in ivars satisfy the test condition or if
494+
* nelems is 0, otherwise this routine returns 0.
488495
*/
489496
typedef int (*mca_spml_base_module_test_all_fn_t)(void *ivars,
490497
int cmp,
@@ -507,9 +514,11 @@ typedef int (*mca_spml_base_module_test_all_fn_t)(void *ivars,
507514
* which elements in ivars are excluded from the test set.
508515
* @param datatype Type of the objects
509516
*
510-
* @return OSHMEM_SUCCESS or failure status.
517+
* @return Returns the index of an element in the ivars array that satisfies the
518+
* test condition. If the test set is empty or no conditions in the test
519+
* set are satisfied, this routine returns SIZE_MAX..
511520
*/
512-
typedef int (*mca_spml_base_module_test_any_fn_t)(void *ivars,
521+
typedef size_t (*mca_spml_base_module_test_any_fn_t)(void *ivars,
513522
int cmp,
514523
void *cmp_value,
515524
size_t nelems,
@@ -533,9 +542,10 @@ typedef int (*mca_spml_base_module_test_any_fn_t)(void *ivars,
533542
* which elements in ivars are excluded from the test set.
534543
* @param datatype Type of the objects
535544
*
536-
* @return OSHMEM_SUCCESS or failure status.
545+
* @return Returns the number of indices returned in the indices array. If the test
546+
* set is empty, this routine returns 0.
537547
*/
538-
typedef int (*mca_spml_base_module_test_some_fn_t)(void *ivars,
548+
typedef size_t (*mca_spml_base_module_test_some_fn_t)(void *ivars,
539549
int cmp,
540550
void *cmp_value,
541551
size_t nelems,
@@ -560,7 +570,8 @@ typedef int (*mca_spml_base_module_test_some_fn_t)(void *ivars,
560570
* which elements in ivars are excluded from the test set.
561571
* @param datatype Type of the objects
562572
*
563-
* @return OSHMEM_SUCCESS or failure status.
573+
* @return Returns 1 if all variables in ivars satisfy the test conditions or if
574+
* nelems is 0, otherwise this routine returns 0.
564575
*/
565576
typedef int (*mca_spml_base_module_test_all_vector_fn_t)(void *ivars,
566577
int cmp,

oshmem/mca/spml/ucx/spml_ucx.c

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1483,43 +1483,43 @@ int mca_spml_ucx_put_signal_nb(shmem_ctx_t ctx, void* dst_addr, size_t size,
14831483
}
14841484

14851485
/* This routine is not implemented */
1486-
int mca_spml_ucx_wait_until_all(void *ivars, int cmp, void
1486+
void mca_spml_ucx_wait_until_all(void *ivars, int cmp, void
14871487
*cmp_value, size_t nelems, const int *status, int datatype)
14881488
{
1489-
return OSHMEM_ERR_NOT_IMPLEMENTED;
1489+
return ;
14901490
}
14911491

14921492
/* This routine is not implemented */
1493-
int mca_spml_ucx_wait_until_any(void *ivars, int cmp, void
1493+
size_t mca_spml_ucx_wait_until_any(void *ivars, int cmp, void
14941494
*cmp_value, size_t nelems, const int *status, int datatype)
14951495
{
14961496
return OSHMEM_ERR_NOT_IMPLEMENTED;
14971497
}
14981498

14991499
/* This routine is not implemented */
1500-
int mca_spml_ucx_wait_until_some(void *ivars, int cmp, void
1500+
size_t mca_spml_ucx_wait_until_some(void *ivars, int cmp, void
15011501
*cmp_value, size_t nelems, size_t *indices, const int *status, int
15021502
datatype)
15031503
{
15041504
return OSHMEM_ERR_NOT_IMPLEMENTED;
15051505
}
15061506

1507-
/* This routine is not implemented */
1508-
int mca_spml_ucx_wait_until_all_vector(void *ivars, int cmp, void
1507+
/* This routine is not implemented */
1508+
void mca_spml_ucx_wait_until_all_vector(void *ivars, int cmp, void
15091509
*cmp_values, size_t nelems, const int *status, int datatype)
15101510
{
1511-
return OSHMEM_ERR_NOT_IMPLEMENTED;
1511+
return ;
15121512
}
15131513

15141514
/* This routine is not implemented */
1515-
int mca_spml_ucx_wait_until_any_vector(void *ivars, int cmp, void
1515+
size_t mca_spml_ucx_wait_until_any_vector(void *ivars, int cmp, void
15161516
*cmp_value, size_t nelems, const int *status, int datatype)
15171517
{
15181518
return OSHMEM_ERR_NOT_IMPLEMENTED;
15191519
}
15201520

15211521
/* This routine is not implemented */
1522-
int mca_spml_ucx_wait_until_some_vector(void *ivars, int cmp, void
1522+
size_t mca_spml_ucx_wait_until_some_vector(void *ivars, int cmp, void
15231523
*cmp_value, size_t nelems, size_t *indices, const int *status, int
15241524
datatype)
15251525
{
@@ -1534,14 +1534,14 @@ int mca_spml_ucx_test_all(void *ivars, int cmp, void *cmp_value,
15341534
}
15351535

15361536
/* This routine is not implemented */
1537-
int mca_spml_ucx_test_any(void *ivars, int cmp, void *cmp_value,
1537+
size_t mca_spml_ucx_test_any(void *ivars, int cmp, void *cmp_value,
15381538
size_t nelems, const int *status, int datatype)
15391539
{
15401540
return OSHMEM_ERR_NOT_IMPLEMENTED;
15411541
}
15421542

15431543
/* This routine is not implemented */
1544-
int mca_spml_ucx_test_some(void *ivars, int cmp, void *cmp_value,
1544+
size_t mca_spml_ucx_test_some(void *ivars, int cmp, void *cmp_value,
15451545
size_t nelems, size_t *indices, const int *status, int datatype)
15461546
{
15471547
return OSHMEM_ERR_NOT_IMPLEMENTED;
@@ -1555,14 +1555,14 @@ int mca_spml_ucx_test_all_vector(void *ivars, int cmp, void
15551555
}
15561556

15571557
/* This routine is not implemented */
1558-
int mca_spml_ucx_test_any_vector(void *ivars, int cmp, void
1558+
size_t mca_spml_ucx_test_any_vector(void *ivars, int cmp, void
15591559
*cmp_values, size_t nelems, const int *status, int datatype)
15601560
{
15611561
return OSHMEM_ERR_NOT_IMPLEMENTED;
15621562
}
15631563

15641564
/* This routine is not implemented */
1565-
int mca_spml_ucx_test_some_vector(void *ivars, int cmp, void
1565+
size_t mca_spml_ucx_test_some_vector(void *ivars, int cmp, void
15661566
*cmp_values, size_t nelems, size_t *indices, const int *status, int
15671567
datatype)
15681568
{

oshmem/mca/spml/ucx/spml_ucx.h

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -222,31 +222,31 @@ extern int mca_spml_ucx_put_signal(shmem_ctx_t ctx, void* dst_addr, size_t size,
222222
extern int mca_spml_ucx_put_signal_nb(shmem_ctx_t ctx, void* dst_addr, size_t size,
223223
void* src_addr, uint64_t *sig_addr, uint64_t signal, int sig_op, int
224224
dst);
225-
extern int mca_spml_ucx_wait_until_all(void *ivars, int cmp, void
225+
extern void mca_spml_ucx_wait_until_all(void *ivars, int cmp, void
226226
*cmp_value, size_t nelems, const int *status, int datatype);
227-
extern int mca_spml_ucx_wait_until_any(void *ivars, int cmp, void
227+
extern size_t mca_spml_ucx_wait_until_any(void *ivars, int cmp, void
228228
*cmp_value, size_t nelems, const int *status, int datatype);
229-
extern int mca_spml_ucx_wait_until_some(void *ivars, int cmp, void
229+
extern size_t mca_spml_ucx_wait_until_some(void *ivars, int cmp, void
230230
*cmp_value, size_t nelems, size_t *indices, const int *status, int
231231
datatype);
232-
extern int mca_spml_ucx_wait_until_all_vector(void *ivars, int cmp, void
232+
extern void mca_spml_ucx_wait_until_all_vector(void *ivars, int cmp, void
233233
*cmp_values, size_t nelems, const int *status, int datatype);
234-
extern int mca_spml_ucx_wait_until_any_vector(void *ivars, int cmp, void
234+
extern size_t mca_spml_ucx_wait_until_any_vector(void *ivars, int cmp, void
235235
*cmp_value, size_t nelems, const int *status, int datatype);
236-
extern int mca_spml_ucx_wait_until_some_vector(void *ivars, int cmp, void
236+
extern size_t mca_spml_ucx_wait_until_some_vector(void *ivars, int cmp, void
237237
*cmp_value, size_t nelems, size_t *indices, const int *status, int
238238
datatype);
239239
extern int mca_spml_ucx_test_all(void *ivars, int cmp, void *cmp_value,
240240
size_t nelems, const int *status, int datatype);
241-
extern int mca_spml_ucx_test_any(void *ivars, int cmp, void *cmp_value,
241+
extern size_t mca_spml_ucx_test_any(void *ivars, int cmp, void *cmp_value,
242242
size_t nelems, const int *status, int datatype);
243-
extern int mca_spml_ucx_test_some(void *ivars, int cmp, void *cmp_value,
243+
extern size_t mca_spml_ucx_test_some(void *ivars, int cmp, void *cmp_value,
244244
size_t nelems, size_t *indices, const int *status, int datatype);
245245
extern int mca_spml_ucx_test_all_vector(void *ivars, int cmp, void
246246
*cmp_values, size_t nelems, const int *status, int datatype);
247-
extern int mca_spml_ucx_test_any_vector(void *ivars, int cmp, void
247+
extern size_t mca_spml_ucx_test_any_vector(void *ivars, int cmp, void
248248
*cmp_values, size_t nelems, const int *status, int datatype);
249-
extern int mca_spml_ucx_test_some_vector(void *ivars, int cmp, void
249+
extern size_t mca_spml_ucx_test_some_vector(void *ivars, int cmp, void
250250
*cmp_values, size_t nelems, size_t *indices, const int *status, int
251251
datatype);
252252
extern int mca_spml_ucx_team_sync(shmem_team_t team);

oshmem/runtime/runtime.h

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -151,11 +151,7 @@ OSHMEM_DECLSPEC int oshmem_shmem_register_params(void);
151151

152152
#if OSHMEM_PARAM_CHECK == 1
153153

154-
#define RUNTIME_TEAM_MANAGMENT_CHECK_RC(x) \
155-
if (x <= -1) \
156-
{ \
157-
RUNTIME_CHECK_ERROR("Internal error is appeared rc = %d\n", (x)); \
158-
}
154+
159155

160156
#define RUNTIME_CHECK_ERROR(...) \
161157
do { \
@@ -166,6 +162,15 @@ OSHMEM_DECLSPEC int oshmem_shmem_register_params(void);
166162
fprintf(stderr, __VA_ARGS__); \
167163
} while(0);
168164

165+
/* check if this routine is implemented. Can be used for routines that do
166+
* not return error code. */
167+
#define RUNTIME_CHECK_IMPL_RC(x) \
168+
if (x <= -1) \
169+
{ \
170+
int _rc = x; \
171+
RUNTIME_CHECK_ERROR("Internal error is appeared rc = %d\n", (_rc)); \
172+
}
173+
169174
/**
170175
* Check if SHMEM API generates internal error return code
171176
* Note: most API does not return error code
@@ -228,7 +233,7 @@ OSHMEM_DECLSPEC int oshmem_shmem_register_params(void);
228233
#define RUNTIME_CHECK_ADDR(x)
229234
#define RUNTIME_CHECK_ADDR_SIZE(x,s)
230235
#define RUNTIME_CHECK_WITH_MEMHEAP_SIZE(x)
231-
#define RUNTIME_TEAM_MANAGMENT_CHECK_RC(x)
236+
#define RUNTIME_CHECK_IMPL_RC(x)
232237

233238
#endif /* OSHMEM_PARAM_CHECK */
234239

oshmem/shmem/c/shmem_alltoall.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ SHMEM_TYPE_ALLTOALLS(_alltoalls64, sizeof(uint64_t))
172172
#define SHMEM_TYPE_TEAM_ALLTOALL(type_name, type, code, postfix) \
173173
int shmem##type_name##postfix(shmem_team_t team, type *dest, const type *source, size_t nelems) \
174174
{ \
175-
size_t rc = 0; \
175+
int rc = 0; \
176176
\
177177
RUNTIME_CHECK_INIT(); \
178178
\
@@ -212,10 +212,10 @@ SHMEM_TYPE_TEAM_ALLTOALL(_ptrdiff, ptrdiff_t, SHMEM_PTRDIFF_T, _alltoall)
212212
SHMEM_TYPE_TEAM_ALLTOALL(, void, SHMEM_BYTE, _alltoallmem)
213213

214214

215-
#define SHMEM_TYPE_TEAM_ALLTOALLS(type_name, type, code, postfix) \
215+
#define SHMEM_TYPE_TEAM_ALLTOALLS(type_name, type, code, postfix) \
216216
int shmem##type_name##postfix(shmem_team_t team, type *dest, const type *source, ptrdiff_t dst, ptrdiff_t sst, size_t nelems) \
217217
{ \
218-
size_t rc = 0; \
218+
int rc = 0; \
219219
\
220220
RUNTIME_CHECK_INIT(); \
221221
\

oshmem/shmem/c/shmem_broadcast.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ SHMEM_TYPE_BROADCAST(_broadcast64, sizeof(uint64_t))
130130
#define SHMEM_TYPE_TEAM_BROADCAST(type_name, type, code, postfix) \
131131
int shmem##type_name##postfix(shmem_team_t team, type *dest, const type *source, size_t nelems, int PE_root) \
132132
{ \
133-
size_t rc = 0; \
133+
int rc = 0; \
134134
\
135135
RUNTIME_CHECK_INIT(); \
136136
\

oshmem/shmem/c/shmem_collect.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ static void _shmem_collect(void *target,
8484
/* Teams collect */
8585
#pragma weak shmem_char_collect = pshmem_char_collect
8686
#pragma weak shmem_short_collect = pshmem_short_collect
87-
#pragma weak shmem_int_collect = pshmem_int_collect
87+
#pragma weak shmem_int_collect = pshmem_int_collect
8888
#pragma weak shmem_long_collect = pshmem_long_collect
8989
#pragma weak shmem_float_collect = pshmem_float_collect
9090
#pragma weak shmem_double_collect = pshmem_double_collect
@@ -149,10 +149,10 @@ SHMEM_TYPE_COLLECT(_fcollect32, sizeof(uint32_t), true)
149149
SHMEM_TYPE_COLLECT(_fcollect64, sizeof(uint64_t), true)
150150

151151

152-
#define SHMEM_TYPE_TEAM_COLLECT(type_name, type, code, postfix) \
152+
#define SHMEM_TYPE_TEAM_COLLECT(type_name, type, code, postfix) \
153153
int shmem##type_name##postfix(shmem_team_t team, type *dest, const type *source, size_t nelems) \
154154
{ \
155-
size_t rc = 0; \
155+
int rc = 0; \
156156
\
157157
RUNTIME_CHECK_INIT(); \
158158
\
@@ -198,7 +198,7 @@ SHMEM_TYPE_TEAM_COLLECT(, void, SHMEM_BYTE, _collectmem)
198198
#define SHMEM_TYPE_TEAM_FCOLLECT(type_name, type, code, postfix) \
199199
int shmem##type_name##postfix(shmem_team_t team, type *dest, const type *source, size_t nelems) \
200200
{ \
201-
size_t rc = 0; \
201+
int rc = 0; \
202202
\
203203
RUNTIME_CHECK_INIT(); \
204204
\

oshmem/shmem/c/shmem_reduce.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -396,6 +396,8 @@ SHMEM_TYPE_REDUCE_OP(prod, _int64, int64_t, shmemx)
396396
\
397397
} \
398398
RUNTIME_CHECK_RC(rc); \
399+
\
400+
return rc; \
399401
}
400402

401403
SHMEM_TYPE_TEAM_REDUCE_OP(and, _uchar, unsigned char, OSHMEM_OP_AND, SHMEM_UCHAR)

0 commit comments

Comments
 (0)