OpenCL* for CPU
Ask questions and share information on Intel® SDK for OpenCL™ Applications and OpenCL™ implementations for Intel® CPU.
Announcements
This forum covers OpenCL* for CPU only. OpenCL* for GPU questions can be asked in the GPU Compute Software forum. Intel® FPGA SDK for OpenCL™ questions can be ask in the FPGA Intel® High Level Design forum.

OpenCL related question

Doru_Adrian_Thom_P_
254 Views

Hello! I have restarted some of my experiments on the Intel Haswell processor and some of them stopped working, namely the ones related to examples meant to be executed for the GPU.

My main question is if I use clCreateBuffer with the flag CL_MEM_USE_HOST_PTR what does that flag actually do:

1. i create the array on the host, the gpu will use the same address as the address that was given to the array allocated on the host; if this thing happens then theoretically I will be able to compute something on the GPU and at the kernel termination point (also known as a synchronization point), the data written by the GPU should be inside the allocate region from the host?

2. i create the vector on the CPU host, after which there is a secondary memory location allocated when invoked clCreateBuffer, even though I am using CL_MEM_USE_HOST_PTR, and the data is inherently copied between the host and the device memory allocations in memory.

The reason i am asking is mainly because of the L3 cache which is shared between the CPU and the GPU. If both operate on the same address then in the L3 cache the data can be seen by both. Therefore a cooperation between the two may be possible

 

Thanks

0 Kudos
2 Replies
QIAOMIN_Q_
New Contributor I
254 Views

Hello Thom,

We have specific OpenCL forum named 'Intel® SDK for OpenCL* Applications' where you will be answered.

 
Thank you.
 --
 QIAOMIN.Q
 Intel Developer Support
 Please participate in our redesigned community support web site:

User forums:                   http://software.intel.com/en-us/forums/

0 Kudos
Raghupathi_M_Intel
254 Views

On newer generation of Intel platforms the host (CPU) and device (GPU) share the same physical memory. So when you create an OpenCL buffer with CL_MEM_USE_HOST_PTR there is no copy involved (no CPU->GPU transfer), so yes (1) above is true. You can create the buffer on the CPU modify it on the GPU and then consume the result on the CPU (though you have to follow OpenCL specification and use map/unmap when you access the buffer back on the CPU).

Raghu

0 Kudos
Reply