Skip to content

Commit 48ae44b

Browse files
committed
accelerator/cuda: Return OPAL error codes instead of CUresult
Signed-off-by: William Zhang <[email protected]>
1 parent b751060 commit 48ae44b

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

opal/mca/accelerator/cuda/accelerator_cuda.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,7 @@ static int accelerator_cuda_memcpy(int dest_dev_id, int src_dev_id, void *dest,
371371
{
372372
CUresult result;
373373

374-
delayed_init = opal_accelerator_cuda_delayed_init();
374+
int delayed_init = opal_accelerator_cuda_delayed_init();
375375
if (OPAL_UNLIKELY(0 != delayed_init)) {
376376
return delayed_init;
377377
}
@@ -462,7 +462,7 @@ static int accelerator_cuda_mem_alloc(int dev_id, void **ptr, size_t size)
462462
if (OPAL_UNLIKELY(CUDA_SUCCESS != result)) {
463463
opal_show_help("help-accelerator-cuda.txt", "cuMemAlloc failed", true,
464464
OPAL_PROC_MY_HOSTNAME, result);
465-
return result;
465+
return OPAL_ERROR;
466466
}
467467
}
468468
return 0;
@@ -476,7 +476,7 @@ static int accelerator_cuda_mem_release(int dev_id, void *ptr)
476476
if (OPAL_UNLIKELY(CUDA_SUCCESS != result)) {
477477
opal_show_help("help-accelerator-cuda.txt", "cuMemFree failed", true,
478478
OPAL_PROC_MY_HOSTNAME, result);
479-
return result;
479+
return OPAL_ERROR;
480480
}
481481
}
482482
return 0;
@@ -525,7 +525,7 @@ static int accelerator_cuda_host_register(int dev_id, void *ptr, size_t size)
525525
if (OPAL_UNLIKELY(CUDA_SUCCESS != result)) {
526526
opal_show_help("help-accelerator-cuda.txt", "cuMemHostRegister failed", true,
527527
ptr, size, OPAL_PROC_MY_HOSTNAME, result);
528-
return result;
528+
return OPAL_ERROR;
529529
}
530530

531531
return OPAL_SUCCESS;
@@ -539,7 +539,7 @@ static int accelerator_cuda_host_unregister(int dev_id, void *ptr)
539539
if (OPAL_UNLIKELY(CUDA_SUCCESS != result)) {
540540
opal_show_help("help-accelerator-cuda.txt", "cuMemHostUnregister failed", true,
541541
ptr, OPAL_PROC_MY_HOSTNAME, result);
542-
return result;
542+
return OPAL_ERROR;
543543
}
544544
}
545545
return OPAL_SUCCESS;
@@ -563,7 +563,7 @@ static int accelerator_cuda_get_device(int *dev_id)
563563
if (OPAL_UNLIKELY(CUDA_SUCCESS != result)) {
564564
opal_show_help("help-accelerator-cuda.txt", "cuCtxGetDevice failed", true,
565565
result);
566-
return result;
566+
return OPAL_ERROR;
567567
}
568568
*dev_id = cuDev;
569569
return 0;
@@ -586,7 +586,7 @@ static int accelerator_cuda_device_can_access_peer(int *access, int dev1, int de
586586
if (OPAL_UNLIKELY(CUDA_SUCCESS != result)) {
587587
opal_show_help("help-accelerator-cuda.txt", "cuDeviceCanAccessPeer failed", true,
588588
OPAL_PROC_MY_HOSTNAME, result);
589-
return result;
589+
return OPAL_ERROR;
590590
}
591591
return 0;
592592
}
@@ -612,14 +612,14 @@ static int accelerator_cuda_get_buffer_id(int dev_id, const void *addr, opal_acc
612612
if (OPAL_UNLIKELY(result != CUDA_SUCCESS)) {
613613
opal_show_help("help-accelerator-cuda.txt", "bufferID failed", true, OPAL_PROC_MY_HOSTNAME,
614614
result);
615-
return result;
615+
return OPAL_ERROR;
616616
}
617617
result = cuPointerSetAttribute(&enable, CU_POINTER_ATTRIBUTE_SYNC_MEMOPS,
618618
(CUdeviceptr) addr);
619619
if (OPAL_UNLIKELY(CUDA_SUCCESS != result)) {
620620
opal_show_help("help-accelerator-cuda.txt", "cuPointerSetAttribute failed", true,
621621
OPAL_PROC_MY_HOSTNAME, result, addr);
622-
return result;
622+
return OPAL_ERROR;
623623
}
624624
return OPAL_SUCCESS;
625625
}

0 commit comments

Comments
 (0)