• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag
 

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
OpenCL Basic Programming Question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

OpenCL Basic Programming Question


  • Subject: OpenCL Basic Programming Question
  • From: "Gerriet M. Denkmann" <email@hidden>
  • Date: Fri, 14 Feb 2014 21:53:43 +0700

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@hidden)

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:

This email sent to email@hidden


  • Follow-Ups:
    • Re: OpenCL Basic Programming Question
      • From: "Gerriet M. Denkmann" <email@hidden>
    • Re: OpenCL Basic Programming Question
      • From: Uli Kusterer <email@hidden>
  • Prev by Date: Display selectd sub-menuItem in NSPopUpButton
  • Next by Date: PDFPage init methods not called
  • Previous by thread: Re: Display selectd sub-menuItem in NSPopUpButton
  • Next by thread: Re: OpenCL Basic Programming Question
  • Index(es):
    • Date
    • Thread