<#part sign=pgpmime>
On Mon, 2 Apr 2012 23:44:08 +0200, Kin Trinh <[email protected]> wrote:
> # how would i go about making this work
> # i have written my own wrapper for cublas and want to pass my device
> pointers to pycuda
> 
> # example psudo code
> 
> ...
> 
> mod = SourceModule("""
> __global__ void multiply_them(float *dest, float *a, float *b)
> {
>   const int i = threadIdx.x;
>   dest[i] = a[i] * b[i] + 2;
> }
> """)
> 
> multiply_them = mod.get_function("multiply_them")
> 
> # cudaMalloc()
> # A is a LP_c_float
> 
> B = numpy.mat(numpy.ones((2, 2)), numpy.float32)
> 
> # i just want to be able to pass my pointers along somehow...
> multiply_them( drv.Out(B), A, A, block=(4,1,1), grid=(1,1))

PyCUDA takes integers wherever it wants device pointers--so as long as
you can turn your ctypes type into an int, you should be good to go.

Andreas


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

Reply via email to