Class CudaPitchedDeviceVariable<T>
A variable located in CUDA device memory. The data is aligned following Pitch
Inheritance
Implements
Inherited Members
Namespace: ManagedCuda
Assembly: ManagedCuda.dll
Syntax
public class CudaPitchedDeviceVariable<T> : IDisposable where T : struct
Type Parameters
Name | Description |
---|---|
T | variable base type |
Constructors
| Improve this Doc View SourceCudaPitchedDeviceVariable(CUdeviceptr, SizeT, SizeT, SizeT)
Creates a new CudaPitchedDeviceVariable from an existing CUdeviceptr The CUdeviceptr won't be freed when disposing.
Declaration
public CudaPitchedDeviceVariable(CUdeviceptr devPtr, SizeT width, SizeT height, SizeT pitch)
Parameters
Type | Name | Description |
---|---|---|
CUdeviceptr | devPtr | |
SizeT | width | In elements |
SizeT | height | In elements |
SizeT | pitch | In bytes |
CudaPitchedDeviceVariable(CUdeviceptr, SizeT, SizeT, SizeT, Boolean)
Creates a new CudaPitchedDeviceVariable from an existing CUdeviceptr
Declaration
public CudaPitchedDeviceVariable(CUdeviceptr devPtr, SizeT width, SizeT height, SizeT pitch, bool isOwner)
Parameters
Type | Name | Description |
---|---|---|
CUdeviceptr | devPtr | |
SizeT | width | In elements |
SizeT | height | In elements |
SizeT | pitch | In bytes |
System.Boolean | isOwner | The CUdeviceptr will be freed while disposing if the CudaPitchedDeviceVariable is the owner |
CudaPitchedDeviceVariable(SizeT, SizeT)
Creates a new CudaPitchedDeviceVariable and allocates the memory on the device
Declaration
public CudaPitchedDeviceVariable(SizeT width, SizeT height)
Parameters
Type | Name | Description |
---|---|---|
SizeT | width | In elements |
SizeT | height | In elements |
CudaPitchedDeviceVariable(SizeT, SizeT, SizeT)
Creates a new CudaPitchedDeviceVariable and allocates the memory on the device
Declaration
public CudaPitchedDeviceVariable(SizeT width, SizeT height, SizeT pack)
Parameters
Type | Name | Description |
---|---|---|
SizeT | width | In elements |
SizeT | height | In elements |
SizeT | pack | Group |
Properties
| Improve this Doc View SourceDevicePointer
Device pointer
Declaration
public CUdeviceptr DevicePointer { get; }
Property Value
Type | Description |
---|---|
CUdeviceptr |
Height
Height in elements
Declaration
public SizeT Height { get; }
Property Value
Type | Description |
---|---|
SizeT |
Item[SizeT, SizeT]
Access array elements directly from host.
Each single access invokes a device to host or host to device copy. Access is therefor rather slow.
Declaration
public T this[SizeT x, SizeT y] { get; set; }
Parameters
Type | Name | Description |
---|---|---|
SizeT | x | X-index in elements |
SizeT | y | Y-index in elements |
Property Value
Type | Description |
---|---|
T |
Pitch
Pitch in bytes
Declaration
public SizeT Pitch { get; }
Property Value
Type | Description |
---|---|
SizeT |
TotalSizeInBytes
Total size in bytes (Pitch * Height)
Declaration
public SizeT TotalSizeInBytes { get; }
Property Value
Type | Description |
---|---|
SizeT |
Width
Width in elements
Declaration
public SizeT Width { get; }
Property Value
Type | Description |
---|---|
SizeT |
WidthInBytes
Width in bytes
Declaration
public SizeT WidthInBytes { get; }
Property Value
Type | Description |
---|---|
SizeT |
Methods
| Improve this Doc View SourceAsyncCopyToDevice(CUdeviceptr, CUstream)
Async Copy data from device to device memory
Declaration
public void AsyncCopyToDevice(CUdeviceptr source, CUstream stream)
Parameters
Type | Name | Description |
---|---|---|
CUdeviceptr | source | Source pointer to device memory |
CUstream | stream |
AsyncCopyToDevice(CUdeviceptr, CudaStream)
Async Copy data from device to device memory (1D Copy, copies destination pitch * height bytes data)
Declaration
public void AsyncCopyToDevice(CUdeviceptr source, CudaStream stream)
Parameters
Type | Name | Description |
---|---|---|
CUdeviceptr | source | Source pointer to device memory |
CudaStream | stream |
AsyncCopyToDevice(CudaDeviceVariable<T>, CUstream)
Async Copy data from device to device memory
Declaration
public void AsyncCopyToDevice(CudaDeviceVariable<T> source, CUstream stream)
Parameters
Type | Name | Description |
---|---|---|
CudaDeviceVariable<T> | source | Source |
CUstream | stream |
AsyncCopyToDevice(CudaDeviceVariable<T>, CudaStream)
Async Copy data from device to device memory (1D Copy, copies destination pitch * height bytes data)
Declaration
public void AsyncCopyToDevice(CudaDeviceVariable<T> source, CudaStream stream)
Parameters
Type | Name | Description |
---|---|---|
CudaDeviceVariable<T> | source | Source |
CudaStream | stream |
AsyncCopyToDevice(CudaPitchedDeviceVariable<T>, CUstream)
Async Copy from device to device memory
Declaration
public void AsyncCopyToDevice(CudaPitchedDeviceVariable<T> deviceSrc, CUstream stream)
Parameters
Type | Name | Description |
---|---|---|
CudaPitchedDeviceVariable<T> | deviceSrc | Source |
CUstream | stream |
AsyncCopyToDevice(CudaPitchedDeviceVariable<T>, CudaStream)
Async Copy from device to device memory
Declaration
public void AsyncCopyToDevice(CudaPitchedDeviceVariable<T> deviceSrc, CudaStream stream)
Parameters
Type | Name | Description |
---|---|---|
CudaPitchedDeviceVariable<T> | deviceSrc | Source |
CudaStream | stream |
CopyToDevice(T[])
Copy from Host to device memory
Declaration
public void CopyToDevice(T[] hostSrc)
Parameters
Type | Name | Description |
---|---|---|
T[] | hostSrc | Source |
CopyToDevice(T[], SizeT, SizeT)
Copy from Host to device memory
Declaration
public void CopyToDevice(T[] hostSrc, SizeT width, SizeT height)
Parameters
Type | Name | Description |
---|---|---|
T[] | hostSrc | Source |
SizeT | width | Width in elements |
SizeT | height | Height in elements |
CopyToDevice(T[], SizeT, SizeT, SizeT, SizeT, SizeT, SizeT, SizeT, SizeT)
Copy from host to device memory
Declaration
public void CopyToDevice(T[] hostSrc, SizeT SrcXInBytes, SizeT SrcY, SizeT DestXInBytes, SizeT DestY, SizeT widthInBytes, SizeT height, SizeT SrcPitch, SizeT DestPitch)
Parameters
Type | Name | Description |
---|---|---|
T[] | hostSrc | Source |
SizeT | SrcXInBytes | Source X in bytes |
SizeT | SrcY | Source Y |
SizeT | DestXInBytes | Destination X in bytes |
SizeT | DestY | Destination Y |
SizeT | widthInBytes | Width in bytes |
SizeT | height | Height in elements |
SizeT | SrcPitch | Source pitch |
SizeT | DestPitch | Destination pitch |
CopyToDevice(T[,])
Copy from Host to device memory. Assumes that aHostDest has no additional line padding.
Declaration
public void CopyToDevice(T[, ] hostSrc)
Parameters
Type | Name | Description |
---|---|---|
T[,] | hostSrc | Source |
CopyToDevice(T[,], SizeT, SizeT, SizeT, SizeT, SizeT, SizeT, SizeT, SizeT)
Copy from host to device memory
Declaration
public void CopyToDevice(T[, ] hostSrc, SizeT SrcXInBytes, SizeT SrcY, SizeT DestXInBytes, SizeT DestY, SizeT widthInBytes, SizeT height, SizeT SrcPitch, SizeT DestPitch)
Parameters
Type | Name | Description |
---|---|---|
T[,] | hostSrc | Source |
SizeT | SrcXInBytes | Source X in bytes |
SizeT | SrcY | Source Y |
SizeT | DestXInBytes | Destination X in bytes |
SizeT | DestY | Destination Y |
SizeT | widthInBytes | Width in bytes |
SizeT | height | Height in elements |
SizeT | SrcPitch | Source pitch |
SizeT | DestPitch | Destination pitch |
CopyToDevice(CUdeviceptr)
Copy from device to device memory
Declaration
public void CopyToDevice(CUdeviceptr deviceSrc)
Parameters
Type | Name | Description |
---|---|---|
CUdeviceptr | deviceSrc | Source |
CopyToDevice(CUdeviceptr, SizeT)
Copy from device to device memory
Declaration
public void CopyToDevice(CUdeviceptr deviceSrc, SizeT pitchSrc)
Parameters
Type | Name | Description |
---|---|---|
CUdeviceptr | deviceSrc | Source |
SizeT | pitchSrc | Source pitch |
CopyToDevice(CUdeviceptr, SizeT, SizeT, SizeT, SizeT, SizeT, SizeT, SizeT, SizeT)
Copy from device to device memory
Declaration
public void CopyToDevice(CUdeviceptr deviceSrc, SizeT SrcXInBytes, SizeT SrcY, SizeT DestXInBytes, SizeT DestY, SizeT widthInBytes, SizeT height, SizeT SrcPitch, SizeT DestPitch)
Parameters
Type | Name | Description |
---|---|---|
CUdeviceptr | deviceSrc | Source |
SizeT | SrcXInBytes | Source X in bytes |
SizeT | SrcY | Source Y |
SizeT | DestXInBytes | Destination X in bytes |
SizeT | DestY | Destination Y |
SizeT | widthInBytes | Width in bytes |
SizeT | height | Height in elements |
SizeT | SrcPitch | Source pitch |
SizeT | DestPitch | Destination pitch |
CopyToDevice(CudaDeviceVariable<T>)
Copy from device to device memory
Declaration
public void CopyToDevice(CudaDeviceVariable<T> deviceSrc)
Parameters
Type | Name | Description |
---|---|---|
CudaDeviceVariable<T> | deviceSrc | Source |
CopyToDevice(CudaDeviceVariable<T>, SizeT, SizeT, SizeT, SizeT, SizeT, SizeT, SizeT, SizeT)
Copy from device to device memory
Declaration
public void CopyToDevice(CudaDeviceVariable<T> deviceSrc, SizeT SrcXInBytes, SizeT SrcY, SizeT DestXInBytes, SizeT DestY, SizeT widthInBytes, SizeT height, SizeT SrcPitch, SizeT DestPitch)
Parameters
Type | Name | Description |
---|---|---|
CudaDeviceVariable<T> | deviceSrc | Source |
SizeT | SrcXInBytes | Source X in bytes |
SizeT | SrcY | Source Y |
SizeT | DestXInBytes | Destination X in bytes |
SizeT | DestY | Destination Y |
SizeT | widthInBytes | Width in bytes |
SizeT | height | Height in elements |
SizeT | SrcPitch | Source pitch |
SizeT | DestPitch | Destination pitch |
CopyToDevice(CudaPitchedDeviceVariable<T>)
Copy from device to device memory
Declaration
public void CopyToDevice(CudaPitchedDeviceVariable<T> deviceSrc)
Parameters
Type | Name | Description |
---|---|---|
CudaPitchedDeviceVariable<T> | deviceSrc | Source |
CopyToDevice(CudaPitchedDeviceVariable<T>, SizeT, SizeT, SizeT, SizeT, SizeT, SizeT, SizeT, SizeT)
Copy from device to device memory
Declaration
public void CopyToDevice(CudaPitchedDeviceVariable<T> deviceSrc, SizeT SrcXInBytes, SizeT SrcY, SizeT DestXInBytes, SizeT DestY, SizeT widthInBytes, SizeT height, SizeT SrcPitch, SizeT DestPitch)
Parameters
Type | Name | Description |
---|---|---|
CudaPitchedDeviceVariable<T> | deviceSrc | Source |
SizeT | SrcXInBytes | Source X in bytes |
SizeT | SrcY | Source Y |
SizeT | DestXInBytes | Destination X in bytes |
SizeT | DestY | Destination Y |
SizeT | widthInBytes | Width in bytes |
SizeT | height | Height in elements |
SizeT | SrcPitch | Source pitch |
SizeT | DestPitch | Destination pitch |
CopyToDevice(IntPtr)
Copy from Host to device memory
Declaration
public void CopyToDevice(IntPtr hostSrc)
Parameters
Type | Name | Description |
---|---|---|
System.IntPtr | hostSrc | Source |
CopyToDevice(IntPtr, SizeT, SizeT)
Copy from Host to device memory
Declaration
public void CopyToDevice(IntPtr hostSrc, SizeT width, SizeT height)
Parameters
Type | Name | Description |
---|---|---|
System.IntPtr | hostSrc | Source |
SizeT | width | Width in bytes |
SizeT | height | Height in elements |
CopyToDevice(IntPtr, SizeT, SizeT, SizeT, SizeT, SizeT, SizeT, SizeT, SizeT)
Copy from host to device memory
Declaration
public void CopyToDevice(IntPtr hostSrc, SizeT SrcXInBytes, SizeT SrcY, SizeT DestXInBytes, SizeT DestY, SizeT widthInBytes, SizeT height, SizeT SrcPitch, SizeT DestPitch)
Parameters
Type | Name | Description |
---|---|---|
System.IntPtr | hostSrc | Source |
SizeT | SrcXInBytes | Source X in bytes |
SizeT | SrcY | Source Y |
SizeT | DestXInBytes | Destination X in bytes |
SizeT | DestY | Destination Y |
SizeT | widthInBytes | Width in bytes |
SizeT | height | Height in elements |
SizeT | SrcPitch | Source pitch |
SizeT | DestPitch | Destination pitch |
CopyToHost(T[])
Copy data from device to host memory
Declaration
public void CopyToHost(T[] aHostDest)
Parameters
Type | Name | Description |
---|---|---|
T[] | aHostDest | Destination |
CopyToHost(T[], SizeT, SizeT)
Copy data from this device to host memory
Declaration
public void CopyToHost(T[] hostDest, SizeT width, SizeT height)
Parameters
Type | Name | Description |
---|---|---|
T[] | hostDest | Destination |
SizeT | width | Width in elements |
SizeT | height | Height in elements |
CopyToHost(T[], SizeT, SizeT, SizeT, SizeT, SizeT, SizeT, SizeT, SizeT)
Copy data from device to host memory
Declaration
public void CopyToHost(T[] hostDest, SizeT DestXInBytes, SizeT DestY, SizeT SrcXInBytes, SizeT SrcY, SizeT widthInBytes, SizeT height, SizeT DestPitch, SizeT SrcPitch)
Parameters
Type | Name | Description |
---|---|---|
T[] | hostDest | Destination |
SizeT | DestXInBytes | Destination X in bytes |
SizeT | DestY | Destination Y |
SizeT | SrcXInBytes | Source X in bytes |
SizeT | SrcY | Source Y |
SizeT | widthInBytes | Width in bytes |
SizeT | height | Height in elements |
SizeT | DestPitch | Destination pitch |
SizeT | SrcPitch | Source pitch |
CopyToHost(T[,])
Copy data from device to host memory. Assumes that aHostDest has no additional line padding.
Declaration
public void CopyToHost(T[, ] aHostDest)
Parameters
Type | Name | Description |
---|---|---|
T[,] | aHostDest | Destination |
CopyToHost(T[,], SizeT, SizeT, SizeT, SizeT, SizeT, SizeT, SizeT, SizeT)
Copy data from device to host memory
Declaration
public void CopyToHost(T[, ] hostDest, SizeT DestXInBytes, SizeT DestY, SizeT SrcXInBytes, SizeT SrcY, SizeT widthInBytes, SizeT height, SizeT DestPitch, SizeT SrcPitch)
Parameters
Type | Name | Description |
---|---|---|
T[,] | hostDest | Destination |
SizeT | DestXInBytes | Destination X in bytes |
SizeT | DestY | Destination Y |
SizeT | SrcXInBytes | Source X in bytes |
SizeT | SrcY | Source Y |
SizeT | widthInBytes | Width in bytes |
SizeT | height | Height in elements |
SizeT | DestPitch | Destination pitch |
SizeT | SrcPitch | Source pitch |
CopyToHost(IntPtr)
Copy data from device to host memory
Declaration
public void CopyToHost(IntPtr hostDest)
Parameters
Type | Name | Description |
---|---|---|
System.IntPtr | hostDest | IntPtr to destination in host memory |
CopyToHost(IntPtr, SizeT, SizeT)
Copy data from device to host memory
Declaration
public void CopyToHost(IntPtr hostDest, SizeT width, SizeT height)
Parameters
Type | Name | Description |
---|---|---|
System.IntPtr | hostDest | IntPtr to destination in host memory |
SizeT | width | Width in bytes |
SizeT | height | Height in elements |
CopyToHost(IntPtr, SizeT, SizeT, SizeT, SizeT, SizeT, SizeT, SizeT, SizeT)
Copy data from device to host memory
Declaration
public void CopyToHost(IntPtr hostDest, SizeT DestXInBytes, SizeT DestY, SizeT SrcXInBytes, SizeT SrcY, SizeT widthInBytes, SizeT height, SizeT DestPitch, SizeT SrcPitch)
Parameters
Type | Name | Description |
---|---|---|
System.IntPtr | hostDest | Destination |
SizeT | DestXInBytes | Destination X in bytes |
SizeT | DestY | Destination Y |
SizeT | SrcXInBytes | Source X in bytes |
SizeT | SrcY | Source Y |
SizeT | widthInBytes | Width in bytes |
SizeT | height | Height in elements |
SizeT | DestPitch | Destination pitch |
SizeT | SrcPitch | Source pitch |
Dispose()
Dispose
Declaration
public void Dispose()
Dispose(Boolean)
For IDisposable
Declaration
protected virtual void Dispose(bool fDisposing)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | fDisposing |
Finalize()
For dispose
Declaration
protected void Finalize()
Memset(Byte)
Memset
Declaration
public void Memset(byte aValue)
Parameters
Type | Name | Description |
---|---|---|
System.Byte | aValue |
Memset(UInt16)
Memset
Declaration
public void Memset(ushort aValue)
Parameters
Type | Name | Description |
---|---|---|
System.UInt16 | aValue |
Memset(UInt32)
Memset
Declaration
public void Memset(uint aValue)
Parameters
Type | Name | Description |
---|---|---|
System.UInt32 | aValue |
MemsetAsync(Byte, CUstream)
Memset
Declaration
public void MemsetAsync(byte aValue, CUstream stream)
Parameters
Type | Name | Description |
---|---|---|
System.Byte | aValue | |
CUstream | stream |
MemsetAsync(UInt16, CUstream)
Memset
Declaration
public void MemsetAsync(ushort aValue, CUstream stream)
Parameters
Type | Name | Description |
---|---|---|
System.UInt16 | aValue | |
CUstream | stream |
MemsetAsync(UInt32, CUstream)
Memset
Declaration
public void MemsetAsync(uint aValue, CUstream stream)
Parameters
Type | Name | Description |
---|---|---|
System.UInt32 | aValue | |
CUstream | stream |
PeerCopyToDevice(CudaContext, CUdeviceptr, CudaContext)
Copies from device memory in one context to device memory in another context
Declaration
public void PeerCopyToDevice(CudaContext destCtx, CUdeviceptr source, CudaContext sourceCtx)
Parameters
Type | Name | Description |
---|---|---|
CudaContext | destCtx | Destination context |
CUdeviceptr | source | Source pointer to device memory |
CudaContext | sourceCtx | Source context |
PeerCopyToDevice(CudaContext, CUdeviceptr, CudaContext, CUstream)
Async-Copies from device memory in one context to device memory in another context
Declaration
public void PeerCopyToDevice(CudaContext destCtx, CUdeviceptr source, CudaContext sourceCtx, CUstream stream)
Parameters
Type | Name | Description |
---|---|---|
CudaContext | destCtx | Destination context |
CUdeviceptr | source | Source pointer to device memory |
CudaContext | sourceCtx | Source context |
CUstream | stream |
PeerCopyToDevice(CudaContext, CudaDeviceVariable<T>, CudaContext)
Copies from device memory in one context to device memory in another context
Declaration
public void PeerCopyToDevice(CudaContext destCtx, CudaDeviceVariable<T> source, CudaContext sourceCtx)
Parameters
Type | Name | Description |
---|---|---|
CudaContext | destCtx | Destination context |
CudaDeviceVariable<T> | source | Source pointer to device memory |
CudaContext | sourceCtx | Source context |
PeerCopyToDevice(CudaContext, CudaDeviceVariable<T>, CudaContext, CUstream)
Async-Copies from device memory in one context to device memory in another context
Declaration
public void PeerCopyToDevice(CudaContext destCtx, CudaDeviceVariable<T> source, CudaContext sourceCtx, CUstream stream)
Parameters
Type | Name | Description |
---|---|---|
CudaContext | destCtx | Destination context |
CudaDeviceVariable<T> | source | Source pointer to device memory |
CudaContext | sourceCtx | Source context |
CUstream | stream |
Operators
| Improve this Doc View SourceImplicit(CudaPitchedDeviceVariable<T> to T[])
Converts a device variable to a host array
Declaration
public static implicit operator T[](CudaPitchedDeviceVariable<T> d)
Parameters
Type | Name | Description |
---|---|---|
CudaPitchedDeviceVariable<T> | d | device variable |
Returns
Type | Description |
---|---|
T[] | newly allocated host array with values from device memory |