I started a new VS2017 c# console app project and installed Alea and Alea.Fody from package manager. Running a piece of sample code from the website gave me the following exception.
System.TypeInitializationException occurred HResult=0x80131534 Message=The type initializer for 'Alea.GlobalImplicitMemoryTracker' threw an exception. Source=Alea StackTrace: at Alea.GlobalImplicitMemoryTracker.GetInManagedFlag() at gputest.Program.DelegateWithClosureGpu() at gputest.Program.Main(String[] args) in c:\Users\myuser\documents\visual studio 2017\Projects\gputest\gputest\Program.cs:line 14
Inner Exception 1: TypeInitializationException: The type initializer for 'A.cf5aded17df9f7cc4c132234dda010fa7' threw an exception.
Inner Exception 2: FileNotFoundException: Could not load file or assembly 'FSharp.Core, Version=4.4.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
Here is the entire program.
using Alea;
using Alea.Parallel;
using System.Linq;
namespace gputest
{
class Program
{
private const int Length = 1000000;
static void Main(string[] args)
{
DelegateWithClosureGpu();
}
[GpuManaged]
public static void DelegateWithClosureGpu()
{
var arg1 = Enumerable.Range(0, Length).ToArray();
var arg2 = Enumerable.Range(0, Length).ToArray();
var result = new int[Length];
Gpu.Default.For(0, result.Length, i => result[i] = arg1[i] + arg2[i]);
var expected = arg1.Zip(arg2, (x, y) => x + y);
//Assert.That(result, Is.EqualTo(expected));
}
}
}