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

#9 Test Conjugate on complex samples #26

Merged
merged 4 commits into from
Jul 7, 2021
Merged

Conversation

mzuzek
Copy link
Collaborator

@mzuzek mzuzek commented Jun 30, 2021

TODO

  • Template scalar type in block implementation functions;
  • Refactor tests to template scalar type;
  • Test Conjugate and ConjugateTranspose on random sample matrices with Kokkos::complex<> values;
  • Support std::complex<> (getting issues on Kokkos::atomic_add())

@mzuzek mzuzek self-assigned this Jun 30, 2021
@mzuzek mzuzek requested review from fnrizzi and uhetmaniuk June 30, 2021 19:20
@fnrizzi
Copy link
Owner

fnrizzi commented Jul 1, 2021

what problem are you getting from Kokkos::atomic_add()?

@mzuzek
Copy link
Collaborator Author

mzuzek commented Jul 1, 2021

I'm not sure yet what's going on: volatile is messing somewhere.
Here's the full error message (click to expand):
FAILED: example/wiki/sparse/CMakeFiles/KokkosKernels_nga_bspmv.dir/KokkosSparse_nga_bspmv.cpp.o 
/usr/local/bin/c++ -DKOKKOS_DEPENDENCE -Iexample -I/home/dev/kk/kokkos-kernels/example -I/home/dev/kk/kokkos-kernels/example/../test_common -Iexample/wiki/sparse -I/home/dev/kk/kokkos-kernels/example/wiki/sparse -I/home/dev/kk/kokkos-kernels/example/wiki/sparse/../../../../test_common -Isrc -I/home/dev/kk/kokkos-kernels/src -I/home/dev/kk/kokkos-kernels/src/impl -Isrc/impl -I/home/dev/kk/kokkos-kernels/src/impl/tpls -I/home/dev/kk/kokkos-kernels/src/blas -I/home/dev/kk/kokkos-kernels/src/blas/impl -I/home/dev/kk/kokkos-kernels/src/sparse -I/home/dev/kk/kokkos-kernels/src/sparse/impl -I/home/dev/kk/kokkos-kernels/src/graph -I/home/dev/kk/kokkos-kernels/src/graph/impl -I/home/dev/kk/kokkos-kernels/src/batched -I/home/dev/kk/kokkos-kernels/src/common -isystem /home/dev/kk/install/kokkos/include -isystem /usr/include/superlu -O3 -DNDEBUG -pthread -MD -MT example/wiki/sparse/CMakeFiles/KokkosKernels_nga_bspmv.dir/KokkosSparse_nga_bspmv.cpp.o -MF example/wiki/sparse/CMakeFiles/KokkosKernels_nga_bspmv.dir/KokkosSparse_nga_bspmv.cpp.o.d -o example/wiki/sparse/CMakeFiles/KokkosKernels_nga_bspmv.dir/KokkosSparse_nga_bspmv.cpp.o -c /home/dev/kk/kokkos-kernels/example/wiki/sparse/KokkosSparse_nga_bspmv.cpp
In file included from /home/dev/kk/install/kokkos/include/Kokkos_Atomic.hpp:233,
                 from /home/dev/kk/install/kokkos/include/impl/Kokkos_Atomic_View.hpp:48,
                 from /home/dev/kk/install/kokkos/include/impl/Kokkos_ViewMapping.hpp:59,
                 from /home/dev/kk/install/kokkos/include/Kokkos_View.hpp:501,
                 from /home/dev/kk/install/kokkos/include/Kokkos_Parallel.hpp:53,
                 from /home/dev/kk/install/kokkos/include/Kokkos_Threads.hpp:220,
                 from /home/dev/kk/install/kokkos/include/decl/Kokkos_Declare_THREADS.hpp:49,
                 from /home/dev/kk/install/kokkos/include/KokkosCore_Config_DeclareBackend.hpp:47,
                 from /home/dev/kk/install/kokkos/include/Kokkos_Core.hpp:56,
                 from /home/dev/kk/kokkos-kernels/example/wiki/sparse/KokkosSparse_nga_bspmv.cpp:1:
/home/dev/kk/install/kokkos/include/impl/Kokkos_Atomic_Fetch_Add.hpp: In instantiation of ‘T Kokkos::atomic_fetch_add(volatile T*, typename std::enable_if<((sizeof (T) != 4) && (sizeof (T) != 8)), const T>::type&) [with T = std::complex; typename std::enable_if<((sizeof (T) != 4) && (sizeof (T) != 8)), const T>::type = const std::complex]’:
/home/dev/kk/install/kokkos/include/impl/Kokkos_Atomic_Generic_Secondary.hpp:67:25:   required from ‘void Kokkos::atomic_add(volatile T*, T) [with T = std::complex]’
/home/dev/kk/kokkos-kernels/src/sparse/impl/KokkosSparse_spmv_impl_block_crs.hpp:690:29:   required from ‘void KokkosSparse::Impl::BSPMV_Transpose_Functor::operator()(KokkosSparse::Impl::BSPMV_Transpose_Functor::ordinal_type) const [with AMatrix = KokkosSparse::Experimental::BlockCrsMatrix, int, Kokkos::Device, Kokkos::MemoryTraits<1>, int>; XVector = Kokkos::View*, Kokkos::LayoutRight, Kokkos::Device, Kokkos::MemoryTraits<0> >; YVector = Kokkos::View*, Kokkos::LayoutRight, Kokkos::Device, Kokkos::MemoryTraits<0> >; KokkosSparse::Impl::BSPMV_Transpose_Functor::ordinal_type = int]’
/home/dev/kk/install/kokkos/include/Threads/Kokkos_Threads_Parallel.hpp:88:14:   required from ‘static typename std::enable_if::value>::type Kokkos::Impl::ParallelFor, Kokkos::Threads>::exec_range(const FunctorType&, Kokkos::Impl::ParallelFor, Kokkos::Threads>::Member, Kokkos::Impl::ParallelFor, Kokkos::Threads>::Member) [with TagType = void; FunctorType = KokkosSparse::Impl::BSPMV_Transpose_Functor, int, Kokkos::Device, Kokkos::MemoryTraits<1>, int>, Kokkos::View*, Kokkos::LayoutRight, Kokkos::Device, Kokkos::MemoryTraits<0> >, Kokkos::View*, Kokkos::LayoutRight, Kokkos::Device, Kokkos::MemoryTraits<0> > >; Traits = {Kokkos::Threads}; typename std::enable_if::value>::type = void; Kokkos::Impl::ParallelFor, Kokkos::Threads>::Member = long unsigned int]’
/home/dev/kk/install/kokkos/include/Threads/Kokkos_Threads_Parallel.hpp:119:46:   required from ‘static typename std::enable_if::value>::type Kokkos::Impl::ParallelFor, Kokkos::Threads>::exec_schedule(Kokkos::Impl::ThreadsExec&, const void*) [with Schedule = Kokkos::Static; FunctorType = KokkosSparse::Impl::BSPMV_Transpose_Functor, int, Kokkos::Device, Kokkos::MemoryTraits<1>, int>, Kokkos::View*, Kokkos::LayoutRight, Kokkos::Device, Kokkos::MemoryTraits<0> >, Kokkos::View*, Kokkos::LayoutRight, Kokkos::Device, Kokkos::MemoryTraits<0> > >; Traits = {Kokkos::Threads}; typename std::enable_if::value>::type = void]’
/home/dev/kk/install/kokkos/include/Threads/Kokkos_Threads_Parallel.hpp:108:56:   required from ‘static void Kokkos::Impl::ParallelFor, Kokkos::Threads>::exec(Kokkos::Impl::ThreadsExec&, const void*) [with FunctorType = KokkosSparse::Impl::BSPMV_Transpose_Functor, int, Kokkos::Device, Kokkos::MemoryTraits<1>, int>, Kokkos::View*, Kokkos::LayoutRight, Kokkos::Device, Kokkos::MemoryTraits<0> >, Kokkos::View*, Kokkos::LayoutRight, Kokkos::Device, Kokkos::MemoryTraits<0> > >; Traits = {Kokkos::Threads}]’
/home/dev/kk/install/kokkos/include/Threads/Kokkos_Threads_Parallel.hpp:158:24:   [ skipping 3 instantiation contexts, use -ftemplate-backtrace-limit=0 to disable ]
/home/dev/kk/kokkos-kernels/src/sparse/impl/KokkosSparse_spmv_impl_block_crs.hpp:1091:23:   required from ‘void KokkosSparse::Impl::spMatVec_transpose(KokkosKernels::Experimental::Controls, const AlphaType&, const KokkosSparse::Experimental::BlockCrsMatrix&, const XVector&, const BetaType&, YVector&, bool, bool) [with AT = std::complex; AO = int; AD = Kokkos::Device; AM = void; AS = int; AlphaType = std::complex; XVector = Kokkos::View*, Kokkos::LayoutRight, Kokkos::Device, Kokkos::MemoryTraits<0> >; BetaType = std::complex; YVector = Kokkos::View*, Kokkos::LayoutRight, Kokkos::Device, Kokkos::MemoryTraits<0> >; typename std::enable_if<(! kk_is_gpu_exec_space())>::type*  = 0]’
/home/dev/kk/kokkos-kernels/src/sparse/KokkosSparse_spmv.hpp:551:38:   required from ‘void KokkosSparse::spmv(KokkosKernels::Experimental::Controls, const char*, const AlphaType&, const KokkosSparse::Experimental::BlockCrsMatrix&, const XVector&, const BetaType&, YVector&) [with ScalarType = std::complex; OrdinalType = int; Device = Kokkos::Device; MemoryTraits = void; SizeType = int; AlphaType = std::complex; XVector = Kokkos::View*, Kokkos::LayoutRight, Kokkos::Device, Kokkos::MemoryTraits<0> >; BetaType = std::complex; YVector = Kokkos::View*, Kokkos::LayoutRight, Kokkos::Device, Kokkos::MemoryTraits<0> >]’
/home/dev/kk/kokkos-kernels/example/wiki/sparse/KokkosSparse_nga_bspmv.cpp:385:21:   required from ‘bool test::compare(const char*, const mtx_t&, const bmtx_t&, Scalar, Scalar, double&, double&) [with mtx_t = KokkosSparse::CrsMatrix, int, Kokkos::Device, void, int>; bmtx_t = KokkosSparse::Experimental::BlockCrsMatrix, int, Kokkos::Device, void, int>; Scalar = std::complex]’
/home/dev/kk/kokkos-kernels/example/wiki/sparse/KokkosSparse_nga_bspmv.cpp:455:29:   required from ‘void test::TestRunner::operator()(const string&, mtx_t, test::Variants&, int, int) [with mtx_t = KokkosSparse::CrsMatrix, int, Kokkos::Device, void, int>; bmtx_t = KokkosSparse::Experimental::BlockCrsMatrix, void, int>; Scalar = std::complex; Output = CSVOutput; std::__cxx11::string = std::__cxx11::basic_string; test::Variants = std::vector]’
/home/dev/kk/kokkos-kernels/example/wiki/sparse/KokkosSparse_nga_bspmv.cpp:506:16:   required from ‘void test::test_random_samples(Executor&, test::Variants&, int, int, int) [with Scalar = std::complex; Executor = test::TestRunner; test::Variants = std::vector]’
/home/dev/kk/kokkos-kernels/example/wiki/sparse/KokkosSparse_nga_bspmv.cpp:683:92:   required from here
/home/dev/kk/install/kokkos/include/impl/Kokkos_Atomic_Fetch_Add.hpp:343:5: error: no matching function for call to ‘complex(volatile std::complex&)’
   T return_val = *dest;
     ^~~~~~~~~~
In file included from /home/dev/kk/install/kokkos/include/Kokkos_Complex.hpp:51,
                 from /home/dev/kk/install/kokkos/include/Kokkos_Core.hpp:71,
                 from /home/dev/kk/kokkos-kernels/example/wiki/sparse/KokkosSparse_nga_bspmv.cpp:1:
/usr/include/c++/8/complex:1221:12: note: candidate: ‘constexpr std::complex::complex(const std::complex&)’ 
     struct complex
            ^~~~~~~~~~~~~~~
/usr/include/c++/8/complex:1221:12: note:   conversion of argument 1 would be ill-formed:
In file included from /home/dev/kk/install/kokkos/include/Kokkos_Atomic.hpp:233,
                 from /home/dev/kk/install/kokkos/include/impl/Kokkos_Atomic_View.hpp:48,
                 from /home/dev/kk/install/kokkos/include/impl/Kokkos_ViewMapping.hpp:59,
                 from /home/dev/kk/install/kokkos/include/Kokkos_View.hpp:501,
                 from /home/dev/kk/install/kokkos/include/Kokkos_Parallel.hpp:53,
                 from /home/dev/kk/install/kokkos/include/Kokkos_Threads.hpp:220,
                 from /home/dev/kk/install/kokkos/include/decl/Kokkos_Declare_THREADS.hpp:49,
                 from /home/dev/kk/install/kokkos/include/KokkosCore_Config_DeclareBackend.hpp:47,
                 from /home/dev/kk/install/kokkos/include/Kokkos_Core.hpp:56,
                 from /home/dev/kk/kokkos-kernels/example/wiki/sparse/KokkosSparse_nga_bspmv.cpp:1:
/home/dev/kk/install/kokkos/include/impl/Kokkos_Atomic_Fetch_Add.hpp:343:5: error: binding reference of type ‘const std::complex&’ to ‘volatile std::complex’ discards qualifiers
   T return_val = *dest;
     ^~~~~~~~~~
In file included from /home/dev/kk/install/kokkos/include/Kokkos_Complex.hpp:51,
                 from /home/dev/kk/install/kokkos/include/Kokkos_Core.hpp:71,
                 from /home/dev/kk/kokkos-kernels/example/wiki/sparse/KokkosSparse_nga_bspmv.cpp:1:
/usr/include/c++/8/complex:1221:12: note: candidate: ‘constexpr std::complex::complex(std::complex&&)’ 
     struct complex
            ^~~~~~~~~~~~~~~
/usr/include/c++/8/complex:1221:12: note:   conversion of argument 1 would be ill-formed:
In file included from /home/dev/kk/install/kokkos/include/Kokkos_Atomic.hpp:233,
                 from /home/dev/kk/install/kokkos/include/impl/Kokkos_Atomic_View.hpp:48,
                 from /home/dev/kk/install/kokkos/include/impl/Kokkos_ViewMapping.hpp:59,
                 from /home/dev/kk/install/kokkos/include/Kokkos_View.hpp:501,
                 from /home/dev/kk/install/kokkos/include/Kokkos_Parallel.hpp:53,
                 from /home/dev/kk/install/kokkos/include/Kokkos_Threads.hpp:220,
                 from /home/dev/kk/install/kokkos/include/decl/Kokkos_Declare_THREADS.hpp:49,
                 from /home/dev/kk/install/kokkos/include/KokkosCore_Config_DeclareBackend.hpp:47,
                 from /home/dev/kk/install/kokkos/include/Kokkos_Core.hpp:56,
                 from /home/dev/kk/kokkos-kernels/example/wiki/sparse/KokkosSparse_nga_bspmv.cpp:1:
/home/dev/kk/install/kokkos/include/impl/Kokkos_Atomic_Fetch_Add.hpp:343:5: error: cannot bind rvalue reference of type ‘std::complex&&’ to lvalue of type ‘volatile std::complex’
   T return_val = *dest;
     ^~~~~~~~~~
/home/dev/kk/install/kokkos/include/impl/Kokkos_Atomic_Fetch_Add.hpp:354:15: error: passing ‘volatile std::complex’ as ‘this’ argument discards qualifiers [-fpermissive]
   *dest       = return_val + val;
   ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
In file included from /home/dev/kk/install/kokkos/include/Kokkos_Complex.hpp:51,
                 from /home/dev/kk/install/kokkos/include/Kokkos_Core.hpp:71,
                 from /home/dev/kk/kokkos-kernels/example/wiki/sparse/KokkosSparse_nga_bspmv.cpp:1:
/usr/include/c++/8/complex:1221:12: note:   in call to ‘constexpr std::complex& std::complex::operator=(std::complex&&)’
     struct complex
            ^~~~~~~~~~~~~~~
In file included from /home/dev/kk/install/kokkos/include/Kokkos_Atomic.hpp:233,
                 from /home/dev/kk/install/kokkos/include/impl/Kokkos_Atomic_View.hpp:48,
                 from /home/dev/kk/install/kokkos/include/impl/Kokkos_ViewMapping.hpp:59,
                 from /home/dev/kk/install/kokkos/include/Kokkos_View.hpp:501,
                 from /home/dev/kk/install/kokkos/include/Kokkos_Parallel.hpp:53,
                 from /home/dev/kk/install/kokkos/include/Kokkos_Threads.hpp:220,
                 from /home/dev/kk/install/kokkos/include/decl/Kokkos_Declare_THREADS.hpp:49,
                 from /home/dev/kk/install/kokkos/include/KokkosCore_Config_DeclareBackend.hpp:47,
                 from /home/dev/kk/install/kokkos/include/Kokkos_Core.hpp:56,
                 from /home/dev/kk/kokkos-kernels/example/wiki/sparse/KokkosSparse_nga_bspmv.cpp:1:
/home/dev/kk/install/kokkos/include/impl/Kokkos_Atomic_Fetch_Add.hpp:355:11: error: no matching function for call to ‘complex(volatile std::complex&)’
   const T tmp = *dest;
           ^~~
In file included from /home/dev/kk/install/kokkos/include/Kokkos_Complex.hpp:51,
                 from /home/dev/kk/install/kokkos/include/Kokkos_Core.hpp:71,
                 from /home/dev/kk/kokkos-kernels/example/wiki/sparse/KokkosSparse_nga_bspmv.cpp:1:
/usr/include/c++/8/complex:1221:12: note: candidate: ‘constexpr std::complex::complex(const std::complex&)’ 
     struct complex
            ^~~~~~~~~~~~~~~
/usr/include/c++/8/complex:1221:12: note:   conversion of argument 1 would be ill-formed:
In file included from /home/dev/kk/install/kokkos/include/Kokkos_Atomic.hpp:233,
                 from /home/dev/kk/install/kokkos/include/impl/Kokkos_Atomic_View.hpp:48,
                 from /home/dev/kk/install/kokkos/include/impl/Kokkos_ViewMapping.hpp:59,
                 from /home/dev/kk/install/kokkos/include/Kokkos_View.hpp:501,
                 from /home/dev/kk/install/kokkos/include/Kokkos_Parallel.hpp:53,
                 from /home/dev/kk/install/kokkos/include/Kokkos_Threads.hpp:220,
                 from /home/dev/kk/install/kokkos/include/decl/Kokkos_Declare_THREADS.hpp:49,
                 from /home/dev/kk/install/kokkos/include/KokkosCore_Config_DeclareBackend.hpp:47,
                 from /home/dev/kk/install/kokkos/include/Kokkos_Core.hpp:56,
                 from /home/dev/kk/kokkos-kernels/example/wiki/sparse/KokkosSparse_nga_bspmv.cpp:1:
/home/dev/kk/install/kokkos/include/impl/Kokkos_Atomic_Fetch_Add.hpp:355:11: error: binding reference of type ‘const std::complex&’ to ‘volatile std::complex’ discards qualifiers
   const T tmp = *dest;
           ^~~
In file included from /home/dev/kk/install/kokkos/include/Kokkos_Complex.hpp:51,
                 from /home/dev/kk/install/kokkos/include/Kokkos_Core.hpp:71,
                 from /home/dev/kk/kokkos-kernels/example/wiki/sparse/KokkosSparse_nga_bspmv.cpp:1:
/usr/include/c++/8/complex:1221:12: note: candidate: ‘constexpr std::complex::complex(std::complex&&)’ 
     struct complex
            ^~~~~~~~~~~~~~~
/usr/include/c++/8/complex:1221:12: note:   conversion of argument 1 would be ill-formed:
In file included from /home/dev/kk/install/kokkos/include/Kokkos_Atomic.hpp:233,
                 from /home/dev/kk/install/kokkos/include/impl/Kokkos_Atomic_View.hpp:48,
                 from /home/dev/kk/install/kokkos/include/impl/Kokkos_ViewMapping.hpp:59,
                 from /home/dev/kk/install/kokkos/include/Kokkos_View.hpp:501,
                 from /home/dev/kk/install/kokkos/include/Kokkos_Parallel.hpp:53,
                 from /home/dev/kk/install/kokkos/include/Kokkos_Threads.hpp:220,
                 from /home/dev/kk/install/kokkos/include/decl/Kokkos_Declare_THREADS.hpp:49,
                 from /home/dev/kk/install/kokkos/include/KokkosCore_Config_DeclareBackend.hpp:47,
                 from /home/dev/kk/install/kokkos/include/Kokkos_Core.hpp:56,
                 from /home/dev/kk/kokkos-kernels/example/wiki/sparse/KokkosSparse_nga_bspmv.cpp:1:
/home/dev/kk/install/kokkos/include/impl/Kokkos_Atomic_Fetch_Add.hpp:355:11: error: cannot bind rvalue reference of type ‘std::complex&&’ to lvalue of type ‘volatile std::complex’
   const T tmp = *dest;
           ^~~

@uhetmaniuk uhetmaniuk merged commit c42ae80 into develop Jul 7, 2021
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

Successfully merging this pull request may close these issues.

3 participants