From 33b68aa500b114e45a87d4c40d71e369cb198c21 Mon Sep 17 00:00:00 2001 From: Jacob Wujciak-Jens Date: Mon, 28 Oct 2024 13:58:13 -0700 Subject: [PATCH] Add nvrtc to setup scripts. (#11335) Summary: https://github.com/facebookincubator/velox/issues/11225 requires CUDA's nvrtc library and the cuda driver stubs (on machines without a gpu) to be available. * Install nvrct and stubs in centos and ubuntu scripts * Turn GPU build back on. * Add missing links and remove some superflous ones * Turn all targets that link directly or indirectly against CUDA::cuda_driver into standalone targets as the stubbed symbols will throw a dload error on the gpu less runner. This way we keep them out of the mono library and avoid throwing errors in non-gpu tests. * Exclude tests that use the cuda driver stubs via label Pull Request resolved: https://github.com/facebookincubator/velox/pull/11335 Reviewed By: Yuhta Differential Revision: D65067732 Pulled By: pedroerp fbshipit-source-id: 4e33222659cf196ca0869ec98c5f35f7a27ee7da --- .github/workflows/linux-build.yml | 4 +-- scripts/setup-centos9.sh | 3 +- scripts/setup-ubuntu.sh | 3 +- velox/experimental/wave/common/CMakeLists.txt | 6 ++-- .../wave/common/tests/CMakeLists.txt | 9 ++--- .../wave/dwio/decode/CMakeLists.txt | 5 +-- .../wave/dwio/decode/tests/CMakeLists.txt | 7 ++-- velox/experimental/wave/exec/CMakeLists.txt | 9 ++--- .../wave/exec/tests/CMakeLists.txt | 35 +++++-------------- .../wave/vector/tests/CMakeLists.txt | 2 +- 10 files changed, 32 insertions(+), 51 deletions(-) diff --git a/.github/workflows/linux-build.yml b/.github/workflows/linux-build.yml index dbdcf3222656..b40b9af49356 100644 --- a/.github/workflows/linux-build.yml +++ b/.github/workflows/linux-build.yml @@ -115,7 +115,7 @@ jobs: "-DVELOX_ENABLE_GCS=ON" "-DVELOX_ENABLE_ABFS=ON" "-DVELOX_ENABLE_REMOTE_FUNCTIONS=ON" - "-DVELOX_ENABLE_GPU=OFF" + "-DVELOX_ENABLE_GPU=ON" "-DVELOX_MONO_LIBRARY=ON" ) make release EXTRA_CMAKE_FLAGS="${EXTRA_CMAKE_FLAGS[*]}" @@ -136,7 +136,7 @@ jobs: working-directory: _build/release run: | export CLASSPATH=`/usr/local/hadoop/bin/hdfs classpath --glob` - ctest -j 8 --output-on-failure --no-tests=error + ctest -j 8 --label-exclude cuda_driver --output-on-failure --no-tests=error ubuntu-debug: runs-on: 8-core-ubuntu diff --git a/scripts/setup-centos9.sh b/scripts/setup-centos9.sh index d8de1b50cc33..04224adc90d1 100755 --- a/scripts/setup-centos9.sh +++ b/scripts/setup-centos9.sh @@ -220,7 +220,8 @@ function install_arrow { function install_cuda { # See https://developer.nvidia.com/cuda-downloads dnf config-manager --add-repo https://developer.download.nvidia.com/compute/cuda/repos/rhel9/x86_64/cuda-rhel9.repo - dnf install -y cuda-nvcc-$(echo $1 | tr '.' '-') cuda-cudart-devel-$(echo $1 | tr '.' '-') + local dashed="$(echo $1 | tr '.' '-')" + dnf install -y cuda-nvcc-$dashed cuda-cudart-devel-$dashed cuda-nvrtc-devel-$dashed cuda-driver-devel-$dashed } function install_velox_deps { diff --git a/scripts/setup-ubuntu.sh b/scripts/setup-ubuntu.sh index 2676bd59ae1d..5874e98e9651 100755 --- a/scripts/setup-ubuntu.sh +++ b/scripts/setup-ubuntu.sh @@ -244,7 +244,8 @@ function install_cuda { rm cuda-keyring_1.1-1_all.deb $SUDO apt update fi - $SUDO apt install -y cuda-nvcc-$(echo $1 | tr '.' '-') cuda-cudart-dev-$(echo $1 | tr '.' '-') + local dashed="$(echo $1 | tr '.' '-')" + $SUDO apt install -y cuda-nvcc-$dashed cuda-cudart-dev-$dashed cuda-nvrtc-dev-$dashed cuda-driver-dev-$dashed } function install_velox_deps { diff --git a/velox/experimental/wave/common/CMakeLists.txt b/velox/experimental/wave/common/CMakeLists.txt index d7c621fbe1e5..8cea9f79c1a5 100644 --- a/velox/experimental/wave/common/CMakeLists.txt +++ b/velox/experimental/wave/common/CMakeLists.txt @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -velox_add_library( +add_library( velox_wave_common GpuArena.cpp Buffer.cpp @@ -23,11 +23,13 @@ velox_add_library( Type.cpp ResultStaging.cpp) -velox_link_libraries( +target_link_libraries( velox_wave_common velox_exception velox_common_base velox_type + CUDA::cuda_driver + CUDA::cudart CUDA::nvrtc) if(${VELOX_BUILD_TESTING}) diff --git a/velox/experimental/wave/common/tests/CMakeLists.txt b/velox/experimental/wave/common/tests/CMakeLists.txt index 4fffaf40ada0..22507b09db9f 100644 --- a/velox/experimental/wave/common/tests/CMakeLists.txt +++ b/velox/experimental/wave/common/tests/CMakeLists.txt @@ -24,16 +24,11 @@ add_executable( HashTestUtil.cpp) add_test(velox_wave_common_test velox_wave_common_test) +set_tests_properties(velox_wave_common_test PROPERTIES LABELS cuda_driver) target_link_libraries( velox_wave_common_test velox_wave_common - velox_memory - velox_time - velox_exception GTest::gtest GTest::gtest_main - gflags::gflags - glog::glog - Folly::folly - CUDA::nvrtc) + CUDA::cudart) diff --git a/velox/experimental/wave/dwio/decode/CMakeLists.txt b/velox/experimental/wave/dwio/decode/CMakeLists.txt index 790995c47a3c..6e7e9c780e41 100644 --- a/velox/experimental/wave/dwio/decode/CMakeLists.txt +++ b/velox/experimental/wave/dwio/decode/CMakeLists.txt @@ -14,6 +14,7 @@ add_subdirectory(tests) -velox_add_library(velox_wave_decode GpuDecoder.cu) +add_library(velox_wave_decode GpuDecoder.cu) -velox_link_libraries(velox_wave_decode velox_wave_common) +target_link_libraries( + velox_wave_decode velox_wave_common) diff --git a/velox/experimental/wave/dwio/decode/tests/CMakeLists.txt b/velox/experimental/wave/dwio/decode/tests/CMakeLists.txt index bba31ba3174d..66d35ec05a69 100644 --- a/velox/experimental/wave/dwio/decode/tests/CMakeLists.txt +++ b/velox/experimental/wave/dwio/decode/tests/CMakeLists.txt @@ -15,17 +15,14 @@ add_executable(velox_wave_decode_test GpuDecoderTest.cu) add_test(velox_wave_decode_test velox_wave_decode_test) +set_tests_properties(velox_wave_decode_test PROPERTIES LABELS cuda_driver) target_link_libraries( velox_wave_decode_test velox_wave_decode velox_wave_common velox_memory - velox_time - velox_exception GTest::gtest GTest::gtest_main - gflags::gflags - glog::glog Folly::folly - CUDA::nvrtc) + fmt::fmt) diff --git a/velox/experimental/wave/exec/CMakeLists.txt b/velox/experimental/wave/exec/CMakeLists.txt index 024efe9f8f97..4b4d7ef2619b 100644 --- a/velox/experimental/wave/exec/CMakeLists.txt +++ b/velox/experimental/wave/exec/CMakeLists.txt @@ -12,11 +12,12 @@ # See the License for the specific language governing permissions and # limitations under the License. -velox_add_library(velox_wave_stream OperandSet.cpp Wave.cpp) +add_library(velox_wave_stream OperandSet.cpp Wave.cpp) -velox_link_libraries(velox_wave_stream Folly::folly fmt::fmt xsimd) +target_link_libraries( + velox_wave_stream Folly::folly fmt::fmt xsimd) -velox_add_library( +add_library( velox_wave_exec Aggregation.cpp AggregationInstructions.cu @@ -34,7 +35,7 @@ velox_add_library( WaveHiveDataSource.cpp WaveSplitReader.cpp) -velox_link_libraries( +target_link_libraries( velox_wave_exec velox_wave_vector velox_wave_common diff --git a/velox/experimental/wave/exec/tests/CMakeLists.txt b/velox/experimental/wave/exec/tests/CMakeLists.txt index 92382cc2a1e0..49e6da748f3b 100644 --- a/velox/experimental/wave/exec/tests/CMakeLists.txt +++ b/velox/experimental/wave/exec/tests/CMakeLists.txt @@ -40,25 +40,17 @@ target_link_libraries( velox_type velox_vector velox_vector_fuzzer - Boost::atomic - Boost::context - Boost::date_time - Boost::filesystem - Boost::program_options - Boost::regex - Boost::thread - Boost::system - gtest - gtest_main - gmock + GTest::gtest + GTest::gtest_main + GTest::gmock Folly::folly gflags::gflags glog::glog fmt::fmt - ${FILESYSTEM} - CUDA::nvrtc) + CUDA::cudart) add_test(velox_wave_exec_test velox_wave_exec_test) +set_tests_properties(velox_wave_exec_test PROPERTIES LABELS cuda_driver) if(${VELOX_ENABLE_BENCHMARKS}) add_executable(velox_wave_benchmark WaveBenchmark.cpp) @@ -87,22 +79,13 @@ if(${VELOX_ENABLE_BENCHMARKS}) velox_type velox_vector velox_vector_fuzzer - Boost::atomic - Boost::context - Boost::date_time - Boost::filesystem - Boost::program_options - Boost::regex - Boost::thread - Boost::system - gtest - gtest_main - gmock + GTest::gtest + GTest::gtest_main + GTest::gmock ${FOLLY_BENCHMARK} Folly::folly gflags::gflags glog::glog fmt::fmt - ${FILESYSTEM} - CUDA::nvrtc) + CUDA::cudart) endif() diff --git a/velox/experimental/wave/vector/tests/CMakeLists.txt b/velox/experimental/wave/vector/tests/CMakeLists.txt index 1b12f8ad56ba..c6d94713a930 100644 --- a/velox/experimental/wave/vector/tests/CMakeLists.txt +++ b/velox/experimental/wave/vector/tests/CMakeLists.txt @@ -14,7 +14,7 @@ add_executable(velox_wave_vector_test VectorTest.cpp) -add_test(veloxwave__vector_test velox_wave_vector_test) +add_test(veloxwave_vector_test velox_wave_vector_test) target_link_libraries( velox_wave_vector_test