Show / Hide Table of Contents

    Class CudaDeviceVariable<T>

    A variable located in CUDA device memory

    Inheritance
    System.Object
    CudaDeviceVariable<T>
    Implements
    System.IDisposable
    Inherited Members
    System.Object.Equals(System.Object)
    System.Object.Equals(System.Object, System.Object)
    System.Object.GetHashCode()
    System.Object.GetType()
    System.Object.MemberwiseClone()
    System.Object.ReferenceEquals(System.Object, System.Object)
    System.Object.ToString()
    Namespace: ManagedCuda
    Assembly: ManagedCuda.dll
    Syntax
    public class CudaDeviceVariable<T> : IDisposable where T : struct
    Type Parameters
    Name Description
    T

    variable base type

    Constructors

    | Improve this Doc View Source

    CudaDeviceVariable(CUdeviceptr)

    Creates a new CudaDeviceVariable from an existing CUdeviceptr. The allocated size is gethered via the CUDA API. devPtr won't be freed while disposing.

    Declaration
    public CudaDeviceVariable(CUdeviceptr devPtr)
    Parameters
    Type Name Description
    CUdeviceptr devPtr
    | Improve this Doc View Source

    CudaDeviceVariable(CUdeviceptr, SizeT)

    Creates a new CudaDeviceVariable from an existing CUdeviceptr. devPtr won't be freed while disposing.

    Declaration
    public CudaDeviceVariable(CUdeviceptr devPtr, SizeT size)
    Parameters
    Type Name Description
    CUdeviceptr devPtr
    SizeT size

    Size in Bytes

    | Improve this Doc View Source

    CudaDeviceVariable(CUdeviceptr, Boolean)

    Creates a new CudaDeviceVariable from an existing CUdeviceptr. The allocated size is gethered via the CUDA API.

    Declaration
    public CudaDeviceVariable(CUdeviceptr devPtr, bool isOwner)
    Parameters
    Type Name Description
    CUdeviceptr devPtr
    System.Boolean isOwner

    The CUdeviceptr will be freed while disposing, if the CudaDeviceVariable is the owner

    | Improve this Doc View Source

    CudaDeviceVariable(CUdeviceptr, Boolean, SizeT)

    Creates a new CudaDeviceVariable from an existing CUdeviceptr.

    Declaration
    public CudaDeviceVariable(CUdeviceptr devPtr, bool isOwner, SizeT size)
    Parameters
    Type Name Description
    CUdeviceptr devPtr
    System.Boolean isOwner

    The CUdeviceptr will be freed while disposing, if the CudaDeviceVariable is the owner

    SizeT size

    Size in Bytes

    | Improve this Doc View Source

    CudaDeviceVariable(CUmodule, String)

    Creates a new CudaDeviceVariable from definition in cu-file.

    Declaration
    public CudaDeviceVariable(CUmodule module, string name)
    Parameters
    Type Name Description
    CUmodule module

    The module where the variable is defined in.

    System.String name

    The variable name as defined in the cu-file.

    | Improve this Doc View Source

    CudaDeviceVariable(SizeT)

    Creates a new CudaDeviceVariable and allocates the memory on the device

    Declaration
    public CudaDeviceVariable(SizeT size)
    Parameters
    Type Name Description
    SizeT size

    In elements

    | Improve this Doc View Source

    CudaDeviceVariable(CudaKernel, String)

    Creates a new CudaDeviceVariable from definition in cu-file.

    Declaration
    public CudaDeviceVariable(CudaKernel kernel, string name)
    Parameters
    Type Name Description
    CudaKernel kernel

    The kernel which module defines the variable.

    System.String name

    The variable name as defined in the cu-file.

    Properties

    | Improve this Doc View Source

    DevicePointer

    Device pointer

    Declaration
    public CUdeviceptr DevicePointer { get; }
    Property Value
    Type Description
    CUdeviceptr
    | Improve this Doc View Source

    IsOwner

    If the wrapper class instance is the owner of a CUDA handle, it will be destroyed while disposing.

    Declaration
    public bool IsOwner { get; }
    Property Value
    Type Description
    System.Boolean
    | Improve this Doc View Source

    Item[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 index] { get; set; }
    Parameters
    Type Name Description
    SizeT index

    index in elements

    Property Value
    Type Description
    T
    | Improve this Doc View Source

    Null

    Gets a null-pointer equivalent

    Declaration
    public static CudaDeviceVariable<T> Null { get; }
    Property Value
    Type Description
    CudaDeviceVariable<T>
    | Improve this Doc View Source

    Size

    Size in elements

    Declaration
    public SizeT Size { get; }
    Property Value
    Type Description
    SizeT
    | Improve this Doc View Source

    SizeInBytes

    Size in bytes

    Declaration
    public SizeT SizeInBytes { get; }
    Property Value
    Type Description
    SizeT
    | Improve this Doc View Source

    TypeSize

    Type size in bytes

    Declaration
    public SizeT TypeSize { get; }
    Property Value
    Type Description
    SizeT

    Methods

    | Improve this Doc View Source

    AsyncCopyToDevice(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
    | Improve this Doc View Source

    AsyncCopyToDevice(CUdeviceptr, SizeT, SizeT, SizeT, CUstream)

    Async Copy data from device to device memory

    Declaration
    public void AsyncCopyToDevice(CUdeviceptr source, SizeT offsetSrc, SizeT offsetDest, SizeT sizeInBytes, CUstream stream)
    Parameters
    Type Name Description
    CUdeviceptr source

    Source pointer to device memory

    SizeT offsetSrc

    Offset to source pointer in bytes

    SizeT offsetDest

    Offset to destination pointer in bytes

    SizeT sizeInBytes

    Size to copy in bytes

    CUstream stream
    | Improve this Doc View Source

    AsyncCopyToDevice(CUdeviceptr, SizeT, SizeT, SizeT, CudaStream)

    Async Copy data from device to device memory

    Declaration
    public void AsyncCopyToDevice(CUdeviceptr source, SizeT offsetSrc, SizeT offsetDest, SizeT sizeInBytes, CudaStream stream)
    Parameters
    Type Name Description
    CUdeviceptr source

    Source pointer to device memory

    SizeT offsetSrc

    Offset to source pointer in bytes

    SizeT offsetDest

    Offset to destination pointer in bytes

    SizeT sizeInBytes

    Size to copy in bytes

    CudaStream stream
    | Improve this Doc View Source

    AsyncCopyToDevice(CUdeviceptr, CudaStream)

    Async Copy data from device to device memory

    Declaration
    public void AsyncCopyToDevice(CUdeviceptr source, CudaStream stream)
    Parameters
    Type Name Description
    CUdeviceptr source

    Source pointer to device memory

    CudaStream stream
    | Improve this Doc View Source

    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
    | Improve this Doc View Source

    AsyncCopyToDevice(CudaDeviceVariable<T>, SizeT, SizeT, SizeT, CUstream)

    Async Copy data from device to device memory

    Declaration
    public void AsyncCopyToDevice(CudaDeviceVariable<T> source, SizeT offsetSrc, SizeT offsetDest, SizeT sizeInBytes, CUstream stream)
    Parameters
    Type Name Description
    CudaDeviceVariable<T> source

    Source

    SizeT offsetSrc

    Offset to source pointer in bytes

    SizeT offsetDest

    Offset to destination pointer in bytes

    SizeT sizeInBytes

    Size to copy in bytes

    CUstream stream
    | Improve this Doc View Source

    AsyncCopyToDevice(CudaDeviceVariable<T>, SizeT, SizeT, SizeT, CudaStream)

    Async Copy data from device to device memory

    Declaration
    public void AsyncCopyToDevice(CudaDeviceVariable<T> source, SizeT offsetSrc, SizeT offsetDest, SizeT sizeInBytes, CudaStream stream)
    Parameters
    Type Name Description
    CudaDeviceVariable<T> source

    Source

    SizeT offsetSrc

    Offset to source pointer in bytes

    SizeT offsetDest

    Offset to destination pointer in bytes

    SizeT sizeInBytes

    Size to copy in bytes

    CudaStream stream
    | Improve this Doc View Source

    AsyncCopyToDevice(CudaDeviceVariable<T>, CudaStream)

    Async Copy data from device to device memory

    Declaration
    public void AsyncCopyToDevice(CudaDeviceVariable<T> source, CudaStream stream)
    Parameters
    Type Name Description
    CudaDeviceVariable<T> source

    Source

    CudaStream stream
    | Improve this Doc View Source

    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
    | Improve this Doc View Source

    AsyncCopyToDevice(CudaPitchedDeviceVariable<T>, SizeT, SizeT, SizeT, SizeT, CUstream)

    Async Copy from device to device memory

    Declaration
    public void AsyncCopyToDevice(CudaPitchedDeviceVariable<T> deviceSrc, SizeT offsetSrc, SizeT offsetDest, SizeT width, SizeT height, CUstream stream)
    Parameters
    Type Name Description
    CudaPitchedDeviceVariable<T> deviceSrc

    Source

    SizeT offsetSrc

    Offset to source pointer in bytes

    SizeT offsetDest

    Offset to destination pointer in bytes

    SizeT width

    Width of 2D memory to copy in bytes

    SizeT height

    Height in elements

    CUstream stream
    | Improve this Doc View Source

    AsyncCopyToDevice(CudaPitchedDeviceVariable<T>, SizeT, SizeT, SizeT, SizeT, CudaStream)

    Async Copy from device to device memory

    Declaration
    public void AsyncCopyToDevice(CudaPitchedDeviceVariable<T> deviceSrc, SizeT offsetSrc, SizeT offsetDest, SizeT width, SizeT height, CudaStream stream)
    Parameters
    Type Name Description
    CudaPitchedDeviceVariable<T> deviceSrc

    Source

    SizeT offsetSrc

    Offset to source pointer in bytes

    SizeT offsetDest

    Offset to destination pointer in bytes

    SizeT width

    Width of 2D memory to copy in bytes

    SizeT height

    Height in elements

    CudaStream stream
    | Improve this Doc View Source

    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
    | Improve this Doc View Source

    CopyToDevice(T)

    Copy data from host to device memory

    Declaration
    public void CopyToDevice(T source)
    Parameters
    Type Name Description
    T source

    Source pointer to host memory

    | Improve this Doc View Source

    CopyToDevice(T, SizeT)

    Copy data from host to device memory

    Declaration
    public void CopyToDevice(T source, SizeT offsetDest)
    Parameters
    Type Name Description
    T source

    Source pointer to host memory

    SizeT offsetDest

    Offset to destination pointer in bytes

    | Improve this Doc View Source

    CopyToDevice(T[])

    Copy data from host to device memory

    Declaration
    public void CopyToDevice(T[] source)
    Parameters
    Type Name Description
    T[] source

    Source pointer to host memory

    | Improve this Doc View Source

    CopyToDevice(T[], SizeT, SizeT, SizeT)

    Copy data from host to device memory

    Declaration
    public void CopyToDevice(T[] source, SizeT offsetSrc, SizeT offsetDest, SizeT sizeInBytes)
    Parameters
    Type Name Description
    T[] source

    Source pointer to host memory

    SizeT offsetSrc

    Offset to source pointer in bytes

    SizeT offsetDest

    Offset to destination pointer in bytes

    SizeT sizeInBytes

    Size to copy in bytes

    | Improve this Doc View Source

    CopyToDevice(CUdeviceptr)

    Copy data from device to device memory

    Declaration
    public void CopyToDevice(CUdeviceptr source)
    Parameters
    Type Name Description
    CUdeviceptr source

    Source pointer to device memory

    | Improve this Doc View Source

    CopyToDevice(CUdeviceptr, SizeT, SizeT, SizeT)

    Copy data from device to device memory

    Declaration
    public void CopyToDevice(CUdeviceptr source, SizeT offsetSrc, SizeT offsetDest, SizeT sizeInBytes)
    Parameters
    Type Name Description
    CUdeviceptr source

    Source pointer to device memory

    SizeT offsetSrc

    Offset to source pointer in bytes

    SizeT offsetDest

    Offset to destination pointer in bytes

    SizeT sizeInBytes

    Size to copy in bytes

    | Improve this Doc View Source

    CopyToDevice(CudaDeviceVariable<T>)

    Copy data from device to device memory

    Declaration
    public void CopyToDevice(CudaDeviceVariable<T> source)
    Parameters
    Type Name Description
    CudaDeviceVariable<T> source

    Source

    | Improve this Doc View Source

    CopyToDevice(CudaDeviceVariable<T>, SizeT, SizeT, SizeT)

    Copy data from device to device memory

    Declaration
    public void CopyToDevice(CudaDeviceVariable<T> source, SizeT offsetSrc, SizeT offsetDest, SizeT sizeInBytes)
    Parameters
    Type Name Description
    CudaDeviceVariable<T> source

    Source

    SizeT offsetSrc

    Offset to source pointer in bytes

    SizeT offsetDest

    Offset to destination pointer in bytes

    SizeT sizeInBytes

    Size to copy in bytes

    | Improve this Doc View Source

    CopyToDevice(CudaPitchedDeviceVariable<T>)

    Copy from device to device memory

    Declaration
    public void CopyToDevice(CudaPitchedDeviceVariable<T> deviceSrc)
    Parameters
    Type Name Description
    CudaPitchedDeviceVariable<T> deviceSrc

    Source

    | Improve this Doc View Source

    CopyToDevice(CudaPitchedDeviceVariable<T>, SizeT, SizeT, SizeT, SizeT)

    Copy from device to device memory

    Declaration
    public void CopyToDevice(CudaPitchedDeviceVariable<T> deviceSrc, SizeT offsetSrc, SizeT offsetDest, SizeT widthInBytes, SizeT height)
    Parameters
    Type Name Description
    CudaPitchedDeviceVariable<T> deviceSrc

    Source

    SizeT offsetSrc

    Offset to source pointer in bytes

    SizeT offsetDest

    Offset to destination pointer in bytes

    SizeT widthInBytes

    Width of 2D memory to copy in bytes

    SizeT height

    Height in elements

    | Improve this Doc View Source

    CopyToDevice(Array)

    Copy from Host to device memory. Array elements can be of any (value)type, but total size in bytes must match to allocated device memory.

    Declaration
    public void CopyToDevice(Array hostSrc)
    Parameters
    Type Name Description
    System.Array hostSrc

    Source

    | Improve this Doc View Source

    CopyToDevice(IntPtr)

    Copy data from host to device memory

    Declaration
    public void CopyToDevice(IntPtr source)
    Parameters
    Type Name Description
    System.IntPtr source

    Source pointer to host memory

    | Improve this Doc View Source

    CopyToDevice(IntPtr, SizeT)

    Copy data from host to device memory

    Declaration
    public void CopyToDevice(IntPtr source, SizeT offsetDest)
    Parameters
    Type Name Description
    System.IntPtr source

    Source pointer to host memory

    SizeT offsetDest

    Offset to destination pointer in bytes

    | Improve this Doc View Source

    CopyToDevice(IntPtr, SizeT, SizeT, SizeT)

    Copy data from host to device memory

    Declaration
    public void CopyToDevice(IntPtr source, SizeT offsetSrc, SizeT offsetDest, SizeT sizeInBytes)
    Parameters
    Type Name Description
    System.IntPtr source

    Source pointer to host memory

    SizeT offsetSrc

    Offset to source pointer in bytes

    SizeT offsetDest

    Offset to destination pointer in bytes

    SizeT sizeInBytes

    Size to copy in bytes

    | Improve this Doc View Source

    CopyToHost(ref T)

    Copy data from device to host memory

    Declaration
    public void CopyToHost(ref T dest)
    Parameters
    Type Name Description
    T dest

    Destination data in host memory

    | Improve this Doc View Source

    CopyToHost(ref T, SizeT)

    Copy data from device to host memory

    Declaration
    public void CopyToHost(ref T dest, SizeT offsetSrc)
    Parameters
    Type Name Description
    T dest

    Destination data in host memory

    SizeT offsetSrc

    Offset to source pointer in bytes

    | Improve this Doc View Source

    CopyToHost(T[])

    Copy data from device to host memory

    Declaration
    public void CopyToHost(T[] dest)
    Parameters
    Type Name Description
    T[] dest

    Destination pointer to host memory

    | Improve this Doc View Source

    CopyToHost(T[], SizeT, SizeT, SizeT)

    Copy data from device to host memory

    Declaration
    public void CopyToHost(T[] dest, SizeT offsetSrc, SizeT offsetDest, SizeT sizeInBytes)
    Parameters
    Type Name Description
    T[] dest

    Destination pointer to host memory

    SizeT offsetSrc

    Offset to source pointer in bytes

    SizeT offsetDest

    Offset to destination pointer in bytes

    SizeT sizeInBytes

    Size to copy in bytes

    | Improve this Doc View Source

    CopyToHost(Array)

    Copy data from this device to host memory. Array elements can be of any (value)type, but total size in bytes must match to allocated device memory.

    Declaration
    public void CopyToHost(Array hostDest)
    Parameters
    Type Name Description
    System.Array hostDest

    Destination

    | Improve this Doc View Source

    CopyToHost(IntPtr)

    Copy data from device to host memory

    Declaration
    public void CopyToHost(IntPtr dest)
    Parameters
    Type Name Description
    System.IntPtr dest

    Destination pointer to host memory

    | Improve this Doc View Source

    CopyToHost(IntPtr, SizeT)

    Copy data from device to host memory

    Declaration
    public void CopyToHost(IntPtr dest, SizeT offsetSrc)
    Parameters
    Type Name Description
    System.IntPtr dest

    Destination data in host memory

    SizeT offsetSrc

    Offset to source pointer in bytes

    | Improve this Doc View Source

    CopyToHost(IntPtr, SizeT, SizeT, SizeT)

    Copy data from device to host memory

    Declaration
    public void CopyToHost(IntPtr dest, SizeT offsetSrc, SizeT offsetDest, SizeT sizeInBytes)
    Parameters
    Type Name Description
    System.IntPtr dest

    Destination pointer to host memory

    SizeT offsetSrc

    Offset to source pointer in bytes

    SizeT offsetDest

    Offset to destination pointer in bytes

    SizeT sizeInBytes

    Size to copy in bytes

    | Improve this Doc View Source

    Dispose()

    Dispose

    Declaration
    public void Dispose()
    | Improve this Doc View Source

    Dispose(Boolean)

    For IDisposable

    Declaration
    protected virtual void Dispose(bool fDisposing)
    Parameters
    Type Name Description
    System.Boolean fDisposing
    | Improve this Doc View Source

    Finalize()

    For dispose

    Declaration
    protected void Finalize()
    | Improve this Doc View Source

    Memset(Byte)

    Memset

    Declaration
    public void Memset(byte aValue)
    Parameters
    Type Name Description
    System.Byte aValue
    | Improve this Doc View Source

    Memset(UInt16)

    Memset

    Declaration
    public void Memset(ushort aValue)
    Parameters
    Type Name Description
    System.UInt16 aValue
    | Improve this Doc View Source

    Memset(UInt32)

    Memset

    Declaration
    public void Memset(uint aValue)
    Parameters
    Type Name Description
    System.UInt32 aValue
    | Improve this Doc View Source

    MemsetAsync(Byte, CUstream)

    Memset

    Declaration
    public void MemsetAsync(byte aValue, CUstream stream)
    Parameters
    Type Name Description
    System.Byte aValue
    CUstream stream
    | Improve this Doc View Source

    MemsetAsync(UInt16, CUstream)

    Memset

    Declaration
    public void MemsetAsync(ushort aValue, CUstream stream)
    Parameters
    Type Name Description
    System.UInt16 aValue
    CUstream stream
    | Improve this Doc View Source

    MemsetAsync(UInt32, CUstream)

    Memset

    Declaration
    public void MemsetAsync(uint aValue, CUstream stream)
    Parameters
    Type Name Description
    System.UInt32 aValue
    CUstream stream
    | Improve this Doc View Source

    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

    | Improve this Doc View Source

    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
    | Improve this Doc View Source

    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

    | Improve this Doc View Source

    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 Source

    Implicit(T to CudaDeviceVariable<T>)

    Converts a host array to a newly allocated device variable.

    Declaration
    public static implicit operator CudaDeviceVariable<T>(T d)
    Parameters
    Type Name Description
    T d

    host array

    Returns
    Type Description
    CudaDeviceVariable<T>

    newly allocated device variable with values from host memory

    | Improve this Doc View Source

    Implicit(T[] to CudaDeviceVariable<T>)

    Converts a host array to a newly allocated device variable.

    Declaration
    public static implicit operator CudaDeviceVariable<T>(T[] d)
    Parameters
    Type Name Description
    T[] d

    host array

    Returns
    Type Description
    CudaDeviceVariable<T>

    newly allocated device variable with values from host memory

    | Improve this Doc View Source

    Implicit(CudaDeviceVariable<T> to T)

    Converts a device variable to a host value. In case of multiple device values, only the first value is copied.

    Declaration
    public static implicit operator T(CudaDeviceVariable<T> d)
    Parameters
    Type Name Description
    CudaDeviceVariable<T> d

    device variable

    Returns
    Type Description
    T

    newly allocated host variable with value from device memory

    | Improve this Doc View Source

    Implicit(CudaDeviceVariable<T> to T[])

    Converts a device variable to a host array

    Declaration
    public static implicit operator T[](CudaDeviceVariable<T> d)
    Parameters
    Type Name Description
    CudaDeviceVariable<T> d

    device variable

    Returns
    Type Description
    T[]

    newly allocated host array with values from device memory

    Implements

    System.IDisposable
    • Improve this Doc
    • View Source
    Back to top Generated by DocFX