Skip to content

Commit be5500e

Browse files
committed
fix compiler warnings
fix warnings -Wstrict-prototypes fix warnings due to incorrect declaration classes fix warnings due to c++11/17 standarts fix compiler warnings in GPU case fix build warnings with openMPI fix cleanning IMB without GPU
1 parent 4e9c441 commit be5500e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+161
-103
lines changed

ReadMe_IMB.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,8 @@ command-line parameters.
246246
-----------------------------------------
247247
Building Instructions for Linux* OS
248248
-----------------------------------------
249-
1) Set the CC variable to point to the appropriate compiler wrapper, mpiicc or mpicc.
249+
1) Set the CC and CXX variables to point to the appropriate compiler wrapper,
250+
mpiicx or mpicc for C, mpiicpx or mpicxx for C++.
250251
2) Run one or more Makefile commands below:
251252

252253
make clean - remove legacy binary object files and executable files

src_c/IMB_benchmark.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,9 @@ For more documentation than found here, see
4949

5050
#include "IMB_mem_info.h"
5151

52+
#define IMB_INPUT_NAME_LEN 32
53+
#define IMB_INPUT_ARG_LEN 72
54+
5255
/* Classification of benchmarks */
5356

5457
typedef enum {

src_c/IMB_chk_diff.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1310,13 +1310,13 @@ static long crc_32_tab[] = { /* CRC polynomial 0xedb88320 */
13101310

13111311

13121312

1313-
long IMB_compute_crc (register char* buf, register size_t size) {
1313+
long IMB_compute_crc (char* buf, size_t size) {
13141314
/*
13151315
13161316
In/out variables:
13171317
1318-
-buf (type register char*)
1319-
-size (type register int)
1318+
-buf (type char*)
1319+
-size (type int)
13201320
13211321
Return value (type long)
13221322

src_c/IMB_cuda.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@ For more documentation than found here, see
4343
#ifdef GPU_ENABLE
4444
#include "IMB_cuda.h"
4545

46+
static unsigned num_devices = 0;
47+
cudaStream_t cuda_stream;
48+
4649
int cuda_initialize(char *dll_name)
4750
{
4851
cuda_init_functable_dll(dll_name);
@@ -86,7 +89,7 @@ void *cuda_alloc(size_t size, char *where, MEM_ALLOC_TYPE mem_alloc_type)
8689
}
8790
default:
8891
{
89-
printf("Error: Unknown buf type\n");
92+
printf("ERROR: Unknown buf type\n");
9093
exit(1);
9194
}
9295
}
@@ -122,7 +125,6 @@ void cuda_ass_buf(void *buf, int rank, size_t pos1, size_t pos2, int value)
122125
if (pos2 <= pos1)
123126
return;
124127

125-
static const int asize = (int)sizeof(assign_type);
126128
char *tmp_buf = malloc(pos2 + 1 - pos1);
127129
cuda_memcpy(tmp_buf, buf + pos1, pos2 - pos1);
128130
IMB_ass_buf(tmp_buf, rank, pos1, pos2, value);
@@ -153,7 +155,7 @@ void cuda_free(void **B, MEM_ALLOC_TYPE mem_alloc_type)
153155
}
154156
default:
155157
{
156-
printf("Error: Unknown buf type\n");
158+
printf("ERROR: Unknown buf type\n");
157159
exit(1);
158160
}
159161
}

src_c/IMB_cuda.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,7 @@ For more documentation than found here, see
4949
#include "IMB_declare.h"
5050
#include "IMB_benchmark.h"
5151
#include "IMB_cuda_api.h"
52-
53-
static unsigned num_devices = 0;
52+
#include "IMB_prototypes.h"
5453

5554
#define CUDA_CHKERR_EXPL_FINALLY(f, fin, a) { cudaError_t _cuda_chkerr_err; \
5655
if ((_cuda_chkerr_err=(f), (fin), _cuda_chkerr_err) != cudaSuccess) { \
@@ -75,7 +74,7 @@ static unsigned num_devices = 0;
7574
}
7675
#define C_CHKERR(f) C_CHKERR_EXPL(f, goto f_err)
7776

78-
cudaStream_t cuda_stream;
77+
extern cudaStream_t cuda_stream;
7978

8079
int cuda_initialize(char *dll_name);
8180
void *cuda_alloc(size_t size, char *where, MEM_ALLOC_TYPE mem_alloc_type);

src_c/IMB_cuda_api.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ void cuda_init_functable_dll(const char *dll_name)
7272

7373
if (dl_error)
7474
{
75-
printf("%s\n", dl_error);
75+
fprintf(stderr, "%s\n", dl_error);
7676
exit(1);
7777
}
7878

@@ -86,13 +86,13 @@ void cuda_init_functable_dll(const char *dll_name)
8686

8787
if (dl_error)
8888
{
89-
printf("%s\n", dl_error);
89+
fprintf(stderr, "%s\n", dl_error);
9090
exit(1);
9191
}
9292

9393
if (sym_ptr[i] == NULL)
9494
{
95-
printf("Symbol %s is not available!\n", fn_names[i]);
95+
fprintf(stderr, "Symbol %s is not available!\n", fn_names[i]);
9696
exit(1);
9797
}
9898
}

src_c/IMB_cuda_api.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ For more documentation than found here, see
4646
#include "cuda_runtime_api.h"
4747
#include "driver_types.h"
4848
#include <dlfcn.h>
49+
#include <stdio.h>
50+
#include <stdlib.h>
4951

5052
/* *INDENT-OFF* */
5153
/* The current function names are from CUDA 12.0 */

src_c/IMB_gpu_common.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ For more documentation than found here, see
4343
#ifdef GPU_ENABLE
4444
#include "IMB_gpu_common.h"
4545

46+
gpu_backend IMB_gpu_backend;
47+
4648
void gpu_initialize()
4749
{
4850
char dll_name_cuda[] = "libcudart.so";

src_c/IMB_gpu_common.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ typedef struct gpu_backend {
6767
int (*IMB_gpu_memcpy) (void*, const void*, size_t);
6868
} gpu_backend;
6969

70-
gpu_backend IMB_gpu_backend;
70+
extern gpu_backend IMB_gpu_backend;
7171

7272
void gpu_initialize();
7373

src_c/IMB_init.c

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -459,7 +459,7 @@ int IMB_basic_input(struct comm_info* c_info, struct Bench** P_BList,
459459

460460
} else if (!strcmp((*argv)[iarg], "-iter_policy")) {
461461
int ierr;
462-
char iter_policy[32];
462+
char iter_policy[IMB_INPUT_NAME_LEN];
463463
if (iarg + 1 >= *argc) {
464464
fprintf(stderr, "Missing argument after \"iter_policy\"\n");
465465
ok = -1;
@@ -549,9 +549,9 @@ int IMB_basic_input(struct comm_info* c_info, struct Bench** P_BList,
549549
iarg_msg = iarg + 1;
550550

551551
if (t) {
552-
char inp_line[72];
552+
char inp_line[IMB_INPUT_ARG_LEN];
553553

554-
while (fgets(inp_line, 72, t)) {
554+
while (fgets(inp_line, IMB_INPUT_ARG_LEN, t)) {
555555
if (inp_line[0] != '#' && strlen(inp_line) > 1)
556556
n_lens++;
557557
}
@@ -574,17 +574,17 @@ int IMB_basic_input(struct comm_info* c_info, struct Bench** P_BList,
574574

575575

576576
if (t) {
577-
char inp_line[72], nam[32];
578-
while (fgets(inp_line, 72, t)) {
577+
char inp_line[IMB_INPUT_ARG_LEN], name[IMB_INPUT_NAME_LEN];
578+
while (fgets(inp_line, IMB_INPUT_ARG_LEN, t)) {
579579
if (inp_line[0] != '#' && strlen(inp_line) - 1) {
580-
sscanf(inp_line, "%32s", nam);
580+
sscanf(inp_line, "%31s[^\n]", name);
581581
if (n_cases >= 1000) {
582582
fprintf(unit, "Too many benchmark cases\n");
583583
fflush(stderr);
584584
ok = -1;
585585
break;
586586
}
587-
IMB_add_to_list_tail(nam, &Blist_head, &Blist_tail, &n_cases);
587+
IMB_add_to_list_tail(name, &Blist_head, &Blist_tail, &n_cases);
588588
}
589589
}
590590
fclose(t);
@@ -631,8 +631,8 @@ int IMB_basic_input(struct comm_info* c_info, struct Bench** P_BList,
631631
if ((min_log >= 0) &&
632632
(max_log > 0) &&
633633
(min_log < MAX_INT_LOG) &&
634-
(max_log<MAX_INT_LOG) &&
635-
(max_log>min_log)) {
634+
(max_log < MAX_INT_LOG) &&
635+
(max_log > min_log)) {
636636
c_info->min_msg_log = min_log;
637637
c_info->max_msg_log = max_log;
638638
} else {
@@ -819,14 +819,14 @@ int IMB_basic_input(struct comm_info* c_info, struct Bench** P_BList,
819819
c_info->n_lens = n_lens;
820820

821821
if (t && n_lens > 0) {
822-
char inp_line[72], S[72];
822+
char inp_line[IMB_INPUT_ARG_LEN], S[IMB_INPUT_ARG_LEN];
823823
int sz, isz;
824824

825825
IMB_i_alloc(int, c_info->msglen, n_lens, "Basic_Input");
826826

827827
isz = -1;
828828

829-
while (fgets(inp_line, 72, t)) {
829+
while (fgets(inp_line, IMB_INPUT_ARG_LEN, t)) {
830830
S[0] = '\0';
831831
if (inp_line[0] != '#' && strlen(inp_line) - 1) {
832832
int ierr;

0 commit comments

Comments
 (0)