pub enum CudaTransferStrategy {
PageableCopy,
PinnedCopy,
LazyPinnedCopy,
Coherence,
}
Expand description
Specify the CUDA transfer strategy.
Defines which strategy with which to transfer data from main-memory to device memory.
A Prefetch
strategy is not defined, because cuda_prefetch_async()
requires unified memory allocated with cuda_malloc_managed()
. Thus,
regular memory that is allocated with the system allocator cannot be used in
conjunction with prefetching. As unified memory is more specific than the
general system memory, prefetching is handled separately using
IntoCudaIterator
.
Variants
PageableCopy
Copy directly from pageable memory.
Transfers data using cuda_memcopy()
directly from the specified memory
location. No intermediate steps are performed.
This strategy can also transfer memory that is pinned by the user before the transfer.
PinnedCopy
Copy using an intermediate, pinned buffer.
The transfer first copies data from its original location into a pinned
buffer. Then data is transferred using cuda_memcpy()
.
In principle, this strategy can also tranfer from a pinned memory
location. However, the PageableCopy
strategy would avoid the additional
overhead incurred by the intermediate buffer.
LazyPinnedCopy
Pin the memory in-place and the copy.
The transfer first pins the memory in-place using cuda_host_register()
.
Then the data is transferred using cuda_memcpy()
.
Don’t use this strategy with a pinned memory location, as calling
cuda_host_register()
on a pinned location is probably undefined
behavior.
Coherence
Access the memory in-place without any copies.
Requires that the GPU has cache-coherent access to main-memory. E.g., POWER9 and Tesla V100 with NVLink 2.0.
Trait Implementations
sourceimpl Clone for CudaTransferStrategy
impl Clone for CudaTransferStrategy
sourcefn clone(&self) -> CudaTransferStrategy
fn clone(&self) -> CudaTransferStrategy
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for CudaTransferStrategy
impl Debug for CudaTransferStrategy
impl Copy for CudaTransferStrategy
Auto Trait Implementations
impl RefUnwindSafe for CudaTransferStrategy
impl Send for CudaTransferStrategy
impl Sync for CudaTransferStrategy
impl Unpin for CudaTransferStrategy
impl UnwindSafe for CudaTransferStrategy
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<T> Pointable for T
impl<T> Pointable for T
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more