![]() |
VOOZH | about |
dotnet add package ManagedCuda-CUFFT --version 13.0.64
NuGet\Install-Package ManagedCuda-CUFFT -Version 13.0.64
<PackageReference Include="ManagedCuda-CUFFT" Version="13.0.64" />
<PackageVersion Include="ManagedCuda-CUFFT" Version="13.0.64" />Directory.Packages.props
<PackageReference Include="ManagedCuda-CUFFT" />Project file
paket add ManagedCuda-CUFFT --version 13.0.64
#r "nuget: ManagedCuda-CUFFT, 13.0.64"
#:package ManagedCuda-CUFFT@13.0.64
#addin nuget:?package=ManagedCuda-CUFFT&version=13.0.64Install as a Cake Addin
#tool nuget:?package=ManagedCuda-CUFFT&version=13.0.64Install as a Cake Tool
It all started as a hobby project to easily access CUDA from C# - at that time CUDA was available in version 3. Now more than 10 years later, managedCuda is still alive and is updated regularly by me to the latest versions of CUDA. In order to support further developments, I switched from the LGPL license to a dual-license GPLv3 / commercial license starting with managedCuda for Cuda version 12 onwards. In case you plan to use managedCuda 12+ for a commercial project, please contact me by mail: managedcuda@articimaging.eu. If you use the open-source license and want to contribute to future development, you can donate me a beer here:
One can find multiple packages for managedCuda on nuget, but the official packages are:
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:
CudaDeviceVariable<float> devVar = new CudaDeviceVariable<float>(64);
devVar[0] = 1.0f;
devVar[1] = 2.0f;
float hostVar1 = devVar[0];
float hostVar2 = devVar[1];
float3[] array_host = new float3[100];
for (int i = 0; i < 100; i++)
{
array_host[i] = new float3(i, i+1, i+2);
}
//alloc device memory and copy data:
CudaDeviceVariable<float3> array_device = array_host;
//alloc host array and copy data:
float3[] array_host2 = array_device;
Random rand = new Random();
int length = 256;
//init some ramdom values
double[] randoms = new double[length];
for (int i = 0; i < length; i++)
{
randoms[i] = rand.NextDouble();
}
//Alloc device memory
CudaDeviceVariable<double> a = randoms;
CudaDeviceVariable<double> b = new CudaDeviceVariable<double>(length);
b.Set(10.0); //NPPs method
int size = a.MeanGetBufferSize(); //NPPs method
//Alloc temporary memory for NPPs mean method
CudaDeviceVariable<byte> buffer = new CudaDeviceVariable<byte>(size);
CudaDeviceVariable<double> mean = new CudaDeviceVariable<double>(1);
a.Mul(b); //NPPs method
a.DivC(10.0); //NPPs method
a.Mean(mean, buffer); //NPPs method
//Copy data back to host
double m = mean;
double[] res = a;
//Clean up
mean.Dispose();
buffer.Dispose();
b.Dispose();
a.Dispose();
Nvidia changed the cuda context behavior in the cuda libraries (NPP, Cufft, etc.) why it is highly recommended to use a PrimaryContext instead of a CudaContext when using ManagedCUDA together with Cuda libraries. To create a PrimaryContext in ManagedCUDA, use the following lines of code:
int deviceID = 0;
PrimaryContext ctx = new PrimaryContext(deviceID);
// Set current to CPU thread, mandatory for a PrimaryContext
ctx.SetCurrent();
NPP in Cuda 13 removed the NppStreamContext initialization API and requires manual setting of all fields, which is now done by ManagedCUDA. To initialize a NppStreamContext:
// Create a NppStreamContext from default Null-Stream:
NppStreamContext streamCtx = new NppStreamContext(CUstream.NullStream);
// Create a NppStreamContext from a custom stream
CudaStream stream2 = new CudaStream(CUStreamFlags.Default);
NppStreamContext streamCtx2 = new NppStreamContext(stream2);
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 net5.0 was computed. net5.0-windows net5.0-windows was computed. net6.0 net6.0 is compatible. net6.0-android net6.0-android was computed. net6.0-ios net6.0-ios was computed. net6.0-maccatalyst net6.0-maccatalyst was computed. net6.0-macos net6.0-macos was computed. net6.0-tvos net6.0-tvos was computed. net6.0-windows net6.0-windows was computed. net7.0 net7.0 was computed. net7.0-android net7.0-android was computed. net7.0-ios net7.0-ios was computed. net7.0-maccatalyst net7.0-maccatalyst was computed. net7.0-macos net7.0-macos was computed. net7.0-tvos net7.0-tvos was computed. net7.0-windows net7.0-windows was computed. net8.0 net8.0 is compatible. net8.0-android net8.0-android was computed. net8.0-browser net8.0-browser was computed. net8.0-ios net8.0-ios was computed. net8.0-maccatalyst net8.0-maccatalyst was computed. net8.0-macos net8.0-macos was computed. net8.0-tvos net8.0-tvos was computed. net8.0-windows net8.0-windows was computed. net9.0 net9.0 was computed. net9.0-android net9.0-android was computed. net9.0-browser net9.0-browser was computed. net9.0-ios net9.0-ios was computed. net9.0-maccatalyst net9.0-maccatalyst was computed. net9.0-macos net9.0-macos was computed. net9.0-tvos net9.0-tvos was computed. net9.0-windows net9.0-windows was computed. net10.0 net10.0 was computed. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
| .NET Core | netcoreapp3.1 netcoreapp3.1 is compatible. |
| .NET Framework | net48 net48 is compatible. net481 net481 was computed. |
Showing the top 2 NuGet packages that depend on ManagedCuda-CUFFT:
| Package | Downloads |
|---|---|
|
alarmclockkisser.AsynCUDA
async CUDA Kernel & FFT operations |
|
|
AsynCUDA12.Runtime
Package Description |
Showing the top 2 popular GitHub repositories that depend on ManagedCuda-CUFFT:
| Repository | Stars |
|---|---|
|
kunzmi/ImageStackAlignator
Implementation of Google's Handheld Multi-Frame Super-Resolution algorithm (from Pixel 3 and Pixel 4 camera)
|
|
|
GoodAI/BrainSimulator
Brain Simulator is a platform for visual prototyping of artificial intelligence architectures.
|
| Version | Downloads | Last Updated |
|---|---|---|
| 13.0.64 | 532 | 11/4/2025 |
| 12.8.60 | 1,060 | 3/3/2025 |
| 12.4.57 | 853 | 3/22/2024 |
| 12.3.54 | 1,028 | 1/2/2024 |
| 12.2.52 | 1,107 | 7/13/2023 |
| 12.1.51 | 386 | 5/18/2023 |
| 12.0.48 | 526 | 1/29/2023 |
| 11.4.47 | 1,091 | 8/19/2021 |
| 11.0.43 | 1,612 | 7/16/2020 |
| 10.2.41 | 7,317 | 4/26/2020 |
| 10.0.31 | 16,527 | 10/28/2018 |
| 8.0.22 | 1,784 | 5/28/2017 |
| 8.0.13 | 1,871 | 10/23/2016 |