Skip to content

Tpetra: Fix compiling Tpetra::Multivector::dot() with nvcc-8 for non-complex Scalar

Created by: masterleinad

@trilinos/tpetra

Description

Split the two cases in Tpetra::Details::localDotWorkAround using std::enable_if such that the compiler doesn't try to compile the complex branch for a non-complex Scalar type.

Motivation and Context

Without this patch I get

include/Cuda/Kokkos_Cuda_Parallel.hpp(2461): error: calling a __host__ function("") from a __device__ function("Kokkos::Impl::ParallelReduce< ::Kokkos::Impl::CudaFunctorAdapter< ::,  ::Kokkos::RangePolicy< ::Kokkos::Cuda, int > ,         double, void> ,  ::Kokkos::RangePolicy< ::Kokkos::Cuda, int > ,  ::Kokkos::InvalidType,  ::Kokkos::Cuda> ::operator ()") is not allowed

caused by the call to Kokkos::parallel_reduce in Tpetra::Details::localDotWorkAround for a non-complex Scalar type when compiling with nvcc-8. This is similar to the issue in #4264 (closed).

Related Issues

How Has This Been Tested?

Compiling deal.II with https://github.com/dealii/dealii/pull/7180 and nvcc-8 works with this patch.

Checklist

  • My commit messages mention the appropriate GitHub issue numbers.
  • My code follows the code style of the affected package(s).
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the code contribution guidelines for this project.
  • I have added tests to cover my changes.
  • All new and existing tests passed.
  • No new compiler warnings were introduced.
  • These changes break backwards compatibility.

Merge request reports