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}
Implements
Inherited Members
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 |