pykokkos
pykokkos copied to clipboard
Example random_sum.py fails because int32 is not a supported type for a reduction
Currently example random_sum.py fails at compile time with the following error:
Initialized view: [ 5 7 5 2 6 10 1 8 0 2]
/home/kestenerp/miniconda3/envs/pykokkos/lib/python3.11/site-packages/pykokkos_base-0.0.7-py3.11-linux-x86_64.egg/include/kokkos/OpenMP/Kokkos_OpenMP_Parallel_Reduce.hpp(64): error: function "pk_functor_RandomSum<ExecSpace>::operator() [with ExecSpace=Kokkos::OpenMP]" cannot be called with the given argument list
argument types are: (const pk_functor_RandomSum<Kokkos::OpenMP>::my_reduction_tag, Kokkos::OpenMP::size_type, double)
object type is: const pk_functor_RandomSum<Kokkos::OpenMP>
functor(t, iwork, update);
^
detected during:
instantiation of "std::enable_if_t<<expression>, void> Kokkos::Impl::ParallelReduce<CombinedFunctorReducerType, Kokkos::RangePolicy<Traits...>, Kokkos::OpenMP>::exec_range<TagType>(const Kokkos::Impl::ParallelReduce<CombinedFunctorReducerType, Kokkos::RangePolicy<Traits...>, Kokkos::OpenMP>::FunctorType &, Kokkos::Impl::ParallelReduce<CombinedFunctorReducerType, Kokkos::RangePolicy<Traits...>, Kokkos::OpenMP>::Member, Kokkos::Impl::ParallelReduce<CombinedFunctorReducerType, Kokkos::RangePolicy<Traits...>, Kokkos::OpenMP>::Member, Kokkos::Impl::ParallelReduce<CombinedFunctorReducerType, Kokkos::RangePolicy<Traits...>, Kokkos::OpenMP>::reference_type) [with CombinedFunctorReducerType=Kokkos::Impl::CombinedFunctorReducer<pk_functor_RandomSum<Kokkos::OpenMP>, Kokkos::Impl::FunctorAnalysis<Kokkos::Impl::FunctorPatternInterface::REDUCE, Kokkos::RangePolicy<Kokkos::OpenMP, pk_functor_RandomSum<Kokkos::OpenMP>::my_reduction_tag>, pk_functor_RandomSum<Kokkos::OpenMP>, double>::Reducer, void>, Traits=<Kokkos::OpenMP, pk_functor_RandomSum<Kokkos::OpenMP>::my_reduction_tag>, TagType=pk_functor_RandomSum<Kokkos::OpenMP>::my_reduction_tag]" at line 106
instantiation of "void Kokkos::Impl::ParallelReduce<CombinedFunctorReducerType, Kokkos::RangePolicy<Traits...>, Kokkos::OpenMP>::execute() const [with CombinedFunctorReducerType=Kokkos::Impl::CombinedFunctorReducer<pk_functor_RandomSum<Kokkos::OpenMP>, Kokkos::Impl::FunctorAnalysis<Kokkos::Impl::FunctorPatternInterface::REDUCE, Kokkos::RangePolicy<Kokkos::OpenMP, pk_functor_RandomSum<Kokkos::OpenMP>::my_reduction_tag>, pk_functor_RandomSum<Kokkos::OpenMP>, double>::Reducer, void>, Traits=<Kokkos::OpenMP, pk_functor_RandomSum<Kokkos::OpenMP>::my_reduction_tag>]" at line 1517 of /home/kestenerp/miniconda3/envs/pykokkos/lib/python3.11/site-packages/pykokkos_base-0.0.7-py3.11-linux-x86_64.egg/include/kokkos/Kokkos_Parallel_Reduce.hpp
instantiation of "void Kokkos::Impl::ParallelReduceAdaptor<PolicyType, FunctorType, ReturnType>::execute_impl(const std::string &, const PolicyType &, const FunctorType &, ReturnType &) [with PolicyType=Kokkos::RangePolicy<Kokkos::OpenMP, pk_functor_RandomSum<Kokkos::OpenMP>::my_reduction_tag>, FunctorType=pk_functor_RandomSum<Kokkos::OpenMP>, ReturnType=double]" at line 1533 of /home/kestenerp/miniconda3/envs/pykokkos/lib/python3.11/site-packages/pykokkos_base-0.0.7-py3.11-linux-x86_64.egg/include/kokkos/Kokkos_Parallel_Reduce.hpp
instantiation of "std::enable_if_t<<expression>, void> Kokkos::Impl::ParallelReduceAdaptor<PolicyType, FunctorType, ReturnType>::execute(const std::string &, const PolicyType &, const FunctorType &, ReturnType &) [with PolicyType=Kokkos::RangePolicy<Kokkos::OpenMP, pk_functor_RandomSum<Kokkos::OpenMP>::my_reduction_tag>, FunctorType=pk_functor_RandomSum<Kokkos::OpenMP>, ReturnType=double, Dummy=double]" at line 1687 of /home/kestenerp/miniconda3/envs/pykokkos/lib/python3.11/site-packages/pykokkos_base-0.0.7-py3.11-linux-x86_64.egg/include/kokkos/Kokkos_Parallel_Reduce.hpp
instantiation of "std::enable_if_t<<expression>, void> Kokkos::parallel_reduce(const PolicyType &, const FunctorType &, ReturnType &) [with PolicyType=Kokkos::RangePolicy<Kokkos::OpenMP, pk_functor_RandomSum<Kokkos::OpenMP>::my_reduction_tag>, FunctorType=pk_functor_RandomSum<Kokkos::OpenMP>, ReturnType=double]" at line 12 of ./bindings.cpp
1 error detected in the compilation of "./bindings.cpp".
nvlink fatal : Could not open input file './bindings.cpp.o'
C++ compilation in pk_cpp/home/kestenerp/install/kokkos/github/pykokkos_pk/examples/kokkos/random_sum/random_sum_RandomSum/OpenMP failed
the main reason is that the generated file bindings.cpp
is instantiating the accumulator variable a double instead of int32.
This can be fixed in core/translators/bindings.py