Forum Discussion
Altera_Forum
Honored Contributor
8 years agoOutput Message: "...A host pointer is provided without also specifying one of..."
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 ...
Altera_Forum
Honored Contributor
8 years ago --- 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");