I installed the latest AMD driver to support OpenCL 2.0. The samples work fine. However, when I check the clinfo, I found that my CPU device OpenCL C version is 1.2, while OpenCL 2.0 for my GPU. Does anything go wrong or it is normal?
As OpenCL support SVM, so I expect CPU and GPU to have same global memory size, however in clinfo, they don't. Is this caused by different OpenCL C version?
Solved! Go to Solution.
Any SVM buffer created by clSVMAlloc are shared by the host and all devices in an OpenCL context that support shared virtual memory. Being the host, cpu can access that buffer.
Sorry to bother, but I met some problem in using clSVMAlloc. My context includes a GPU, and I allocate a SVM buffer with the context by using clSVMAlloc. However, CPU can't access the buffer in the host code, it returns segmentation fault. The interesting thing is that if i create the context with CPU instead of GPU, everything is fine, and the host can access the SVM buffer. Can you help me out? It drives me crazy. Thanks.
Try clEnqueueSVMMap before updating on host. Moreover, you may check the SVM samples from APP SDK to see whether they are working or not. If they work, please try to compare your code with the sample ones to figure out the possible problem. If nothing helps, please provide your code and mention the setup details.
Thanks, I just forgot to use map and unmap. BTW, I use the pointer returned by clSVMAlloc to create cl_mem object so that the buffer is also shared. However, the cpu device seems to be able to access the cl_mem object, too. The cpu device isn't updated to opencl 2.0, so it can't use SVM feature, why nothing goes wrong? Thanks.
Could you please explain the code flow in more detail especially about the device selection, context creation and SVM allocation and sharing? Also, what is the setup - dGPU or APU ?