Hey,
I’m very new to OpenCL, still trying to get a handle on all the boiler plate stuff here for setting up the context and kicking off the kernel. What I’m working on is a parallel ray tracer which serves as the core of my MS project. I’m using a primer tutorial to get started, I don’t particularly have time to read through 400 page books at the moment as the parallel nature isn’t the core of this project (it just needs to be real time).
I’m following this primer tutorial here.
Setup: Win 7 x64, i7-3820, no OC, 16GB memory. The target OpenCL device is an AMD card, I’m not sure which (this isn’t my machine), device manager says it’s a Radeon HD 7900 series, but it doesn’t give me a specific model. Catalyst control center says the same thing, device ID is a 6798 if that means anything, but it seems to have 3GB of memory @ 1.3Ghz…anyway…it IS OpenCL capable, I know somebody who did an OpenCL project on this system.
So I’m following this guy’s primer, basically following it for the main part, but changing some stuff around (making it less OO), and I have this line of code, which it eats itself on:
status = clEnqueueNDRangeKernel(clCommandQueue, programKernel, 1, NULL, workGroupLength, NULL, 0, NULL, &event);
The kernel function it’s trying to run is defined by this function:
__kernel void adder(__global float* a, __global float* b, __global float* c)
{
unsigned int i = get_global_id(0);
c[i] = a[i] + b[i];
}
The command queue is created with this line:
cl_command_queue clCommandQueue = clCreateCommandQueue(clContext, gpuDevice, NULL, &status);
Where I believe the context and device were selected correctly.
The kernel was created with this line:
cl_kernel programKernel = clCreateKernel(clProgramObj, "adder", &status);
Where the program object was created with this line:
cl_program clProgramObj = clCreateProgramWithSource(clContext, 1, &programName, &programLength, &status);
Where programName is a deceptive variable that actually points the source code pulled from the CL source of pointer to char type.
EDIT:
workGroupLength is a pointer pointing to a variable of size_t which contains the 2 1D buffers I filled to be added together. I filled the 2 buffers with 5 numbers, which is what the value that the workGroupLength pointer points to.
/EDIT
EDIT 2:
I forgot to mention, after EVERY openCL line, I have a print statement which prints the return value of the previous statement executed. EVERY line results in CL_SUCCESS.
/EDIT 2
Anyways, when it hits the first line I listed, I just get a “<program name> has stopped working” - apparently a seg fault. If I choose to try and debug it drops me in msvcr100d.dll!_unlock(int), where it appears to be crashing on the only line of code in there (LeaveCriticalSection()), which I did not right. The stack trace goes through like 40 system DLL’s so I can’t really find where shit went bad.
Any help is appreciated.
TIA!