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"