Hi,

I would like to exchange 2 pointer addresses of gpuarray. Here, this is an example of what I want to do

"""
__global__ void computation(float *a, float *b)
{
     // compute something with a and put the result in b
}

__global__ void exchange(float **a, float **b)
{
    float *tmp;
    tmp = *a;
    *a = *b;
    *b = tmp;
}
"""

Then I construct 2 gpuarrays and I call my first kernel easily.

kernel1 = mod.get_function("computation")
kernel2 = mod.get_function("exchange")

a_gpu = gpuarray.to_gpu(a)
b_gpu = gpuarray.to_gpu(b)

kernel1(a_gpu.gpudata, b_gpu.gpudata, ...)
kernel2( ????, ????, ...)

But I don't understand how to call the second kernel "exchange" to change the addresses of my gpuarrays.
How can I get the address of a gpuarray and then how can I change it ?

Perhaps, there is a more simple way...

Thanks,
Loic


_______________________________________________
PyCUDA mailing list
[email protected]
http://lists.tiker.net/listinfo/pycuda

Reply via email to