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

CUSPARSE_VERSION used to select CUSPARSE_SPM*/M*_ALG_DEFAULT #1967

Closed
maartenarnst opened this issue Sep 12, 2023 · 10 comments
Closed

CUSPARSE_VERSION used to select CUSPARSE_SPM*/M*_ALG_DEFAULT #1967

maartenarnst opened this issue Sep 12, 2023 · 10 comments

Comments

@maartenarnst
Copy link

Kokkos kernels provides specialisations of spMV and spMM that call CUSPARSE functions. As part of the Cuda 11 release cycle, Nvidia changed the names of the enumerator values that set the default algorithm. Thus, we can find in several files in Kokkos kernels preprocessor conditionals that select between CUSPARSE_SPMV_ALG_DEFAULT and CUSPARSE_MV_ALG_DEFAULT for spMV and between CUSPARSE_SPMM_ALG_DEFAULT and CUSPARSE_MM_ALG_DEFAULT for spMM depending on the CUSPARSE_VERSION.

However, the CUSPARSE_VERSION used is not consistent across these files:

  • In Kokkos-kernels/perf_test/sparse/KokkosSparse_spmv_struct_tuning.cpp, the conditional is #if CUSPARSE_VERSION >= 11201.
  • In Kokkos-kernels/sparse/tpls/KokkosSparse_spmv_tpl_spec_decl.hpp, the conditional is #if CUSPARSE_VERSION >= 11301.
  • In Kokkos-kernels/sparse/tpls/KokkosSparse_spmv_mv_tpl_spec_decl.hpp, the conditional is #if CUSPARSE_VERSION < 11010.

Moreover, the value may not always be well chosen. Indeed, as @etphipp pointed out in trilinos/Trilinos#12238, the CUSPARSE_VERSION does not necessarily match the cuda toolkit version, and Nvidia changed the enumerator values as part of the incremental subreleases in the Cuda 11 release cycle. In particular, in Cuda toolkit 11.1.1, the CUSPARSE_VERSION is 11301, and the names of the spMV default algorithm enumerator value is still CUSPARSE_MV_ALG_DEFAULT . Thus, choosing 11201 or 11010 as in the Kokkos kernels files mentioned above can be expected to lead to a compilation error in Cuda toolkit 11.1.1.

In trilinos/Trilinos#12238, @etphipp and I went through subsequent subreleases of Cuda 11 (see details in that PR). And we found that using a CUSPARSE_VERSION of 11401 would work. It's a subrelease in which both names are available and the older one is marked deprecated.

@etphipp is in favour of addressing this issue simultaneously in all concerned packages in Trilinos and setting the same threshold (Kokkos kernels, Stokhos, muelu). In this regard, I wanted to ask your suggestion how to proceed? Should I introduce a PR in Kokkos kernels with a change to a CUSPARSE_VERSION threshold of 11401? Thanks in advance!

@maartenarnst
Copy link
Author

@cwpearson
Copy link
Contributor

cwpearson commented Oct 23, 2023

@cwpearson
Copy link
Contributor

cwpearson commented Oct 23, 2023

Looks like the SpMV enums changed in cuSPARSE version 11.4.0 and became required in cuSPARSE version 12.0.0 (the abbreviated documentation is probably an error, Nvidia changed their documentation format in CUDA 12)

@cwpearson
Copy link
Contributor

We need to do a similar thing to check the SpMM enums

@cwpearson
Copy link
Contributor

cwpearson commented Oct 23, 2023

@cwpearson
Copy link
Contributor

The SpMM enums changed in CUDA 11.0.1 / cuSPARSE 11.0.0

@etphipp
Copy link
Contributor

etphipp commented Nov 15, 2023

Has this been merged to Trilinos? I am still getting errors like

/ascldap/users/etphipp/project/Trilinos/Trilinos/packages/kokkos-kernels/sparse/tpls/KokkosSparse_spmv_tpl_spec_decl.hpp(98): error: identifier "CUSPARSE_SPMV_ALG_DEFAULT" is undefined

/ascldap/users/etphipp/project/Trilinos/Trilinos/packages/kokkos-kernels/sparse/tpls/KokkosSparse_spmv_tpl_spec_decl.hpp(112): error: identifier "CUSPARSE_SPMV_CSR_ALG2" is undefined

@brian-kelley
Copy link
Contributor

@etphipp No, they are only in KokkosKernels develop at the moment.

@ndellingwood @cwpearson Is it too late for #2011 and #2012 to get cherry picked into release-candidate-4.2.00?

@lucbv
Copy link
Contributor

lucbv commented Nov 15, 2023

Not yet but the release is underway

@brian-kelley
Copy link
Contributor

@lucbv Carl's fixes for this aren't in the 4.2 candidate actually

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

5 participants