我正在尝试使用 aleagpu,但我得到了 System.TypeInitializationException。我试图用谷歌搜索问题所在,但找不到任何解决方案,所以请帮忙。该程序尽可能简单:
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);
}
}
我在想我的安装有问题,因为程序是从 aleagpu 的主页复制的示例。
我的系统是:
- Windows 10
- .NET v4.5.2
- VS 2015 社区 NVIDIA GPU计算工具包CUDA v8.0
Alea 于 2016 年 11 月 9 日从 NuGet 安装
- 阿莉亚 (3.0.1)
- Alea.IL (2.2.0.3307)
- Alea.CUDA (2.2.0.3307)
- Alea.CUDA.IL (2.2.0.3307)
- Alea.CUDA.Unbound (2.2.0.3307)
PATH 中的变量是正确的。
我也尝试了 AleaSample.CS.ParallelForAutoMemMgt,结果相同。
最佳答案
事实证明,aleagpu 是用 F# 编写的,当您安装 FSharp.Core 时,该程序可以运行。 感谢 Ghosthack 回答问题:Alea GPU Tutorial not compiling on VS 2015 Update 2 with FSharp.Core 4.4.0.0
关于c# - aleagpu 抛出的 TypeInitializationException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40503817/