C#GPGPU库混合错误
我是GPU计算新手。我找到了一个叫做的在线图书馆。他们说 “Hybrid.Net使.Net开发人员能够利用GPU的强大功能,使用简单的众所周知的构造:Parallel.for,用于数据和计算密集型应用程序。” 我下载了这个库,当我运行helloworld应用程序时,它们提供了C#GPGPU库混合错误,c#,gpgpu,C#,Gpgpu,我是GPU计算新手。我找到了一个叫做的在线图书馆。他们说 “Hybrid.Net使.Net开发人员能够利用GPU的强大功能,使用简单的众所周知的构造:Parallel.for,用于数据和计算密集型应用程序。” 我下载了这个库,当我运行helloworld应用程序时,它们提供了 using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Ta
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Hybrid.Gpu;
using Hybrid.MsilToOpenCL;
using Hybrid;
using OpenCLNet;
namespace ConsoleApplication2
{
class Program
{
static void Main(string[] args)
{
//define vectors a, b and c
int vectorLength = 1024;
int[] a = new int[vectorLength];
int[] b = new int[vectorLength];
int[] c = new int[vectorLength];
//initialize vectors a, b and c
//execute vector addition on GPU
Hybrid.Parallel.For(Execute.OnSingleGpu, 0, vectorLength, delegate(int i)
{
c[i] = a[i] + b[i];
});
}
}
}
我明白了
有人能告诉我这里发生了什么事吗
(你知道我是StackOverflow新手。)检查内部异常。它将包含您需要的详细信息。您的意思是像“试一试”一样?。我什么都没试过,但我得到了上面给你的信息。@KamalRathnayake当你说“我得到”时,你是在写异常信息。但该异常对象具有“InnerException”属性。该属性有时为null,但当发生类型初始化异常时,它将原始异常存储在InnerException属性中。它应该为您提供有关该类型初始化失败原因的更多信息。
An unhandled exception of type 'System.TypeInitializationException' occurred in Hybrid.MsilToOpenCL.dll
Additional information: The type initializer for 'OpenCLNet.OpenCL' threw an exception.