i began to fetch some opencl calls from some net resources
9this is somewhat experimental sec becaose i hed not mouch
time to read
int main(int argc, char **argv)
{
SetupDllFunctions();
cl_platform_id platform_id = 0;
int retval = clGetPlatformIDs_(1, &platform_id, NULL);
if(retval == CL_SUCCESS ) printf("clGetPlatformIDs success") ;
cl_device_id device_id = 0;
int ret = clGetDeviceIDs_( platform_id, CL_DEVICE_TYPE_GPU, 1, &device_id, NULL );
if(ret == CL_SUCCESS) printf("get device id success ") ;
if(ret == CL_INVALID_PLATFORM) printf("CL_INVALID_PLATFORM") ;
if(ret == CL_INVALID_DEVICE_TYPE ) printf("CL_INVALID_DEVICE_TYPE ") ;
if(ret == CL_INVALID_VALUE ) printf("CL_INVALID_VALUE ") ;
if(ret == CL_DEVICE_NOT_FOUND ) printf("CL_DEVICE_NOT_FOUND ") ;
cl_context context = clCreateContextFromType_(NULL, CL_DEVICE_TYPE_GPU, NULL, NULL, &ret);
if(ret == CL_SUCCESS) printf("context success ") ;
cl_command_queue queue = clCreateCommandQueue_(context, device_id, 0, &ret);
if(ret == CL_SUCCESS) printf("queue success ") ;
char* kernel_src[2] = { "__kernel void SAXPY (__global float* x, __global float* y, float a) { const int i = get_global_id (0); y [i] += a * x [i]; } ", 0};
cl_program program = clCreateProgramWithSource_(context, 1, kernel_src, NULL, &ret);
if(ret == CL_SUCCESS) printf("create program success ") ;
if(ret == CL_INVALID_CONTEXT ) printf("CL_INVALID_CONTEXT ") ;
if(ret == CL_INVALID_VALUE ) printf("CL_INVALID_VALUE ") ;
if(ret == CL_OUT_OF_HOST_MEMORY ) printf("CL_OUT_OF_HOST_MEMORY ") ;
return 0;
}
and the outcome here is
clGetPlatformIDs successget device id success context success queue success CL_INVALID_CONTEXT
in the other words platform device context queue seem to be ok, then create program fail
- coul someone help with that?
(god damd how i hate this kind of pseudo programming when you take a loose knot of api calls and you checking if this s**t will work or not - this is more pseudo than programming, unlogical aggrieviating s**t- me head aches as usual when doing such kind of sht)