Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v5.0.x: Fix a bunch of compiler warnings #12133

Merged
merged 10 commits into from
Nov 28, 2023
6 changes: 5 additions & 1 deletion ompi/communicator/ft/comm_ft.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
* reserved.
*
* Copyright (c) 2021 Nanook Consulting. All rights reserved.
* Copyright (c) 2023 Jeffrey M. Squyres. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
Expand Down Expand Up @@ -441,10 +442,13 @@ bool ompi_comm_is_proc_active(ompi_communicator_t *comm, int peer_id, bool remot

int ompi_comm_set_rank_failed(ompi_communicator_t *comm, int peer_id, bool remote)
{
/* populate the proc in the comm's group array so that it is not a sentinel and can be read as failed */
#if OPAL_ENABLE_DEBUG
/* populate the proc in the comm's group array so that it is not a
sentinel and can be read as failed */
ompi_proc_t *ompi_proc = ompi_group_get_proc_ptr((remote ? comm->c_remote_group : comm->c_local_group),
peer_id, true);
assert(NULL != ompi_proc);
#endif

/* Disable ANY_SOURCE */
comm->any_source_enabled = false;
Expand Down
3 changes: 2 additions & 1 deletion ompi/communicator/ft/comm_ft_detector.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
* Copyright (c) 2021 Triad National Security, LLC. All rights
* reserved.
*
* Copyright (c) 2023 Jeffrey M. Squyres. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
Expand Down Expand Up @@ -579,7 +580,7 @@ static void fd_event_cb(int fd, short flags, void* pdetector)
}

void* fd_progress(opal_object_t* obj) {
int ret;
int __opal_attribute_unused__ ret;
MPI_Request req;
if( OMPI_SUCCESS != ompi_comm_start_detector(&ompi_mpi_comm_world.comm)) {
OPAL_THREAD_ADD_FETCH32(&fd_thread_active, -1);
Expand Down
4 changes: 1 addition & 3 deletions ompi/mca/coll/adapt/coll_adapt_ireduce.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
* reserved.
* Copyright (c) 2020 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2022 IBM Corporation. All rights reserved
* Copyright (c) 2023 Jeffrey M. Squyres. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
Expand Down Expand Up @@ -663,7 +664,6 @@ int ompi_coll_adapt_ireduce_generic(const void *sbuf, void *rbuf, int count,
con->next_recv_segs[i] = min - 1;
}

int num_recvs = 0;
for (int32_t seg_index = 0; seg_index < min; seg_index++)
{
/* For each child */
Expand Down Expand Up @@ -711,8 +711,6 @@ int ompi_coll_adapt_ireduce_generic(const void *sbuf, void *rbuf, int count,
}
/* Set the recv callback */
ompi_request_set_callback(recv_req, recv_cb, context);

++num_recvs;
}
}
}
Expand Down
3 changes: 1 addition & 2 deletions ompi/mca/coll/base/coll_base_reduce_scatter_block.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
* Copyright (c) 2018 Siberian State University of Telecommunications
* and Information Sciences. All rights reserved.
* Copyright (c) 2022 IBM Corporation. All rights reserved.
* Copyright (c) 2023 Jeffrey M. Squyres. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
Expand Down Expand Up @@ -245,7 +246,6 @@ ompi_coll_base_reduce_scatter_block_intra_recursivedoubling(
int is_commutative = ompi_op_is_commute(op);

/* Recursive distance doubling */
int rdoubling_step = 0;
for (int mask = 1; mask < comm_size; mask <<= 1) {
int remote = rank ^ mask;
int cur_tree_root = ompi_rounddown(rank, mask);
Expand Down Expand Up @@ -350,7 +350,6 @@ ompi_coll_base_reduce_scatter_block_intra_recursivedoubling(
if (MPI_SUCCESS != err) { goto cleanup_and_return; }
}
}
rdoubling_step++;
err = ompi_datatype_destroy(&dtypesend);
if (MPI_SUCCESS != err) { goto cleanup_and_return; }
err = ompi_datatype_destroy(&dtyperecv);
Expand Down
3 changes: 2 additions & 1 deletion ompi/mca/coll/base/coll_base_util.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
* All rights reserved.
* Copyright (c) 2014-2020 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* Copyright (c) 2023 Jeffrey M. Squyres. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
Expand Down Expand Up @@ -398,7 +399,7 @@ int ompi_coll_base_file_getnext_long(FILE *fptr, int *fileline, long* val)

int ompi_coll_base_file_getnext_string(FILE *fptr, int *fileline, char** val)
{
char trash, token[32];
char trash, token[33];
int rc;

*val = NULL; /* security in case we fail */
Expand Down
4 changes: 3 additions & 1 deletion ompi/mca/coll/inter/coll_inter_allreduce.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
* Copyright (c) 2013 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2015-2017 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* Copyright (c) 2023 Jeffrey M. Squyres. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
Expand Down Expand Up @@ -48,7 +49,8 @@ mca_coll_inter_allreduce_inter(const void *sbuf, void *rbuf, int count,
mca_coll_base_module_t *module)
{
int err, rank, root = 0;
char *tmpbuf = NULL, *pml_buffer = NULL, *source;
char *tmpbuf = NULL, *pml_buffer = NULL;
const char *source;
ptrdiff_t gap, span;

rank = ompi_comm_rank(comm);
Expand Down
28 changes: 0 additions & 28 deletions ompi/mca/coll/libnbc/libdict/dict.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,34 +16,6 @@
dict_malloc_func ompi_coll_libnbc_dict_malloc = malloc;
dict_free_func ompi_coll_libnbc_dict_free = free;

static inline dict_malloc_func
dict_set_malloc(dict_malloc_func func)
{
dict_malloc_func old = ompi_coll_libnbc_dict_malloc;
ompi_coll_libnbc_dict_malloc = func ? func : malloc;
return old;
}

static inline dict_free_func
dict_set_free(dict_free_func func)
{
dict_free_func old = ompi_coll_libnbc_dict_free;
ompi_coll_libnbc_dict_free = func ? func : free;
return old;
}

/*
* In comparing, we cannot simply subtract because that might result in signed
* overflow.
*/
static inline int
dict_int_cmp(const void *k1, const void *k2)
{
const int *a = (int*)k1, *b = (int*)k2;

return (*a < *b) ? -1 : (*a > *b) ? +1 : 0;
}

int
ompi_coll_libnbc_dict_uint_cmp(const void *k1, const void *k2)
{
Expand Down
24 changes: 0 additions & 24 deletions ompi/mca/coll/libnbc/libdict/hb_tree.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,30 +53,6 @@ static hb_node *node_max __P((hb_node *node));
static hb_node *node_next __P((hb_node *node));
static hb_node *node_prev __P((hb_node *node));

static dict *hb_dict_new __P((dict_cmp_func key_cmp, dict_del_func key_del,
dict_del_func dat_del));
static dict_itor *hb_dict_itor_new __P((hb_tree *tree));
static void hb_itor_invalidate __P((hb_itor *itor));
static int hb_itor_first __P((hb_itor *itor));
static void *hb_itor_data __P((hb_itor *itor));
static const void *hb_itor_cdata __P((const hb_itor *itor));
static int hb_itor_last __P((hb_itor *itor));
static int hb_itor_nextn __P((hb_itor *itor, unsigned count));
static int hb_itor_prev __P((hb_itor *itor));
static int hb_itor_prevn __P((hb_itor *itor, unsigned count));
static int hb_itor_search __P((hb_itor *itor, const void *key));
static int hb_itor_set_data __P((hb_itor *itor, void *dat, int del));
static unsigned hb_tree_count __P((const hb_tree *tree));
static void hb_tree_destroy __P((hb_tree *tree, int del));
static void hb_tree_empty __P((hb_tree *tree, int del));
static unsigned hb_tree_height __P((const hb_tree *tree));
static const void *hb_tree_max __P((const hb_tree *tree));
static unsigned hb_tree_mheight __P((const hb_tree *tree));
static const void *hb_tree_min __P((const hb_tree *tree));
static unsigned hb_tree_pathlen __P((const hb_tree *tree));
static int hb_tree_probe __P((hb_tree *tree, void *key, void **dat));
static void hb_tree_walk __P((hb_tree *tree, dict_vis_func visit));

hb_tree *
ompi_coll_libnbc_hb_tree_new(dict_cmp_func key_cmp, dict_del_func key_del,
dict_del_func dat_del)
Expand Down
7 changes: 7 additions & 0 deletions ompi/mca/coll/tuned/coll_tuned_dynamic_file.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
* All rights reserved.
* Copyright (c) 2015 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* Copyright (c) 2023 Jeffrey M. Squyres. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
Expand Down Expand Up @@ -69,8 +70,10 @@ int ompi_coll_tuned_read_rules_config_file (char *fname, ompi_coll_alg_rule_t**

/* stats info */
int total_alg_count = 0;
#if OPAL_ENABLE_DEBUG
int total_com_count = 0;
int total_msg_count = 0;
#endif

if (!fname) {
OPAL_OUTPUT((ompi_coll_tuned_stream,"Gave NULL as rule table configuration file for tuned collectives... ignoring!\n"));
Expand Down Expand Up @@ -203,11 +206,15 @@ int ompi_coll_tuned_read_rules_config_file (char *fname, ompi_coll_alg_rule_t**
goto on_file_error;
}

#if OPAL_ENABLE_DEBUG
total_msg_count++;
#endif

} /* msg size */

#if OPAL_ENABLE_DEBUG
total_com_count++;
#endif

} /* comm size */

Expand Down
10 changes: 1 addition & 9 deletions ompi/mca/common/ompio/common_ompio_aggregators.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
* Copyright (c) 2015-2018 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* Copyright (c) 2017 IBM Corporation. All rights reserved.
* Copyright (c) 2023 Jeffrey M. Squyres. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
Expand Down Expand Up @@ -195,16 +196,13 @@ int mca_common_ompio_forced_grouping ( ompio_file_t *fh,
int rest = fh->f_size % num_groups;
int flag = OMPI_COMM_IS_MAPBY_NODE (&ompi_mpi_comm_world.comm);
int k=0, p=0, g=0;
int total_procs = 0;

for ( k=0, p=0; p<num_groups; p++ ) {
if ( p < rest ) {
contg_groups[p].procs_per_contg_group = group_size+1;
total_procs +=(group_size+1);
}
else {
contg_groups[p].procs_per_contg_group = group_size;
total_procs +=group_size;
}

if ( flag ) {
Expand Down Expand Up @@ -1269,9 +1267,6 @@ int mca_common_ompio_prepare_to_group(ompio_file_t *fh,
int i = 0;
int j = 0;
int k = 0;
int merge_count = 0;
int split_count = 0; //not req?
int retain_as_is_count = 0; //not req?
int ret=OMPI_SUCCESS;

//Store start offset and length in an array //also add bytes per process
Expand Down Expand Up @@ -1367,16 +1362,13 @@ int mca_common_ompio_prepare_to_group(ompio_file_t *fh,
if((size_t)(aggr_bytes_per_group_tmp[i])>
(size_t)OMPIO_MCA_GET(fh, bytes_per_agg)){
decision_list_tmp[i] = OMPIO_SPLIT;
split_count++;
}
else if((size_t)(aggr_bytes_per_group_tmp[i])<
(size_t)OMPIO_MCA_GET(fh, bytes_per_agg)){
decision_list_tmp[i] = OMPIO_MERGE;
merge_count++;
}
else{
decision_list_tmp[i] = OMPIO_RETAIN;
retain_as_is_count++;
}
}

Expand Down
4 changes: 1 addition & 3 deletions ompi/mca/common/ompio/common_ompio_file_read_all.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
* Copyright (c) 2008-2022 University of Houston. All rights reserved.
* Copyright (c) 2017-2018 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* Copyright (c) 2023 Jeffrey M. Squyres. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
Expand Down Expand Up @@ -85,7 +86,6 @@ mca_common_ompio_base_file_read_all (struct ompio_file_t *fh,
int **blocklen_per_process=NULL;
MPI_Aint **displs_per_process=NULL;
char *global_buf = NULL;
MPI_Aint global_count = 0;
mca_io_ompio_local_io_array *file_offsets_for_agg=NULL;

/* array that contains the sorted indices of the global_iov */
Expand Down Expand Up @@ -607,13 +607,11 @@ mca_common_ompio_base_file_read_all (struct ompio_file_t *fh,
}
/*Moving file offsets to an IO array!*/
temp_index = 0;
global_count = 0;
for (i=0;i<fh->f_procs_per_group; i++){
for(j=0;j<disp_index[i];j++){
if (blocklen_per_process[i][j] > 0){
file_offsets_for_agg[temp_index].length =
blocklen_per_process[i][j];
global_count += blocklen_per_process[i][j];
file_offsets_for_agg[temp_index].process_id = i;
file_offsets_for_agg[temp_index].offset =
displs_per_process[i][j];
Expand Down
5 changes: 3 additions & 2 deletions ompi/mca/fbtl/posix/fbtl_posix_preadv.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
* Copyright (c) 2008-2021 University of Houston. All rights reserved.
* Copyright (c) 2015-2018 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* Copyright (c) 2023 Jeffrey M. Squyres. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
Expand Down Expand Up @@ -221,11 +222,11 @@ ssize_t mca_fbtl_posix_preadv_datasieving (ompio_file_t *fh, struct flock *lock,
size_t start_offset = (size_t) fh->f_io_array[startindex].offset;
for ( i = startindex ; i < endindex ; i++) {
pos = (size_t) fh->f_io_array[i].offset - start_offset;
if ( (ssize_t) pos > total_bytes ) {
if ( pos > total_bytes ) {
break;
}
num_bytes = fh->f_io_array[i].length;
if ( ((ssize_t) pos + (ssize_t)num_bytes) > total_bytes ) {
if ( (pos + (size_t)num_bytes) > total_bytes ) {
num_bytes = total_bytes - (ssize_t)pos;
}

Expand Down
8 changes: 7 additions & 1 deletion ompi/mca/fcoll/dynamic/fcoll_dynamic_file_write_all.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
* Copyright (c) 2015-2018 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* Copyright (c) 2017 IBM Corporation. All rights reserved.
* Copyright (c) 2023 Jeffrey M. Squyres. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
Expand Down Expand Up @@ -86,8 +87,9 @@ mca_fcoll_dynamic_file_write_all (struct ompio_file_t *fh,
int current_index = 0, temp_index=0;

char *global_buf = NULL;
#if DEBUG_ON
MPI_Aint global_count = 0;

#endif

/* array that contains the sorted indices of the global_iov */
int *sorted = NULL, *sorted_file_offsets=NULL;
Expand Down Expand Up @@ -713,7 +715,9 @@ mca_fcoll_dynamic_file_write_all (struct ompio_file_t *fh,
}

/*Now update the displacements array with memory offsets*/
#if DEBUG_ON
global_count = 0;
#endif
for (i=0;i<entries_per_aggregator;i++){
temp_pindex =
file_offsets_for_agg[sorted_file_offsets[i]].process_id;
Expand All @@ -726,8 +730,10 @@ mca_fcoll_dynamic_file_write_all (struct ompio_file_t *fh,
temp_pindex, temp_disp_index[temp_pindex],
temp_pindex, disp_index[temp_pindex]);
}
#if DEBUG_ON
global_count +=
file_offsets_for_agg[sorted_file_offsets[i]].length;
#endif
}

if (NULL != temp_disp_index){
Expand Down
Loading