Skip to content

Commit

Permalink
#1173: disable threading by default, refactor threading configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
cz4rs committed May 19, 2021
1 parent 5feaf96 commit 2d276bc
Show file tree
Hide file tree
Showing 48 changed files with 236 additions and 62 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/dockerimage-clang-3.9-ubuntu-mpich.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ jobs:
VT_MIMALLOC: 0
VT_DOCS: 0
VT_ASAN: 0
VT_FCONTEXT: 1
VT_USE_OPENMP: 0
VT_USE_STD_THREAD: 0
VT_CI_BUILD: 1
CACHE: ~/.local/cache/

Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/dockerimage-clang-5.0-ubuntu-mpich.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ jobs:
VT_MIMALLOC: 0
VT_DOCS: 0
VT_ASAN: 0
VT_FCONTEXT: 0
VT_USE_OPENMP: 0
VT_USE_STD_THREAD: 1
VT_CI_BUILD: 1
CACHE: ~/.local/cache/

Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/dockerimage-clang-8-alpine-mpich.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ jobs:
VT_MIMALLOC: 0
VT_DOCS: 0
VT_ASAN: 0
VT_FCONTEXT: 0
VT_USE_OPENMP: 0
VT_USE_STD_THREAD: 0
VT_CI_BUILD: 1
CACHE: ~/.local/cache/

Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/dockerimage-gcc-5-ubuntu-mpich.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ jobs:
VT_MIMALLOC: 0
VT_DOCS: 0
VT_ASAN: 0
VT_FCONTEXT: 0
VT_USE_OPENMP: 1
VT_USE_STD_THREAD: 0
VT_CI_BUILD: 1
CACHE: ~/.local/cache/

Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/dockerimage-gcc-6-ubuntu-mpich.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ jobs:
VT_MIMALLOC: 0
VT_DOCS: 0
VT_ASAN: 0
VT_FCONTEXT: 1
VT_USE_OPENMP: 0
VT_USE_STD_THREAD: 0
VT_CI_BUILD: 1
CACHE: ~/.local/cache/

Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/dockerimage-gcc-7-ubuntu-mpich.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ jobs:
VT_MIMALLOC: 0
VT_DOCS: 0
VT_ASAN: 0
VT_FCONTEXT: 0
VT_USE_OPENMP: 0
VT_USE_STD_THREAD: 0
VT_CI_BUILD: 1
CACHE: ~/.local/cache/

Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/dockerimage-gcc-8-ubuntu-mpich.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ jobs:
VT_DOCS: 0
VT_ASAN: 1
VT_POOL: 0
VT_FCONTEXT: 0
VT_USE_OPENMP: 0
VT_USE_STD_THREAD: 0
VT_CI_BUILD: 1
CACHE: ~/.local/cache/

Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/dockerimage-intel-18-ubuntu-mpich.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ jobs:
VT_DOCS: 0
VT_ASAN: 0
VT_POOL: 0
VT_FCONTEXT: 0
VT_USE_OPENMP: 0
VT_USE_STD_THREAD: 0
VT_CI_BUILD: 1
CACHE: ~/.local/cache/

Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/macosx-clang-mpich.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ jobs:
CMAKE_BUILD_TYPE: release
VT_LB_ENABLED: 1
VT_TRACE_ENABLED: 1
VT_USE_OPENMP: 0
VT_USE_STD_THREAD: 0
VT_FCONTEXT: 0

steps:
- uses: actions/checkout@v2
Expand Down
3 changes: 3 additions & 0 deletions ci/azure/azure-intel-18-ubuntu-mpich-extended.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ variables:
VT_POOL: 0
VT_EXTENDED_TESTS: 1
VT_UNITY_BUILD: 1
VT_FCONTEXT: 0
VT_USE_OPENMP: 0
VT_USE_STD_THREAD: 0
VT_ZOLTAN: 0
VT_CI_BUILD: 1
VT_DIAGNOSTICS: 1
Expand Down
3 changes: 3 additions & 0 deletions ci/azure/azure-intel-19-ubuntu-mpich.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ variables:
VT_POOL: 0
VT_EXTENDED_TESTS: 0
VT_UNITY_BUILD: 1
VT_FCONTEXT: 0
VT_USE_OPENMP: 0
VT_USE_STD_THREAD: 0
VT_ZOLTAN: 0
VT_CI_BUILD: 1
VT_DIAGNOSTICS: 1
Expand Down
3 changes: 3 additions & 0 deletions ci/azure/azure-nvidia-10-ubuntu-mpich-extended.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ variables:
VT_POOL: 0
VT_EXTENDED_TESTS: 1
VT_UNITY_BUILD: 1
VT_FCONTEXT: 0
VT_USE_OPENMP: 0
VT_USE_STD_THREAD: 0
VT_ZOLTAN: 0
VT_CI_BUILD: 1
VT_DIAGNOSTICS: 1
Expand Down
3 changes: 3 additions & 0 deletions ci/azure/azure-nvidia-10-ubuntu-mpich.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ variables:
VT_POOL: 0
VT_EXTENDED_TESTS: 0
VT_UNITY_BUILD: 1
VT_FCONTEXT: 0
VT_USE_OPENMP: 0
VT_USE_STD_THREAD: 0
VT_ZOLTAN: 0
VT_CI_BUILD: 1
VT_DIAGNOSTICS: 0
Expand Down
3 changes: 3 additions & 0 deletions ci/azure/azure-nvidia-11-ubuntu-mpich-extended.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ variables:
VT_POOL: 0
VT_EXTENDED_TESTS: 1
VT_UNITY_BUILD: 1
VT_FCONTEXT: 0
VT_USE_OPENMP: 0
VT_USE_STD_THREAD: 0
VT_ZOLTAN: 0
VT_CI_BUILD: 1
VT_DIAGNOSTICS: 1
Expand Down
3 changes: 3 additions & 0 deletions ci/azure/azure-nvidia-11-ubuntu-mpich.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ variables:
VT_POOL: 0
VT_EXTENDED_TESTS: 0
VT_UNITY_BUILD: 1
VT_FCONTEXT: 0
VT_USE_OPENMP: 0
VT_USE_STD_THREAD: 0
VT_ZOLTAN: 0
VT_CI_BUILD: 1
VT_DIAGNOSTICS: 0
Expand Down
3 changes: 3 additions & 0 deletions ci/build_cpp.sh
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,9 @@ cmake -G "${CMAKE_GENERATOR:-Ninja}" \
-Dvt_asan_enabled="${VT_ASAN_ENABLED:-0}" \
-Dvt_pool_enabled="${VT_POOL_ENABLED:-1}" \
-Dzoltan_DIR="${ZOLTAN_CONFIG:-}" \
-Dvt_fcontext_enabled="${VT_FCONTEXT_ENABLED:-0}" \
-DUSE_OPENMP="${VT_USE_OPENMP:-0}" \
-DUSE_STD_THREAD="${VT_USE_STD_THREAD:-0}" \
-DMI_INTERPOSE:BOOL=ON \
-DMI_OVERRIDE:BOOL=ON \
-Dvt_mpi_guards="${VT_MPI_GUARD_ENABLED:-0}" \
Expand Down
6 changes: 6 additions & 0 deletions ci/docker/alpine-cpp.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ ARG VT_MIMALLOC_ENABLED
ARG VT_DOXYGEN_ENABLED
ARG VT_ASAN_ENABLED
ARG VT_POOL_ENABLED
ARG VT_FCONTEXT_ENABLED
ARG VT_USE_OPENMP
ARG VT_USE_STD_THREAD
ARG CMAKE_BUILD_TYPE

ENV VT_LB_ENABLED=${VT_LB_ENABLED} \
Expand All @@ -37,6 +40,9 @@ ENV VT_LB_ENABLED=${VT_LB_ENABLED} \
VT_TRACE_RUNTIME_ENABLED=${VT_TRACE_RUNTIME} \
VT_ASAN_ENABLED=${VT_ASAN_ENABLED} \
VT_POOL_ENABLED=${VT_POOL_ENABLED} \
VT_FCONTEXT_ENABLED=${VT_FCONTEXT_ENABLED} \
VT_USE_OPENMP=${VT_USE_OPENMP} \
VT_USE_STD_THREAD=${VT_USE_STD_THREAD} \
CMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}

RUN /vt/ci/build_cpp.sh /vt /build
Expand Down
6 changes: 6 additions & 0 deletions ci/docker/ubuntu-18.04-clang-cpp.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,9 @@ ARG VT_DOXYGEN_ENABLED
ARG VT_ASAN_ENABLED
ARG VT_POOL_ENABLED
ARG CMAKE_BUILD_TYPE
ARG VT_FCONTEXT_ENABLED
ARG VT_USE_OPENMP
ARG VT_USE_STD_THREAD

ENV VT_LB_ENABLED=${VT_LB_ENABLED} \
VT_TRACE_ENABLED=${VT_TRACE_ENABLED} \
Expand All @@ -79,6 +82,9 @@ ENV VT_LB_ENABLED=${VT_LB_ENABLED} \
VT_ASAN_ENABLED=${VT_ASAN_ENABLED} \
VT_POOL_ENABLED=${VT_POOL_ENABLED} \
VT_MPI_GUARD_ENABLED=${VT_MPI_GUARD_ENABLED} \
VT_FCONTEXT_ENABLED=${VT_FCONTEXT_ENABLED} \
VT_USE_OPENMP=${VT_USE_OPENMP} \
VT_USE_STD_THREAD=${VT_USE_STD_THREAD} \
CMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}

RUN /vt/ci/build_cpp.sh /vt /build
Expand Down
6 changes: 6 additions & 0 deletions ci/docker/ubuntu-18.04-gnu-cpp.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,9 @@ ARG VT_ASAN_ENABLED
ARG VT_POOL_ENABLED
ARG VT_ZOLTAN_ENABLED
ARG CMAKE_BUILD_TYPE
ARG VT_FCONTEXT_ENABLED
ARG VT_USE_OPENMP
ARG VT_USE_STD_THREAD

ENV VT_LB_ENABLED=${VT_LB_ENABLED} \
VT_TRACE_ENABLED=${VT_TRACE_ENABLED} \
Expand All @@ -120,6 +123,9 @@ ENV VT_LB_ENABLED=${VT_LB_ENABLED} \
VT_POOL_ENABLED=${VT_POOL_ENABLED} \
VT_ZOLTAN_ENABLED=${VT_ZOLTAN_ENABLED} \
VT_MPI_GUARD_ENABLED=${VT_MPI_GUARD_ENABLED} \
VT_FCONTEXT_ENABLED=${VT_FCONTEXT_ENABLED} \
VT_USE_OPENMP=${VT_USE_OPENMP} \
VT_USE_STD_THREAD=${VT_USE_STD_THREAD} \
CMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}

RUN /vt/ci/build_cpp.sh /vt /build
Expand Down
6 changes: 6 additions & 0 deletions ci/docker/ubuntu-18.04-gnu-docs.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ ARG VT_DOXYGEN_ENABLED
ARG VT_ASAN_ENABLED
ARG VT_POOL_ENABLED
ARG CMAKE_BUILD_TYPE
ARG VT_FCONTEXT_ENABLED
ARG VT_USE_OPENMP
ARG VT_USE_STD_THREAD

ENV VT_LB_ENABLED=${VT_LB_ENABLED} \
VT_TRACE_ENABLED=${VT_TRACE_ENABLED} \
Expand All @@ -61,6 +64,9 @@ ENV VT_LB_ENABLED=${VT_LB_ENABLED} \
VT_ASAN_ENABLED=${VT_ASAN_ENABLED} \
VT_POOL_ENABLED=${VT_POOL_ENABLED} \
VT_MPI_GUARD_ENABLED=${VT_MPI_GUARD_ENABLED} \
VT_FCONTEXT_ENABLED=${VT_FCONTEXT_ENABLED} \
VT_USE_OPENMP=${VT_USE_OPENMP} \
VT_USE_STD_THREAD=${VT_USE_STD_THREAD} \
CMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}

RUN /vt/ci/build_cpp.sh /vt /build "${token}"
6 changes: 6 additions & 0 deletions ci/docker/ubuntu-18.04-intel-cpp.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,9 @@ ARG VT_MIMALLOC_ENABLED
ARG VT_DOXYGEN_ENABLED
ARG VT_ASAN_ENABLED
ARG VT_POOL_ENABLED
ARG VT_FCONTEXT_ENABLED
ARG VT_USE_OPENMP
ARG VT_USE_STD_THREAD
ARG CMAKE_BUILD_TYPE

ENV VT_LB_ENABLED=${VT_LB_ENABLED} \
Expand All @@ -80,6 +83,9 @@ ENV VT_LB_ENABLED=${VT_LB_ENABLED} \
VT_ASAN_ENABLED=${VT_ASAN_ENABLED} \
VT_POOL_ENABLED=${VT_POOL_ENABLED} \
VT_MPI_GUARD_ENABLED=${VT_MPI_GUARD_ENABLED} \
VT_FCONTEXT_ENABLED=${VT_FCONTEXT_ENABLED} \
VT_USE_OPENMP=${VT_USE_OPENMP} \
VT_USE_STD_THREAD=${VT_USE_STD_THREAD} \
CMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}

RUN /vt/ci/build_cpp.sh /vt /build
Expand Down
6 changes: 6 additions & 0 deletions ci/docker/ubuntu-18.04-nvidia-cpp.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ ARG VT_DOXYGEN_ENABLED
ARG VT_ASAN_ENABLED
ARG VT_POOL_ENABLED
ARG CMAKE_BUILD_TYPE
ARG VT_FCONTEXT_ENABLED
ARG VT_USE_OPENMP
ARG VT_USE_STD_THREAD

ENV VT_LB_ENABLED=${VT_LB_ENABLED} \
VT_TRACE_ENABLED=${VT_TRACE_ENABLED} \
Expand All @@ -53,6 +56,9 @@ ENV VT_LB_ENABLED=${VT_LB_ENABLED} \
VT_TRACE_RUNTIME_ENABLED=${VT_TRACE_RUNTIME} \
VT_ASAN_ENABLED=${VT_ASAN_ENABLED} \
VT_POOL_ENABLED=${VT_POOL_ENABLED} \
VT_FCONTEXT_ENABLED=${VT_FCONTEXT_ENABLED} \
VT_USE_OPENMP=${VT_USE_OPENMP} \
VT_USE_STD_THREAD=${VT_USE_STD_THREAD} \
CMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}

RUN /vt/ci/build_cpp.sh /vt /build
Expand Down
6 changes: 6 additions & 0 deletions ci/docker/ubuntu-20.04-clang-cpp.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,9 @@ ARG VT_MIMALLOC_ENABLED
ARG VT_DOXYGEN_ENABLED
ARG VT_ASAN_ENABLED
ARG VT_POOL_ENABLED
ARG VT_FCONTEXT_ENABLED
ARG VT_USE_OPENMP
ARG VT_USE_STD_THREAD
ARG CMAKE_BUILD_TYPE

ENV VT_LB_ENABLED=${VT_LB_ENABLED} \
Expand All @@ -79,6 +82,9 @@ ENV VT_LB_ENABLED=${VT_LB_ENABLED} \
VT_ASAN_ENABLED=${VT_ASAN_ENABLED} \
VT_POOL_ENABLED=${VT_POOL_ENABLED} \
VT_MPI_GUARD_ENABLED=${VT_MPI_GUARD_ENABLED} \
VT_FCONTEXT_ENABLED=${VT_FCONTEXT_ENABLED} \
VT_USE_OPENMP=${VT_USE_OPENMP} \
VT_USE_STD_THREAD=${VT_USE_STD_THREAD} \
CMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}

RUN /vt/ci/build_cpp.sh /vt /build
Expand Down
6 changes: 6 additions & 0 deletions ci/docker/ubuntu-20.04-gnu-cpp.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ ARG VT_DOXYGEN_ENABLED
ARG VT_ASAN_ENABLED
ARG VT_POOL_ENABLED
ARG CMAKE_BUILD_TYPE
ARG VT_FCONTEXT_ENABLED
ARG VT_USE_OPENMP
ARG VT_USE_STD_THREAD

ENV VT_LB_ENABLED=${VT_LB_ENABLED} \
VT_TRACE_ENABLED=${VT_TRACE_ENABLED} \
Expand All @@ -54,6 +57,9 @@ ENV VT_LB_ENABLED=${VT_LB_ENABLED} \
VT_ASAN_ENABLED=${VT_ASAN_ENABLED} \
VT_POOL_ENABLED=${VT_POOL_ENABLED} \
VT_MPI_GUARD_ENABLED=${VT_MPI_GUARD_ENABLED} \
VT_FCONTEXT_ENABLED=${VT_FCONTEXT_ENABLED} \
VT_USE_OPENMP=${VT_USE_OPENMP} \
VT_USE_STD_THREAD=${VT_USE_STD_THREAD} \
CMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}

RUN /vt/ci/build_cpp.sh /vt /build
Expand Down
31 changes: 22 additions & 9 deletions cmake/load_threading_package.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,26 @@ include(cmake/threading_config.cmake)
# Threading build configuration
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)
option(vt_fcontext_enabled "Build VT with fcontext (ULT) enabled" OFF)

if ("$ENV{ATDM_CONFIG_USE_CUDA}" STREQUAL "ON")
message(STATUS "VT: CUDA detected from ATDM environment. Not finding OpenMP")
else()
find_package(OpenMP)
endif()

# OpenMP support
if (USE_STD_THREAD)
message(STATUS "VT: Using std::thread for worker threading")
message(
STATUS
"Using std::thread for worker threading"
)
config_for_std_thread()
elseif(USE_OPENMP)
message(STATUS "VT: Using openmp for worker threading")
message(
STATUS
"Using OpenMP for worker threading"
)
find_package(OpenMP)
config_for_openmp()
if (NOT OpenMP_FOUND)
message(
Expand All @@ -29,10 +36,16 @@ elseif(USE_OPENMP)
"valid OpenMP in compiler"
)
endif()
elseif(OpenMP_FOUND) #no default specified
message(STATUS "VT: OpenMP found, defaulting to use openmp for worker threading")
config_for_openmp()
else() #no default specified
message(STATUS "VT: OpenMP not found: using std::thread for workers")
config_for_std_thread()
elseif(vt_fcontext_enabled)
message(
STATUS
"Using fcontext for worker threading"
)
config_for_fcontext()
else()
message(
STATUS
"Threading disabled"
)
config_no_threading()
endif()
14 changes: 14 additions & 0 deletions cmake/threading_config.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ function(config_for_openmp)

set(vt_feature_cmake_openmp "1" PARENT_SCOPE)
set(vt_feature_cmake_stdthread "0" PARENT_SCOPE)
set(vt_fcontext_enabled "0" PARENT_SCOPE)

#
# The OpenMP compiler and linker flags are handled through the target instead
Expand All @@ -27,4 +28,17 @@ function(config_for_std_thread)

set(vt_feature_cmake_openmp "0" PARENT_SCOPE)
set(vt_feature_cmake_stdthread "1" PARENT_SCOPE)
set(vt_fcontext_enabled "0" PARENT_SCOPE)
endfunction(config_for_std_thread)

function(config_for_fcontext)
set(vt_feature_cmake_openmp "0" PARENT_SCOPE)
set(vt_feature_cmake_stdthread "0" PARENT_SCOPE)
set(vt_fcontext_enabled "1" PARENT_SCOPE)
endfunction(config_for_fcontext)

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

0 comments on commit 2d276bc

Please sign in to comment.