Skip to content

Commit 4ac185c

Browse files
committed
Silcene spurious compiler warnings.
1 parent 54c196b commit 4ac185c

2 files changed

Lines changed: 14 additions & 9 deletions

File tree

src/gpuarray_buffer_opencl.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ static int cl_get_device_count(unsigned int platform, unsigned int* devcount) {
5858
cl_platform_id p;
5959
cl_uint numd;
6060
cl_int err;
61-
unsigned int platcount;
61+
unsigned int platcount = 0;
6262

6363
/* This will load the library if needed */
6464
GA_CHECK(cl_get_platform_count(&platcount));

src/gpuarray_collectives_cuda_nccl.c

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -236,8 +236,9 @@ static inline int check_restrictions(gpudata *src, size_t offsrc,
236236
static int reduce(gpudata *src, size_t offsrc, gpudata *dest, size_t offdest,
237237
size_t count, int typecode, int opcode, int root,
238238
gpucomm *comm) {
239-
ncclRedOp_t op;
240-
ncclDataType_t datatype;
239+
// need dummy init so that compiler shuts up
240+
ncclRedOp_t op = nccl_NUM_OPS;
241+
ncclDataType_t datatype = nccl_NUM_TYPES;
241242
gpudata *dst = NULL;
242243
int rank = 0;
243244
cuda_context *ctx;
@@ -285,8 +286,9 @@ static int reduce(gpudata *src, size_t offsrc, gpudata *dest, size_t offdest,
285286
static int all_reduce(gpudata *src, size_t offsrc, gpudata *dest,
286287
size_t offdest, size_t count, int typecode, int opcode,
287288
gpucomm *comm) {
288-
ncclRedOp_t op;
289-
ncclDataType_t datatype;
289+
// need dummy init so that compiler shuts up
290+
ncclRedOp_t op = nccl_NUM_OPS;
291+
ncclDataType_t datatype = nccl_NUM_TYPES;
290292
cuda_context *ctx;
291293

292294
ASSERT_BUF(src);
@@ -322,8 +324,9 @@ static int all_reduce(gpudata *src, size_t offsrc, gpudata *dest,
322324
static int reduce_scatter(gpudata *src, size_t offsrc, gpudata *dest,
323325
size_t offdest, size_t count, int typecode,
324326
int opcode, gpucomm *comm) {
325-
ncclRedOp_t op;
326-
ncclDataType_t datatype;
327+
// need dummy init so that compiler shuts up
328+
ncclRedOp_t op = nccl_NUM_OPS;
329+
ncclDataType_t datatype = nccl_NUM_TYPES;
327330
int ndev = 0;
328331
size_t resc_size;
329332
cuda_context *ctx;
@@ -367,7 +370,8 @@ static int reduce_scatter(gpudata *src, size_t offsrc, gpudata *dest,
367370
*/
368371
static int broadcast(gpudata *array, size_t offset, size_t count, int typecode,
369372
int root, gpucomm *comm) {
370-
ncclDataType_t datatype;
373+
// need dummy init so that compiler shuts up
374+
ncclDataType_t datatype = nccl_NUM_TYPES;
371375
int rank = 0;
372376
cuda_context *ctx;
373377

@@ -406,7 +410,8 @@ static int broadcast(gpudata *array, size_t offset, size_t count, int typecode,
406410
static int all_gather(gpudata *src, size_t offsrc, gpudata *dest,
407411
size_t offdest, size_t count, int typecode,
408412
gpucomm *comm) {
409-
ncclDataType_t datatype;
413+
// need dummy init so that compiler shuts up
414+
ncclDataType_t datatype = nccl_NUM_TYPES;
410415
int ndev = 0;
411416
size_t resc_size;
412417
cuda_context *ctx;

0 commit comments

Comments
 (0)