Skip to content

Commit

Permalink
Fix compiler error due to unavailability of some CUDA methods
Browse files Browse the repository at this point in the history
  • Loading branch information
sebhtml committed Jul 7, 2024
1 parent edb0779 commit 76f073a
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
14 changes: 14 additions & 0 deletions src/driver/result.rs
Original file line number Diff line number Diff line change
Expand Up @@ -599,10 +599,17 @@ pub unsafe fn malloc_managed(
/// Advise about the usage of a given memory range.
///
/// See [cuda docs](https://docs.nvidia.com/cuda/cuda-driver-api/group__CUDA__UNIFIED.html#group__CUDA__UNIFIED_1g27608c857a9254789c13f3e3b72029e2)
/// **Only available in 12.2+.
///
/// # Safety
/// 1. Memory must have been allocated by [malloc_managed()]
/// 2. num_bytes must be the amount of bytes passed to [malloc_managed()]
#[cfg(any(
feature = "cuda-12020",
feature = "cuda-12030",
feature = "cuda-12040",
feature = "cuda-12050"
))]
pub unsafe fn mem_advise(
dptr: sys::CUdeviceptr,
num_bytes: usize,
Expand All @@ -615,9 +622,16 @@ pub unsafe fn mem_advise(
}

/// See [cuda docs](https://docs.nvidia.com/cuda/cuda-driver-api/group__CUDA__UNIFIED.html#group__CUDA__UNIFIED_1gfe94f8b7fb56291ebcea44261aa4cb84)
/// **Only available in 12.2+.
///
/// # Safety
/// 1. The dptr/num_bytes must be allocated by [malloc_managed()] and must be the exact same memory range.
#[cfg(any(
feature = "cuda-12020",
feature = "cuda-12030",
feature = "cuda-12040",
feature = "cuda-12050"
))]
pub unsafe fn mem_prefetch_async(
dptr: sys::CUdeviceptr,
num_bytes: usize,
Expand Down
7 changes: 6 additions & 1 deletion src/nccl/result.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,12 @@ pub unsafe fn comm_init_all(
/// **Only available in 12.2+.
/// # Safety
/// User is in charge of sending valid pointers.
#[cfg(any(feature = "cuda-12020", feature = "cuda-12030", feature = "cuda-12040"))]
#[cfg(any(
feature = "cuda-12020",
feature = "cuda-12030",
feature = "cuda-12040",
feature = "cuda-12050"
))]
pub unsafe fn comm_split(
comm: sys::ncclComm_t,
color: ::core::ffi::c_int,
Expand Down

0 comments on commit 76f073a

Please sign in to comment.