use cusparse library from python

i want to use cusparse library matrix-vector multiplication and its functions(all format conversion coo csr ell hyb dia) in python. how can i use it in python. can someone help and suggest me a small example with any format like coo or csr.

you can access cusparse library directly from python using bindings like pyculib or cupy

If you google for “pyculib cusparse” for example, you will find some example codes. Maybe not exactly csrmv, but close.

Thank you very much for your replay…
Yeah i tried pyculib and cupy but i dont find full implementation. please correct me if i am wrong, as i want to use all formats (coo,csr,csc,bsr,ell,dia,bsr), their matrix vector multiplication(spmv operation) and conversion to these and from as well. but in pyculib i only able to find csr csc and bsr. i tried csr and bsr it works fine but not able to find csc spmv caller and other as well like hyb dia etc.

When i use hyb spmv call (just replace csr with hyb) it throws an error as ‘Not implemented type object can not be callable’. Do these Libraries under development or only supports few formats. please correct if i am wrong.

in cupy documetation
i only find conversion functions from one format to another but how can i perform spmv opration (matrix vector multiplication).

In cusparse documentation somewhere it is written that these are deprecated and will remove from future release, but right now i want them all for my project.


Yes, you may not find complete implementations anywhere. I’m not really sure.

Anyway, both cython and python ctypes allow you to access C-callable libraries from python.

Here is an example using python ctypes of calling compiled routines that use a CUDA library.

Yes, it is not cusparse, but the methodology would be similar.

Hello Robert_Crovella,

Can you please help me about my issue i posted

Actually i dont know that i am raising this issue under right section/category or not. because otherwise it is not justifiable for readers or helpers to read non related queries in a particular section. my question is more like implementation issue. can you suggest me something or tell me right direction to go or ask this in particular section.