Reputation: 1405
I am trying to use aleagpu but I get the System.TypeInitializationException. I have tried to google what the problem is but I couldn't find any solution, so please help. The program is the simplest possible:
class Klazz
{
private const int N = 100;
private const int Length = 10000000;
var gpu = Gpu.Default;// here is the Exception thrown
public static void Unmanaged()
{
var data = new int[Length];
for (var k = 0; k < N; k++)
gpu.For(0, data.Length, i => data[i] += 1);
}
}
I am imagining that there is something wrong in my installation, because the program is a copied example from aleagpu's homepage.
My system is:
Alea is installed from NuGet November 9. 2016
The variables in PATH is correct.
I have tried the AleaSample.CS.ParallelForAutoMemMgt as well with the same result.
Upvotes: 5
Views: 861
Reputation: 1610
Also, please make sure that you either install version 2.2 or version 3.x. For the new version 3.x you only need to install the Alea or the Alea.Fody package [https://www.nuget.org/packages/Alea/3.0.1][1] and do not mix with the 2.2 packages.
Upvotes: 1
Reputation: 1405
It turns out that aleagpu is written in F#, and when you install FSharp.Core the program works. Thanks to Ghosthack answering the question: Alea GPU Tutorial not compiling on VS 2015 Update 2 with FSharp.Core 4.4.0.0
Upvotes: 5