0

I have been referencing the examples on Alea GPU's website (http://www.aleagpu.com/release/3_0_3/doc/gpu_programming_csharp.html), but I am unable to get a Kernel to launch. I believe I have set everything up correctly but even their examples give compile issues.

Given a kernel of:

private static void Kernel(int[] result, int[] arg1, int[] arg2)
{
    var start = blockIdx.x*blockDim.x + threadIdx.x;
    var stride = gridDim.x*blockDim.x;
    for (var i = start; i < result.Length; i += stride)
    {
        result[i] = arg1[i] + arg2[i];
    }
}

And the code to run it:

gpu.Launch(Kernel, lp, result, arg1, arg2);

Visual Studio (2017 Community) complains: 'Gpu' does not contain a definition for 'Launch' and no extension method 'Launch' accepting a first argument of type 'Gpu' could be found (are you missing a using directive or an assembly reference?)

I believe I have Alea GPU set up properly. I used nuget to install both it and Fody as per the instructions on its site (http://www.aleagpu.com/release/3_0_3/doc/installation.html). I also installed the F# package required for Alea GPU.

Is my installation correct? If so, am I using outdated documentation or is something else wrong with how I am trying to launch the kernel?

2 Answers 2

0

Solved it while I was looking into alternative solutions. I needed to import Alea.CSharp in addition to Alea.

using Alea;
using Alea.CSharp;

Funnily enough, Visual Studio didn't prompt me to import Alea.CSharp until I had something else written that needed it, once I imported it I noticed that the error for gpu.Launch went away.

0

The right syntax is

var gpu = Gpu.Default;
gpu.Launch(...);

or

Gpu.Default.Launch(...);

and yes, you need

using Alea;
using Alea.CSharp;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.