From 58f395b15524309b36bcc1480eb4d186764df7dd Mon Sep 17 00:00:00 2001 From: Alessandro Bellina Date: Wed, 7 Apr 2021 18:58:29 -0500 Subject: [PATCH] Use dynamic cudart for nvcomp in java build (#7896) This PR does two things: - It adds a check that will fail the build if it detects that CUDA runtime was linked statically. For now, that seems like a safe bet, and if we decide to start building with a static CUDA in the future, we should remove that check. - As part of investigation for https://github.com/rapidsai/cudf/issues/7600, libnvcomp was the last library that had a statically linked CUDA runtime, so this PR addresses that. Authors: - Alessandro Bellina (https://github.com/abellina) Approvers: - Jason Lowe (https://github.com/jlowe) URL: https://github.com/rapidsai/cudf/pull/7896 --- java/ci/build-in-docker.sh | 3 +++ java/src/main/native/cmake/Modules/ConfigureNvcomp.cmake | 8 +++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/java/ci/build-in-docker.sh b/java/ci/build-in-docker.sh index fc7e5762275..10be5b9c639 100755 --- a/java/ci/build-in-docker.sh +++ b/java/ci/build-in-docker.sh @@ -74,6 +74,9 @@ fi cd $WORKSPACE/java mvn -B clean package $BUILD_ARG +###### Sanity test: fail if static cudart found ###### +find . -name '*.so' | xargs -I{} readelf -Ws {} | grep cuInit && echo "Found statically linked CUDA runtime, this is currently not tested" && exit 1 + ###### Stash Jar files ###### rm -rf $OUT_PATH mkdir -p $OUT_PATH diff --git a/java/src/main/native/cmake/Modules/ConfigureNvcomp.cmake b/java/src/main/native/cmake/Modules/ConfigureNvcomp.cmake index 0bef79116af..bff0f4ac606 100644 --- a/java/src/main/native/cmake/Modules/ConfigureNvcomp.cmake +++ b/java/src/main/native/cmake/Modules/ConfigureNvcomp.cmake @@ -16,7 +16,13 @@ set(NVCOMP_ROOT "${CMAKE_BINARY_DIR}/nvcomp") -set(NVCOMP_CMAKE_ARGS "-DUSE_RMM=ON -DCUB_DIR=${CUB_INCLUDE}") +if(CUDA_STATIC_RUNTIME) + set(NVCOMP_CUDA_RUNTIME_LIBRARY Static) +else() + set(NVCOMP_CUDA_RUNTIME_LIBRARY Shared) +endif() + +set(NVCOMP_CMAKE_ARGS "-DCMAKE_CUDA_RUNTIME_LIBRARY=${NVCOMP_CUDA_RUNTIME_LIBRARY} -DUSE_RMM=ON -DCUB_DIR=${CUB_INCLUDE}") configure_file("${CMAKE_SOURCE_DIR}/cmake/Templates/Nvcomp.CMakeLists.txt.cmake" "${NVCOMP_ROOT}/CMakeLists.txt")