IPPL-framework / ippl

IPPL is a C++ library to develop performance portable code for fully Eulerian, Lagrangian or hybrid Eulerian-Lagrangian methods.
https://ippl-framework.github.io/ippl/
GNU General Public License v3.0
21 stars 20 forks source link

Unit tests do not compile in Cuda build #308

Open s-mayani opened 2 months ago

s-mayani commented 2 months ago

The IPPL unit tests are not compiling in Cuda build. The problem is in the FFT unit tests, which cause the following error:

[ 87%] Building CXX object unit_tests/FFT/CMakeFiles/FFT.dir/FFT.cpp.o
/psi/home/mayani_s/ippl-phd/ippl/src/FFT/FFT.h(267): error: incomplete type is not allowed
      class FFT<CosTransform, Field> : public FFTBase<Field, heffte::fft3d, typename detail::HeffteBackendType<typename Field::memory_space>::backendCos> {
                                                                                     ^
          detected during:
            instantiation of class "ippl::FFT<ippl::CosTransform, Field> [with Field=ippl::Field<double, 2U, ippl::UniformCartesian<double, 2U>, Cell, Kokkos::Serial>]" at line 1065 of /afs/psi.ch/sys/psi.merlin/Programming/gcc/12.3.0/include/c++/12.3.0/bits/unique_ptr.h
            instantiation of "std::__detail::__unique_ptr_t<_Tp> std::make_unique<_Tp,_Args...>(_Args &&...) [with _Tp=ippl::FFT<ippl::CosTransform, ippl::Field<double, 2U, ippl::UniformCartesian<double, 2U>, Cell, Kokkos::Serial>>, _Args=<const ippl::FieldLayout<2U> &, ippl::ParameterList>]" at line 149 of /psi/home/mayani_s/ippl-phd/ippl/unit_tests/FFT/FFT.cpp
            instantiation of "void FFTTest<Parameters<T, ExecSpace, Rank<Dim>>>::testTrig<Transform>(std::shared_ptr<FFTTest<Parameters<T, ExecSpace, Rank<Dim>>>::field_type_real> &, const FFTTest<Parameters<T, ExecSpace, Rank<Dim>>>::layout_type &) [with T=double, ExecSpace=Kokkos::Serial, Dim=2U, Transform=ippl::CosTransform]" at line 181 of /psi/home/mayani_s/ippl-phd/ippl/unit_tests/FFT/FFT.cpp
            instantiation of "void FFTTest_Cos_Test<gtest_TypeParam_>::TestBody() [with gtest_TypeParam_=Parameters<double, Kokkos::Serial, Rank<2U>>]" at line 457 of /psi/home/mayani_s/ippl-phd/ippl/build_cuda_unit/_deps/googletest-src/googletest/include/gtest/internal/gtest-internal.h
            implicit generation of "FFTTest_Cos_Test<gtest_TypeParam_>::~FFTTest_Cos_Test() noexcept [with gtest_TypeParam_=Parameters<double, Kokkos::Serial, Rank<2U>>]" at line 457 of /psi/home/mayani_s/ippl-phd/ippl/build_cuda_unit/_deps/googletest-src/googletest/include/gtest/internal/gtest-internal.h
            [ 4 instantiation contexts not shown ]
            implicit generation of "testing::internal::TestFactoryImpl<TestClass>::~TestFactoryImpl() noexcept [with TestClass=FFTTest_Cos_Test<Parameters<double, Kokkos::Serial, Rank<2U>>>]" at line 726 of /psi/home/mayani_s/ippl-phd/ippl/build_cuda_unit/_deps/googletest-src/googletest/include/gtest/internal/gtest-internal.h
            instantiation of class "testing::internal::TestFactoryImpl<TestClass> [with TestClass=FFTTest_Cos_Test<Parameters<double, Kokkos::Serial, Rank<2U>>>]" at line 726 of /psi/home/mayani_s/ippl-phd/ippl/build_cuda_unit/_deps/googletest-src/googletest/include/gtest/internal/gtest-internal.h
            implicit generation of "testing::internal::TestFactoryImpl<TestClass>::TestFactoryImpl() [with TestClass=FFTTest_Cos_Test<Parameters<double, Kokkos::Serial, Rank<2U>>>]" at line 726 of /psi/home/mayani_s/ippl-phd/ippl/build_cuda_unit/_deps/googletest-src/googletest/include/gtest/internal/gtest-internal.h
            instantiation of class "testing::internal::TestFactoryImpl<TestClass> [with TestClass=FFTTest_Cos_Test<Parameters<double, Kokkos::Serial, Rank<2U>>>]" at line 726 of /psi/home/mayani_s/ippl-phd/ippl/build_cuda_unit/_deps/googletest-src/googletest/include/gtest/internal/gtest-internal.h
            instantiation of "__nv_bool testing::internal::TypeParameterizedTest<Fixture, TestSel, Types>::Register(const char *, const testing::internal::CodeLocation &, const char *, const char *, int, const std::vector<std::string, std::allocator<std::string>> &) [with Fixture=FFTTest, TestSel=testing::internal::TemplateSel<FFTTest_Cos_Test>, Types=gtest_type_params_FFTTest_]" at line 180 of /psi/home/mayani_s/ippl-phd/ippl/unit_tests/FFT/FFT.cpp

/psi/home/mayani_s/ippl-phd/ippl/build_cuda_unit/_deps/heffte-src/include/heffte_common.h(236): error: class "std::enable_if<false, void *>" has no member "type"
      template<typename backend_tag, typename std::enable_if<is_enabled<backend_tag>::value, void*>::type = nullptr>
                                                                                                     ^
          detected during:
            processing of template argument list for "heffte::backend::buffer_traits" based on template argument <<error-type>> at line 240 of /psi/home/mayani_s/ippl-phd/ippl/build_cuda_unit/_deps/heffte-src/include/heffte_fft3d.h
            instantiation of class "heffte::fft3d<backend_tag, index> [with backend_tag=<error-type>, index=int]" at line 128 of /psi/home/mayani_s/ippl-phd/ippl/src/FFT/FFT.h
            instantiation of class "ippl::FFTBase<Field, FFT, Backend, BufferType> [with Field=ippl::Field<double, 2U, ippl::UniformCartesian<double, 2U>, Cell, Kokkos::Serial>, FFT=heffte::fft3d, Backend=<error-type>, BufferType=double]" at line 267 of /psi/home/mayani_s/ippl-phd/ippl/src/FFT/FFT.h
            instantiation of class "ippl::FFT<ippl::CosTransform, Field> [with Field=ippl::Field<double, 2U, ippl::UniformCartesian<double, 2U>, Cell, Kokkos::Serial>]" at line 1065 of /afs/psi.ch/sys/psi.merlin/Programming/gcc/12.3.0/include/c++/12.3.0/bits/unique_ptr.h
            instantiation of "std::__detail::__unique_ptr_t<_Tp> std::make_unique<_Tp,_Args...>(_Args &&...) [with _Tp=ippl::FFT<ippl::CosTransform, ippl::Field<double, 2U, ippl::UniformCartesian<double, 2U>, Cell, Kokkos::Serial>>, _Args=<const ippl::FieldLayout<2U> &, ippl::ParameterList>]" at line 149 of /psi/home/mayani_s/ippl-phd/ippl/unit_tests/FFT/FFT.cpp
            [ 7 instantiation contexts not shown ]
            implicit generation of "testing::internal::TestFactoryImpl<TestClass>::~TestFactoryImpl() noexcept [with TestClass=FFTTest_Cos_Test<Parameters<double, Kokkos::Serial, Rank<2U>>>]" at line 726 of /psi/home/mayani_s/ippl-phd/ippl/build_cuda_unit/_deps/googletest-src/googletest/include/gtest/internal/gtest-internal.h
            instantiation of class "testing::internal::TestFactoryImpl<TestClass> [with TestClass=FFTTest_Cos_Test<Parameters<double, Kokkos::Serial, Rank<2U>>>]" at line 726 of /psi/home/mayani_s/ippl-phd/ippl/build_cuda_unit/_deps/googletest-src/googletest/include/gtest/internal/gtest-internal.h
            implicit generation of "testing::internal::TestFactoryImpl<TestClass>::TestFactoryImpl() [with TestClass=FFTTest_Cos_Test<Parameters<double, Kokkos::Serial, Rank<2U>>>]" at line 726 of /psi/home/mayani_s/ippl-phd/ippl/build_cuda_unit/_deps/googletest-src/googletest/include/gtest/internal/gtest-internal.h
            instantiation of class "testing::internal::TestFactoryImpl<TestClass> [with TestClass=FFTTest_Cos_Test<Parameters<double, Kokkos::Serial, Rank<2U>>>]" at line 726 of /psi/home/mayani_s/ippl-phd/ippl/build_cuda_unit/_deps/googletest-src/googletest/include/gtest/internal/gtest-internal.h
            instantiation of "__nv_bool testing::internal::TypeParameterizedTest<Fixture, TestSel, Types>::Register(const char *, const testing::internal::CodeLocation &, const char *, const char *, int, const std::vector<std::string, std::allocator<std::string>> &) [with Fixture=FFTTest, TestSel=testing::internal::TemplateSel<FFTTest_Cos_Test>, Types=gtest_type_params_FFTTest_]" at line 180 of /psi/home/mayani_s/ippl-phd/ippl/unit_tests/FFT/FFT.cpp

There are also some uses of std:: in the unit tests that cause the following warning:

[ 85%] Building CXX object unit_tests/BareField/CMakeFiles/BareField.dir/BareField.cpp.o
/psi/home/mayani_s/ippl-phd/ippl/src/Field/BareField.hpp(27): warning #20013-D: calling a constexpr __host__ function("infinity") from a __host__ __device__ function("min") is not allowed. The experimental flag '--expt-relaxed-constexpr' can be used to allow this.
              return ippl::Vector<T, Dim>(std::numeric_limits<T>::infinity());
                                          ^
          detected during:
            instantiation of "ippl::Vector<T, Dim> Kokkos::reduction_identity<ippl::Vector<T, Dim>>::min() [with T=double, Dim=1U]" at line 215