vaaale / aparapi

Automatically exported from code.google.com/p/aparapi
Other
0 stars 0 forks source link

Support Asynchronous Data Transfers/Overlapping Compute #62

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Currently, Aparapi only supports synchronous data transfers. OpenCL supports 
both synchronous and asynchronous data transfers.

Excellent article (by a gentleman who apparently used to work at PNNL):
http://www.codeproject.com/Articles/201258/Part-5-OpenCL-Buffers-and-Memory-Affi
nity

<snip>

"Explicit, programmer initiated transfers occur by queuing one or more 
transfers on a command queue. Examples include:

C API:

    clEnqueueReadBuffer(), clEnqueueReadImage()
    clEnqueueWriteBuffer(), clEnqueueWriteImage()
    clEnqueueCopyBuffer(), clEnqueueCopyImage()

C++ API

    cl::enqueueReadBuffer(), cl::enqueueWriteBuffer()

Data transfers can be either blocking, in which case the queue waits for the 
transfer to complete, or asynchronous requiring the use of events for 
notification when a transfer has completed. Using asynchronous data transfers 
benefits application performance by allowing computation to overlap with data 
movement - thus decreasing the time to solution. Since the PCIe bus is full 
duplex, meaning that it can transfer data in two directions at the same time, 
there is a potential 2-times increase in data transfer bandwidth that can be 
achieved.

Alternatively, regions of the object data can be implicitly transferred by 
mapping buffers into the host address space. These transfers can occur both 
asynchronously and on a demand basis, meaning only portions of the data 
required by a calculation are moved and cached on a device. API examples 
include:

C API:

    clEnqueueMapBuffer(), clEnqueueMapImage()
    clEnqueueUnmapMemObject()

C++ API:

    cl::Buffer() (via various flags discussed below)
    cl::enqueueMapBuffer(), cl::enqueueMapImage()
    cl::enqueueUnmapMemObject();"

There is a lot of great information in that article.

Original issue reported on code.google.com by ryan.lam...@gmail.com on 11 Aug 2012 at 10:33

GoogleCodeExporter commented 9 years ago
Issue 104 has been merged into this issue.

Original comment by ryan.lam...@gmail.com on 20 Apr 2013 at 12:39