Search code examples
c#visual-studio-2017cufftaleagpu

cuFFT in Alea GPU


I am using Alea GPU to program on GPU using C# language. I installed Alea 3.0.4 on Visual Studio 2017 project, but I can't find some cuFFT library. On NVidia's website stands cuFFT is part of CUDA Toolkit, so I don't need to download additional CUDA libraries. Do I need to downlaod some additional binding or it is possible to use cuFFT with Alea GPU?


Solution

  • The bindings you're searching are here: https://www.nuget.org/packages/Alea.CudaToolkit/

    In order for these to work you need to have CUDA Tooklit installed in your machine. (v7.5 or greater)

    Here's an example on how to use it:

    using Alea.CudaToolkit;
    
    int plan;
    int padSize = ...
    SafeCall(CuFFT.cufftPlan1d(&plan, padSize, cufftType_t.CUFFT_C2C, 1));
    

    or...

    using Alea.CudaToolkit;
    
    int handle;
    SafeCall(CuFFT.cufftCreate(&handle));
    

    SafeCall is defined as:

    private static void SafeCall(cufftResult_t status)
    {
        if (status != cufftResult_t.CUFFT_SUCCESS)
        {
            throw new InvalidOperationException(status.ToString());
        }
    }