Skip to content
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
4 changes: 4 additions & 0 deletions crates/cust/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

Notable changes to this project will be documented in this file.

## Unreleased

- Add `memory::memcpy_dtoh` to allow copying from device to host.

## 0.3.2 - 2/16/22

- Fixed `ModuleJitOptions` not working (due to cursed reasons).
Expand Down
11 changes: 11 additions & 0 deletions crates/cust/src/memory/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,17 @@ pub unsafe fn memcpy_htod(
Ok(())
}

/// Simple wrapper over cuMemcpyDtoH_v2
#[allow(clippy::missing_safety_doc)]
pub unsafe fn memcpy_dtoh(
d_ptr: *mut c_void,
src_ptr: cust_raw::CUdeviceptr,
size: usize,
) -> CudaResult<()> {
crate::sys::cuMemcpyDtoH_v2(d_ptr, src_ptr, size).to_result()?;
Ok(())
}

/// Get the current free and total memory.
///
/// Returns in `.1` the total amount of memory available to the the current context.
Expand Down