Skip to content

Commit 8ddc997

Browse files
authored
Merge pull request open-mpi#12129 from jsquyres/pr/fix-compiler-warnings
Fix a bunch of compiler warnings
2 parents c97f4f0 + c64fb39 commit 8ddc997

30 files changed

+96
-95
lines changed

ompi/communicator/ft/comm_ft.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
* reserved.
77
*
88
* Copyright (c) 2021 Nanook Consulting. All rights reserved.
9+
* Copyright (c) 2023 Jeffrey M. Squyres. All rights reserved.
910
* $COPYRIGHT$
1011
*
1112
* Additional copyrights may follow
@@ -728,8 +729,6 @@ static int ompi_comm_ishrink_check_cid(ompi_comm_request_t *request) {
728729
}
729730

730731
static int ompi_comm_ishrink_check_activate(ompi_comm_request_t *request) {
731-
ompi_comm_ishrink_context_t *context =
732-
(ompi_comm_ishrink_context_t *)request->context;
733732
int rc;
734733
#if OPAL_ENABLE_DEBUG
735734
double stop;
@@ -740,6 +739,8 @@ static int ompi_comm_ishrink_check_activate(ompi_comm_request_t *request) {
740739
return rc;
741740
}
742741
#if OPAL_ENABLE_DEBUG
742+
ompi_comm_ishrink_context_t *context =
743+
(ompi_comm_ishrink_context_t *)request->context;
743744
stop = MPI_Wtime();
744745
OPAL_OUTPUT_VERBOSE((10, ompi_ftmpi_output_handle,
745746
"%s ompi: comm_ishrink: COLL SELECT: %g seconds\n",
@@ -780,10 +781,13 @@ bool ompi_comm_is_proc_active(ompi_communicator_t *comm, int peer_id, bool remot
780781

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

788792
/* Disable ANY_SOURCE */
789793
comm->any_source_enabled = false;

ompi/communicator/ft/comm_ft_detector.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
* Copyright (c) 2021 Triad National Security, LLC. All rights
77
* reserved.
88
*
9+
* Copyright (c) 2023 Jeffrey M. Squyres. All rights reserved.
910
* $COPYRIGHT$
1011
*
1112
* Additional copyrights may follow
@@ -579,7 +580,7 @@ static void fd_event_cb(int fd, short flags, void* pdetector)
579580
}
580581

581582
void* fd_progress(opal_object_t* obj) {
582-
int ret;
583+
int __opal_attribute_unused__ ret;
583584
MPI_Request req;
584585
if( OMPI_SUCCESS != ompi_comm_start_detector(&ompi_mpi_comm_world.comm)) {
585586
OPAL_THREAD_ADD_FETCH32(&fd_thread_active, -1);

ompi/mca/coll/adapt/coll_adapt_ireduce.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
* reserved.
55
* Copyright (c) 2020 Cisco Systems, Inc. All rights reserved.
66
* Copyright (c) 2022 IBM Corporation. All rights reserved
7+
* Copyright (c) 2023 Jeffrey M. Squyres. All rights reserved.
78
* $COPYRIGHT$
89
*
910
* Additional copyrights may follow
@@ -663,7 +664,6 @@ int ompi_coll_adapt_ireduce_generic(const void *sbuf, void *rbuf, int count,
663664
con->next_recv_segs[i] = min - 1;
664665
}
665666

666-
int num_recvs = 0;
667667
for (int32_t seg_index = 0; seg_index < min; seg_index++)
668668
{
669669
/* For each child */
@@ -711,8 +711,6 @@ int ompi_coll_adapt_ireduce_generic(const void *sbuf, void *rbuf, int count,
711711
}
712712
/* Set the recv callback */
713713
ompi_request_set_callback(recv_req, recv_cb, context);
714-
715-
++num_recvs;
716714
}
717715
}
718716
}

ompi/mca/coll/base/coll_base_reduce_scatter_block.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
* Copyright (c) 2018 Siberian State University of Telecommunications
1919
* and Information Sciences. All rights reserved.
2020
* Copyright (c) 2022 IBM Corporation. All rights reserved.
21+
* Copyright (c) 2023 Jeffrey M. Squyres. All rights reserved.
2122
* $COPYRIGHT$
2223
*
2324
* Additional copyrights may follow
@@ -245,7 +246,6 @@ ompi_coll_base_reduce_scatter_block_intra_recursivedoubling(
245246
int is_commutative = ompi_op_is_commute(op);
246247

247248
/* Recursive distance doubling */
248-
int rdoubling_step = 0;
249249
for (int mask = 1; mask < comm_size; mask <<= 1) {
250250
int remote = rank ^ mask;
251251
int cur_tree_root = ompi_rounddown(rank, mask);
@@ -350,7 +350,6 @@ ompi_coll_base_reduce_scatter_block_intra_recursivedoubling(
350350
if (MPI_SUCCESS != err) { goto cleanup_and_return; }
351351
}
352352
}
353-
rdoubling_step++;
354353
err = ompi_datatype_destroy(&dtypesend);
355354
if (MPI_SUCCESS != err) { goto cleanup_and_return; }
356355
err = ompi_datatype_destroy(&dtyperecv);

ompi/mca/coll/base/coll_base_util.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
* All rights reserved.
1212
* Copyright (c) 2014-2020 Research Organization for Information Science
1313
* and Technology (RIST). All rights reserved.
14+
* Copyright (c) 2023 Jeffrey M. Squyres. All rights reserved.
1415
* $COPYRIGHT$
1516
*
1617
* Additional copyrights may follow
@@ -398,7 +399,7 @@ int ompi_coll_base_file_getnext_long(FILE *fptr, int *fileline, long* val)
398399

399400
int ompi_coll_base_file_getnext_string(FILE *fptr, int *fileline, char** val)
400401
{
401-
char trash, token[32];
402+
char trash, token[33];
402403
int rc;
403404

404405
*val = NULL; /* security in case we fail */

ompi/mca/coll/inter/coll_inter_allreduce.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
* Copyright (c) 2013 Cisco Systems, Inc. All rights reserved.
1414
* Copyright (c) 2015-2017 Research Organization for Information Science
1515
* and Technology (RIST). All rights reserved.
16+
* Copyright (c) 2023 Jeffrey M. Squyres. All rights reserved.
1617
* $COPYRIGHT$
1718
*
1819
* Additional copyrights may follow
@@ -48,7 +49,8 @@ mca_coll_inter_allreduce_inter(const void *sbuf, void *rbuf, int count,
4849
mca_coll_base_module_t *module)
4950
{
5051
int err, rank, root = 0;
51-
char *tmpbuf = NULL, *pml_buffer = NULL, *source;
52+
char *tmpbuf = NULL, *pml_buffer = NULL;
53+
const char *source;
5254
ptrdiff_t gap, span;
5355

5456
rank = ompi_comm_rank(comm);

ompi/mca/coll/libnbc/libdict/dict.c

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -17,34 +17,6 @@ dict_malloc_func ompi_coll_libnbc_dict_malloc = malloc;
1717
dict_free_func ompi_coll_libnbc_dict_free = free;
1818

1919

20-
static inline dict_malloc_func
21-
dict_set_malloc(dict_malloc_func func)
22-
{
23-
dict_malloc_func old = ompi_coll_libnbc_dict_malloc;
24-
ompi_coll_libnbc_dict_malloc = func ? func : malloc;
25-
return old;
26-
}
27-
28-
static inline dict_free_func
29-
dict_set_free(dict_free_func func)
30-
{
31-
dict_free_func old = ompi_coll_libnbc_dict_free;
32-
ompi_coll_libnbc_dict_free = func ? func : free;
33-
return old;
34-
}
35-
36-
/*
37-
* In comparing, we cannot simply subtract because that might result in signed
38-
* overflow.
39-
*/
40-
static inline int
41-
dict_int_cmp(const void *k1, const void *k2)
42-
{
43-
const int *a = (int*)k1, *b = (int*)k2;
44-
45-
return (*a < *b) ? -1 : (*a > *b) ? +1 : 0;
46-
}
47-
4820
int
4921
ompi_coll_libnbc_dict_uint_cmp(const void *k1, const void *k2)
5022
{

ompi/mca/coll/tuned/coll_tuned_dynamic_file.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
* All rights reserved.
1212
* Copyright (c) 2015 Research Organization for Information Science
1313
* and Technology (RIST). All rights reserved.
14+
* Copyright (c) 2023 Jeffrey M. Squyres. All rights reserved.
1415
* $COPYRIGHT$
1516
*
1617
* Additional copyrights may follow
@@ -69,8 +70,10 @@ int ompi_coll_tuned_read_rules_config_file (char *fname, ompi_coll_alg_rule_t**
6970

7071
/* stats info */
7172
int total_alg_count = 0;
73+
#if OPAL_ENABLE_DEBUG
7274
int total_com_count = 0;
7375
int total_msg_count = 0;
76+
#endif
7477

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

209+
#if OPAL_ENABLE_DEBUG
206210
total_msg_count++;
211+
#endif
207212

208213
} /* msg size */
209214

215+
#if OPAL_ENABLE_DEBUG
210216
total_com_count++;
217+
#endif
211218

212219
} /* comm size */
213220

ompi/mca/common/ompio/common_ompio_aggregators.c

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
* Copyright (c) 2015-2018 Research Organization for Information Science
1717
* and Technology (RIST). All rights reserved.
1818
* Copyright (c) 2017 IBM Corporation. All rights reserved.
19+
* Copyright (c) 2023 Jeffrey M. Squyres. All rights reserved.
1920
* $COPYRIGHT$
2021
*
2122
* Additional copyrights may follow
@@ -195,16 +196,13 @@ int mca_common_ompio_forced_grouping ( ompio_file_t *fh,
195196
int rest = fh->f_size % num_groups;
196197
int flag = OMPI_COMM_IS_MAPBY_NODE (&ompi_mpi_comm_world.comm);
197198
int k=0, p=0, g=0;
198-
int total_procs = 0;
199199

200200
for ( k=0, p=0; p<num_groups; p++ ) {
201201
if ( p < rest ) {
202202
contg_groups[p].procs_per_contg_group = group_size+1;
203-
total_procs +=(group_size+1);
204203
}
205204
else {
206205
contg_groups[p].procs_per_contg_group = group_size;
207-
total_procs +=group_size;
208206
}
209207

210208
if ( flag ) {
@@ -1269,9 +1267,6 @@ int mca_common_ompio_prepare_to_group(ompio_file_t *fh,
12691267
int i = 0;
12701268
int j = 0;
12711269
int k = 0;
1272-
int merge_count = 0;
1273-
int split_count = 0; //not req?
1274-
int retain_as_is_count = 0; //not req?
12751270
int ret=OMPI_SUCCESS;
12761271

12771272
//Store start offset and length in an array //also add bytes per process
@@ -1367,16 +1362,13 @@ int mca_common_ompio_prepare_to_group(ompio_file_t *fh,
13671362
if((size_t)(aggr_bytes_per_group_tmp[i])>
13681363
(size_t)OMPIO_MCA_GET(fh, bytes_per_agg)){
13691364
decision_list_tmp[i] = OMPIO_SPLIT;
1370-
split_count++;
13711365
}
13721366
else if((size_t)(aggr_bytes_per_group_tmp[i])<
13731367
(size_t)OMPIO_MCA_GET(fh, bytes_per_agg)){
13741368
decision_list_tmp[i] = OMPIO_MERGE;
1375-
merge_count++;
13761369
}
13771370
else{
13781371
decision_list_tmp[i] = OMPIO_RETAIN;
1379-
retain_as_is_count++;
13801372
}
13811373
}
13821374

ompi/mca/common/ompio/common_ompio_file_read_all.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
* Copyright (c) 2008-2022 University of Houston. All rights reserved.
1313
* Copyright (c) 2017-2018 Research Organization for Information Science
1414
* and Technology (RIST). All rights reserved.
15+
* Copyright (c) 2023 Jeffrey M. Squyres. All rights reserved.
1516
* $COPYRIGHT$
1617
*
1718
* Additional copyrights may follow
@@ -85,7 +86,6 @@ mca_common_ompio_base_file_read_all (struct ompio_file_t *fh,
8586
int **blocklen_per_process=NULL;
8687
MPI_Aint **displs_per_process=NULL;
8788
char *global_buf = NULL;
88-
MPI_Aint global_count = 0;
8989
mca_io_ompio_local_io_array *file_offsets_for_agg=NULL;
9090

9191
/* array that contains the sorted indices of the global_iov */
@@ -607,13 +607,11 @@ mca_common_ompio_base_file_read_all (struct ompio_file_t *fh,
607607
}
608608
/*Moving file offsets to an IO array!*/
609609
temp_index = 0;
610-
global_count = 0;
611610
for (i=0;i<fh->f_procs_per_group; i++){
612611
for(j=0;j<disp_index[i];j++){
613612
if (blocklen_per_process[i][j] > 0){
614613
file_offsets_for_agg[temp_index].length =
615614
blocklen_per_process[i][j];
616-
global_count += blocklen_per_process[i][j];
617615
file_offsets_for_agg[temp_index].process_id = i;
618616
file_offsets_for_agg[temp_index].offset =
619617
displs_per_process[i][j];

ompi/mca/fbtl/posix/fbtl_posix_preadv.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
* Copyright (c) 2008-2021 University of Houston. All rights reserved.
1313
* Copyright (c) 2015-2018 Research Organization for Information Science
1414
* and Technology (RIST). All rights reserved.
15+
* Copyright (c) 2023 Jeffrey M. Squyres. All rights reserved.
1516
* $COPYRIGHT$
1617
*
1718
* Additional copyrights may follow
@@ -221,11 +222,11 @@ ssize_t mca_fbtl_posix_preadv_datasieving (ompio_file_t *fh, struct flock *lock,
221222
size_t start_offset = (size_t) fh->f_io_array[startindex].offset;
222223
for ( i = startindex ; i < endindex ; i++) {
223224
pos = (size_t) fh->f_io_array[i].offset - start_offset;
224-
if ( (ssize_t) pos > total_bytes ) {
225+
if ( pos > total_bytes ) {
225226
break;
226227
}
227228
num_bytes = fh->f_io_array[i].length;
228-
if ( ((ssize_t) pos + (ssize_t)num_bytes) > total_bytes ) {
229+
if ( (pos + (size_t)num_bytes) > total_bytes ) {
229230
num_bytes = total_bytes - (ssize_t)pos;
230231
}
231232

ompi/mca/fcoll/dynamic/fcoll_dynamic_file_write_all.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
* Copyright (c) 2015-2018 Research Organization for Information Science
1414
* and Technology (RIST). All rights reserved.
1515
* Copyright (c) 2017 IBM Corporation. All rights reserved.
16+
* Copyright (c) 2023 Jeffrey M. Squyres. All rights reserved.
1617
* $COPYRIGHT$
1718
*
1819
* Additional copyrights may follow
@@ -86,8 +87,9 @@ mca_fcoll_dynamic_file_write_all (struct ompio_file_t *fh,
8687
int current_index = 0, temp_index=0;
8788

8889
char *global_buf = NULL;
90+
#if DEBUG_ON
8991
MPI_Aint global_count = 0;
90-
92+
#endif
9193

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

715717
/*Now update the displacements array with memory offsets*/
718+
#if DEBUG_ON
716719
global_count = 0;
720+
#endif
717721
for (i=0;i<entries_per_aggregator;i++){
718722
temp_pindex =
719723
file_offsets_for_agg[sorted_file_offsets[i]].process_id;
@@ -726,8 +730,10 @@ mca_fcoll_dynamic_file_write_all (struct ompio_file_t *fh,
726730
temp_pindex, temp_disp_index[temp_pindex],
727731
temp_pindex, disp_index[temp_pindex]);
728732
}
733+
#if DEBUG_ON
729734
global_count +=
730735
file_offsets_for_agg[sorted_file_offsets[i]].length;
736+
#endif
731737
}
732738

733739
if (NULL != temp_disp_index){

ompi/mca/fcoll/dynamic_gen2/fcoll_dynamic_gen2_file_write_all.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
* and Technology (RIST). All rights reserved.
1515
* Copyright (c) 2017 IBM Corporation. All rights reserved.
1616
* Copyright (c) 2018 Cisco Systems, Inc. All rights reserved
17+
* Copyright (c) 2023 Jeffrey M. Squyres. All rights reserved.
1718
* $COPYRIGHT$
1819
*
1920
* Additional copyrights may follow
@@ -788,7 +789,9 @@ static int shuffle_init ( int index, int cycles, int aggregator, int rank, mca_i
788789
int temp_index=0;
789790
MPI_Aint *memory_displacements=NULL;
790791
int *temp_disp_index=NULL;
792+
#if DEBUG_ON
791793
MPI_Aint global_count = 0;
794+
#endif
792795
int* blocklength_proc=NULL;
793796
ptrdiff_t* displs_proc=NULL;
794797

@@ -1085,7 +1088,9 @@ static int shuffle_init ( int index, int cycles, int aggregator, int rank, mca_i
10851088
}
10861089

10871090
/*Now update the displacements array with memory offsets*/
1091+
#if DEBUG_ON
10881092
global_count = 0;
1093+
#endif
10891094
for (i=0;i<entries_per_aggregator;i++){
10901095
temp_pindex =
10911096
file_offsets_for_agg[sorted_file_offsets[i]].process_id;
@@ -1098,8 +1103,10 @@ static int shuffle_init ( int index, int cycles, int aggregator, int rank, mca_i
10981103
temp_pindex, temp_disp_index[temp_pindex],
10991104
temp_pindex, data->disp_index[temp_pindex]);
11001105
}
1106+
#if DEBUG_ON
11011107
global_count +=
11021108
file_offsets_for_agg[sorted_file_offsets[i]].length;
1109+
#endif
11031110
}
11041111

11051112
if (NULL != temp_disp_index){

0 commit comments

Comments
 (0)