0

I know that this has been posted many times, but I'm reposting the same question because none of the suggestions in the Internet works for me. I've been stuck here for weeks trying to get a simple OpenCL program running.

Here's what I did:

I got a new video card with CUDA and installed a fresh copy of Ubuntu 14.04:

 # lspci | grep VGA
 02:00.0 VGA compatible controller: NVIDIA Corporation GF119 [GeForce GT 610] (rev a1)

and then installed CUDA in it:

sudo apt-get install nvidia-cuda-toolkit

This installed all the necessary files for OpenCL compilation as far as I could see. I got following files in my computer now:

/usr/lib/x86_64-linux-gnu/libOpenCL.so
/etc/OpenCL/vendors/nvidia.icd

Then I tried the following program:

#include <stdio.h>
#include <CL/cl.h>

int main(void)
{
    cl_int err;
    cl_uint numPlatforms = 0;
    err = clGetPlatformIDs(0, NULL, &numPlatforms);
    if (CL_SUCCESS == err)
        printf("\nDetected OpenCL platforms: %d", numPlatforms);
    else
        printf("\nError calling clGetPlatformIDs. Error code: %d", err);
    getchar();
    return 0;
}

Compiled it successfully as follows:

 gcc -o test2 test.c -lOpenCL

And when I run it, I get the following message:

 Error calling clGetPlatformIDs. Error code: -1001

I've tried numourous suggestions in the Internet to get this to work but for no avail. I'd appreciate any help you could offer.

  • Can you list these _numourous suggestions_ that you tried? – doqtor Sep 30 '15 at 18:37
  • Did you try the first one, posted some weeks ago? Compile the app in 64 bits instead of 32, or 32 instead of 64. The nvidia ICD only installs one type of it, not both, so one of them will fail to load. – DarkZeros Sep 30 '15 at 21:13
  • At least related, not unlikely a duplicate: http://stackoverflow.com/questions/4959621/error-1001-in-clgetplatformids-call?rq=1 (Although the "answer" there is more than vague, admittedly...) – Marco13 Sep 30 '15 at 22:03
  • I agree with @Marco13, it is mostly likely a broken ICD. Technically -1001 (CL_PLATFORM_NOT_FOUND_KHR) is returned by clGetPlatformIDs when no platforms are found, but it can also indicate an ICD problem (such as a version mis-match between ICD and drivers). – Dithermaster Oct 02 '15 at 22:57

0 Answers0