- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The full message I am getting on the terminal is :
Context callback: A host pointer is provided without also specifying one of CL_MEM_USE_HOST_PTR or CL_MEM_COPY_HOST_PTR
Context callback: A host pointer is provided without also specifying one of CL_MEM_USE_HOST_PTR or CL_MEM_COPY_HOST_PTR
Context callback: A host pointer is provided without also specifying one of CL_MEM_USE_HOST_PTR or CL_MEM_COPY_HOST_PTR
The program seems to be working just fine. They are associated with each time I set the parameters of the kernel. uint *init_ptr = (uint *)malloc(sizeof(uint)); *init_ptr = 0; int *size_ptr = (int *)malloc(sizeof(int)); *size_ptr = SIZE; status = clSetKernelArg(well_kernel, 3, sizeof(cl_uint), seed_ptr); checkError(status, "Failed to set kernel arg 3"); status = clSetKernelArg(well_kernel, 4, sizeof(cl_uint), init_ptr); checkError(status, "Failed to set kernel arg 4"); status = clSetKernelArg(well_kernel, 5, sizeof(cl_int), size_ptr); checkError(status, "Failed to set kernel arg 5"); So, are those messages a problem?
Link Copied
3 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You are trying to pass a host pointer directly to the device, without first creating buffers on the device. I am surprised this even works. Read up on the "clCreateBuffer()" function or check one of Altera's basic examples (or basically any OpenCL code example) to see how you should first create buffers on the device.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
--- Quote Start --- You are trying to pass a host pointer directly to the device, without first creating buffers on the device. I am surprised this even works. Read up on the "clCreateBuffer()" function or check one of Altera's basic examples (or basically any OpenCL code example) to see how you should first create buffers on the device. --- Quote End --- I tried the following but the messages continue to show.
uint *init_ptr = (uint *)malloc(sizeof(uint));
*init_ptr = 0;
cl_mem init_buffer = clCreateBuffer(my_context,
CL_MEM_READ_ONLY | CL_MEM_ALLOC_HOST_PTR,
sizeof(uint),
init_ptr,
&status);
int *size_ptr = (int *)malloc(sizeof(int));
*size_ptr = SIZE;
cl_mem size_buffer = clCreateBuffer(my_context,
CL_MEM_READ_ONLY | CL_MEM_ALLOC_HOST_PTR,
sizeof(int),
size_ptr,
&status);
status = clSetKernelArg(well_kernel, 4, sizeof(cl_uint), &init_buffer);
checkError(status, "Failed to set kernel arg 4");
status = clSetKernelArg(well_kernel, 5, sizeof(cl_int), &size_buffer);
checkError(status, "Failed to set kernel arg 5");
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am not really sure if I understand what you are trying to do with that code. Are you trying to pass two values (rather than buffers) to the kernel? If that is the case, just pass them as values, no need to define pointers and allocate buffers.
uint init = 0;
int size = SIZE;
status = clSetKernelArg(well_kernel, 4, sizeof(uint), (void *) &init);
checkError(status, "Failed to set kernel arg 4");
status = clSetKernelArg(well_kernel, 5, sizeof(int), (void *) &size);
checkError(status, "Failed to set kernel arg 5");

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page