Skip to content

Commit 1b95379

Browse files
authored
Merge pull request #12648 from roiedanino/oshmem/fixing-type-warnings
OSHMEM/SHMEM: fix warnings regarding types and unused variables in shmem
2 parents c207927 + 093900d commit 1b95379

File tree

8 files changed

+65
-105
lines changed

8 files changed

+65
-105
lines changed

oshmem/mca/spml/spml.h

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -597,12 +597,11 @@ typedef int (*mca_spml_base_module_test_all_vector_fn_t)(void *ivars,
597597
*
598598
* @return OSHMEM_SUCCESS or failure status.
599599
*/
600-
typedef int (*mca_spml_base_module_test_any_vector_fn_t)(void *ivars,
601-
int cmp,
602-
void *cmp_values,
603-
size_t nelems,
604-
const int *status,
605-
int datatype);
600+
typedef size_t (*mca_spml_base_module_test_any_vector_fn_t)(void *ivars, int cmp,
601+
void *cmp_values,
602+
size_t nelems,
603+
const int *status,
604+
int datatype);
606605

607606
/*
608607
* Indicate whether at least one variable within an array of variables on the local PE meets
@@ -624,13 +623,13 @@ typedef int (*mca_spml_base_module_test_any_vector_fn_t)(void *ivars,
624623
*
625624
* @return OSHMEM_SUCCESS or failure status.
626625
*/
627-
typedef int (*mca_spml_base_module_test_some_vector_fn_t)(void *ivars,
628-
int cmp,
629-
void *cmp_values,
630-
size_t nelems,
631-
size_t *indices,
632-
const int *status,
633-
int datatype);
626+
typedef size_t (*mca_spml_base_module_test_some_vector_fn_t)(void *ivars,
627+
int cmp,
628+
void *cmp_values,
629+
size_t nelems,
630+
size_t *indices,
631+
const int *status,
632+
int datatype);
634633

635634
/*
636635
* Registers the arrival of a PE at a synchronization point.

oshmem/mca/spml/ucx/spml_ucx.c

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1663,44 +1663,44 @@ int mca_spml_ucx_put_signal_nb(shmem_ctx_t ctx, void* dst_addr, size_t size,
16631663
void mca_spml_ucx_wait_until_all(void *ivars, int cmp, void
16641664
*cmp_value, size_t nelems, const int *status, int datatype)
16651665
{
1666-
return ;
1666+
RUNTIME_SHMEM_NOT_IMPLEMENTED_API_ABORT();
16671667
}
16681668

16691669
/* This routine is not implemented */
16701670
size_t mca_spml_ucx_wait_until_any(void *ivars, int cmp, void
16711671
*cmp_value, size_t nelems, const int *status, int datatype)
16721672
{
1673-
return OSHMEM_ERR_NOT_IMPLEMENTED;
1673+
RUNTIME_SHMEM_NOT_IMPLEMENTED_API_ABORT_RET_SIZE_T();
16741674
}
16751675

16761676
/* This routine is not implemented */
16771677
size_t mca_spml_ucx_wait_until_some(void *ivars, int cmp, void
16781678
*cmp_value, size_t nelems, size_t *indices, const int *status, int
16791679
datatype)
16801680
{
1681-
return OSHMEM_ERR_NOT_IMPLEMENTED;
1681+
RUNTIME_SHMEM_NOT_IMPLEMENTED_API_ABORT_RET_SIZE_T();
16821682
}
16831683

16841684
/* This routine is not implemented */
16851685
void mca_spml_ucx_wait_until_all_vector(void *ivars, int cmp, void
16861686
*cmp_values, size_t nelems, const int *status, int datatype)
16871687
{
1688-
return ;
1688+
RUNTIME_SHMEM_NOT_IMPLEMENTED_API_ABORT();
16891689
}
16901690

16911691
/* This routine is not implemented */
16921692
size_t mca_spml_ucx_wait_until_any_vector(void *ivars, int cmp, void
16931693
*cmp_value, size_t nelems, const int *status, int datatype)
16941694
{
1695-
return OSHMEM_ERR_NOT_IMPLEMENTED;
1695+
RUNTIME_SHMEM_NOT_IMPLEMENTED_API_ABORT_RET_SIZE_T();
16961696
}
16971697

16981698
/* This routine is not implemented */
16991699
size_t mca_spml_ucx_wait_until_some_vector(void *ivars, int cmp, void
17001700
*cmp_value, size_t nelems, size_t *indices, const int *status, int
17011701
datatype)
17021702
{
1703-
return OSHMEM_ERR_NOT_IMPLEMENTED;
1703+
RUNTIME_SHMEM_NOT_IMPLEMENTED_API_ABORT_RET_SIZE_T();
17041704
}
17051705

17061706
/* This routine is not implemented */
@@ -1714,36 +1714,39 @@ int mca_spml_ucx_test_all(void *ivars, int cmp, void *cmp_value,
17141714
size_t mca_spml_ucx_test_any(void *ivars, int cmp, void *cmp_value,
17151715
size_t nelems, const int *status, int datatype)
17161716
{
1717-
return OSHMEM_ERR_NOT_IMPLEMENTED;
1717+
RUNTIME_SHMEM_NOT_IMPLEMENTED_API_ABORT_RET_SIZE_T();
17181718
}
17191719

17201720
/* This routine is not implemented */
17211721
size_t mca_spml_ucx_test_some(void *ivars, int cmp, void *cmp_value,
17221722
size_t nelems, size_t *indices, const int *status, int datatype)
17231723
{
1724-
return OSHMEM_ERR_NOT_IMPLEMENTED;
1724+
RUNTIME_SHMEM_NOT_IMPLEMENTED_API_ABORT_RET_SIZE_T();
17251725
}
17261726

17271727
/* This routine is not implemented */
1728-
int mca_spml_ucx_test_all_vector(void *ivars, int cmp, void
1729-
*cmp_values, size_t nelems, const int *status, int datatype)
1728+
int mca_spml_ucx_test_all_vector(void *ivars, int cmp, void *cmp_values,
1729+
size_t nelems, const int *status,
1730+
int datatype)
17301731
{
17311732
return OSHMEM_ERR_NOT_IMPLEMENTED;
17321733
}
17331734

17341735
/* This routine is not implemented */
1735-
int mca_spml_ucx_test_any_vector(void *ivars, int cmp, void
1736-
*cmp_values, size_t nelems, const int *status, int datatype)
1736+
size_t mca_spml_ucx_test_any_vector(void *ivars, int cmp,
1737+
void *cmp_values, size_t nelems,
1738+
const int *status, int datatype)
17371739
{
1738-
return OSHMEM_ERR_NOT_IMPLEMENTED;
1740+
RUNTIME_SHMEM_NOT_IMPLEMENTED_API_ABORT_RET_SIZE_T();
17391741
}
17401742

17411743
/* This routine is not implemented */
1742-
int mca_spml_ucx_test_some_vector(void *ivars, int cmp, void
1743-
*cmp_values, size_t nelems, size_t *indices, const int *status, int
1744-
datatype)
1744+
size_t mca_spml_ucx_test_some_vector(void *ivars, int cmp,
1745+
void *cmp_values, size_t nelems,
1746+
size_t *indices, const int *status,
1747+
int datatype)
17451748
{
1746-
return OSHMEM_ERR_NOT_IMPLEMENTED;
1749+
RUNTIME_SHMEM_NOT_IMPLEMENTED_API_ABORT_RET_SIZE_T();
17471750
}
17481751

17491752
/* This routine is not implemented */
@@ -1855,5 +1858,3 @@ int mca_spml_ucx_team_reduce(shmem_team_t team, void
18551858
{
18561859
return OSHMEM_ERR_NOT_IMPLEMENTED;
18571860
}
1858-
1859-

oshmem/mca/spml/ucx/spml_ucx.h

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -259,11 +259,10 @@ extern size_t mca_spml_ucx_test_some(void *ivars, int cmp, void *cmp_value,
259259
size_t nelems, size_t *indices, const int *status, int datatype);
260260
extern int mca_spml_ucx_test_all_vector(void *ivars, int cmp, void
261261
*cmp_values, size_t nelems, const int *status, int datatype);
262-
extern int mca_spml_ucx_test_any_vector(void *ivars, int cmp, void
263-
*cmp_values, size_t nelems, const int *status, int datatype);
264-
extern int mca_spml_ucx_test_some_vector(void *ivars, int cmp, void
265-
*cmp_values, size_t nelems, size_t *indices, const int *status, int
266-
datatype);
262+
extern size_t mca_spml_ucx_test_any_vector(void *ivars, int cmp, void *cmp_values, size_t nelems,
263+
const int *status, int datatype);
264+
extern size_t mca_spml_ucx_test_some_vector(void *ivars, int cmp, void *cmp_values, size_t nelems,
265+
size_t *indices, const int *status, int datatype);
267266
extern int mca_spml_ucx_team_sync(shmem_team_t team);
268267
extern int mca_spml_ucx_team_my_pe(shmem_team_t team);
269268
extern int mca_spml_ucx_team_n_pes(shmem_team_t team);

oshmem/mca/spml/ucx/spml_ucx_component.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -463,7 +463,6 @@ static int mca_spml_ucx_component_fini(void)
463463
volatile int fenced = 0;
464464
int i;
465465
int ret = OSHMEM_SUCCESS;
466-
mca_spml_ucx_ctx_t *ctx;
467466

468467
opal_progress_unregister(spml_ucx_default_progress);
469468
if (mca_spml_ucx.active_array.ctxs_count) {

oshmem/mca/sshmem/ucx/sshmem_ucx_module.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -181,12 +181,11 @@ segment_create(map_segment_t *ds_buf,
181181
{
182182
mca_spml_ucx_t *spml = (mca_spml_ucx_t*)mca_spml.self;
183183
unsigned flags = UCP_MEM_MAP_ALLOCATE;
184-
int status;
185184

186185
if (hint & SHMEM_HINT_DEVICE_NIC_MEM) {
187186
#if HAVE_DECL_UCS_MEMORY_TYPE_RDMA
188-
status = segment_create_internal(ds_buf, NULL, size, flags,
189-
UCS_MEMORY_TYPE_RDMA, 3);
187+
int status = segment_create_internal(ds_buf, NULL, size,
188+
flags, UCS_MEMORY_TYPE_RDMA, 3);
190189
if (status == OSHMEM_SUCCESS) {
191190
ds_buf->alloc_hints = hint;
192191
ds_buf->allocator = &sshmem_ucx_allocator;

oshmem/runtime/runtime.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,18 @@ OSHMEM_DECLSPEC int oshmem_shmem_register_params(void);
237237

238238
#endif /* OSHMEM_PARAM_CHECK */
239239

240+
#define RUNTIME_SHMEM_NOT_IMPLEMENTED_API_ABORT() \
241+
do { \
242+
SHMEM_API_ERROR("Called non-implemented API: %s", __func__); \
243+
oshmem_shmem_abort(OSHMEM_ERR_NOT_IMPLEMENTED); \
244+
} while (0)
245+
246+
#define RUNTIME_SHMEM_NOT_IMPLEMENTED_API_ABORT_RET_SIZE_T() \
247+
do { \
248+
RUNTIME_SHMEM_NOT_IMPLEMENTED_API_ABORT(); \
249+
return SIZE_MAX; \
250+
} while (0)
251+
240252
END_C_DECLS
241253

242254
#endif /* OSHMEM_SHMEM_RUNTIME_H */

oshmem/shmem/c/shmem_test_ivars.c

Lines changed: 11 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@
124124
#define SHMEM_TYPE_TEST_ALL(type_name, type, code, prefix) \
125125
int prefix##type_name##_test_all(volatile type *ivars, size_t nelems, const int *status, int cmp, type value) \
126126
{ \
127-
int rc = OSHMEM_SUCCESS; \
127+
int rc; \
128128
\
129129
RUNTIME_CHECK_INIT(); \
130130
\
@@ -138,81 +138,60 @@
138138
return rc; \
139139
}
140140

141-
142141
#define SHMEM_TYPE_TEST_ANY(type_name, type, code, prefix) \
143142
size_t prefix##type_name##_test_any(volatile type *ivars, size_t nelems, const int *status, int cmp, type value) \
144143
{ \
145-
size_t rc = 0; \
146-
\
147144
RUNTIME_CHECK_INIT(); \
148145
\
149-
rc = MCA_SPML_CALL(test_any( \
150-
(void*)ivars, \
151-
cmp, \
152-
(void*)&value, \
153-
nelems, status, code)); \
154-
RUNTIME_CHECK_IMPL_RC(rc); \
155-
\
156-
return rc; \
146+
return MCA_SPML_CALL(test_any( \
147+
(void*)ivars, \
148+
cmp, \
149+
(void*)&value, \
150+
nelems, status, code)); \
157151
}
158152

159153

160154
#define SHMEM_TYPE_TEST_SOME(type_name, type, code, prefix) \
161155
size_t prefix##type_name##_test_some(volatile type *ivars, size_t nelems, size_t *indices, const int *status, int cmp, type value) \
162156
{ \
163-
size_t rc = 0; \
164-
\
165157
RUNTIME_CHECK_INIT(); \
166158
\
167-
rc = MCA_SPML_CALL(test_some( \
159+
return MCA_SPML_CALL(test_some( \
168160
(void*)ivars, \
169161
cmp, \
170162
(void*)&value, \
171163
nelems, indices, status, code)); \
172-
RUNTIME_CHECK_IMPL_RC(rc); \
173-
\
174-
return rc; \
175164
}
176165

177166
#define SHMEM_TYPE_TEST_ANY_VECTOR(type_name, type, code, prefix) \
178167
size_t prefix##type_name##_test_any_vector(volatile type *ivars, size_t nelems, const int *status, int cmp, type *values) \
179168
{ \
180-
size_t rc = 0; \
181-
\
182169
RUNTIME_CHECK_INIT(); \
183170
\
184-
rc = MCA_SPML_CALL(test_any_vector( \
171+
return MCA_SPML_CALL(test_any_vector( \
185172
(void*)ivars, \
186173
cmp, \
187174
(void*)values, \
188175
nelems, status, code)); \
189-
RUNTIME_CHECK_IMPL_RC(rc); \
190-
\
191-
return rc; \
192176
}
193177

194178
#define SHMEM_TYPE_TEST_SOME_VECTOR(type_name, type, code, prefix) \
195179
size_t prefix##type_name##_test_some_vector(volatile type *ivars, size_t nelems, size_t *indices, const int *status, int cmp, type *values) \
196180
{ \
197-
size_t rc = 0; \
198-
\
199181
RUNTIME_CHECK_INIT(); \
200182
\
201-
rc = MCA_SPML_CALL(test_some_vector( \
183+
return MCA_SPML_CALL(test_some_vector( \
202184
(void*)ivars, \
203185
cmp, \
204186
(void*)values, \
205187
nelems, indices, status, code)); \
206-
RUNTIME_CHECK_IMPL_RC(rc); \
207-
\
208-
return rc; \
209188
}
210189

211190

212191
#define SHMEM_TYPE_TEST_ALL_VECTOR(type_name, type, code, prefix) \
213-
int prefix##type_name##_test_all_vector(volatile type *ivars, size_t nelems, const int *status, int cmp, type *values) \
192+
int prefix##type_name##_test_all_vector(volatile type *ivars, size_t nelems, const int *status, int cmp, type *values) \
214193
{ \
215-
int rc = OSHMEM_SUCCESS; \
194+
int rc; \
216195
\
217196
RUNTIME_CHECK_INIT(); \
218197
\

0 commit comments

Comments
 (0)