Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Altera_Forum
Honored Contributor I
805 Views

Output 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 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?
0 Kudos
3 Replies
Altera_Forum
Honored Contributor I
66 Views

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.

Altera_Forum
Honored Contributor I
66 Views

 

--- 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");
Altera_Forum
Honored Contributor I
66 Views

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