Hi all, This came up a while ago on the mpi4py mailing list [1] and with CUDA 6 brining unified virtual memory it may become more important in the future.
It would be nice if PyCUDA device allocations provided a method for creating a suitable Python buffer object: e.g, myalloc.asbuf(offset=0, sz=...). This would provide a clean way for PyCUDA and mpi4py to interoperate (as the wrapped MPI functions expect Python buffer objects as opposed to pointers). Currently one must either resort to writing a C extension or hacks such as: import ctypes as ct make_buf = ct.pythonapi.PyBuffer_FromMemory make_buf.argtypes = [ct.c_void_p, ct.c_ssize_t] make_buf.restype = ct.py_object cubuf = cuda.mem_alloc(SZ*8) pybuf = make_buf(long(cubuf), SZ*8) Regards, Freddie. [1] <https://groups.google.com/forum/#!searchin/mpi4py/cuda/mpi4py/qpM-ZcAtA_Y/34qXGuf8fQsJ>
signature.asc
Description: OpenPGP digital signature
_______________________________________________ PyCUDA mailing list PyCUDA@tiker.net http://lists.tiker.net/listinfo/pycuda