Reputation: 353
I have a laptop with (Intel i5 CPU with Intel HD 4000 GPU integrated) and NVIDIA GT653M as discrete GPU.
I use the CPU as the host and the HD 4000 GPU as the device. both work on OpenCL 1.2
Q1: now when I am working with the clGetMemObjectInfo
() function to obtain the host pointer(CL_MEM_HOST_PTR
) of a memory buffer that wraps an array, sometimes the function return the pointer correctly and sometimes it returns 0. my code is very simple, I want to know why is this occurs?
Q2: can I configure the CPU to be used as host and device at the same time?
Upvotes: 0
Views: 271
Reputation: 353
1- khronos specifies in OpenCL 1.2 clCreateSubBuffer()
function documentation that
The
CL_MEM_USE_HOST_PTR
,CL_MEM_ALLOC_HOST_PTR
andCL_MEM_COPY_HOST_PTR
values cannot be specified in flags but are inherited from the corresponding memory access qualifiers associated with buffer.'
and this was not the case in OpenCL 1.0. so I modified it and it worked fine.
2- I did understand the architecture in a wrong way, so thanks.
Upvotes: 0
Reputation: 1814
Check that you've created your cl_mem's with CL_MEM_USE_HOST_PTR allocation flag, otherwise your query for host pointer has no sense. Also, check return code of clGetMemObjectInfo() for specific error code.
Both CPU & GPU are OpenCL Devices, and can be used to build programms, run kernels, etc. So yes, you can do this for shure.
Upvotes: 0