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

Teuchos: initializeKokkos' use of call_once requires TPL_ENABLE_Pthread=ON for serial g++ builds #3057

Closed
kddevin opened this issue Jul 3, 2018 · 2 comments
Labels
pkg: Teuchos Issues primarily dealing with the Teuchos Package

Comments

@kddevin
Copy link
Contributor

kddevin commented Jul 3, 2018

@trilinos/teuchos @trilinos/tpetra

Expectations and Current behavior

Serial builds with g++ and TPL_ENABLE_Pthread=OFF used to work. Now, with gnu compilers and TPL_ENABLE_Pthread=OFF, I can build in serial but Teuchos' initializeKokkos throws an error.

It appears that g++ requires Pthread to correctly execute std::call_once, which is used in initializeKokkos. Thus, TPL_ENABLE_Pthread=OFF leads to an error.

The attached program demonstrates the std::call_once behavior. Here are the compilations and test results. I've seen the same behavior with gcc 4.9.3, 6.3.1 and 7.2.1.

callOnce.cpp.txt

g++ -std=c++11 callOnce.cpp
a.out
In initialize 0
terminate called after throwing an instance of 'std::system_error'
what(): Unknown error 18446744073709551615
Abort (core dumped)
g++ -std=c++11 -pthread callOnce.cpp
a.out
In initialize 0
In initializeOnce 0
In initialize 1
In initialize 2
In initialize 3
In initialize 4
In initialize 5
In initialize 6
In initialize 7
In initialize 8
In initialize 9
Done: callCnt = 10; initCnt = 1

Motivation and Context

Serial builds of Zoltan2 tests with TPL_ENABLE_Pthread=OFF build but do not execute.
Discovered trying to diagnose #3033

Definition of Done

Possible Solution

Can the use of call_once be safely removed, with initializeKokkos just testing Kokkos' initialization status? Or is call_once really needed for threading?

Steps to Reproduce

Build serial Zoltan2 with gnu compilers and -DTPL_ENABLE_Pthread=OFF; make test.

Your Environment

module purge
module load sems-env
module load sems-gcc/4.9.3
cmake
-DTPL_ENABLE_Pthread:BOOL=OFF
-DTrilinos_ENABLE_SECONDARY_TESTED_CODE:BOOL=ON
-DTrilinos_ENABLE_ALL_OPTIONAL_PACKAGES:BOOL=OFF
-DTrilinos_ENABLE_TESTS:BOOL=OFF
-DTrilinos_ENABLE_EXPLICIT_INSTANTIATION:BOOL=ON
-DTrilinos_ENABLE_Zoltan2:BOOL=ON
-DZoltan2_ENABLE_TESTS:BOOL=ON
..

Related Issues

#3033

  • Blocks
  • Is blocked by
  • Follows
  • Precedes
  • Related to
  • Part of
  • Composed of

Additional Information

@kddevin kddevin added the pkg: Teuchos Issues primarily dealing with the Teuchos Package label Jul 3, 2018
@mhoemmen mhoemmen mentioned this issue Jul 3, 2018
7 tasks
mhoemmen added a commit that referenced this issue Jul 4, 2018
@mhoemmen
Copy link
Contributor

mhoemmen commented Jul 4, 2018

I merged PR #3058 into develop. Hopefully that will fix this issue. Please let me know if you continue to have troubles; thanks!

@mhoemmen
Copy link
Contributor

mhoemmen commented Jul 4, 2018

FYI, #3058 purges use of std::call_once from Tpetra::Map's initialization of Kokkos. If it later becomes necessary to reintroduce std::call_once, we should protect it with the macro corresponding to TPL_ENABLE_Pthread.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pkg: Teuchos Issues primarily dealing with the Teuchos Package
Projects
None yet
Development

No branches or pull requests

2 participants