From: Daniel Arndt Date: Thu, 3 Apr 2025 21:09:52 +0000 (-0400) Subject: Only allow vectorization with clang X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=faaa0435056d6f2420df2f27f30648f4335500f9;p=dealii.git Only allow vectorization with clang --- diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index c0106e0940..e16b35f409 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -374,7 +374,6 @@ jobs: -D Kokkos_ENABLE_CUDA=ON \ -D Kokkos_ENABLE_CUDA_LAMBDA=ON \ -D Kokkos_ENABLE_CUDA_CONSTEXPR=ON \ - -D Kokkos_ARCH_NATIVE=ON \ -D Kokkos_ARCH_VOLTA70=ON \ .. make install diff --git a/cmake/modules/FindDEAL_II_KOKKOS.cmake b/cmake/modules/FindDEAL_II_KOKKOS.cmake index 8e9226a906..67f80dec92 100644 --- a/cmake/modules/FindDEAL_II_KOKKOS.cmake +++ b/cmake/modules/FindDEAL_II_KOKKOS.cmake @@ -133,6 +133,15 @@ if(KOKKOS_FOUND) endif() if(Kokkos_ENABLE_CUDA) + if (NOT CMAKE_CXX_COMPILER_ID MATCHES Clang) + # We need to disable SIMD vectorization for CUDA device code with nvcc. + # Otherwise, nvcc compilers from version 9 on will emit an error message like: + # "[...] contains a vector, which is not supported in device code". We + # would like to set the variable in check_01_cpu_feature but at that point + # we don't know if CUDA support is enabled in Kokkos + set(DEAL_II_VECTORIZATION_WIDTH_IN_BITS 0) + endif() + # Require lambda support and expt-relaxed-constexpr for Cuda # so that we can use std::array and other interfaces with # __host__ constexpr functions in device code diff --git a/include/deal.II/base/array_view.h b/include/deal.II/base/array_view.h index 0e187c3449..010e6b7a2b 100644 --- a/include/deal.II/base/array_view.h +++ b/include/deal.II/base/array_view.h @@ -431,15 +431,7 @@ public: * Return a pointer to the underlying array serving as element storage. * In case the container is empty a nullptr is returned. */ - template - DEAL_II_HOST_DEVICE - std::enable_if_t, - value_type *> - data() const noexcept; - - template - std::enable_if_t, - value_type *> + DEAL_II_HOST_DEVICE value_type * data() const noexcept; /** @@ -669,26 +661,9 @@ ArrayView::operator!=( template -template -inline DEAL_II_HOST_DEVICE std::enable_if_t< - std::is_same_v, - typename ArrayView::value_type *> -ArrayView::data() const noexcept -{ - if (n_elements == 0) - return nullptr; - else - return starting_element; -} - - - -template -template -inline std::enable_if_t< - std::is_same_v, - typename ArrayView::value_type *> -ArrayView::data() const noexcept +inline DEAL_II_HOST_DEVICE + typename ArrayView::value_type * + ArrayView::data() const noexcept { if (n_elements == 0) return nullptr;