Ubuntu 16.10 CUDA Toolkit install with OpenCL

I posted this question on askubuntu at http://askubuntu.com/questions/846769/ubuntu-16-10-nvidia-opencl but it is receiving very little attention. In brief I have a new Ubuntu 16.10 installation. Although I do program with CUDA, I have a project that requires portability across devices so I need to do some OpenCL. I want to see if I can get this up and running on Ubuntu 16.10 but so far no luck.

I install the cuda toolkit with:

sudo apt-get install nvidia-cuda-toolkit

and also install ‘clinfo’ to query the OpenCL platform and devices

sudo apt-get install clinfo

But when I run clinfo all I get is:

Number of platforms:            0

Regardless of what devices I have installed on the machine, it should still detect the platform. Any thoughts?

CUDA (any current version) is not officially supported on Ubuntu 16.10. This doesn’t mean you can’t do OpenCL work, but it means your cuda toolkit install may be broken.

Principally OpenCL just needs a properly installed NVIDIA GPU driver (on an NVIDIA GPU).

What driver do you have installed? What is the output of nvidia-smi ?

I installed the latest driver nvidia-367. The call to nvidia-smi returns:

NVIDIA-SMI has failed because it couldn't communicate with the NVIDIA driver.  Make sure that the latest NVIDIA driver is installed and running.

As another thought on this topic, I can iterate and rebuild much faster with virtual machines but they wouldn’t have a NVIDIA GPU. Would it be possible to still install the NVIDIA driver and at least recognize the OpenCL platform? Basically I am just looking for the minimal needed to successfully build one of my software packages in this new OS.

So your driver install is broken. That is why clinfo is not returning anything.

Yes, it’s possible to install the necessary components to build (only) without installing the complete driver, and probably without installing the driver at all. That won’t make clinfo work, of course.

One approach would be to install the driver libraries and headers only. There are a set of command-line switches that you can pass to a driver runfile installer to do this. I don’t know how to do it with a package manager method (sudo apt-get …)

Another approach would be to go with your existing toolkit install, and point your OpenCL link process at the stub library provided in the CUDA toolkit library stub directory.

Okay, so I have a script I use for my own device querying using OpenCL on github www.github.com/cdeterman/intel_opencl.

If I try your last approach I CAN compile the file

g++ clDeviceQuery.cpp -o clDeviceQuery -L/usr/local/cuda-8.0/targets/x86_64-linux/lib/ -lOpenCL

I would expect running the executable to return at least the platform name and then tell me no devices are found. Instead it results in:

cdDeviceQuery Starting...
 Error -1001 in clGetPlatformIDs Call!

Is this what you would expect as well?

Probably. I don’t think you have a valid NVIDIA platform.

Just because you’ve linked against the stub library, doesn’t mean everything is fine. If you don’t actually have a proper library available on the target, the calls into that library are going to fail miserably.

What I said was that this was an approach to build codes. NOT run codes.

If you want proper runtime behavior, you need a proper runtime environment.

Is there any update when CUDA will be officially supported on 16.10?

If your focus is OpenCL, I don’t believe it should matter if you use Ubuntu 16.10.

You may still be confused on what is needed for development (compiling code) and running code.

In any event, it’s possible that Ubuntu 16.10 will never be officially supported for CUDA development. NVIDIA generally doesn’t discuss future plans on these forums.