I am trying to get the "simple to use" Alea Libary to work (I have a RTX2080, so this shouldn't be the Problem).
The UI is WPF based and implemented in a .NET Core 3.1 project. It injects a "GpuCalculator" object into the "Core.Lib" (.Net Standard 2.1).
I created a .Net Standard 2.0 Class-Library for the execution (Core.Calculations Project). The GpuCalculator is implemented here. I installed the Alea NuGet Package (Version 3.0.4) along with the FSharp.Core (Version 5.0.1), which is needed from Alea. At first I had the same Problem described here: How to setup project using Alea GPU
That's why I added the following lines to my csproj File:
<ItemGroup>
<Reference Include="Alea">
<HintPath>$(NuGetPackageRoot)\alea\3.0.4\lib\net45\alea.dll</HintPath>
</Reference>
<Reference Include="Alea.IL">
<HintPath>$(NuGetPackageRoot)\alea\3.0.4\lib\net45\Alea.IL.dll</HintPath>
</Reference>
<Reference Include="Alea.Parallel">
<HintPath>$(NuGetPackageRoot)\alea\3.0.4\lib\net45\Alea.Parallel.dll</HintPath>
</Reference>
</ItemGroup>
The Problem now is that whenever I want to access "Gpu.Default", an Exception is thrown (NullReferenceException) from the F# Code. Even a simple access to Default doesn't work:
var gpu = Gpu.Default;
Results in an Error like this:
at Microsoft.FSharp.Core.LanguagePrimitives.IntrinsicFunctions.UnboxGeneric[T](Object source) in D:\workspace\_work\1\s\src\fsharp\FSharp.Core\prim-types.fs:line 647
I also tried to switch my target platform from "Any CPU" to "x64" because I saw the hint somewhere. It had no effect though :(
I am thankful for every help!
Do I need any other NuGet packages? Should I probably switch to something different? Cudafy? OpenGL (via OpenTK) Compute-Shaders? Vulcan (C#?)...?
edit: On my Latop I get the following error when I want to access the Gpu.Default:
Method not found: 'System.Reflection.Emit.AssemblyBuilder System.AppDomain.DefineDynamicAssembly(System.Reflection.AssemblyName, System.Reflection.Emit.AssemblyBuilderAccess)'.