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

Output from PerTeam fails #733

Closed
bathmatt opened this issue Apr 13, 2017 · 3 comments
Closed

Output from PerTeam fails #733

bathmatt opened this issue Apr 13, 2017 · 3 comments
Assignees
Labels
Bug Broken / incorrect code; it could be Kokkos' responsibility, or others’ (e.g., Trilinos)

Comments

@bathmatt
Copy link

Here is a simple example that I sent to @crtrott but wanted tracking in github. This works fine with PerThread

BTW, This is with a pull from this a.m. into a standard trilinos build.

      int shared_index;
      Kokkos::single(Kokkos::PerTeam(team_member),[&] (int& idx) {
         idx = Kokkos::atomic_fetch_add(&iter(0),1);
      },shared_index);

This gives the error

                 from /home/mbetten/installs/install-for-panzer/gcc-DEBUG/include/Kokkos_Core.hpp:53,
                 from /home/mbetten/Trilinos/N-Body/src/const_len_vector.hpp:10,
                 from /home/mbetten/Trilinos/N-Body/src/main.cpp:1:
/home/mbetten/installs/install-for-panzer/gcc-DEBUG/include/impl/Kokkos_HostThreadTeam.hpp: In instantiation of ‘void Kokkos::single(const Kokkos::Impl::ThreadSingleStruct<Kokkos::Impl::HostThreadTeamMember<Space> >&, const FunctorType&, ValueType&) [with Space = Kokkos::OpenMP; FunctorType = MatrixBuilder::operator()(const MemberType&) const::<lambda(int&)>; ValueType = int]’:
/home/mbetten/Trilinos/N-Body/src/Matrix.hpp:301:21:   required from here
/home/mbetten/installs/install-for-panzer/gcc-DEBUG/include/impl/Kokkos_HostThreadTeam.hpp:1067:3: error: call of overloaded ‘team_broadcast(const MatrixBuilder::operator()(const MemberType&) const::<lambda(int&)>&, int&)’ is ambiguous
   single.team_member.team_broadcast( functor , val );
   ^~~~~~
In file included from /home/mbetten/installs/install-for-panzer/gcc-DEBUG/include/Kokkos_Serial.hpp:59:0,
                 from /home/mbetten/installs/install-for-panzer/gcc-DEBUG/include/Kokkos_Core.hpp:53,
                 from /home/mbetten/Trilinos/N-Body/src/const_len_vector.hpp:10,
                 from /home/mbetten/Trilinos/N-Body/src/main.cpp:1:
/home/mbetten/installs/install-for-panzer/gcc-DEBUG/include/impl/Kokkos_HostThreadTeam.hpp:542:8: note: candidate: void Kokkos::Impl::HostThreadTeamMember<HostExecSpace>::team_broadcast(T&, int) const [with T = const MatrixBuilder::operator()(const MemberType&) const::<lambda(int&)>; HostExecSpace = Kokkos::OpenMP]
   void team_broadcast( T & value , const int source_team_rank = 0 ) const noexcept
        ^~~~~~~~~~~~~~
/home/mbetten/installs/install-for-panzer/gcc-DEBUG/include/impl/Kokkos_HostThreadTeam.hpp:574:8: note: candidate: void Kokkos::Impl::HostThreadTeamMember<HostExecSpace>::team_broadcast(const Closure&, T&) const [with Closure = MatrixBuilder::operator()(const MemberType&) const::<lambda(int&)>; T = int; HostExecSpace = Kokkos::OpenMP]
   void team_broadcast( Closure const & f , T & value ) const noexcept


@crtrott crtrott added Blocks Promotion Overview issue for release-blocking bugs Bug Broken / incorrect code; it could be Kokkos' responsibility, or others’ (e.g., Trilinos) labels Apr 17, 2017
@crtrott
Copy link
Member

crtrott commented Apr 17, 2017

Confirmed failure. Works on master fails on develop:

#include<Kokkos_Core.hpp>

int main(int argc, char* argv[]) {
  Kokkos::initialize(argc,argv);

  Kokkos::View<int*> iter("Iter",1);

  Kokkos::parallel_for(Kokkos::TeamPolicy<>(1,1), KOKKOS_LAMBDA (const Kokkos::TeamPolicy<>::member_type& team) {
    int shared_index;
      Kokkos::single(Kokkos::PerTeam(team),[&] (int& idx) {
         idx = Kokkos::atomic_fetch_add(&iter(0),1);
      },shared_index);
  });
  Kokkos::finalize();
}

@crtrott crtrott self-assigned this Apr 17, 2017
@crtrott
Copy link
Member

crtrott commented Apr 17, 2017

The problem was the addition of a team_broadcast function which takes a functor and a value but not a root index. Making a root index mandatory fixes this.

@bathmatt
Copy link
Author

bathmatt commented Apr 18, 2017 via email

@crtrott crtrott removed the Blocks Promotion Overview issue for release-blocking bugs label Apr 18, 2017
@crtrott crtrott closed this as completed Apr 25, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Broken / incorrect code; it could be Kokkos' responsibility, or others’ (e.g., Trilinos)
Projects
None yet
Development

No branches or pull requests

2 participants