-
Notifications
You must be signed in to change notification settings - Fork 8
create cuSPARSE backend and spmv #40
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
Conversation
b6bfd8f to
d91aac3
Compare
9ef0f35 to
f06d675
Compare
|
@BenBrock I have updated/rebase the pr on the latest main branch. It reuse the example and test with Thrust. |
|
@yhmtsai Thanks, I will try to add this to the PR by your morning Friday, although I'm a bit busy today. As for using CCCL vs. Thrust, my understanding is that Thrust is now part of CCCL, and the usage is the same ( |
BenBrock
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This all looks good to me. I'm happy to merge unless somebody from Nvidia (maybe @fbusato or @essex-edwards) wants to comment.
| set(SPBLAS_GPU_BACKEND ON) | ||
| find_package(CUDAToolkit REQUIRED) | ||
| target_link_libraries(spblas INTERFACE CUDA::cudart CUDA::cusparse CUDA::cublas) | ||
| set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DSPBLAS_ENABLE_CUSPARSE") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Currently, we're just compiling with the host compiler, which is fine, since all of our examples and tests can use the host compiler for CUDA. If a user application is compiling with CUDA (nvcc) instead of a host compiler, we also want to add the correct linking and compile flags. I think the only piece of this that's missing is adding -DSPBLAS_ENABLE_CUSPARSE to CMAKE_CUDA_FLAGS . Can @fbusato or @essex-edwards comment on what the right thing to do here is?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think nvcc does not support C++23 but I am not sure how complete support from nvhpc.
if we would like to use nvcc there we will need to use earlier standard.
52dbe18 to
2f2c5b8
Compare
|
@BenBrock I have rebased it and it needs your apporval again. I think we can merge this now and continue the other pr. |
BenBrock
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approving this PR.
One thing we do need to reconcile soon is:
-
Whether passing in a state object is optional. It's currently optional in all the non-GPU vendor implementations, and I think it should be optional, particularly for simple operations like SpMV.
-
What the naming is of the state object. We (I believe) in our last meeting that we want one state object, so something like
operation_state_t. This is what's currently implemented in all the non-GPU vendor implementations. This doesn't mean we can't have anspmv_state_tobject if you want to use that in the implementation, but it needs to be type erased and stored inside anoperation_state_t.
The device examples currently use spmv_state_t, so I think we can leave this as-is until it gets changed, probably as part of my Intel GPU PR.
|
I think operation_state_t is the collection of several op_state_t mainly for easy usage for user in the end. |
This PR creates cuSPARSE backend and add spmv implementation.
It follows the current design of gpu backend.
Compiling this target is required on the node with available Nvidia GPU due to Thrust. Otherwise, it will give
Illegal instruction (core dumped). I do not dig into whether there is a way to force Thrust with cuda support on CPU-only system.Should we use CCCL rather than Thrust?