From 76a028136ec99b3a8aac1cbce8a6a061aab9f79a Mon Sep 17 00:00:00 2001 From: Jake Hemstad Date: Thu, 13 Jul 2023 15:36:50 +0000 Subject: [PATCH 1/5] Enable CUB benchmarks in build script. --- ci/build_cub.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/ci/build_cub.sh b/ci/build_cub.sh index 18549a5cc3..18df0e3310 100755 --- a/ci/build_cub.sh +++ b/ci/build_cub.sh @@ -13,6 +13,7 @@ CMAKE_OPTIONS=" -DCUB_ENABLE_DIALECT_CPP20=$(if [[ $CXX_STANDARD -ne 20 ]]; then echo "OFF"; else echo "ON"; fi) \ -DTHRUST_IGNORE_DEPRECATED_CPP_DIALECT=ON \ -DCUB_IGNORE_DEPRECATED_CPP_DIALECT=ON \ + -DCUB_ENABLE_BENCHMARKS=YES \ " configure_and_build "CUB" "$CMAKE_OPTIONS" From fda27a7e3880b513e4c2353cecb155e64da4002d Mon Sep 17 00:00:00 2001 From: Jake Hemstad Date: Thu, 13 Jul 2023 11:17:13 -0500 Subject: [PATCH 2/5] Only build CUB benchmarks for CUDA >= 11.5. --- ci/build_common.sh | 2 ++ ci/build_cub.sh | 15 ++++++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/ci/build_common.sh b/ci/build_common.sh index 8d0909e227..0bb423bfff 100755 --- a/ci/build_common.sh +++ b/ci/build_common.sh @@ -22,6 +22,7 @@ readonly CXX_STANDARD=$2 readonly GPU_ARCHS=$(echo $3 | tr ' ,' ';') readonly PARALLEL_LEVEL=${PARALLEL_LEVEL:=$(nproc)} +readonly NVCC_VERSION=$(nvcc --version | grep release | awk '{print $6}' | cut -c2-) if [ -z ${DEVCONTAINER_NAME+x} ]; then BUILD_DIR=../build/local @@ -47,6 +48,7 @@ COMMON_CMAKE_OPTIONS=" echo "========================================" echo "Begin build" echo "pwd=$(pwd)" +echo "NVCC_VERSION=$NVCC_VERSION" echo "HOST_COMPILER=$HOST_COMPILER" echo "CXX_STANDARD=$CXX_STANDARD" echo "GPU_ARCHS=$GPU_ARCHS" diff --git a/ci/build_cub.sh b/ci/build_cub.sh index 18df0e3310..aaa0d73a6e 100755 --- a/ci/build_cub.sh +++ b/ci/build_cub.sh @@ -2,6 +2,19 @@ source "$(dirname "$0")/build_common.sh" + +# CUB benchmarks require at least CUDA nvcc 11.5 for int128 +# Returns "true" if the first version is greater than or equal to the second +version_compare() { [ "$1" = "$(echo -e "$1\n$2" | sort -Vr | head -n1)" ] } +readonly ENABLE_CUB_BENCHMARKS=$(version_compare $NVCC_VERSION 11.5) + +if [[ $ENABLE_CUB_BENCHMARKS == "true" ]]; then + echo "CUDA version is $NVCC_VERSION. Building CUB benchmarks." +else + echo "CUDA version is $NVCC_VERSION. Not building CUB benchmarks because CUDA version is less than 11.5." +fi + + CMAKE_OPTIONS=" -DCCCL_ENABLE_THRUST=OFF \ -DCCCL_ENABLE_LIBCUDACXX=OFF \ @@ -13,7 +26,7 @@ CMAKE_OPTIONS=" -DCUB_ENABLE_DIALECT_CPP20=$(if [[ $CXX_STANDARD -ne 20 ]]; then echo "OFF"; else echo "ON"; fi) \ -DTHRUST_IGNORE_DEPRECATED_CPP_DIALECT=ON \ -DCUB_IGNORE_DEPRECATED_CPP_DIALECT=ON \ - -DCUB_ENABLE_BENCHMARKS=YES \ + -DCUB_ENABLE_BENCHMARKS=${ENABLE_CUB_BENCHMARKS} " configure_and_build "CUB" "$CMAKE_OPTIONS" From 603b8c8abfb114648baa9240acde4d7993f2e0ee Mon Sep 17 00:00:00 2001 From: Jake Hemstad Date: Thu, 13 Jul 2023 11:22:15 -0500 Subject: [PATCH 3/5] Add missing line terminator. --- ci/build_cub.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/build_cub.sh b/ci/build_cub.sh index aaa0d73a6e..413fc59d42 100755 --- a/ci/build_cub.sh +++ b/ci/build_cub.sh @@ -26,7 +26,7 @@ CMAKE_OPTIONS=" -DCUB_ENABLE_DIALECT_CPP20=$(if [[ $CXX_STANDARD -ne 20 ]]; then echo "OFF"; else echo "ON"; fi) \ -DTHRUST_IGNORE_DEPRECATED_CPP_DIALECT=ON \ -DCUB_IGNORE_DEPRECATED_CPP_DIALECT=ON \ - -DCUB_ENABLE_BENCHMARKS=${ENABLE_CUB_BENCHMARKS} + -DCUB_ENABLE_BENCHMARKS=${ENABLE_CUB_BENCHMARKS} \ " configure_and_build "CUB" "$CMAKE_OPTIONS" From 5848f626779c3b01f15ea411d4c22dd0c6412f80 Mon Sep 17 00:00:00 2001 From: Jake Hemstad Date: Thu, 13 Jul 2023 11:35:44 -0500 Subject: [PATCH 4/5] Quote expansion. --- ci/build_cub.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/build_cub.sh b/ci/build_cub.sh index 413fc59d42..d491cef0f0 100755 --- a/ci/build_cub.sh +++ b/ci/build_cub.sh @@ -26,7 +26,7 @@ CMAKE_OPTIONS=" -DCUB_ENABLE_DIALECT_CPP20=$(if [[ $CXX_STANDARD -ne 20 ]]; then echo "OFF"; else echo "ON"; fi) \ -DTHRUST_IGNORE_DEPRECATED_CPP_DIALECT=ON \ -DCUB_IGNORE_DEPRECATED_CPP_DIALECT=ON \ - -DCUB_ENABLE_BENCHMARKS=${ENABLE_CUB_BENCHMARKS} \ + -DCUB_ENABLE_BENCHMARKS="${ENABLE_CUB_BENCHMARKS}" \ " configure_and_build "CUB" "$CMAKE_OPTIONS" From c8f9be609baf975280adcb5f670f0e1f3f83c42e Mon Sep 17 00:00:00 2001 From: Jake Hemstad Date: Thu, 13 Jul 2023 11:58:19 -0500 Subject: [PATCH 5/5] Fix formatting. --- ci/build_cub.sh | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/ci/build_cub.sh b/ci/build_cub.sh index d491cef0f0..3b41da9e76 100755 --- a/ci/build_cub.sh +++ b/ci/build_cub.sh @@ -5,7 +5,13 @@ source "$(dirname "$0")/build_common.sh" # CUB benchmarks require at least CUDA nvcc 11.5 for int128 # Returns "true" if the first version is greater than or equal to the second -version_compare() { [ "$1" = "$(echo -e "$1\n$2" | sort -Vr | head -n1)" ] } +version_compare() { + if [[ "$(printf '%s\n' "$1" "$2" | sort -V | head -n1)" == "$2" ]]; then + echo "true" + else + echo "false" + fi +} readonly ENABLE_CUB_BENCHMARKS=$(version_compare $NVCC_VERSION 11.5) if [[ $ENABLE_CUB_BENCHMARKS == "true" ]]; then @@ -14,7 +20,6 @@ else echo "CUDA version is $NVCC_VERSION. Not building CUB benchmarks because CUDA version is less than 11.5." fi - CMAKE_OPTIONS=" -DCCCL_ENABLE_THRUST=OFF \ -DCCCL_ENABLE_LIBCUDACXX=OFF \ @@ -26,7 +31,7 @@ CMAKE_OPTIONS=" -DCUB_ENABLE_DIALECT_CPP20=$(if [[ $CXX_STANDARD -ne 20 ]]; then echo "OFF"; else echo "ON"; fi) \ -DTHRUST_IGNORE_DEPRECATED_CPP_DIALECT=ON \ -DCUB_IGNORE_DEPRECATED_CPP_DIALECT=ON \ - -DCUB_ENABLE_BENCHMARKS="${ENABLE_CUB_BENCHMARKS}" \ + -DCUB_ENABLE_BENCHMARKS="$ENABLE_CUB_BENCHMARKS"\ " configure_and_build "CUB" "$CMAKE_OPTIONS"