Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix compiler error due to unavailability of some CUDA methods #270

Merged
merged 1 commit into from
Jul 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading