pub struct GreenContext { /* private fields */ }Expand description
A green context — an SM-partitioned CUDA context. Drops destroy the green context (does not affect the parent device context).
Implementations§
Source§impl GreenContext
impl GreenContext
Sourcepub fn from_resource(device: &Device, resource: CUdevResource) -> Result<Self>
pub fn from_resource(device: &Device, resource: CUdevResource) -> Result<Self>
Create a green context on device from a single resource (e.g. an
SM partition produced by sm_resource_split_by_count).
Sourcepub fn as_ctx_raw(&self) -> Result<CUcontext>
pub fn as_ctx_raw(&self) -> Result<CUcontext>
Convert this green context into a regular CUcontext handle that
can be set as current or passed to other APIs.
Sourcepub fn sm_resource(&self) -> Result<CUdevSmResource>
pub fn sm_resource(&self) -> Result<CUdevSmResource>
Fetch the SM resource the green context was created with.
Sourcepub fn create_stream_raw(&self, flags: u32, priority: i32) -> Result<CUstream>
pub fn create_stream_raw(&self, flags: u32, priority: i32) -> Result<CUstream>
Create a stream that only runs work on this green context’s SMs.
Returns the raw CUstream — baracuda’s crate::Stream requires
a full Context, so we return the raw handle for now.
Sourcepub unsafe fn from_raw(handle: CUgreenCtx) -> Self
pub unsafe fn from_raw(handle: CUgreenCtx) -> Self
Wrap a raw green-context handle — see GreenContext::from_resource
for the normal constructor.
§Safety
The caller guarantees handle is a valid CUgreenCtx that baracuda
may take ownership of (destroyed on drop).
Sourcepub fn into_raw(self) -> CUgreenCtx
pub fn into_raw(self) -> CUgreenCtx
Consume the green context and return its raw handle without destroying it. The caller takes over the destroy responsibility.
pub fn as_raw(&self) -> CUgreenCtx
Trait Implementations§
Source§impl Clone for GreenContext
impl Clone for GreenContext
Source§fn clone(&self) -> GreenContext
fn clone(&self) -> GreenContext
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more