Hi there,
I tried to use OpenCL on my 32-bit Ubuntu Lucid Lynx with a nVidia Quadro NVS 140M. The “deviceQuery” from “NVIDIA_GPU_Computing_SDK/C/bin/linux/release” tells me:
./deviceQuery Starting...
CUDA Device Query (Runtime API) version (CUDART static linking)
There is 1 device supporting CUDA
Device 0: "Quadro NVS 140M"
CUDA Driver Version: 3.20
CUDA Runtime Version: 3.20
CUDA Capability Major/Minor version number: 1.1
Total amount of global memory: 133890048 bytes
Multiprocessors x Cores/MP = Cores: 2 (MP) x 8 (Cores/MP) = 16 (Cores)
Total amount of constant memory: 65536 bytes
Total amount of shared memory per block: 16384 bytes
Total number of registers available per block: 8192
Warp size: 32
Maximum number of threads per block: 512
Maximum sizes of each dimension of a block: 512 x 512 x 64
Maximum sizes of each dimension of a grid: 65535 x 65535 x 1
Maximum memory pitch: 2147483647 bytes
Texture alignment: 256 bytes
Clock rate: 0.80 GHz
Concurrent copy and execution: Yes
Run time limit on kernels: No
Integrated: No
Support host page-locked memory mapping: Yes
Compute mode: Default (multiple host threads can use this device simultaneously)
Concurrent kernel execution: No
Device has ECC support enabled: No
Device is using TCC driver mode: No
deviceQuery, CUDA Driver = CUDART, CUDA Driver Version = 3.20, CUDA Runtime Version = 3.20, NumDevs = 1, Device = Quadro NVS 140M
PASSED
Press <Enter> to Quit...
-----------------------------------------------------------
So i assumed that my installation seems to work. But then I tested some C-code:
#include <stdio.h>
#include <stdlib.h>
#include <CL/cl.h>
int main (int argc, const char * argv[])
{
cl_platform_id pId;
cl_uint pNum;
cl_int err = 0;
cl_context context = NULL;
cl_device_id device = NULL;
clGetPlatformIDs(1, &pId, &pNum);
printf("number of platforms: %i
", pNum); /*<-- allways 1*/
err = clGetDeviceIDs(pId, CL_DEVICE_TYPE_ALL, 1, &device, NULL);
if (err != CL_SUCCESS)
{
printf("Quit!
");
if(err == CL_INVALID_PLATFORM)
printf("invalid platform
");
if(err == CL_INVALID_DEVICE_TYPE)
printf("invalid devicetype
");
if(err == CL_INVALID_VALUE)
printf("error: device_type or num_devices
");
if(err == CL_DEVICE_NOT_FOUND)
printf("no matching device_type found
");
return 1;
}
context = clCreateContextFromType(0, CL_DEVICE_TYPE_GPU, NULL, NULL, NULL);
if(context == NULL)
{
printf("Invalid context
");/*<----!!!!*/
return 2;
}
}
But there’s never a context given back. I also tried this code without X running just by using the terminal.
This is how i compile it:
gcc main.c -I /path/to/Cuda/NVIDIA_GPU_Computing_SDK/OpenCL/common/inc/ -o main -lOpenCL
Since I am a total beginner I have no idea what the mistake could be. Any ideas?