Skip to content

Commit

Permalink
#1173: disable threading by default
Browse files Browse the repository at this point in the history
  • Loading branch information
cz4rs committed Feb 1, 2021
1 parent 033a6f5 commit c1b16ae
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 9 deletions.
24 changes: 15 additions & 9 deletions cmake/load_threading_package.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,18 @@ include(cmake/threading_config.cmake)
option(USE_STD_THREAD "whether to force use of std::thread for threading" OFF)
option(USE_OPENMP "whether to force use of OpenMP for threading" OFF)

find_package(OpenMP)

# OpenMP support
if (USE_STD_THREAD)
message("Using std::thread for worker threading")
message(
STATUS
"Using std::thread for worker threading"
)
config_for_std_thread()
elseif(USE_OPENMP)
message(
STATUS
"Using OpenMP for worker threading"
)
find_package(OpenMP)
config_for_openmp()
if (NOT OpenMP_FOUND)
message(
Expand All @@ -24,9 +29,10 @@ elseif(USE_OPENMP)
"valid OpenMP in compiler"
)
endif()
elseif(OpenMP_FOUND) #no default specified
config_for_openmp()
else() #no default specified
message("OpenMP not found: using std::thread for workers")
config_for_std_thread()
else()
message(
STATUS
"No threading configuration provided"
)
config_no_threading()
endif()
5 changes: 5 additions & 0 deletions cmake/threading_config.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,8 @@ function(config_for_std_thread)
set(vt_feature_cmake_openmp "0" PARENT_SCOPE)
set(vt_feature_cmake_stdthread "1" PARENT_SCOPE)
endfunction(config_for_std_thread)

function(config_no_threading)
set(vt_feature_cmake_openmp "0" PARENT_SCOPE)
set(vt_feature_cmake_stdthread "0" PARENT_SCOPE)
endfunction(config_no_threading)

0 comments on commit c1b16ae

Please sign in to comment.