Pressio / pressio

core C++ library
Other
45 stars 7 forks source link

static assert to report to kokkos-kernels #624

Closed fnrizzi closed 6 months ago

fnrizzi commented 1 year ago
  std::vector<double> data(40);
  using view_type = Kokkos::View<double*, Kokkos::LayoutStride>;
  view_type obj(data.data(), Kokkos::LayoutStride(20, 1+30));
  auto val = ::KokkosBlas::nrm2(obj);
  (void) val;

gives:

/Users/fnrizzi/Desktop/work/ROM/my_local_development/trilinos/702aac58950c2839cae8cbe7f031ffec5d2fb5cf-install/include/Kokkos_View.hpp: In instantiation of 'Kokkos::View<DataType, Properties>::View(Kokkos::View<DataType, Properties>::pointer_type, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t) [with DataType = double; Properties = {Kokkos::LayoutStride, Kokkos::HostSpace, Kokkos::MemoryTraits<1>}; Kokkos::View<DataType, Properties>::pointer_type = double*; size_t = long unsigned int]':
/Users/fnrizzi/Desktop/work/ROM/my_local_development/trilinos/702aac58950c2839cae8cbe7f031ffec5d2fb5cf-install/include/KokkosBlas1_nrm2.hpp:58:24:   required from 'typename Kokkos::Details::InnerProductSpaceTraits<typename XVector::non_const_value_type>::mag_type KokkosBlas::nrm2(const XVector&) [with XVector = Kokkos::View<double*, Kokkos::LayoutStride>; typename Kokkos::Details::InnerProductSpaceTraits<typename XVector::non_const_value_type>::mag_type = double]'
/Users/fnrizzi/Desktop/work/ROM/pressio/tests/functional_small/ops/ops_kokkos_diag.cc:167:36:   required from here
/Users/fnrizzi/Desktop/work/ROM/my_local_development/trilinos/702aac58950c2839cae8cbe7f031ffec5d2fb5cf-install/include/Kokkos_View.hpp:1602:41: error: static assertion failed: Layout is not constructible from extent arguments. Use overload taking a layout object instead.
 1602 |     static_assert(traits::array_layout::is_extent_constructible,
      |                                         ^~~~~~~~~~~~~~~~~~~~~~~
make[3]: *** [tests/functional_small/ops/CMakeFiles/functional_small_ops_diag_kokkos.dir/ops_kokkos_diag.cc.o] Error 1
make[2]: *** [tests/functional_small/ops/CMakeFiles/functional_small_ops_diag_kokkos.dir/all] Error 2
make[1]: *** [tests/functional_small/ops/CMakeFiles/functional_small_ops_diag_kokkos.dir/rule] Error 2
make: *** [tests/functional_small/ops/CMakeFiles/functional_small_ops_diag_kokkos.dir/rule] Error 2