How avoid memory copy GPU-CPU on imx6qp opencl?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How avoid memory copy GPU-CPU on imx6qp opencl?

600 Views
korabelnikov
Contributor III

I use gpu through opencl (pyopencl wrapper namely) and I found that necessity coping memory to gpu before calculations and from gpu after calculations.

A memory on the chip is shared, so these copying may be excess. How to do this?

 

p.s. some authors write that avoid copying.

korabelnikov_0-1627287955021.png

 

code example. I've tried with cl.enqueue_map but without succes, maybe i did something wrong.

Spoiler
res_hist = np.zeros((height, width)).astype(np.float32)
res_hist_g = cl.Buffer(ctx, mf.WRITE_ONLY | mf.USE_HOST_PTR, hostbuf=res_hist)

kernel(queue, res_hist.shape, None, input_buffer, res_hist_g)

# this copy is necessary!
cl.enqueue_copy(queue, res_hist, res_hist_g, is_blocking=True)
Labels (1)
Tags (4)
0 Kudos
1 Reply

594 Views
Bio_TICFSL
NXP TechSupport
NXP TechSupport

Hello koralbelnikov,

Sorry you can avoid copy GPU/CPU when using OPenCL since the driver is from Vivante corp in binary form, you have to modify the driver source code to do this task, and is not provided, however if you have the source code please enter a case in our system.

 

Regards

 

0 Kudos