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

Kokkos::complex<double> atomic deadlocks with Clang 6 Cuda build with -O0 #1752

Closed
crtrott opened this issue Aug 16, 2018 · 3 comments
Closed
Assignees
Labels
Bug Broken / incorrect code; it could be Kokkos' responsibility, or others’ (e.g., Trilinos)
Milestone

Comments

@crtrott
Copy link
Member

crtrott commented Aug 16, 2018

The following code deadlocks with O0:

#include<Kokkos_Core.hpp>


int main(int argc, char* argv[]) {
  Kokkos::initialize(argc,argv);
  {
     Kokkos::View<Kokkos::complex<double>> data("Data");
     Kokkos::parallel_for(2, KOKKOS_LAMBDA(const int& i) {
       Kokkos::atomic_fetch_add( &data(), (Kokkos::complex<double>) 1 );
     });
  }
  Kokkos::finalize();
}

It doesn't deadlock for a single loop iteration.

Build command:

make KOKKOS_DEVICES=Cuda KOKKOS_ARCH=Volta70 -j KOKKOS_PATH=/home/crtrott/Kokkos/kokkos -j CXX=clang++ CXXFLAGS="-O0"
@crtrott crtrott self-assigned this Aug 16, 2018
@crtrott crtrott added the Bug Broken / incorrect code; it could be Kokkos' responsibility, or others’ (e.g., Trilinos) label Aug 16, 2018
@crtrott
Copy link
Member Author

crtrott commented Aug 16, 2018

This caused the Apollo Debug tests to time out.

@crtrott
Copy link
Member Author

crtrott commented Aug 16, 2018

It also deadlocks with O1, but works with O2 and O3.

@ibaned ibaned added this to the 2018 July milestone Aug 16, 2018
@crtrott
Copy link
Member Author

crtrott commented Aug 16, 2018

Found the issue. Effectively __activemask() doesn't do what we think it does, in particular

unsigned mask1 = __activemask();
{
  stuff
}
unsigned mask2 = __activemask();

In this case mask1 != mask2 is possible.

crtrott added a commit that referenced this issue Aug 16, 2018
issue #1752 identified another problem.
Need to keep tighter track of masks.
@crtrott crtrott closed this as completed Nov 5, 2018
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