Skip to content

Commit

Permalink
Merge pull request #8763 from shamisp/topic/cuda12
Browse files Browse the repository at this point in the history
CUDA: make cuGetProcAddress to work with cuda 12
  • Loading branch information
yosefe authored Dec 16, 2022
2 parents db66ee6 + f572bb7 commit a5039ee
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/uct/cuda/base/cuda_md.c
Original file line number Diff line number Diff line change
Expand Up @@ -231,13 +231,25 @@ static int uct_cuda_copy_get_dmabuf_fd(const ucs_memory_info_t *addr_mem_info)
/* Get fxn ptr for cuMemGetHandleForAddressRange in case installed libcuda
* does not have the definition for it even though 11.7 header includes the
* declaration and avoid link error */
#if CUDA_VERSION >= 12000
CUdriverProcAddressQueryResult proc_addr_res;
cu_err = cuGetProcAddress("cuMemGetHandleForAddressRange",
(void**)&get_handle_func, 12000,
CU_GET_PROC_ADDRESS_DEFAULT, &proc_addr_res);
if ((cu_err != CUDA_SUCCESS) ||
(proc_addr_res != CU_GET_PROC_ADDRESS_SUCCESS)) {
ucs_debug("cuMemGetHandleForAddressRange not found");
return UCT_DMABUF_FD_INVALID;
}
#else
cu_err = cuGetProcAddress("cuMemGetHandleForAddressRange",
(void**)&get_handle_func, 11070,
CU_GET_PROC_ADDRESS_DEFAULT);
if (cu_err != CUDA_SUCCESS) {
ucs_debug("cuMemGetHandleForAddressRange not found");
return UCT_DMABUF_FD_INVALID;
}
#endif

cu_err = get_handle_func((void*)&fd, (uintptr_t)addr_mem_info->base_address,
addr_mem_info->alloc_length,
Expand Down

0 comments on commit a5039ee

Please sign in to comment.