I am trying to build the Basic Programming Sample in:
<https://developer.apple.com/library/mac/documentation/Performance/Conceptual/OpenCL_MacProgGuide/ExampleHelloWorld/Example_HelloWorld.html#//apple_ref/doc/uid/TP40008312-CH112-SW2>
I have myKernel.cl:
__kernel void squareq( __global float* input, __global float* output )
{
int i = get_global_id(0);
printf("i %d\n",i); // never seen
output[i] = input[i] * input[i];
}
and myKernel.cl.h:
void squareq_kernel( cl_ndrange *range, float* input, float* output);
main.c has:
#define NUM_VALUES 999
size_t bufferSize = sizeof(cl_float) * NUM_VALUES;
float* test_in = (float*)malloc( bufferSize );
for( NSUInteger i = 0; i < NUM_VALUES; i++ ) test_in[i] = i;
cl_float *mem_in = gcl_malloc( bufferSize, test_in, CL_MEM_READ_ONLY |
CL_MEM_COPY_HOST_PTR );
cl_float *mem_out = gcl_malloc( bufferSize, NULL, CL_MEM_WRITE_ONLY );
dispatch_sync(queue, ^void
{
cl_ndrange range = { 1,
{0, 0, 0},
{NUM_VALUES, 0,
0},
{0, 0, 0}
};
squareq_kernel( &range, mem_in, mem_out ); <-----
EXC_BAD_ACCESS (code=2, address=0x100003228)
}
);
Builds without warnings, but crashes when run (see above).
What am I doing wrong?
Gerriet.
_______________________________________________
Cocoa-dev mailing list ([email protected])
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com
This email sent to [email protected]