Skip to content

Commit 09b63d6

Browse files
committed
accelerator/cuda: Add exception for CUDA_ERROR_INVALID_VALUE
This value can also be returned for host buffers in cases where a cuda context is not available. Signed-off-by: William Zhang <wilzhang@amazon.com>
1 parent dad058e commit 09b63d6

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

opal/mca/accelerator/cuda/accelerator_cuda.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,10 @@ static int accelerator_cuda_check_addr(const void *addr, int *dev_id, uint64_t *
109109
*flags |= MCA_ACCELERATOR_FLAGS_UNIFIED_MEMORY;
110110
}
111111
if (CUDA_SUCCESS != result) {
112-
/* If cuda is not initialized, assume it is a host buffer. */
113-
if (CUDA_ERROR_NOT_INITIALIZED == result) {
112+
/* If cuda is not initialized, assume it is a host buffer. It can also
113+
* return invalid value if the ptr was not allocated by, mapped by,
114+
* or registered with a CUcontext */
115+
if (CUDA_ERROR_NOT_INITIALIZED == result || CUDA_ERROR_INVALID_VALUE == result) {
114116
return 0;
115117
} else {
116118
return OPAL_ERROR;

0 commit comments

Comments
 (0)