Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrapping tridiagonal methods from cuSPARSE #296

Open
RyanGutenkunst opened this issue Apr 9, 2020 · 4 comments
Open

Wrapping tridiagonal methods from cuSPARSE #296

RyanGutenkunst opened this issue Apr 9, 2020 · 4 comments

Comments

@RyanGutenkunst
Copy link

As suggested by @wingkitlee0 , I'm opening a fresh issue based my post here: #44 .

I need cusparseSgtsv2StridedBatch and cusparseSgtsvInterleavedBatch wrapped (which probably also requires wrapping cusparseSgtsv2StridedBatch_bufferSizeExt): https://docs.nvidia.com/cuda/cusparse/index.html#gtsv2stridedbatch .

I expect these wouldn't be hard to wrap, because their arguments are actually just specially formatted dense matrices, so using them shouldn't depend on any other cuSPARSE functions. But I don't know where to start. Does anyone have time to wrap them?

If not, what's the best way for me to learn how to wrap them for skcuda? I see that, for example, s._libcusparse.cusparseDgtsv2StridedBatch is a well-defined function pointer. Is it as simple as defining restypes and argtypes? If so, is there a skcuda module that would be a best-practices example?

BTW: import skcuda.cusparse fails for me, at the import cuda line. There's no cuda. anywhere the module, so I assume this is an oversight. If I remove that line, I can import the module and run some of the simple functions within.

@wingkitlee0
Copy link
Contributor

Hi @RyanGutenkunst,

First, this project has very few traffic and very few people to maintain. So the task depends on how much time you put on it. Last time it took us about a week or so to wrap some functions (see #289 ) when I had some free time. I probably don't have time to contribute code for this but I am happy to answer questions.

If not, what's the best way for me to learn how to wrap them for skcuda?

I think cublas.py should be a good place to start. You are basically right about restypes and argtypes. I suggest you prepare some test cases to check the code.

import skcuda.cusparse fails for me, at the import cuda line.

It should be from . import cuda as in other files. Probably a Python 3 change.

@RyanGutenkunst
Copy link
Author

Thanks @wingkitlee !

I've created a fork to work from: https://github.com/RyanGutenkunst/scikit-cuda . I'll get started and post here when I hit problems and need help or (hopefully) make progress and need feedback.

@RyanGutenkunst
Copy link
Author

I've implemented the methods I care about in cuSPARSE. There are unit tests for them in tests/test_cusparse.py . A few things I could use input on below. If it's more appropriate, I can submit a pull request at this point for feedback.

  1. My only box with an NVIDIA GPU is Windows, so I haven't been able to test in other environments. Can someone help with that?
  2. I tried creating the appropriate file in docs to get the methods I implemented documented, but I'm getting a bunch of errors when I try to run Sphinx, and the docs aren't getting fully created. I'm not experience with Sphinx. Can anyone help with debugging that?
  3. I removed the incomplete previously existing methods from cusparse.py . I don't know if that's preferred to keep the source clean, or whether I should put them back to preserve that incomplete work.

@wingkitlee0
Copy link
Contributor

Sounds like you got it working already!

Maybe @lebedov (the owner of this repo) can answer your questions about OS, sphinx, and pull request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants