Skip to content

Commit 3b3f03d

Browse files
committed
accelerator/cuda: fix typos
Fix a couple minor typos to make compiler happy Signed-off-by: Wenduo Wang <wenduwan@amazon.com>
1 parent 5e0be56 commit 3b3f03d

File tree

3 files changed

+11
-14
lines changed

3 files changed

+11
-14
lines changed

opal/mca/accelerator/cuda/accelerator_cuda.c

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,8 @@ static int accelerator_cuda_sync_stream(opal_accelerator_stream_t *stream);
8181
static int accelerator_cuda_get_num_devices(int *num_devices);
8282
static int accelerator_cuda_get_mem_bw(int device, float *bw);
8383

84-
85-
#define GET_STREAM(_stream) (_stream == MCA_ACCELERATOR_STREAM_DEFAULT ? 0 : *((CUstream *)_stream->stream))
84+
#define GET_STREAM(_stream) \
85+
((_stream) == MCA_ACCELERATOR_STREAM_DEFAULT ? 0 : *((CUstream *) (_stream)->stream))
8686

8787
opal_accelerator_base_module_t opal_accelerator_cuda_module =
8888
{
@@ -128,7 +128,7 @@ opal_accelerator_base_module_t opal_accelerator_cuda_module =
128128
accelerator_cuda_get_mem_bw
129129
};
130130

131-
static inline opal_accelerator_cuda_delayed_init_check(void)
131+
static inline int opal_accelerator_cuda_delayed_init_check(void)
132132
{
133133
if (OPAL_UNLIKELY(true != mca_accelerator_cuda_init_complete)) {
134134
return opal_accelerator_cuda_delayed_init();
@@ -314,7 +314,7 @@ static int accelerator_cuda_create_stream(int dev_id, opal_accelerator_stream_t
314314
}
315315

316316
result = cuStreamCreate((*stream)->stream, 0);
317-
if (OPAL_UNLIKELY(result != CUDA_SUCCESS)) {
317+
if (OPAL_UNLIKELY(CUDA_SUCCESS != result)) {
318318
opal_show_help("help-accelerator-cuda.txt", "cuStreamCreate failed", true,
319319
OPAL_PROC_MY_HOSTNAME, result);
320320
free((*stream)->stream);
@@ -498,13 +498,14 @@ static int accelerator_cuda_memcpy(int dest_dev_id, int src_dev_id, void *dest,
498498
* Additionally, cuMemcpy is not necessarily always synchronous. See:
499499
* https://docs.nvidia.com/cuda/cuda-driver-api/api-sync-behavior.html
500500
* TODO: Add optimizations for type field */
501-
result = cuMemcpyAsync((CUdeviceptr) dest, (CUdeviceptr) src, size, GET_STREAM(opal_accelerator_cuda_memcpy_stream.super));
501+
result = cuMemcpyAsync((CUdeviceptr) dest, (CUdeviceptr) src, size,
502+
(CUstream *) opal_accelerator_cuda_memcpy_stream.base.stream);
502503
if (OPAL_UNLIKELY(CUDA_SUCCESS != result)) {
503504
opal_show_help("help-accelerator-cuda.txt", "cuMemcpyAsync failed", true, dest, src,
504505
size, result);
505506
return OPAL_ERROR;
506507
}
507-
result = cuStreamSynchronize(GET_STREAM(opal_accelerator_cuda_memcpy_stream.super));
508+
result = cuStreamSynchronize((CUstream *) opal_accelerator_cuda_memcpy_stream.base.stream);
508509
if (OPAL_UNLIKELY(CUDA_SUCCESS != result)) {
509510
opal_show_help("help-accelerator-cuda.txt", "cuStreamSynchronize failed", true,
510511
OPAL_PROC_MY_HOSTNAME, result);
@@ -532,7 +533,7 @@ static int accelerator_cuda_memmove_async(int dest_dev_id, int src_dev_id, void
532533
}
533534

534535
result = accelerator_cuda_mem_alloc_stream(src_dev_id, &ptr, size, stream);
535-
if (OPAL_UNLIKELY(OPAL_SUCCESS != result)) {
536+
if (OPAL_UNLIKELY(CUDA_SUCCESS != result)) {
536537
return OPAL_ERROR;
537538
}
538539
tmp = (CUdeviceptr)ptr;
@@ -561,9 +562,9 @@ static int accelerator_cuda_memmove(int dest_dev_id, int src_dev_id, void *dest,
561562
return OPAL_ERROR;
562563
}
563564
ret = accelerator_cuda_sync_stream(&opal_accelerator_cuda_memcpy_stream.base);
564-
if (OPAL_UNLIKELY(OPAL_SUCCESS != result)) {
565+
if (OPAL_UNLIKELY(OPAL_SUCCESS != ret)) {
565566
opal_show_help("help-accelerator-cuda.txt", "cuStreamSynchronize failed", true,
566-
OPAL_PROC_MY_HOSTNAME, result);
567+
OPAL_PROC_MY_HOSTNAME, ret);
567568
return OPAL_ERROR;
568569
}
569570
return OPAL_SUCCESS;
@@ -982,7 +983,7 @@ static int accelerator_cuda_get_buffer_id(int dev_id, const void *addr, opal_acc
982983
}
983984

984985
result = cuPointerGetAttribute((unsigned long long *)buf_id, CU_POINTER_ATTRIBUTE_BUFFER_ID, (CUdeviceptr) addr);
985-
if (OPAL_UNLIKELY(result != CUDA_SUCCESS)) {
986+
if (OPAL_UNLIKELY(CUDA_SUCCESS != result)) {
986987
opal_show_help("help-accelerator-cuda.txt", "bufferID failed", true, OPAL_PROC_MY_HOSTNAME,
987988
result);
988989
return OPAL_ERROR;

opal/mca/accelerator/cuda/accelerator_cuda.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,10 @@
22
* Copyright (c) 2014 Intel, Inc. All rights reserved.
33
* Copyright (c) 2017-2022 Amazon.com, Inc. or its affiliates.
44
* All Rights reserved.
5-
<<<<<<< HEAD
65
* Copyright (c) 2024 NVIDIA Corporation. All rights reserved.
7-
=======
86
* Copyright (c) 2024 The University of Tennessee and The University
97
* of Tennessee Research Foundation. All rights
108
* reserved.
11-
>>>>>>> 26185d6108 (Add stream operations to accelerator components)
129
* $COPYRIGHT$
1310
*
1411
* Additional copyrights may follow

opal/mca/accelerator/cuda/accelerator_cuda_component.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,6 @@ static int accelerator_cuda_component_register(void)
128128
int opal_accelerator_cuda_delayed_init()
129129
{
130130
int result = OPAL_SUCCESS;
131-
int prio_lo, prio_hi;
132131
CUcontext cuContext;
133132

134133
/* Double checked locking to avoid having to

0 commit comments

Comments
 (0)