Skip to content

Commit

Permalink
Merge pull request #9997 from karasevb/pml_ucx_warnings_fix
Browse files Browse the repository at this point in the history
UCX/PML/SPML/OSC: fix compiler warnings
  • Loading branch information
awlauria committed Feb 10, 2022
2 parents 8269a70 + 334c6ec commit 34685a2
Show file tree
Hide file tree
Showing 9 changed files with 42 additions and 39 deletions.
5 changes: 2 additions & 3 deletions ompi/mca/osc/ucx/osc_ucx_passive_target.c
Original file line number Diff line number Diff line change
Expand Up @@ -216,8 +216,7 @@ int ompi_osc_ucx_lock_all(int mpi_assert, struct ompi_win_t *win) {

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

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

if (module->flavor == MPI_WIN_FLAVOR_DYNAMIC) {
for (i = 0; i < module->state.dynamic_win_count; i++) {
for (uint64_t i = 0; i < module->state.dynamic_win_count; i++) {
ret = opal_common_ucx_wpmem_flush(module->local_dynamic_win_info[i].mem , OPAL_COMMON_UCX_SCOPE_WORKER, 0);
if (ret != OMPI_SUCCESS) {
return ret;
Expand Down
8 changes: 4 additions & 4 deletions ompi/mca/pml/ucx/pml_ucx.c
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,7 @@ int mca_pml_ucx_enable(bool enable)

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

if (MCA_PML_BASE_SEND_BUFFERED == mode) {
req->datatype = NULL;
req->datatype = (ucp_datatype_t)NULL;
} else {
req->datatype = mca_pml_ucx_get_datatype(datatype);
}
Expand Down Expand Up @@ -979,7 +979,7 @@ int mca_pml_ucx_iprobe(int src, int tag, struct ompi_communicator_t* comm,
mca_pml_ucx_set_recv_status_public(mpi_status, UCS_OK, &info);
} else {
(++progress_count % opal_common_ucx.progress_iterations) ?
(void)ucp_worker_progress(ompi_pml_ucx.ucp_worker) : opal_progress();
(int)ucp_worker_progress(ompi_pml_ucx.ucp_worker) : opal_progress();
*matched = 0;
}
return OMPI_SUCCESS;
Expand Down Expand Up @@ -1028,7 +1028,7 @@ int mca_pml_ucx_improbe(int src, int tag, struct ompi_communicator_t* comm,
mca_pml_ucx_set_recv_status_public(mpi_status, UCS_OK, &info);
} else {
(++progress_count % opal_common_ucx.progress_iterations) ?
(void)ucp_worker_progress(ompi_pml_ucx.ucp_worker) : opal_progress();
(int)ucp_worker_progress(ompi_pml_ucx.ucp_worker) : opal_progress();
*matched = 0;
}
return OMPI_SUCCESS;
Expand Down
2 changes: 2 additions & 0 deletions ompi/mca/pml/ucx/pml_ucx_component.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,9 @@ mca_pml_base_component_2_1_0_t mca_pml_ucx_component = {

static int mca_pml_ucx_component_register(void)
{
#if HAVE_DECL_UCP_OP_ATTR_FLAG_MULTI_SEND
int multi_send_op_attr_enable;
#endif

ompi_pml_ucx.priority = 51;
(void) mca_base_component_var_register(&mca_pml_ucx_component.pmlm_version, "priority",
Expand Down
3 changes: 1 addition & 2 deletions ompi/mca/pml/ucx/pml_ucx_request.h
Original file line number Diff line number Diff line change
Expand Up @@ -180,10 +180,9 @@ static inline int mca_pml_ucx_set_recv_status(ompi_status_public_t* mpi_status,
ucs_status_t ucp_status,
const ucp_tag_recv_info_t *info)
{
int64_t tag;
int64_t tag = info->sender_tag;

if (OPAL_LIKELY(ucp_status == UCS_OK)) {
tag = info->sender_tag;
mpi_status->MPI_ERROR = MPI_SUCCESS;
mpi_status->MPI_SOURCE = PML_UCX_TAG_GET_SOURCE(tag);
mpi_status->MPI_TAG = PML_UCX_TAG_GET_MPI_TAG(tag);
Expand Down
12 changes: 7 additions & 5 deletions opal/mca/btl/uct/btl_uct_component.c
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,11 @@ static int mca_btl_uct_component_open(void)
int core_count = 36;

(void) opal_hwloc_base_get_topology();
core_count = hwloc_get_nbobjs_by_type(opal_hwloc_topology, HWLOC_OBJ_CORE);
if (0 > (core_count = hwloc_get_nbobjs_by_type(opal_hwloc_topology, HWLOC_OBJ_CORE))) {
return OPAL_ERROR;
}

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

for (int i = 0; i < attr.md_resource_count; ++i) {
for (unsigned i = 0; i < attr.md_resource_count; ++i) {
rc = mca_btl_uct_component_process_uct_md(component, attr.md_resources + i, allowed_ifaces);
if (OPAL_SUCCESS != rc) {
break;
Expand Down Expand Up @@ -484,8 +486,6 @@ static mca_btl_base_module_t **mca_btl_uct_component_init(int *num_btl_modules,
/* for this BTL to be useful the interface needs to support RDMA and certain atomic operations
*/
struct mca_btl_base_module_t **base_modules;
uct_md_resource_desc_t *resources;
unsigned resource_count;
ucs_status_t ucs_status;
char **allowed_ifaces;
int rc;
Expand Down Expand Up @@ -527,6 +527,8 @@ static mca_btl_base_module_t **mca_btl_uct_component_init(int *num_btl_modules,
uct_release_component_list(components);

#else /* UCT 1.6 and older */
uct_md_resource_desc_t *resources;
unsigned resource_count;

uct_query_md_resources(&resources, &resource_count);

Expand Down
27 changes: 14 additions & 13 deletions opal/mca/common/ucx/common_ucx.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include "opal/mca/pmix/pmix-internal.h"
#include "opal/memoryhooks/memory.h"
#include "opal/util/argv.h"
#include "opal/util/printf.h"

#include <fnmatch.h>
#include <stdio.h>
Expand Down Expand Up @@ -203,21 +204,23 @@ static bool opal_common_ucx_check_device(const char *device_name, char **device_
{
char sysfs_driver_link[PATH_MAX];
char driver_path[PATH_MAX];
char *ib_device_name;
char ib_device_name[NAME_MAX];
char *driver_name;
char **list_item;
ssize_t ret;
char ib_device_name_fmt[NAME_MAX];

/* mlx5_0:1 */
ret = sscanf(device_name, "%m[^:]%*d", &ib_device_name);
opal_snprintf(ib_device_name_fmt, sizeof(ib_device_name_fmt),
"%%%u[^:]%%*d", NAME_MAX - 1);
ret = sscanf(device_name, ib_device_name_fmt, &ib_device_name);
if (ret != 1) {
return false;
}

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

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

/* "# resource 6 : md 5 dev 4 flags -- rc_verbs/mlx5_0:1" */
opal_snprintf(rsc_name_fmt, sizeof(rsc_name_fmt),
"# resource %%*d : md %%*d dev %%*d flags -- %%%u[^/ \n\r]/%%%u[^/ \n\r]",
NAME_MAX - 1, NAME_MAX - 1);

/* Rewind and read transports/devices list from the stream */
fseek(stream, 0, SEEK_SET);
while ((support_level != OPAL_COMMON_UCX_SUPPORT_DEVICE)
&& (fgets(line, sizeof(line), stream) != NULL)) {
rsc_tl_name = NULL;
ret = sscanf(line,
/* "# resource 6 : md 5 dev 4 flags -- rc_verbs/mlx5_0:1" */
"# resource %*d : md %*d dev %*d flags -- %m[^/ \n\r]/%m[^/ \n\r]",
&rsc_tl_name, &rsc_device_name);
ret = sscanf(line, rsc_name_fmt, rsc_tl_name, rsc_device_name);
if (ret != 2) {
free(rsc_tl_name);
continue;
}

Expand All @@ -334,9 +338,6 @@ OPAL_DECLSPEC opal_common_ucx_support_level_t opal_common_ucx_support_level(ucp_
MCA_COMMON_UCX_VERBOSE(2, "%s/%s: did not match transport list", rsc_tl_name,
rsc_device_name);
}

free(rsc_device_name);
free(rsc_tl_name);
}

MCA_COMMON_UCX_VERBOSE(2, "support level is %s", support_level_names[support_level]);
Expand Down
16 changes: 8 additions & 8 deletions oshmem/mca/atomic/ucx/atomic_ucx_module.c
Original file line number Diff line number Diff line change
Expand Up @@ -324,14 +324,14 @@ static int mca_atomic_ucx_swap_nb(shmem_ctx_t ctx,
}


int mca_atomic_ucx_cswap_nb(shmem_ctx_t ctx,
void *fetch,
void *target,
uint64_t *prev,
uint64_t cond,
uint64_t value,
size_t size,
int pe)
static int mca_atomic_ucx_cswap_nb(shmem_ctx_t ctx,
void *fetch,
void *target,
uint64_t *prev,
uint64_t cond,
uint64_t value,
size_t size,
int pe)
{
return OSHMEM_ERR_NOT_IMPLEMENTED;
}
Expand Down
4 changes: 2 additions & 2 deletions oshmem/mca/spml/ucx/spml_ucx.c
Original file line number Diff line number Diff line change
Expand Up @@ -1555,14 +1555,14 @@ int mca_spml_ucx_test_all_vector(void *ivars, int cmp, void
}

/* This routine is not implemented */
size_t mca_spml_ucx_test_any_vector(void *ivars, int cmp, void
int mca_spml_ucx_test_any_vector(void *ivars, int cmp, void
*cmp_values, size_t nelems, const int *status, int datatype)
{
return OSHMEM_ERR_NOT_IMPLEMENTED;
}

/* This routine is not implemented */
size_t mca_spml_ucx_test_some_vector(void *ivars, int cmp, void
int mca_spml_ucx_test_some_vector(void *ivars, int cmp, void
*cmp_values, size_t nelems, size_t *indices, const int *status, int
datatype)
{
Expand Down
4 changes: 2 additions & 2 deletions oshmem/mca/spml/ucx/spml_ucx.h
Original file line number Diff line number Diff line change
Expand Up @@ -244,9 +244,9 @@ extern size_t mca_spml_ucx_test_some(void *ivars, int cmp, void *cmp_value,
size_t nelems, size_t *indices, const int *status, int datatype);
extern int mca_spml_ucx_test_all_vector(void *ivars, int cmp, void
*cmp_values, size_t nelems, const int *status, int datatype);
extern size_t mca_spml_ucx_test_any_vector(void *ivars, int cmp, void
extern int mca_spml_ucx_test_any_vector(void *ivars, int cmp, void
*cmp_values, size_t nelems, const int *status, int datatype);
extern size_t mca_spml_ucx_test_some_vector(void *ivars, int cmp, void
extern int mca_spml_ucx_test_some_vector(void *ivars, int cmp, void
*cmp_values, size_t nelems, size_t *indices, const int *status, int
datatype);
extern int mca_spml_ucx_team_sync(shmem_team_t team);
Expand Down

0 comments on commit 34685a2

Please sign in to comment.