Project Description
ManagedCUDA aims an easy integration of NVidia's CUDA in .net applications written in C#, Visual Basic or any other .net language. For this it includes:
- A complete wrapper for the CUDA Driver API, version 4.2 (a 1:1 representation of cuda.h in C#)
- Wrapper for graphics interop with DirectX and OpenGL respectively SlimDX and OpenTK
- Based on this, wrapper classes for CUDA context, kernel, device variable, etc.
For example: copy data from host to device looks like CudaDeviceVariable<Type>.CopyToDevice(Type[] hostArray)
- CUDA vector types like int2, float3 etc. with proper ToString() methods and operators (+, –, *, /)
- New: Implicit converter operators: Allocate and initialize device or host arrays in only one line of code:
float3[] array_host = new float3[100];
for (int i = 0; i < 100; i++)
{
array_host[i] = new float3(i, i+1, i+2);
}
CudaDeviceVariable<float3> array_device = array_host; //init device memory and copy data
float3[] array_host2 = array_device; //init host array and copy data
- New: Access device memory directly per element using [] operator.
- Define your own types: the CudaDeviceVariable accepts any user defined type if it is a value type, i.e. a struct in C#
- The only CUDA wrapper for .net including all CUDA libraries: CUFFT, CURAND, CUSPARSE, CUBLAS and NPP
- Compiles for .net 2.0 and .net 4.0 (default), runs also on mono and Linux but you need to adopt the library names in source code.