diff options
author | Louis Dionne <ldionne@apple.com> | 2019-04-24 20:12:36 +0000 |
---|---|---|
committer | Louis Dionne <ldionne@apple.com> | 2019-04-24 20:12:36 +0000 |
commit | 65a422c81c99a616f4b2eb502108907460265f51 (patch) | |
tree | 6324ed12b07df3379b0a7e25f75ca41b54098dcb /pstl/CMakeLists.txt | |
parent | 0ddd12e1565c8c55cc56f16f0de09193ef96c464 (diff) | |
download | llvm-65a422c81c99a616f4b2eb502108907460265f51.zip llvm-65a422c81c99a616f4b2eb502108907460265f51.tar.gz llvm-65a422c81c99a616f4b2eb502108907460265f51.tar.bz2 |
[pstl] Make the default backend be the serial backend and always provide parallel policies
Summary:
Before this change, the default backend was TBB but one could disable
anything related to TBB by removing the parallel policies. This change
uses the serial backend by default and removes the ability to disable
parallel policies, which is not useful anymore.
Reviewers: rodgert, MikeDvorskiy
Subscribers: mgorny, jkorous, dexonsmith, jdoerfert, libcxx-commits
Differential Revision: https://reviews.llvm.org/D59792
llvm-svn: 359134
Diffstat (limited to 'pstl/CMakeLists.txt')
-rw-r--r-- | pstl/CMakeLists.txt | 25 |
1 files changed, 10 insertions, 15 deletions
diff --git a/pstl/CMakeLists.txt b/pstl/CMakeLists.txt index a11487f..5fb7504 100644 --- a/pstl/CMakeLists.txt +++ b/pstl/CMakeLists.txt @@ -16,8 +16,7 @@ math(EXPR VERSION_PATCH "(${PARALLELSTL_VERSION_SOURCE} % 10)") project(ParallelSTL VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH} LANGUAGES CXX) -option(PARALLELSTL_USE_PARALLEL_POLICIES "Enable parallel policies" OFF) -set(PARALLELSTL_BACKEND "tbb" CACHE STRING "Threading backend; defaults to TBB") +set(PARALLELSTL_BACKEND "serial" CACHE STRING "Threading backend to use. Valid choices are 'serial' and 'tbb'. The default is 'serial'.") if (NOT TBB_DIR) get_filename_component(PSTL_DIR_NAME ${CMAKE_CURRENT_SOURCE_DIR} NAME) @@ -34,20 +33,16 @@ add_library(ParallelSTL INTERFACE) add_library(pstl::ParallelSTL ALIAS ParallelSTL) target_compile_features(ParallelSTL INTERFACE cxx_std_17) -if (PARALLELSTL_USE_PARALLEL_POLICIES) - if (PARALLELSTL_BACKEND STREQUAL "serial") - message(STATUS "Parallel STL uses the serial backend") - target_compile_definitions(ParallelSTL INTERFACE -D_PSTL_PAR_BACKEND_SERIAL) - elseif (PARALLELSTL_BACKEND STREQUAL "tbb") - find_package(TBB 2018 REQUIRED tbb OPTIONAL_COMPONENTS tbbmalloc) - message(STATUS "Parallel STL uses TBB ${TBB_VERSION} (interface version: ${TBB_INTERFACE_VERSION})") - target_link_libraries(ParallelSTL INTERFACE TBB::tbb) - target_compile_definitions(ParallelSTL INTERFACE -D_PSTL_PAR_BACKEND_TBB) - else() - message(FATAL_ERROR "Requested unknown Parallel STL backend '${PARALLELSTL_BACKEND}'.") - endif() +if (PARALLELSTL_BACKEND STREQUAL "serial") + message(STATUS "Parallel STL uses the serial backend") + target_compile_definitions(ParallelSTL INTERFACE -D_PSTL_PAR_BACKEND_SERIAL) +elseif (PARALLELSTL_BACKEND STREQUAL "tbb") + find_package(TBB 2018 REQUIRED tbb OPTIONAL_COMPONENTS tbbmalloc) + message(STATUS "Parallel STL uses TBB ${TBB_VERSION} (interface version: ${TBB_INTERFACE_VERSION})") + target_link_libraries(ParallelSTL INTERFACE TBB::tbb) + target_compile_definitions(ParallelSTL INTERFACE -D_PSTL_PAR_BACKEND_TBB) else() - target_compile_definitions(ParallelSTL INTERFACE PSTL_USE_PARALLEL_POLICIES=0) + message(FATAL_ERROR "Requested unknown Parallel STL backend '${PARALLELSTL_BACKEND}'.") endif() target_include_directories(ParallelSTL |