This repository was archived by the owner on Mar 21, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 761
gpuCI: Local docker builds and gpuCI GPU support #1317
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
c9f60d1
gpuCI: Local docker builds and gpuCI GPU support.
brycelelbach bca02bf
Docker:
brycelelbach a23a8d6
Docker: Hardcode the parallelism level for gpuCI jobs, but keep using
brycelelbach 215fe6e
gpuCI:
brycelelbach 1803bd0
gpuCI: Remove commented out code that only generated build files if t…
brycelelbach 40e6152
gpuCI:
brycelelbach File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,116 @@ | ||
| #! /usr/bin/env bash | ||
|
|
||
| # Copyright (c) 2018-2020 NVIDIA Corporation | ||
| # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| # Released under the Apache License v2.0 with LLVM Exceptions. | ||
| # See https://llvm.org/LICENSE.txt for license information. | ||
|
|
||
| ################################################################################ | ||
| # Thrust and CUB build script for gpuCI | ||
| ################################################################################ | ||
|
|
||
| set -e | ||
|
|
||
| # Logger function for build status output | ||
| function logger() { | ||
| echo -e "\n>>>> ${@}\n" | ||
| } | ||
|
|
||
| ################################################################################ | ||
| # VARIABLES - Set up bash and environmental variables. | ||
| ################################################################################ | ||
|
|
||
| # Get the variables the Docker container set up for us: ${CXX}, ${CUDACXX}, etc. | ||
| source /etc/cccl.bashrc | ||
|
|
||
| # Set path and build parallel level | ||
| export PATH=/usr/local/cuda/bin:${PATH} | ||
|
|
||
| # Set home to the job's workspace. | ||
| export HOME=${WORKSPACE} | ||
|
|
||
| # Switch to the build directory. | ||
| cd ${WORKSPACE} | ||
| mkdir -p build | ||
| cd build | ||
|
|
||
| # The Docker image sets up `${CXX}` and `${CUDACXX}`. | ||
| CMAKE_FLAGS="-G Ninja -DCMAKE_CXX_COMPILER='${CXX}' -DCMAKE_CUDA_COMPILER='${CUDACXX}'" | ||
|
|
||
| if [ "${BUILD_MODE}" == "branch" ]; then | ||
| # Post-commit build. | ||
| CMAKE_FLAGS="${CMAKE_FLAGS} -DTHRUST_INCLUDE_CUB_CMAKE=ON" | ||
| CMAKE_FLAGS="${CMAKE_FLAGS} -DTHRUST_ENABLE_MULTICONFIG=ON" | ||
| CMAKE_FLAGS="${CMAKE_FLAGS} -DTHRUST_MULTICONFIG_ENABLE_DIALECT_CPP11=ON" | ||
| CMAKE_FLAGS="${CMAKE_FLAGS} -DTHRUST_IGNORE_DEPRECATED_CPP_11=ON" | ||
| CMAKE_FLAGS="${CMAKE_FLAGS} -DTHRUST_MULTICONFIG_ENABLE_DIALECT_CPP14=ON" | ||
| CMAKE_FLAGS="${CMAKE_FLAGS} -DTHRUST_MULTICONFIG_ENABLE_DIALECT_CPP17=OFF" | ||
| CMAKE_FLAGS="${CMAKE_FLAGS} -DTHRUST_MULTICONFIG_ENABLE_SYSTEM_CPP=ON" | ||
| CMAKE_FLAGS="${CMAKE_FLAGS} -DTHRUST_MULTICONFIG_ENABLE_SYSTEM_TBB=ON" | ||
| CMAKE_FLAGS="${CMAKE_FLAGS} -DTHRUST_MULTICONFIG_ENABLE_SYSTEM_OMP=ON" | ||
| CMAKE_FLAGS="${CMAKE_FLAGS} -DTHRUST_MULTICONFIG_ENABLE_SYSTEM_CUDA=ON" | ||
| CMAKE_FLAGS="${CMAKE_FLAGS} -DTHRUST_MULTICONFIG_WORKLOAD=LARGE" | ||
| else | ||
| # Pre-commit build. | ||
| CMAKE_FLAGS="${CMAKE_FLAGS} -DTHRUST_DISABLE_ARCH_BY_DEFAULT=ON" | ||
| CMAKE_FLAGS="${CMAKE_FLAGS} -DTHRUST_ENABLE_COMPUTE_50=ON" | ||
| CMAKE_FLAGS="${CMAKE_FLAGS} -DTHRUST_ENABLE_COMPUTE_60=ON" | ||
| CMAKE_FLAGS="${CMAKE_FLAGS} -DTHRUST_ENABLE_COMPUTE_70=ON" | ||
| CMAKE_FLAGS="${CMAKE_FLAGS} -DTHRUST_ENABLE_COMPUTE_80=ON" | ||
| CMAKE_FLAGS="${CMAKE_FLAGS} -DTHRUST_INCLUDE_CUB_CMAKE=ON" | ||
| CMAKE_FLAGS="${CMAKE_FLAGS} -DTHRUST_ENABLE_MULTICONFIG=ON" | ||
| CMAKE_FLAGS="${CMAKE_FLAGS} -DTHRUST_MULTICONFIG_ENABLE_DIALECT_CPP11=ON" | ||
| CMAKE_FLAGS="${CMAKE_FLAGS} -DTHRUST_IGNORE_DEPRECATED_CPP_11=ON" | ||
| CMAKE_FLAGS="${CMAKE_FLAGS} -DTHRUST_MULTICONFIG_ENABLE_DIALECT_CPP14=ON" | ||
| CMAKE_FLAGS="${CMAKE_FLAGS} -DTHRUST_MULTICONFIG_ENABLE_DIALECT_CPP17=OFF" | ||
| CMAKE_FLAGS="${CMAKE_FLAGS} -DTHRUST_MULTICONFIG_ENABLE_SYSTEM_CPP=ON" | ||
| CMAKE_FLAGS="${CMAKE_FLAGS} -DTHRUST_MULTICONFIG_ENABLE_SYSTEM_TBB=ON" | ||
| CMAKE_FLAGS="${CMAKE_FLAGS} -DTHRUST_MULTICONFIG_ENABLE_SYSTEM_OMP=ON" | ||
| CMAKE_FLAGS="${CMAKE_FLAGS} -DTHRUST_MULTICONFIG_ENABLE_SYSTEM_CUDA=ON" | ||
| CMAKE_FLAGS="${CMAKE_FLAGS} -DTHRUST_MULTICONFIG_WORKLOAD=SMALL" | ||
| fi | ||
|
|
||
| CMAKE_BUILD_FLAGS="-j${PARALLEL_LEVEL}" | ||
|
|
||
| if [ ! -z "${@}" ]; then | ||
| CMAKE_BUILD_FLAGS="${CMAKE_BUILD_FLAGS} -- ${@}" | ||
| fi | ||
|
|
||
| CTEST_FLAGS="" | ||
|
|
||
| if [ "${BUILD_TYPE}" == "cpu" ]; then | ||
| CTEST_FLAGS="${CTEST_FLAGS} -E ^cub|^thrust.*cuda" | ||
| fi | ||
|
|
||
| if [ ! -z "${@}" ]; then | ||
| CTEST_FLAGS="${CTEST_FLAGS} -R ^${@}$" | ||
| fi | ||
|
|
||
| ################################################################################ | ||
| # ENVIRONMENT - Configure and print out information about the environment. | ||
| ################################################################################ | ||
|
|
||
| logger "Get environment..." | ||
| env | ||
|
|
||
| logger "Check versions..." | ||
| ${CXX} --version | ||
| ${CUDACXX} --version | ||
|
|
||
| ################################################################################ | ||
| # BUILD - Build Thrust and CUB examples and tests. | ||
| ################################################################################ | ||
|
|
||
| logger "Configure Thrust and CUB..." | ||
| cmake .. ${CMAKE_FLAGS} | ||
|
|
||
| logger "Build Thrust and CUB..." | ||
| cmake --build . ${CMAKE_BUILD_FLAGS} | ||
|
|
||
| ################################################################################ | ||
| # TEST - Run Thrust and CUB examples and tests. | ||
| ################################################################################ | ||
|
|
||
| logger "Test Thrust and CUB..." | ||
| ctest ${CTEST_FLAGS} | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,74 @@ | ||
| #! /usr/bin/env bash | ||
brycelelbach marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| # Copyright (c) 2018-2020 NVIDIA Corporation | ||
| # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| # Released under the Apache License v2.0 with LLVM Exceptions. | ||
| # See https://llvm.org/LICENSE.txt for license information. | ||
|
|
||
| function usage { | ||
| echo "Usage: ${0} [flags...]" | ||
| echo | ||
| echo "Examine the system topology to determine a reasonable amount of build" | ||
| echo "parallelism." | ||
| echo | ||
| echo "Exported variables:" | ||
| echo " $${LOGICAL_CPUS} : Logical processors (e.g. hyperthreads)." | ||
| echo " $${PHYSICAL_CPUS} : Physical processors (e.g. cores)." | ||
| echo " $${TOTAL_MEM_KB} : Total system memory." | ||
| echo " $${CPU_BOUND_THREADS} : # of build threads constrained by processors." | ||
| echo " $${MEM_BOUND_THREADS} : # of build threads constrained by memory." | ||
| echo " $${PARLLEL_LEVEL} : Determined # of build threads." | ||
| echo | ||
| echo "-h, -help, --help" | ||
| echo " Print this message." | ||
| echo | ||
| echo "-q, --quiet" | ||
| echo " Print nothing and only export variables." | ||
|
|
||
| exit -3 | ||
| } | ||
|
|
||
| QUIET=0 | ||
|
|
||
| while test ${#} != 0 | ||
| do | ||
| case "${1}" in | ||
| -h) ;& | ||
| -help) ;& | ||
| --help) usage ;; | ||
| -q) ;& | ||
| --quiet) QUIET=1 ;; | ||
| esac | ||
| shift | ||
| done | ||
|
|
||
| # https://stackoverflow.com/a/23378780 | ||
| if [ $(uname) == "Darwin" ]; then | ||
| export LOGICAL_CPUS=$(sysctl -n hw.logicalcpu_max) | ||
| export PHYSICAL_CPUS=$(sysctl -n hw.physicalcpu_max) | ||
| else | ||
| export LOGICAL_CPUS=$(lscpu -p | egrep -v '^#' | wc -l) | ||
| export PHYSICAL_CPUS=$(lscpu -p | egrep -v '^#' | sort -u -t, -k 2,4 | wc -l) | ||
| fi | ||
|
|
||
| export TOTAL_MEM_KB=`grep MemTotal /proc/meminfo | awk '{print $2}'` | ||
|
|
||
| export CPU_BOUND_THREADS=$((${PHYSICAL_CPUS} * 2)) # 2 Build Threads / Core | ||
| export MEM_BOUND_THREADS=$((${TOTAL_MEM_KB} / (2 * 1000 * 1000))) # 2 GB / Build Thread | ||
|
|
||
| # Pick the smaller of the two as the default. | ||
| if [ ${MEM_BOUND_THREADS} -lt ${CPU_BOUND_THREADS} ]; then | ||
| export PARLLEL_LEVEL=${MEM_BOUND_THREADS} | ||
| else | ||
| export PARLLEL_LEVEL=${CPU_BOUND_THREADS} | ||
| fi | ||
|
|
||
| if [ "${QUIET}" == 0 ]; then | ||
| echo "Logical CPUs: ${LOGICAL_CPUS} [threads]" | ||
| echo "Physical CPUs: ${PHYSICAL_CPUS} [cores]" | ||
| echo "Total Mem: ${TOTAL_MEM_KB} [kb]" | ||
| echo "CPU Bound Threads: ${CPU_BOUND_THREADS} [threads]" | ||
| echo "Mem Bound Threads: ${MEM_BOUND_THREADS} [threads]" | ||
| echo "Parallel Level: ${PARLLEL_LEVEL} [threads]" | ||
| fi | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,67 +1,19 @@ | ||
| #!/usr/bin/env bash | ||
| # Copyright (c) 2018-2020 NVIDIA Corporation | ||
|
|
||
| ################################# | ||
| # Thrust CPU-only script for CI # | ||
| ################################# | ||
|
|
||
| set -e | ||
|
|
||
| # Logger function for build status output | ||
| function logger() { | ||
| echo -e "\n>>>> ${@}\n" | ||
| } | ||
|
|
||
| # Set path and build parallel level | ||
| export PATH=/usr/local/cuda/bin:${PATH} | ||
|
|
||
| # Set home to the job's workspace. | ||
| export HOME=${WORKSPACE} | ||
|
|
||
| # Switch to project root; also root of repo checkout. | ||
| cd ${WORKSPACE} | ||
|
|
||
| # If it's a nightly build, append current YYMMDD to version. | ||
| if [[ "${BUILD_MODE}" = "branch" ]] ; then | ||
| export VERSION_SUFFIX=`date +%y%m%d` | ||
| fi | ||
|
|
||
| # The Docker image sets up `c++` and `cu++`. | ||
| CMAKE_FLAGS="-DCMAKE_CXX_COMPILER=c++ -DCMAKE_CUDA_COMPILER=cu++" | ||
| #! /usr/bin/env bash | ||
|
|
||
| # If it's a nightly build, build all configurations. | ||
| if [[ "${BUILD_MODE}" = "branch" ]] ; then | ||
| CMAKE_FLAGS="${CMAKE_FLAGS} -DTHRUST_MULTICONFIG_WORKLOAD=FULL" | ||
| fi | ||
|
|
||
| ################################################################################ | ||
| # SETUP - Check environment. | ||
| ################################################################################ | ||
|
|
||
| logger "Get env..." | ||
| env | ||
|
|
||
| logger "Check versions..." | ||
| c++ --version | ||
| cu++ --version | ||
| # Copyright (c) 2018-2020 NVIDIA Corporation | ||
| # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| # Released under the Apache License v2.0 with LLVM Exceptions. | ||
| # See https://llvm.org/LICENSE.txt for license information. | ||
|
|
||
| ################################################################################ | ||
| # BUILD - Build Thrust examples and tests. | ||
| # Thrust and CUB build script for gpuCI (CPU-only) | ||
| ################################################################################ | ||
|
|
||
| mkdir build | ||
| cd build | ||
|
|
||
| logger "Configure Thrust..." | ||
| cmake ${CMAKE_OPTIONS} .. | ||
| SCRIPT_PATH=$(cd $(dirname ${0}); pwd -P) | ||
|
|
||
| logger "Build Thrust..." | ||
| cmake --build . -j | ||
| REPOSITORY_PATH=$(realpath ${SCRIPT_PATH}/../..) | ||
|
|
||
| ################################################################################ | ||
| # TEST - Run Thrust CPU-only examples and tests. | ||
| ################################################################################ | ||
| export PARALLEL_LEVEL=4 | ||
|
|
||
| logger "Test Thrust (CPU-only)..." | ||
| ctest -E "^cub|^thrust.*cuda" | ||
| source ${REPOSITORY_PATH}/ci/common/build.bash | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| #! /usr/bin/env bash | ||
|
|
||
| # Copyright (c) 2018-2020 NVIDIA Corporation | ||
| # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| # Released under the Apache License v2.0 with LLVM Exceptions. | ||
| # See https://llvm.org/LICENSE.txt for license information. | ||
|
|
||
| ################################################################################ | ||
| # Thrust and CUB build script for gpuCI (heterogeneous) | ||
| ################################################################################ | ||
|
|
||
| SCRIPT_PATH=$(cd $(dirname ${0}); pwd -P) | ||
|
|
||
| REPOSITORY_PATH=$(realpath ${SCRIPT_PATH}/../..) | ||
|
|
||
| export PARALLEL_LEVEL=4 | ||
|
|
||
| source ${REPOSITORY_PATH}/ci/common/build.bash | ||
|
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Two things to be aware of:
$