inducer / pycuda

CUDA integration for Python, plus shiny features
http://mathema.tician.de/software/pycuda
Other
1.85k stars 285 forks source link

DLPack support in PyCUDA? #226

Open OhadRubin opened 4 years ago

OhadRubin commented 4 years ago

DLPack is a community effort to define a common tensor data structure that could be shared by different frameworks. Currently, Pytorch and MXNet have adopted this interface, and Tensorflow is the progress of adopting it. Using DLPack can benefit many projects in the ecosystem. So it will be really great if PyCUDA can also adopt this interface to help new ideas derived from the mainstream tensor-based frameworks. Related: https://github.com/tensorflow/tensorflow/issues/24453

leofang commented 4 years ago

FYI, CuPy already supports it for a while: https://docs-cupy.chainer.org/en/latest/reference/interoperability.html#dlpack

inducer commented 4 years ago

I'm generally supportive, and I'd be happy to consider a patch/PR. Writing one shouldn't be super hard.

lamhoangtung commented 2 years ago

I would like to help implement dlpack for pycuda. Can you help point me to what function I should write and it's reference from other lib @inducer ?

inducer commented 2 years ago

Is there a canonical Python wrapper for dlpack? If so, you'd just need to import that and fill it with data from a GPUArray (or fill a GPUArray with data from one).

leofang commented 2 years ago

See https://data-apis.org/array-api/latest/design_topics/data_interchange.html?highlight=dlpack.