OpenCL Cloo Null referenece exception when compiling kernel

淺唱寂寞╮ 提交于 2019-12-11 14:36:20

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!