Skip to content

Commit 34685a2

Browse files
authored
Merge pull request #9997 from karasevb/pml_ucx_warnings_fix
UCX/PML/SPML/OSC: fix compiler warnings
2 parents 8269a70 + 334c6ec commit 34685a2

File tree

9 files changed

+42
-39
lines changed

9 files changed

+42
-39
lines changed

ompi/mca/osc/ucx/osc_ucx_passive_target.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -216,8 +216,7 @@ int ompi_osc_ucx_lock_all(int mpi_assert, struct ompi_win_t *win) {
216216

217217
int ompi_osc_ucx_unlock_all(struct ompi_win_t *win) {
218218
ompi_osc_ucx_module_t *module = (ompi_osc_ucx_module_t*)win->w_osc_module;
219-
int comm_size = ompi_comm_size(module->comm),
220-
i = 0, ret = OMPI_SUCCESS;
219+
int comm_size = ompi_comm_size(module->comm), ret = OMPI_SUCCESS;
221220

222221
if (module->epoch_type.access != PASSIVE_ALL_EPOCH) {
223222
return OMPI_ERR_RMA_SYNC;
@@ -226,7 +225,7 @@ int ompi_osc_ucx_unlock_all(struct ompi_win_t *win) {
226225
assert(module->lock_count == 0);
227226

228227
if (module->flavor == MPI_WIN_FLAVOR_DYNAMIC) {
229-
for (i = 0; i < module->state.dynamic_win_count; i++) {
228+
for (uint64_t i = 0; i < module->state.dynamic_win_count; i++) {
230229
ret = opal_common_ucx_wpmem_flush(module->local_dynamic_win_info[i].mem , OPAL_COMMON_UCX_SCOPE_WORKER, 0);
231230
if (ret != OMPI_SUCCESS) {
232231
return ret;

ompi/mca/pml/ucx/pml_ucx.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -497,7 +497,7 @@ int mca_pml_ucx_enable(bool enable)
497497

498498
/* Create a key for adding custom attributes to datatypes */
499499
copy_fn.attr_datatype_copy_fn =
500-
(MPI_Type_internal_copy_attr_function*)MPI_TYPE_NULL_COPY_FN;
500+
(MPI_Type_internal_copy_attr_function)MPI_TYPE_NULL_COPY_FN;
501501
del_fn.attr_datatype_delete_fn = mca_pml_ucx_datatype_attr_del_fn;
502502
ret = ompi_attr_create_keyval(TYPE_ATTR, copy_fn, del_fn,
503503
&ompi_pml_ucx.datatype_attr_keyval, NULL, 0,
@@ -700,7 +700,7 @@ int mca_pml_ucx_isend_init(const void *buf, size_t count, ompi_datatype_t *datat
700700
OMPI_DATATYPE_RETAIN(datatype);
701701

702702
if (MCA_PML_BASE_SEND_BUFFERED == mode) {
703-
req->datatype = NULL;
703+
req->datatype = (ucp_datatype_t)NULL;
704704
} else {
705705
req->datatype = mca_pml_ucx_get_datatype(datatype);
706706
}
@@ -979,7 +979,7 @@ int mca_pml_ucx_iprobe(int src, int tag, struct ompi_communicator_t* comm,
979979
mca_pml_ucx_set_recv_status_public(mpi_status, UCS_OK, &info);
980980
} else {
981981
(++progress_count % opal_common_ucx.progress_iterations) ?
982-
(void)ucp_worker_progress(ompi_pml_ucx.ucp_worker) : opal_progress();
982+
(int)ucp_worker_progress(ompi_pml_ucx.ucp_worker) : opal_progress();
983983
*matched = 0;
984984
}
985985
return OMPI_SUCCESS;
@@ -1028,7 +1028,7 @@ int mca_pml_ucx_improbe(int src, int tag, struct ompi_communicator_t* comm,
10281028
mca_pml_ucx_set_recv_status_public(mpi_status, UCS_OK, &info);
10291029
} else {
10301030
(++progress_count % opal_common_ucx.progress_iterations) ?
1031-
(void)ucp_worker_progress(ompi_pml_ucx.ucp_worker) : opal_progress();
1031+
(int)ucp_worker_progress(ompi_pml_ucx.ucp_worker) : opal_progress();
10321032
*matched = 0;
10331033
}
10341034
return OMPI_SUCCESS;

ompi/mca/pml/ucx/pml_ucx_component.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,9 @@ mca_pml_base_component_2_1_0_t mca_pml_ucx_component = {
4949

5050
static int mca_pml_ucx_component_register(void)
5151
{
52+
#if HAVE_DECL_UCP_OP_ATTR_FLAG_MULTI_SEND
5253
int multi_send_op_attr_enable;
54+
#endif
5355

5456
ompi_pml_ucx.priority = 51;
5557
(void) mca_base_component_var_register(&mca_pml_ucx_component.pmlm_version, "priority",

ompi/mca/pml/ucx/pml_ucx_request.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,10 +180,9 @@ static inline int mca_pml_ucx_set_recv_status(ompi_status_public_t* mpi_status,
180180
ucs_status_t ucp_status,
181181
const ucp_tag_recv_info_t *info)
182182
{
183-
int64_t tag;
183+
int64_t tag = info->sender_tag;
184184

185185
if (OPAL_LIKELY(ucp_status == UCS_OK)) {
186-
tag = info->sender_tag;
187186
mpi_status->MPI_ERROR = MPI_SUCCESS;
188187
mpi_status->MPI_SOURCE = PML_UCX_TAG_GET_SOURCE(tag);
189188
mpi_status->MPI_TAG = PML_UCX_TAG_GET_MPI_TAG(tag);

opal/mca/btl/uct/btl_uct_component.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -122,9 +122,11 @@ static int mca_btl_uct_component_open(void)
122122
int core_count = 36;
123123

124124
(void) opal_hwloc_base_get_topology();
125-
core_count = hwloc_get_nbobjs_by_type(opal_hwloc_topology, HWLOC_OBJ_CORE);
125+
if (0 > (core_count = hwloc_get_nbobjs_by_type(opal_hwloc_topology, HWLOC_OBJ_CORE))) {
126+
return OPAL_ERROR;
127+
}
126128

127-
if (core_count <= opal_process_info.num_local_peers || !opal_using_threads()) {
129+
if ((uint32_t)core_count <= opal_process_info.num_local_peers || !opal_using_threads()) {
128130
/* there is probably no benefit to using multiple device contexts when not
129131
* using threads or oversubscribing the node with mpi processes. */
130132
mca_btl_uct_component.num_contexts_per_module = 1;
@@ -456,7 +458,7 @@ static int mca_btl_uct_component_process_uct_component(uct_component_h component
456458
return OPAL_ERROR;
457459
}
458460

459-
for (int i = 0; i < attr.md_resource_count; ++i) {
461+
for (unsigned i = 0; i < attr.md_resource_count; ++i) {
460462
rc = mca_btl_uct_component_process_uct_md(component, attr.md_resources + i, allowed_ifaces);
461463
if (OPAL_SUCCESS != rc) {
462464
break;
@@ -484,8 +486,6 @@ static mca_btl_base_module_t **mca_btl_uct_component_init(int *num_btl_modules,
484486
/* for this BTL to be useful the interface needs to support RDMA and certain atomic operations
485487
*/
486488
struct mca_btl_base_module_t **base_modules;
487-
uct_md_resource_desc_t *resources;
488-
unsigned resource_count;
489489
ucs_status_t ucs_status;
490490
char **allowed_ifaces;
491491
int rc;
@@ -527,6 +527,8 @@ static mca_btl_base_module_t **mca_btl_uct_component_init(int *num_btl_modules,
527527
uct_release_component_list(components);
528528

529529
#else /* UCT 1.6 and older */
530+
uct_md_resource_desc_t *resources;
531+
unsigned resource_count;
530532

531533
uct_query_md_resources(&resources, &resource_count);
532534

opal/mca/common/ucx/common_ucx.c

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
#include "opal/mca/pmix/pmix-internal.h"
2222
#include "opal/memoryhooks/memory.h"
2323
#include "opal/util/argv.h"
24+
#include "opal/util/printf.h"
2425

2526
#include <fnmatch.h>
2627
#include <stdio.h>
@@ -203,21 +204,23 @@ static bool opal_common_ucx_check_device(const char *device_name, char **device_
203204
{
204205
char sysfs_driver_link[PATH_MAX];
205206
char driver_path[PATH_MAX];
206-
char *ib_device_name;
207+
char ib_device_name[NAME_MAX];
207208
char *driver_name;
208209
char **list_item;
209210
ssize_t ret;
211+
char ib_device_name_fmt[NAME_MAX];
210212

211213
/* mlx5_0:1 */
212-
ret = sscanf(device_name, "%m[^:]%*d", &ib_device_name);
214+
opal_snprintf(ib_device_name_fmt, sizeof(ib_device_name_fmt),
215+
"%%%u[^:]%%*d", NAME_MAX - 1);
216+
ret = sscanf(device_name, ib_device_name_fmt, &ib_device_name);
213217
if (ret != 1) {
214218
return false;
215219
}
216220

217221
sysfs_driver_link[sizeof(sysfs_driver_link) - 1] = '\0';
218222
snprintf(sysfs_driver_link, sizeof(sysfs_driver_link) - 1,
219223
"/sys/class/infiniband/%s/device/driver", ib_device_name);
220-
free(ib_device_name);
221224

222225
ret = readlink(sysfs_driver_link, driver_path, sizeof(driver_path) - 1);
223226
if (ret < 0) {
@@ -246,7 +249,8 @@ OPAL_DECLSPEC opal_common_ucx_support_level_t opal_common_ucx_support_level(ucp_
246249
[OPAL_COMMON_UCX_SUPPORT_TRANSPORT] = "transports only",
247250
[OPAL_COMMON_UCX_SUPPORT_DEVICE] = "transports and devices"};
248251
#if HAVE_DECL_OPEN_MEMSTREAM
249-
char *rsc_tl_name, *rsc_device_name;
252+
char rsc_tl_name[NAME_MAX], rsc_device_name[NAME_MAX];
253+
char rsc_name_fmt[NAME_MAX];
250254
char **tl_list, **device_list, **list_item;
251255
bool is_any_tl, is_any_device;
252256
bool found_tl, negate;
@@ -298,17 +302,17 @@ OPAL_DECLSPEC opal_common_ucx_support_level_t opal_common_ucx_support_level(ucp_
298302
/* Print ucx transports information to the memory stream */
299303
ucp_context_print_info(context, stream);
300304

305+
/* "# resource 6 : md 5 dev 4 flags -- rc_verbs/mlx5_0:1" */
306+
opal_snprintf(rsc_name_fmt, sizeof(rsc_name_fmt),
307+
"# resource %%*d : md %%*d dev %%*d flags -- %%%u[^/ \n\r]/%%%u[^/ \n\r]",
308+
NAME_MAX - 1, NAME_MAX - 1);
309+
301310
/* Rewind and read transports/devices list from the stream */
302311
fseek(stream, 0, SEEK_SET);
303312
while ((support_level != OPAL_COMMON_UCX_SUPPORT_DEVICE)
304313
&& (fgets(line, sizeof(line), stream) != NULL)) {
305-
rsc_tl_name = NULL;
306-
ret = sscanf(line,
307-
/* "# resource 6 : md 5 dev 4 flags -- rc_verbs/mlx5_0:1" */
308-
"# resource %*d : md %*d dev %*d flags -- %m[^/ \n\r]/%m[^/ \n\r]",
309-
&rsc_tl_name, &rsc_device_name);
314+
ret = sscanf(line, rsc_name_fmt, rsc_tl_name, rsc_device_name);
310315
if (ret != 2) {
311-
free(rsc_tl_name);
312316
continue;
313317
}
314318

@@ -334,9 +338,6 @@ OPAL_DECLSPEC opal_common_ucx_support_level_t opal_common_ucx_support_level(ucp_
334338
MCA_COMMON_UCX_VERBOSE(2, "%s/%s: did not match transport list", rsc_tl_name,
335339
rsc_device_name);
336340
}
337-
338-
free(rsc_device_name);
339-
free(rsc_tl_name);
340341
}
341342

342343
MCA_COMMON_UCX_VERBOSE(2, "support level is %s", support_level_names[support_level]);

oshmem/mca/atomic/ucx/atomic_ucx_module.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -324,14 +324,14 @@ static int mca_atomic_ucx_swap_nb(shmem_ctx_t ctx,
324324
}
325325

326326

327-
int mca_atomic_ucx_cswap_nb(shmem_ctx_t ctx,
328-
void *fetch,
329-
void *target,
330-
uint64_t *prev,
331-
uint64_t cond,
332-
uint64_t value,
333-
size_t size,
334-
int pe)
327+
static int mca_atomic_ucx_cswap_nb(shmem_ctx_t ctx,
328+
void *fetch,
329+
void *target,
330+
uint64_t *prev,
331+
uint64_t cond,
332+
uint64_t value,
333+
size_t size,
334+
int pe)
335335
{
336336
return OSHMEM_ERR_NOT_IMPLEMENTED;
337337
}

oshmem/mca/spml/ucx/spml_ucx.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -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-
size_t mca_spml_ucx_test_any_vector(void *ivars, int cmp, void
1558+
int 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-
size_t mca_spml_ucx_test_some_vector(void *ivars, int cmp, void
1565+
int 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: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -244,9 +244,9 @@ 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 size_t mca_spml_ucx_test_any_vector(void *ivars, int cmp, void
247+
extern int mca_spml_ucx_test_any_vector(void *ivars, int cmp, void
248248
*cmp_values, size_t nelems, const int *status, int datatype);
249-
extern size_t mca_spml_ucx_test_some_vector(void *ivars, int cmp, void
249+
extern int 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);

0 commit comments

Comments
 (0)