Skip to content

Commit

Permalink
Use dynamic cudart for nvcomp in java build (#7896)
Browse files Browse the repository at this point in the history
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 #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: #7896
  • Loading branch information
abellina authored Apr 7, 2021
1 parent 2958719 commit 58f395b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
3 changes: 3 additions & 0 deletions java/ci/build-in-docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 7 additions & 1 deletion java/src/main/native/cmake/Modules/ConfigureNvcomp.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down

0 comments on commit 58f395b

Please sign in to comment.