Show / Hide Table of Contents

Class CudaMarshaler

Marshaler to CUDA device memory

Usage example: \begin{lstlisting}[style=customcs]

[DllImport("{cuda DLL name}.dll", EntryPoint = "{EntryPointName}_ExternCWrapper_CUDA", CallingConvention = CallingConvention.Cdecl)] private static extern int methodName( int gridDimX, int gridDimY, int blockDimX, int blockDimY, int blockDimZ, int shared, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CudaMarshaler))] TypeToBemarshaled param);

\end{lstlisting}

Inheritance
System.Object
AbstractNativeMarshaler
CudaMarshaler
Implements
System.Runtime.InteropServices.ICustomMarshaler
Inherited Members
AbstractNativeMarshaler.cleanUpNativeData
AbstractNativeMarshaler.IsCleanUpNativeData()
AbstractNativeMarshaler.CreatingThreadId
AbstractNativeMarshaler.MarshalNativeToManaged(IntPtr)
AbstractNativeMarshaler.MarshalManagedToNative(Object)
AbstractNativeMarshaler.CleanUpNativeData(IntPtr)
AbstractNativeMarshaler.CleanUpManagedData(Object)
AbstractNativeMarshaler.GetNativeDataSize()
AbstractNativeMarshaler.NbelementsInGhost
AbstractNativeMarshaler.Free()
AbstractNativeMarshaler.RegisterDLL(String)
AbstractNativeMarshaler.IsClean()
AbstractNativeMarshaler.AutoRegister(Assembly, Type)
AbstractNativeMarshaler.GetHandleDelegate(Delegate)
AbstractNativeMarshaler.CopyToSymbol(String, IntPtr, IntPtr, IntPtr, IntPtr)
AbstractNativeMarshaler.Flavor
AbstractNativeMarshaler.SetCustomMarshaler(Type, IHybCustomMarshaler)
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: Hybridizer.Runtime.CUDAImports
Assembly: Hybridizer.Runtime.CUDAImports.dll
Syntax
public class CudaMarshaler : AbstractNativeMarshaler, ICustomMarshaler

Constructors

CudaMarshaler()

constructor

Declaration
protected CudaMarshaler()

Properties

Instance

current instance

Declaration
public static CudaMarshaler Instance { get; set; }
Property Value
Type Description
CudaMarshaler

Methods

changeAggregation(Boolean)

Modify aggregation flag to enable marshaler aggregation

Declaration
public static void changeAggregation(bool useAggregation)
Parameters
Type Name Description
System.Boolean useAggregation

Create(Boolean, cuda.ICudaMarshalling)

Factory method

Declaration
public static CudaMarshaler Create(bool useAggregation, cuda.ICudaMarshalling cuda = null)
Parameters
Type Name Description
System.Boolean useAggregation

True: malloc and memcopy will be aggregated in one single large block

cuda.ICudaMarshalling cuda

Implementation of ICuda

Returns
Type Description
CudaMarshaler

The Instance of Marshaller (to be used with Instance property)

Create(Boolean, cudaStream_t, cuda.ICudaMarshalling)

Factory method

Declaration
public static CudaMarshaler Create(bool useAggregation, cudaStream_t stream, cuda.ICudaMarshalling cuda = null)
Parameters
Type Name Description
System.Boolean useAggregation

True: malloc and memcopy will be aggregated in one single large block

cudaStream_t stream

cuda stream for marshaller creation

cuda.ICudaMarshalling cuda

Implementation of ICuda

Returns
Type Description
CudaMarshaler

The Instance of Marshaller (to be used with Instance property)

GetInstance(String)

Necessary when using default DllImport-related marshaler.

Declaration
public static ICustomMarshaler GetInstance(string cookie)
Parameters
Type Name Description
System.String cookie
Returns
Type Description
System.Runtime.InteropServices.ICustomMarshaler

Implements

System.Runtime.InteropServices.ICustomMarshaler
Back to top Generated by DocFX