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

Fixes while documenting #2466

Merged
merged 11 commits into from
Jan 6, 2025
Merged

Fixes while documenting #2466

merged 11 commits into from
Jan 6, 2025

Conversation

lucbv
Copy link
Contributor

@lucbv lucbv commented Dec 17, 2024

While writing the documentation I read a good amount of our public API and these are changes that we might want to consider to make things a bit more uniform across the library.

That check is stricter than required as we will values by reference
to perform copies and won't try to reassign pointers.

Signed-off-by: Luc Berger-Vergiat <[email protected]>
@lucbv lucbv added the Cleanup Code maintenance that isn't a bugfix or new feature label Dec 17, 2024
@lucbv lucbv self-assigned this Dec 17, 2024
@lucbv lucbv requested a review from ndellingwood December 17, 2024 16:00
Signed-off-by: Luc Berger-Vergiat <[email protected]>
Signed-off-by: Luc Berger-Vergiat <[email protected]>
Copy link
Contributor

@ndellingwood ndellingwood left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lucbv just to confirm, the rot, gerr and trmm routines are not intended to be compatible with DynRankView usage (based on inclusion of the static_assert(Kokkos::is_view_v...) constraint)?

@lucbv
Copy link
Contributor Author

lucbv commented Dec 18, 2024

All of BLAS is pretty much asserting on is_view_v, the DynRankView use case was for Batched algorithms

The cosine coefficient is strictly real while the sine coefficient
can be real or complex leading to a bug in the current API. This
commit should fix that for the native and TPL implementation and
the associated unit-test is also fixed accordingly.

Signed-off-by: Luc Berger-Vergiat <[email protected]>
The types for the arguments c and s are actually different and need
to be appropriately propagated through the TPL layers of the library.

Signed-off-by: Luc Berger-Vergiat <[email protected]>
@lucbv
Copy link
Contributor Author

lucbv commented Jan 6, 2025

@brian-kelley can you have a look at this, there are changes for rot based on the discussion we had about the appropriate types required.

@lucbv lucbv merged commit 0adc88b into kokkos:develop Jan 6, 2025
18 checks passed
@lucbv lucbv deleted the fixes_while_documenting branch January 6, 2025 21:07
@vqd8a
Copy link
Contributor

vqd8a commented Jan 6, 2025

@lucbv, I just got these errors:

/p/gpfs1/dang15/Kokkos/kokkos-kernels/blas/tpls/KokkosBlas1_rot_tpl_spec_decl.hpp(323): error: argument of type 

"cuDoubleComplex *" is incompatible with parameter of type "const double *"
  template <> struct Rot< Kokkos::Cuda, Kokkos::View<Kokkos::complex<double>*, Kokkos::LayoutLeft, Kokkos::Device<Kokkos::Cuda, Kokkos::CudaSpace>, Kokkos::MemoryTraits<Kokkos::Unmanaged>>, Kokkos::View<double, Kokkos::LayoutLeft, Kokkos::Device<Kokkos::Cuda, Kokkos::CudaSpace>, Kokkos::MemoryTraits<Kokkos::Unmanaged>>, Kokkos::View<Kokkos::complex<double>, Kokkos::LayoutLeft, Kokkos::Device<Kokkos::Cuda, Kokkos::CudaSpace>, Kokkos::MemoryTraits<Kokkos::Unmanaged>>, true, true> { using VectorView = Kokkos::View<Kokkos::complex<double>*, Kokkos::LayoutLeft, Kokkos::Device<Kokkos::Cuda, Kokkos::CudaSpace>, Kokkos::MemoryTraits<Kokkos::Unmanaged>>; using MagnitudeView = Kokkos::View<double, Kokkos::LayoutLeft, Kokkos::Device<Kokkos::Cuda, Kokkos::CudaSpace>, Kokkos::MemoryTraits<Kokkos::Unmanaged>>; using ScalarView = Kokkos::View<Kokkos::complex<double>, Kokkos::LayoutLeft, Kokkos::Device<Kokkos::Cuda, Kokkos::CudaSpace>, Kokkos::MemoryTraits<Kokkos::Unmanaged>>; static void rot(Kokkos::Cuda const& space, VectorView const& X, VectorView const& Y, MagnitudeView const& c, ScalarView const& s) { Kokkos::Profiling::pushRegion("KokkosBlas::rot[TPL_CUBLAS,complex<double>]"); rot_print_specialization<Kokkos::Cuda, VectorView, ScalarView>(); KokkosBlas::Impl::CudaBlasSingleton& singleton = KokkosBlas::Impl::CudaBlasSingleton::singleton(); KokkosBlas::Impl::cublas_internal_safe_call(cublasSetStream_v2(singleton.handle, space.cuda_stream()), "cublasSetStream(singleton.handle, space.cuda_stream())", "/p/gpfs1/dang15/Kokkos/kokkos-kernels/blas/tpls/KokkosBlas1_rot_tpl_spec_decl.hpp", 323); cublasPointerMode_t pointer_mode; KokkosBlas::Impl::cublas_internal_safe_call(cublasGetPointerMode_v2(singleton.handle, &pointer_mode), "cublasGetPointerMode(singleton.handle, &pointer_mode)", "/p/gpfs1/dang15/Kokkos/kokkos-kernels/blas/tpls/KokkosBlas1_rot_tpl_spec_decl.hpp", 323); KokkosBlas::Impl::cublas_internal_safe_call(cublasSetPointerMode_v2(singleton.handle, CUBLAS_POINTER_MODE_DEVICE), "cublasSetPointerMode(singleton.handle, CUBLAS_POINTER_MODE_DEVICE)", "/p/gpfs1/dang15/Kokkos/kokkos-kernels/blas/tpls/KokkosBlas1_rot_tpl_spec_decl.hpp", 323); cublasZdrot_v2(singleton.handle, X.extent_int(0), reinterpret_cast<cuDoubleComplex*>(X.data()), 1, reinterpret_cast<cuDoubleComplex*>(Y.data()), 1, c.data(), reinterpret_cast<cuDoubleComplex*>(s.data())); KokkosBlas::Impl::cublas_internal_safe_call(cublasSetPointerMode_v2(singleton.handle, pointer_mode), "cublasSetPointerMode(singleton.handle, pointer_mode)", "/p/gpfs1/dang15/Kokkos/kokkos-kernels/blas/tpls/KokkosBlas1_rot_tpl_spec_decl.hpp", 323); Kokkos::Profiling::popRegion(); } };

I am not sure if the errors are caused by this merge. My cmake configurations:

Kokkos:
cmake /p/gpfs1/dang15/Kokkos/kokkos -DCMAKE_CXX_COMPILER=/p/gpfs1/dang15/Kokkos/kokkos/bin/nvcc_wrapper -DCMAKE_BUILD_TYPE:STRING=RELEASE -DCMAKE_INSTALL_PREFIX=/p/gpfs1/dang15/Kokkos/kokkos-install-cuda1222-lassen -DKokkos_ENABLE_OPENMP:BOOL=ON -DKokkos_ARCH_POWER9=ON -DKokkos_ENABLE_CUDA:BOOL=ON -DKokkos_ENABLE_CUDA_LAMBDA:BOOL=ON -DKokkos_ENABLE_CUDA_RELOCATABLE_DEVICE_CODE:BOOL=ON -DKokkos_ARCH_VOLTA70=ON

Kokkos Kernels:
cmake /p/gpfs1/dang15/Kokkos/kokkos-kernels -DCMAKE_CXX_COMPILER=/p/gpfs1/dang15/Kokkos/kokkos/bin/nvcc_wrapper -DCMAKE_BUILD_TYPE:STRING=RELEASE -DCMAKE_CXX_STANDARD=17 -DCMAKE_INSTALL_PREFIX=/p/gpfs1/dang15/Kokkos/kokkoskernels-install-cuda1222-cublason-cusparseon-lassen -DKokkos_DIR=/p/gpfs1/dang15/Kokkos/kokkos-install-cuda1222-lassen/lib64/cmake/Kokkos -DKokkosKernels_ENABLE_TPL_CUBLAS:BOOL=ON -DKokkosKernels_ENABLE_TPL_CUSPARSE:BOOL=ON -DKokkosKernels_ENABLE_TPL_CUSOLVER:BOOL=OFF -DKokkosKernels_ENABLE_EXAMPLES=ON -DKokkosKernels_INST_COMPLEX_DOUBLE=ON

@lucbv
Copy link
Contributor Author

lucbv commented Jan 6, 2025

@vqd8a thanks for reporting it, I am having a look now!

@vqd8a
Copy link
Contributor

vqd8a commented Jan 6, 2025

@lucbv Thanks. I think, changing cublasCsrot to cublasCrot and cublasZdrot to cublasZrot probably fixes the errors.

@lucbv
Copy link
Contributor Author

lucbv commented Jan 6, 2025

I think the change that Vinh suggested makes sense though, the error also points at a cuDoubleComplex vs double issue which would be triggered by the change to a complex parameter for s. I made the relevant change in PR #2473

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Cleanup Code maintenance that isn't a bugfix or new feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants