-
Notifications
You must be signed in to change notification settings - Fork 577
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: Automatically enabling Tecuhos_ENABLE_THREAD_SAFE if you have Kokkos THREADS or OPENMP for the host #11946
Changes from all commits
1338338
aa11d5e
80cc3c7
21e643d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -252,13 +252,29 @@ IF (DEFINED BUILD_SHARED_LIBS) | |
ENDIF () | ||
ENDIF () | ||
|
||
|
||
# As per the discussion in #11921, we explicitly enable thread safe RCPs, | ||
# if Kokkos has a host thread-parallel backend | ||
SET(Teuchos_ENABLE_THREAD_SAFE_Default ${Trilinos_ENABLE_THREAD_SAFE}) | ||
IF(DEFINED ${PROJECT_NAME}_ENABLE_Kokkos AND ${PROJECT_NAME}_ENABLE_Kokkos) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This can be simplified as:
If a variable is undefined, it evaluates to false. See here which states:
|
||
IF( (DEFINED Kokkos_ENABLE_THREADS AND Kokkos_ENABLE_THREADS) OR | ||
(DEFINED Kokkos_ENABLE_OPENMP AND Kokkos_ENABLE_OPENMP) ) | ||
Comment on lines
+260
to
+261
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This can be simplified to:
If a variable is undefined, it evaluates to false. |
||
IF (NOT ${PACKAGE_NAME}_ENABLE_THREAD_SAFE) | ||
MESSAGE(WARNING "A Kokkos host thread-parallel backend is enabled, requiring Trilinos to enable thread-safe RCP classes. You can do this manually by specifying Teuchos_ENABLE_THREAD_SAFE=ON") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So what does it mean if |
||
SET(Teuchos_ENABLE_THREAD_SAFE_Default ON) | ||
ENDIF() | ||
ENDIF() | ||
ENDIF() | ||
|
||
TRIBITS_ADD_OPTION_AND_DEFINE( | ||
${PACKAGE_NAME}_ENABLE_THREAD_SAFE | ||
HAVE_TEUCHOS_THREAD_SAFE | ||
"Enable thread safe code for RCP classes." | ||
${Trilinos_ENABLE_THREAD_SAFE} | ||
${Teuchos_ENABLE_THREAD_SAFE_Default} | ||
) | ||
|
||
|
||
|
||
ASSERT_DEFINED(${PACKAGE_NAME}_ENABLE_THREAD_SAFE) | ||
ASSERT_DEFINED(${PACKAGE_NAME}Core_ENABLE_Pthread) | ||
COMBINED_OPTION( | ||
|
@@ -270,6 +286,10 @@ COMBINED_OPTION( | |
"Enable thread safe unit tests for ${PACKAGE_NAME} Memory Management classes." | ||
) | ||
|
||
|
||
|
||
|
||
|
||
TRIBITS_ADD_OPTION_AND_DEFINE( | ||
${PACKAGE_NAME}_ENABLE_ABC | ||
HAVE_TEUCHOS_ARRAY_BOUNDSCHECK | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -202,7 +202,7 @@ static void share_arrayview_to_threads(ArrayView<int> shared_arrayview, | |
++cycle; | ||
} | ||
} | ||
catch (DanglingReferenceError) { | ||
catch (DanglingReferenceError&) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 |
||
// loop ends - we got the dangling reference | ||
index_tracker.danglingReference = cycle; | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These kokkos-kernels changes should have had a matching PR put in to the kernels repo, @bartlettroscoe can you submit a PR with these changes?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Matching patch to kokkos-kernels is up kokkos/kokkos-kernels#1854