pub struct CudaContext { /* private fields */ }Expand description
CUDA driver context shared by J2K CUDA adapter crates.
Implementations§
Source§impl CudaContext
impl CudaContext
Sourcepub fn system_default() -> Result<Self, CudaError>
pub fn system_default() -> Result<Self, CudaError>
Create a context for the system default CUDA device.
Sourcepub fn retain_primary(device_ordinal: usize) -> Result<Self, CudaError>
pub fn retain_primary(device_ordinal: usize) -> Result<Self, CudaError>
Retain the CUDA primary context for a selected device ordinal.
This is the interoperability constructor for runtimes such as CubeCL
that also use CUDA primary contexts. Dropping the final clone releases
the retain; it never destroys the primary context directly.
Source§impl CudaContext
impl CudaContext
Sourcepub fn synchronize(&self) -> Result<(), CudaError>
pub fn synchronize(&self) -> Result<(), CudaError>
Synchronize all work submitted to this CUDA context.
Source§impl CudaContext
impl CudaContext
Sourcepub fn upload_f32_pinned(
&self,
samples: &[f32],
) -> Result<CudaDeviceBuffer, CudaError>
pub fn upload_f32_pinned( &self, samples: &[f32], ) -> Result<CudaDeviceBuffer, CudaError>
Upload host f32 samples through a temporary page-locked staging buffer.
Source§impl CudaContext
impl CudaContext
Sourcepub fn upload_pinned(&self, bytes: &[u8]) -> Result<CudaDeviceBuffer, CudaError>
pub fn upload_pinned(&self, bytes: &[u8]) -> Result<CudaDeviceBuffer, CudaError>
Upload host bytes through a temporary page-locked staging buffer.
Source§impl CudaContext
impl CudaContext
Sourcepub fn upload(&self, bytes: &[u8]) -> Result<CudaDeviceBuffer, CudaError>
pub fn upload(&self, bytes: &[u8]) -> Result<CudaDeviceBuffer, CudaError>
Upload host bytes into a CUDA device buffer.
Sourcepub fn upload_f32(&self, samples: &[f32]) -> Result<CudaDeviceBuffer, CudaError>
pub fn upload_f32(&self, samples: &[f32]) -> Result<CudaDeviceBuffer, CudaError>
Upload host f32 samples into a CUDA device buffer.
Sourcepub fn allocate(&self, len: usize) -> Result<CudaDeviceBuffer, CudaError>
pub fn allocate(&self, len: usize) -> Result<CudaDeviceBuffer, CudaError>
Allocate an uninitialized CUDA device buffer.
Sourcepub fn buffer_pool(&self) -> CudaBufferPool
pub fn buffer_pool(&self) -> CudaBufferPool
Create a reusable device-buffer pool for this context.
Sourcepub fn best_fit_buffer_pool(&self) -> CudaBufferPool
pub fn best_fit_buffer_pool(&self) -> CudaBufferPool
Create a reusable best-fit device-buffer pool for workloads with many same-sized intermediate buffers.
Trait Implementations§
Source§impl Clone for CudaContext
impl Clone for CudaContext
Source§fn clone(&self) -> CudaContext
fn clone(&self) -> CudaContext
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more