2013-08-27 66 views
0

我是GPGPU计算新手。我发现这个在线库叫做Hybrid。他们说C#GPGPU库混合错误

“Hybrid.Net使.NET开发人员使用简单的众所周知的结构,以充分利用GPU的强大动力的数据和计算密集型应用程序:的Parallel.For”

我下载的图书馆和时我运行他们提供的是

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]; 
      }); 
     } 
    } 
} 

HelloWorld应用程序我得到

An unhandled exception of type 'System.TypeInitializationException' occurred in Hybrid.MsilToOpenCL.dll 

Additional information: The type initializer for 'OpenCLNet.OpenCL' threw an exception. 

谁能告诉我这里发生了什么?

(只是让你知道我是新的StackOverflow。)

回答

0

检查内部异常。它会有你需要的细节。

+0

你的意思就像尝试抓住的东西?我什么都没做,我收到了上面给你的信息。 –

+0

@KamalRathnayake当你说“我得到”时,你会放下异常消息。但该异常对象具有“InnerException”属性。该属性有时为空,但是当发生类型初始化异常时,它将原始异常存储在InnerException属性中。它应该给你更多关于该类型初始化失败的信息。 – McKay