问题
I'm trying to compile a program to run some opencl code using Cloo.
static void Main(string[] arg)
{
CLCalc.InitCL();
string src = File.ReadAllText("kernels.cl");
CLCalc.Program.Compile(src);
}
The program was previously working fine, but now I get a null reference exception.
At first I thought there was a bug in my opencl code but I replaced the opencl with a very simple kernel and it still would not compile.ie:
static void Main(string[] arg)
{
CLCalc.InitCL();
//string src = File.ReadAllText("kernels.cl");
string src = "__kernel void hello(__global char * out){}";
CLCalc.Program.Compile(src);
}
Note that there is no device present. Why would this be? I have a GPU...
This has been a problem since installing the CUDA tooklkit on my PC. Is it even possible for this to be the cause though?
EDIT
I've created a very simple project with only a few lines of code which exbits my bug.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using OpenCL;
using OpenCL.Net;
using OpenCLTemplate;
namespace ClooTest
{
class Program
{
static void Main(string[] args)
{
CLCalc.InitCL();
string src = "__kernel void hello(__global char * out){}";
CLCalc.Program.Compile(src);
}
}
}
EDIT
I've recoverd an old working copy of my program from USB. It ran fine on my home PC. But I get the same bug when I run it on my work PC.
EDIT
If I put a break point in before the compile line I can see an exception
Why would it not be finding my device all of a sudden?
EDIT
When I look at my OpenCL devices the only one listed as default device is my CPU ...
Why!?
来源:https://stackoverflow.com/questions/24005511/opencl-cloo-null-referenece-exception-when-compiling-kernel