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

Example random_sum.py fails because int32 is not a supported type for a reduction #220

Open
pkestene opened this issue Dec 1, 2023 · 0 comments · May be fixed by #221
Open

Example random_sum.py fails because int32 is not a supported type for a reduction #220

pkestene opened this issue Dec 1, 2023 · 0 comments · May be fixed by #221

Comments

@pkestene
Copy link
Contributor

pkestene commented Dec 1, 2023

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

@pkestene pkestene linked a pull request Dec 1, 2023 that will close this issue
@pkestene pkestene changed the title Example random_sul.py fails because int32 is not a supported type for a reduction Example random_sum.py fails because int32 is not a supported type for a reduction Dec 1, 2023
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 a pull request may close this issue.

1 participant