Class CudaContext
- Namespace
- DotCompute.Backends.CUDA
- Assembly
- DotCompute.Backends.CUDA.dll
Manages CUDA context lifecycle and operations
public sealed class CudaContext : IDisposable
- Inheritance
-
CudaContext
- Implements
- Inherited Members
- Extension Methods
Constructors
CudaContext(int)
Initializes a new instance of the CudaContext class.
public CudaContext(int deviceId)
Parameters
deviceIdintThe device identifier.
CudaContext(nint, int)
Initializes a new instance of the CudaContext class.
public CudaContext(nint contextPtr, int deviceId)
Parameters
Properties
DeviceId
Gets or sets the device identifier.
public int DeviceId { get; }
Property Value
- int
The device id.
Handle
Gets or sets the handle.
public nint Handle { get; }
Property Value
- nint
The handle.
Stream
Gets or sets the stream.
public nint Stream { get; }
Property Value
- nint
The stream.
Methods
Dispose()
Performs dispose.
public void Dispose()
~CudaContext()
Finalizer — defense-in-depth release of the CUDA primary context and stream in case Dispose was never called. Logs nothing (logger may already be torn down).
protected ~CudaContext()
MakeCurrent()
Performs make current.
public void MakeCurrent()
Reinitialize()
Performs reinitialize.
public void Reinitialize()
Synchronize()
Performs synchronize.
public void Synchronize()
ToIAccelerator()
Converts this CudaContext to an IAccelerator
public IAccelerator ToIAccelerator()