Hi,

> Le 20 avr. 2018 à 18:17, Andreas Kloeckner <li...@informa.tiker.net> a écrit :
> 
>> Did anybody manage to (actually) interleave sending buffers, retrieving
>> buffers and calculation on the GPU with PyOpenCL ?
> 
> I have (at one point) verified that this does work. In order for
> overlapped transfers to actually happen, you need to allocate the
> host-side end of the transfer with ALLOC_HOST_PTR (or some such--I don't
> remember precisely)--the same as 'page-locked' memory in CUDA.

        Yes, I finally managed to have some pinned memory also using pyopencl 
(following test_map_to_host in 
https://github.com/inducer/pyopencl/blob/master/test/test_array.py 
<https://github.com/inducer/pyopencl/blob/master/test/test_array.py> ) it seems 
to require something like:

psi = np.random.uniform(0, 1, (n_view, nz, ny, nx)).astype(np.complex64)

# Re-allocate psi using pinned memory ?
allocator = cl_tools.DeferredAllocator(cl_ctx, mf.READ_WRITE | 
mf.ALLOC_HOST_PTR)
psi_dev = cla.to_device(cl_queue, psi, allocator=allocator)
psi = psi_dev.map_to_host()
        I am however not sure if that’s the only way - it would seem you need 
to allocate (or at least declare) a GPU array before creating the corresponding 
pinned host array ? Is this correct ?

        Full test snippet 
@https://gist.github.com/vincefn/613649f5df1879db6c0e36dbf0cdc838 
<https://gist.github.com/vincefn/613649f5df1879db6c0e36dbf0cdc838> 

        It _seems_ to work in //, as the speed increases, but when using CUDA 6 
OpenCL, the code runs 2x slower when using COMPUTE_PROFILE=1… 

        Vincent
— 
Vincent Favre-Nicolin

Co-editor, J. Synchrotron Radiation  http://journals.iucr.org/s/ 
<http://journals.iucr.org/s/>

Director, HERCULES school   http://hercules-school.eu 
<http://hercules-school.eu/>

ESRF-The European Synchrotron    http://www.esrf.eu <http://www.esrf.eu/>
71, Avenue des Martyrs
Grenoble, France

X-Ray NanoProbe (XNP) group
Tel: +33 4 76 88 28 11

On leave from Univ. Grenoble Alpes

_______________________________________________
PyOpenCL mailing list
PyOpenCL@tiker.net
https://lists.tiker.net/listinfo/pyopencl

Reply via email to