Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow libcudfjni to be built as a static library #10619

Merged
merged 1 commit into from
Apr 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion java/pom.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2019-2021, NVIDIA CORPORATION.
Copyright (c) 2019-2022, NVIDIA CORPORATION.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -392,6 +392,7 @@
<arg value="-DGPU_ARCHS=${GPU_ARCHS}"/>
<arg value="-DCUDF_JNI_ARROW_STATIC=${CUDF_JNI_ARROW_STATIC}"/>
<arg value="-DCUDF_JNI_LIBCUDF_STATIC=${CUDF_JNI_LIBCUDF_STATIC}"/>
<arg value="-DBUILD_SHARED_LIBS=ON"/>
mythrocks marked this conversation as resolved.
Show resolved Hide resolved
</exec>
<exec dir="${native.build.path}"
failonerror="true"
Expand Down
28 changes: 21 additions & 7 deletions java/src/main/native/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ project(
# * build options ---------------------------------------------------------------------------------

option(USE_NVTX "Build with NVTX support" ON)
option(BUILD_SHARED_LIBS "Build cuDF JNI shared libraries" ON)
option(BUILD_TESTS "Configure CMake to build tests" ON)
option(PER_THREAD_DEFAULT_STREAM "Build with per-thread default stream" OFF)
option(CUDA_STATIC_RUNTIME "Statically link the CUDA runtime" OFF)
Expand All @@ -44,6 +45,7 @@ option(CUDF_JNI_ARROW_STATIC "Statically link Arrow" ON)
option(CUDF_JNI_LIBCUDF_STATIC "Link with libcudf.a" OFF)

message(VERBOSE "CUDF_JNI: Build with NVTX support: ${USE_NVTX}")
message(VERBOSE "CUDF_JNI: Build cuDF JNI shared libraries: ${BUILD_SHARED_LIBS}")
message(VERBOSE "CUDF_JNI: Configure CMake to build tests: ${BUILD_TESTS}")
message(VERBOSE "CUDF_JNI: Build with per-thread default stream: ${PER_THREAD_DEFAULT_STREAM}")
message(VERBOSE "CUDF_JNI: Statically link the CUDA runtime: ${CUDA_STATIC_RUNTIME}")
Expand Down Expand Up @@ -193,7 +195,7 @@ endif()
# * library targets -------------------------------------------------------------------------------

add_library(
cudfjni SHARED
cudfjni
src/Aggregation128UtilsJni.cpp
src/AggregationJni.cpp
src/CudfJni.cpp
Expand All @@ -218,7 +220,7 @@ add_library(
src/check_nvcomp_output_sizes.cu
)

if(CUDF_JNI_LIBCUDF_STATIC)
if(CUDF_JNI_LIBCUDF_STATIC AND BUILD_SHARED_LIBS)
# When linking against libcudf.a, the JNI library will include the old libcudf.so. For
# backwards-compatibility for software that expects to find libcudf.so in the JVM environment
# after cudf has loaded, the JNI code and libcudf.a will be combined into libcudf.so. A stub
Expand Down Expand Up @@ -254,8 +256,15 @@ target_include_directories(
# Override RPATH for cudfjni
set_target_properties(
cudfjni
PROPERTIES BUILD_RPATH "\$ORIGIN" INSTALL_RPATH "\$ORIGIN" # set target compile options
CXX_STANDARD 17 CXX_STANDARD_REQUIRED ON CUDA_STANDARD 17 CUDA_STANDARD_REQUIRED ON
PROPERTIES BUILD_RPATH "\$ORIGIN"
INSTALL_RPATH "\$ORIGIN"
# set target compile options
CXX_STANDARD 17
CXX_STANDARD_REQUIRED ON
CUDA_STANDARD 17
CUDA_STANDARD_REQUIRED ON
POSITION_INDEPENDENT_CODE ON
mythrocks marked this conversation as resolved.
Show resolved Hide resolved
INTERFACE_POSITION_INDEPENDENT_CODE ON
)

target_compile_options(
Expand All @@ -269,11 +278,16 @@ target_compile_definitions(
)

if(USE_GDS)
add_library(cufilejni SHARED src/CuFileJni.cpp)
add_library(cufilejni src/CuFileJni.cpp)
set_target_properties(
cufilejni
PROPERTIES BUILD_RPATH "\$ORIGIN" INSTALL_RPATH "\$ORIGIN" # set target compile options
CXX_STANDARD 17 CXX_STANDARD_REQUIRED ON
PROPERTIES BUILD_RPATH "\$ORIGIN"
INSTALL_RPATH "\$ORIGIN"
# set target compile options
CXX_STANDARD 17
CXX_STANDARD_REQUIRED ON
POSITION_INDEPENDENT_CODE ON
INTERFACE_POSITION_INDEPENDENT_CODE ON
)
target_include_directories(
cufilejni
Expand Down