From f455ed4de243f46ba551489d4b3a64cf7e6b7516 Mon Sep 17 00:00:00 2001 From: Jason Lowe Date: Tue, 5 Apr 2022 15:24:29 -0500 Subject: [PATCH 1/2] Statically link the CUDA runtime into a single shared library Signed-off-by: Jason Lowe --- .../build-libcudf.xml => build-libcudf.xml | 2 + pom.xml | 462 +++++++++++++----- spark-rapids-cudf/pom.xml | 294 ----------- spark-rapids-jni/pom.xml | 211 -------- .../src => src}/main/cpp/CMakeLists.txt | 102 +++- .../cpp/cmake/Modules/ConfigureCUDA.cmake | 0 .../main/cpp/src/RowConversionJni.cpp | 0 .../main/cpp/src/emptyfile.cpp | 22 +- .../main/cpp/src/row_conversion.cu | 0 .../main/cpp/src/row_conversion.hpp | 0 .../spark/rapids/jni/RowConversion.java | 7 +- .../spark/rapids/jni/RowConversionTest.java | 0 12 files changed, 418 insertions(+), 682 deletions(-) rename spark-rapids-cudf/build-libcudf.xml => build-libcudf.xml (95%) delete mode 100755 spark-rapids-cudf/pom.xml delete mode 100755 spark-rapids-jni/pom.xml rename {spark-rapids-jni/src => src}/main/cpp/CMakeLists.txt (62%) rename {spark-rapids-jni/src => src}/main/cpp/cmake/Modules/ConfigureCUDA.cmake (100%) rename {spark-rapids-jni/src => src}/main/cpp/src/RowConversionJni.cpp (100%) rename spark-rapids-jni/src/main/java/com/nvidia/spark/rapids/jni/NativeLibraryLoader.java => src/main/cpp/src/emptyfile.cpp (52%) rename {spark-rapids-jni/src => src}/main/cpp/src/row_conversion.cu (100%) rename {spark-rapids-jni/src => src}/main/cpp/src/row_conversion.hpp (100%) rename {spark-rapids-jni/src => src}/main/java/com/nvidia/spark/rapids/jni/RowConversion.java (96%) rename {spark-rapids-jni/src => src}/test/java/com/nvidia/spark/rapids/jni/RowConversionTest.java (100%) diff --git a/spark-rapids-cudf/build-libcudf.xml b/build-libcudf.xml similarity index 95% rename from spark-rapids-cudf/build-libcudf.xml rename to build-libcudf.xml index 6cd9c11dc2..83991d94c1 100644 --- a/spark-rapids-cudf/build-libcudf.xml +++ b/build-libcudf.xml @@ -35,8 +35,10 @@ executable="cmake" if:true="${needConfigure}"> + + diff --git a/pom.xml b/pom.xml index 9040b7cf0f..4aa3e8126b 100644 --- a/pom.xml +++ b/pom.xml @@ -20,13 +20,12 @@ 4.0.0 com.nvidia - spark-rapids-jni-parent + spark-rapids-jni 22.06.0-SNAPSHOT - pom - RAPIDS Accelerator JNI for Apache Spark Root Project + jar + RAPIDS Accelerator JNI for Apache Spark - The root project of native code and CUDA kernels specific to the - RAPIDS Accelerator for Apache Spark. + Native code and CUDA kernels specific to the RAPIDS Accelerator for Apache Spark http://github.com/NVIDIA/spark-rapids-jni @@ -85,140 +84,347 @@ false false cuda11 - 49d1cc28648fe676dbddcf27c01939f87122ed8e + ${project.basedir}/thirdparty/cudf 3.1.4 5.8.1 + ${cudf.path}/cpp/build + false + true + ${project.build.directory}/libcudfjni 1.8 1.8 2.25.0 + ${project.build.directory}/cmake-build 1.10.0 UTF-8 1.7.30 + false - - spark-rapids-cudf - spark-rapids-jni - - - - - - org.apache.arrow - arrow-vector - ${arrow.version} - test - - - org.apache.hadoop - hadoop-common - ${hadoop.version} - test - - - org.apache.parquet - parquet-avro - ${parquet.version} - test - - - org.junit.jupiter - junit-jupiter-api - ${junit.version} - test - - - org.junit.jupiter - junit-jupiter-params - ${junit.version} - test - - - org.mockito - mockito-core - ${mockito.version} - test - - - org.slf4j - slf4j-api - ${slf4j.version} - - - org.slf4j - slf4j-simple - ${slf4j.version} - test - - - + + + org.apache.arrow + arrow-vector + ${arrow.version} + test + + + org.apache.hadoop + hadoop-common + ${hadoop.version} + test + + + org.apache.parquet + parquet-avro + ${parquet.version} + test + + + org.junit.jupiter + junit-jupiter-api + ${junit.version} + test + + + org.junit.jupiter + junit-jupiter-params + ${junit.version} + test + + + org.mockito + mockito-core + ${mockito.version} + test + + + org.slf4j + slf4j-api + ${slf4j.version} + + + org.slf4j + slf4j-simple + ${slf4j.version} + test + + - - - - org.apache.maven.plugins - maven-antrun-plugin - 3.0.0 - - - org.apache.maven.plugins - maven-compiler-plugin - 3.8.0 - - - org.apache.maven.plugins - maven-exec-plugin - 1.6.0 - - - org.apache.maven.plugins - maven-jar-plugin - 3.0.2 - - - org.apache.maven.plugins - maven-resources-plugin - - 2.6 - - - org.apache.maven.plugins - maven-shade-plugin - 3.2.4 - - - org.apache.maven.plugins - maven-surefire-plugin - 2.22.0 - - - false - true - - ${ai.rapids.refcount.debug} - ${ai.rapids.cudf.nvtx.enabled} - - - - - org.junit.platform - junit-platform-surefire-provider - 1.3.2 - - - org.junit.jupiter - junit-jupiter-engine - ${junit.version} - - - - - org.codehaus.mojo - build-helper-maven-plugin - 3.2.0 - - - + + + org.apache.maven.plugins + maven-antrun-plugin + 3.0.0 + + + submodule check + validate + + ${submodule.check.skip} + + + + + + + run + + + + clean libcudf + clean + + ${libcudf.clean.skip} + + + + + + run + + + + build-libcudf + validate + + + + + + + + + + + + + + + run + + + + build-libcudfjni + validate + + + + + + + + + + + + + + + + + + + + + + + + run + + + + build-sparkrapidsjni + validate + + + + + + + + + + + + + + + + + + + + run + + + + build-info + generate-resources + + + + + + + + + + + + run + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.8.0 + + + org.apache.maven.plugins + maven-jar-plugin + 3.0.2 + + ${cuda.version} + + + + + test-jar + + + tests + + + + + + org.apache.maven.plugins + maven-resources-plugin + + 2.6 + + + copy-native-libs + generate-resources + + copy-resources + + + true + ${project.build.outputDirectory}/${os.arch}/${os.name} + + + ${native.build.path} + + libcudf.so + libcudfjni.so + libcufilejni.so + + + + + + + + + org.apache.maven.plugins + maven-shade-plugin + 3.2.4 + + + org.apache.maven.plugins + maven-surefire-plugin + 2.22.0 + + + false + true + + ${ai.rapids.refcount.debug} + ${ai.rapids.cudf.nvtx.enabled} + + + + + org.junit.platform + junit-platform-surefire-provider + 1.3.2 + + + org.junit.jupiter + junit-jupiter-engine + ${junit.version} + + + + + org.codehaus.mojo + build-helper-maven-plugin + 3.2.0 + + + add-cudf-src + + add-source + + generate-sources + + + ${cudf.path}/java/src/main/java + + + + + add-cudf-test-src + + add-test-source + + generate-test-sources + + + ${cudf.path}/java/src/test/java + + + + + add-cudf-test-resource + + add-test-resource + + generate-test-resources + + + + ${cudf.path}/java/src/test/resources + + + + + + + + + + + ${project.build.directory}/extra-resources + true + + diff --git a/spark-rapids-cudf/pom.xml b/spark-rapids-cudf/pom.xml deleted file mode 100755 index 6613305ff6..0000000000 --- a/spark-rapids-cudf/pom.xml +++ /dev/null @@ -1,294 +0,0 @@ - - - - 4.0.0 - - - com.nvidia - spark-rapids-jni-parent - 22.06.0-SNAPSHOT - - spark-rapids-cudf - 22.06.0-SNAPSHOT - jar - RAPIDS Accelerator cudf - RAPIDS cuDF customized for the RAPIDS Accelerator for Apache Spark - - - ${project.basedir}/../thirdparty/cudf - ${cudf.path}/cpp/build - false - true - ${project.build.directory}/cmake-build - false - - - - - org.apache.arrow - arrow-vector - test - - - org.apache.hadoop - hadoop-common - test - - - org.apache.parquet - parquet-avro - test - - - org.junit.jupiter - junit-jupiter-api - test - - - org.junit.jupiter - junit-jupiter-params - test - - - org.mockito - mockito-core - test - - - org.slf4j - slf4j-api - compile - - - org.slf4j - slf4j-simple - test - - - - - - - maven-antrun-plugin - - - submodule check - validate - - ${submodule.check.skip} - - - - - - - run - - - - clean libcudf - clean - - ${libcudf.clean.skip} - - - - - - run - - - - build libcudf - validate - - - - - - - - - - - - - - - run - - - - build libcudfjni - validate - - - - - - - - - - - - - - - - - - - - - run - - - - build-info - generate-resources - - - - - - - - - - - - run - - - - - - org.codehaus.mojo - build-helper-maven-plugin - - - add-cudf-src - - add-source - - generate-sources - - - ${cudf.path}/java/src/main/java - - - - - add-cudf-test-src - - add-test-source - - generate-test-sources - - - ${cudf.path}/java/src/test/java - - - - - add-cudf-test-resource - - add-test-resource - - generate-test-resources - - - - ${cudf.path}/java/src/test/resources - - - - - - - - org.apache.maven.plugins - maven-jar-plugin - - ${cuda.version} - - - - - test-jar - - - tests - - - - - - maven-resources-plugin - - - copy-native-libs - generate-resources - - copy-resources - - - true - ${project.build.outputDirectory}/${os.arch}/${os.name} - - - ${libcudf.build.path} - - libcudf.so - - - - ${libcudfjni.build.path} - - libcudfjni.so - - - - - - - - - org.apache.maven.plugins - maven-surefire-plugin - - - - - - ${project.build.directory}/extra-resources - true - - - - diff --git a/spark-rapids-jni/pom.xml b/spark-rapids-jni/pom.xml deleted file mode 100755 index a64f82b65c..0000000000 --- a/spark-rapids-jni/pom.xml +++ /dev/null @@ -1,211 +0,0 @@ - - - - 4.0.0 - - - com.nvidia - spark-rapids-jni-parent - 22.06.0-SNAPSHOT - - rapids-4-spark-jni - 22.06.0-SNAPSHOT - jar - RAPIDS Accelerator JNI for Apache Spark - - Native code and CUDA kernels specific to the RAPIDS Accelerator for Apache Spark - - - - ${project.build.directory}/cmake-build - - - - - com.nvidia - spark-rapids-cudf - ${project.version} - ${cuda.version} - - - com.nvidia - spark-rapids-cudf - ${project.version} - test-jar - test - - - org.junit.jupiter - junit-jupiter-api - test - - - - - - - maven-antrun-plugin - - - cmake - validate - - - - - - - - - - - - - - - - run - - - - build-info - generate-resources - - - - - - - - - - - - run - - - - - - org.apache.maven.plugins - maven-jar-plugin - - - classifier-jar - - ${cuda.version} - - - jar - - - - test-jar - - tests - - - test-jar - - - - - - org.apache.maven.plugins - maven-shade-plugin - - - - com.nvidia:spark-rapids-cudf:${cuda.version} - - - - - com.nvidia:spark-rapids-cudf:${cuda.version} - - META-INF/*.MF - - - - true - ${cuda.version} - - - - package - - shade - - - - - - org.apache.maven.plugins - maven-surefire-plugin - - - maven-resources-plugin - - - copy-native-libs - validate - - copy-resources - - - true - ${project.build.directory}/native-deps/${os.arch}/${os.name} - - - ${native.build.path} - - libspark_rapids_jni.so - - - - - - - - - - - ${basedir}/.. - META-INF - - LICENSE - - - - - ${project.build.directory}/extra-resources - true - - - ${project.build.directory}/native-deps/ - - - - diff --git a/spark-rapids-jni/src/main/cpp/CMakeLists.txt b/src/main/cpp/CMakeLists.txt similarity index 62% rename from spark-rapids-jni/src/main/cpp/CMakeLists.txt rename to src/main/cpp/CMakeLists.txt index 98dcd2b7d1..a189198a3f 100644 --- a/spark-rapids-jni/src/main/cpp/CMakeLists.txt +++ b/src/main/cpp/CMakeLists.txt @@ -24,6 +24,8 @@ include(rapids-cpm) include(rapids-cuda) include(rapids-export) include(rapids-find) +include(rapids-cpm) +rapids_cpm_init() # Use GPU_ARCHS if it is defined if(DEFINED GPU_ARCHS) @@ -42,6 +44,7 @@ project( # * build options --------------------------------------------------------------------------------- option(PER_THREAD_DEFAULT_STREAM "Build with per-thread default stream" ON) +option(USE_GDS "Build with GPUDirect Storage (GDS)/cuFile support" OFF) message(VERBOSE "SPARK_RAPIDS_JNI: Build with per-thread default stream: ${PER_THREAD_DEFAULT_STREAM}") @@ -61,7 +64,7 @@ set_property( message(VERBOSE "SPARK_RAPIDS_JNI: RMM_LOGGING_LEVEL = '${RMM_LOGGING_LEVEL}'.") set(CUDF_DIR - "${PROJECT_BINARY_DIR}/../../../thirdparty/cudf" + "${PROJECT_BINARY_DIR}/../../thirdparty/cudf" CACHE STRING "path to cudf repository" ) @@ -85,38 +88,49 @@ else() endif() # cudf -set(CUDF_DEPS_DIR "${CUDF_DIR}/cpp/build/_deps") +set(CUDF_BUILD_DIR "${CUDF_DIR}/cpp/build") +set(CUDF_DEPS_DIR "${CUDF_BUILD_DIR}/_deps") set(CUDF_INCLUDE_DIRS "${CUDF_DIR}/cpp/include" "${CUDF_DIR}/java/src/main/native/include" "${CUDF_DIR}/java/src/main/native/src" "${CUDF_DEPS_DIR}/arrow-src/cpp/src" "${CUDF_DEPS_DIR}/nvcomp-src/include" - "${CUDF_DEPS_DIR}/thrust-src" ) +# Thrust +include(${CUDF_DIR}/cpp/cmake/thirdparty/get_thrust.cmake) + # RMM -find_path( - RMM_INCLUDE "rmm" - HINTS "${CUDF_DEPS_DIR}/rmm-src/include" - "$ENV{RMM_ROOT}/include" - "$ENV{RMM_HOME}/include" - "$ENV{CONDA_PREFIX}/include" -) +include(${CUDF_DIR}/cpp/cmake/thirdparty/get_rmm.cmake) -find_path( - SPDLOG_INCLUDE "spdlog" - HINTS "${CUDF_DEPS_DIR}/spdlog-src/include" - "$ENV{RMM_ROOT}/_deps/spdlog-src/include" - "$ENV{RMM_ROOT}/include" - "$ENV{CONDA_PREFIX}/include" +# Arrow +find_library(ARROW_LIB "libarrow.a" REQUIRED + HINTS "${CUDF_DEPS_DIR}/arrow-build/release" + "${CUDF_DEPS_DIR}/arrow-build/debug" ) +# cudf +find_library(CUDF_LIB "cudf" REQUIRED HINTS ${CUDF_BUILD_DIR}) + # cudfjni -find_library(CUDFJNI_LIB "cudfjni" REQUIRED - HINTS "${PROJECT_BINARY_DIR}/../../../spark-rapids-cudf/target/cmake-build" +find_library(CUDFJNI_LIB "libcudfjni.a" REQUIRED + HINTS "${PROJECT_BINARY_DIR}/../libcudfjni" ) +# ZLIB +rapids_find_package(ZLIB REQUIRED) + +# ################################################################################################## +# * nvcomp ---------------------------------------------------------------------------------------- + +find_path(NVCOMP_INCLUDE "nvcomp" HINTS "${CUDF_BUILD_DIR}/_deps/nvcomp-src/include") + +message(STATUS "NVCOMP: NVCOMP_INCLUDE set to ${NVCOMP_INCLUDE}") + +set(NVCOMP_LIBNAME "libnvcomp.a") +find_library(NVCOMP_LIB "libnvcomp.a" REQUIRED HINTS "${CUDF_BUILD_DIR}/lib") + # ################################################################################################## # * library targets ------------------------------------------------------------------------------- @@ -137,6 +151,7 @@ set_target_properties( CUDA_STANDARD_REQUIRED ON POSITION_INDEPENDENT_CODE ON INTERFACE_POSITION_INDEPENDENT_CODE ON + CUDA_RUNTIME_LIBRARY Static ) target_compile_options( @@ -147,10 +162,10 @@ target_compile_options( # Specify include paths for the current target and dependents target_include_directories( spark_rapids_jni - PRIVATE "${SPARK_RAPIDS_JNI_SOURCE_DIR}/src" + PRIVATE cudf::Thrust + "${NVCOMP_INCLUDE}" + "${SPARK_RAPIDS_JNI_SOURCE_DIR}/src" "${CUDF_INCLUDE_DIRS}" - "${RMM_INCLUDE}" - "${SPDLOG_INCLUDE}" "${JNI_INCLUDE_DIRS}" "${CUDAToolkit_INCLUDE_DIRS}" ) @@ -166,6 +181,47 @@ if(PER_THREAD_DEFAULT_STREAM) endif() target_link_libraries( - spark_rapids_jni - PRIVATE ${CUDFJNI_LIB} + spark_rapids_jni PRIVATE + -Wl,--whole-archive + ${CUDFJNI_LIB} + ${CUDF_LIB} + -Wl,--no-whole-archive + rmm::rmm + ${ARROW_LIB} + ${NVCOMP_LIB} + ZLIB::ZLIB + CUDA::cuda_driver ) + +# For backwards-compatibility with the cudf Java bindings and RAPIDS accelerated UDFs, +# all of the code is built into libcudf.so that is statically linked to the CUDA runtime library. +# libcudfjni.so is a stub library dynamically-linked to libcudf.so. +set_target_properties(spark_rapids_jni PROPERTIES OUTPUT_NAME "cudf") +add_library(cudfjnistub SHARED src/emptyfile.cpp) +set_target_properties(cudfjnistub PROPERTIES OUTPUT_NAME "cudfjni") +target_link_libraries(cudfjnistub -Wl,--no-as-needed spark_rapids_jni -Wl,--as-needed) + +# ################################################################################################## +# * cuFile JNI ------------------------------------------------------------------------------------- + +if(USE_GDS) + include(${CUDF_DIR}/cpp/cmake/Modules/FindcuFile.cmake) + find_library(CUFILEJNI_LIB "libcufilejni.a" REQUIRED HINTS "${PROJECT_BINARY_DIR}/../libcudfjni") + add_library(cufilejni SHARED src/emptyfile.cpp) + set_target_properties( + cufilejni + PROPERTIES BUILD_RPATH "\$ORIGIN" + INSTALL_RPATH "\$ORIGIN" + # set target compile options + CXX_STANDARD 17 + CXX_STANDARD_REQUIRED ON + ) + target_link_libraries( + cufilejni PRIVATE + -Wl,--whole-archive + ${CUFILEJNI_LIB} + -Wl,--no-whole-archive + spark_rapids_jni + ${cuFile_LIBRARIES} + ) +endif() diff --git a/spark-rapids-jni/src/main/cpp/cmake/Modules/ConfigureCUDA.cmake b/src/main/cpp/cmake/Modules/ConfigureCUDA.cmake similarity index 100% rename from spark-rapids-jni/src/main/cpp/cmake/Modules/ConfigureCUDA.cmake rename to src/main/cpp/cmake/Modules/ConfigureCUDA.cmake diff --git a/spark-rapids-jni/src/main/cpp/src/RowConversionJni.cpp b/src/main/cpp/src/RowConversionJni.cpp similarity index 100% rename from spark-rapids-jni/src/main/cpp/src/RowConversionJni.cpp rename to src/main/cpp/src/RowConversionJni.cpp diff --git a/spark-rapids-jni/src/main/java/com/nvidia/spark/rapids/jni/NativeLibraryLoader.java b/src/main/cpp/src/emptyfile.cpp similarity index 52% rename from spark-rapids-jni/src/main/java/com/nvidia/spark/rapids/jni/NativeLibraryLoader.java rename to src/main/cpp/src/emptyfile.cpp index 2107412bf1..d7777f83dc 100644 --- a/spark-rapids-jni/src/main/java/com/nvidia/spark/rapids/jni/NativeLibraryLoader.java +++ b/src/main/cpp/src/emptyfile.cpp @@ -14,24 +14,4 @@ * limitations under the License. */ -package com.nvidia.spark.rapids.jni; - -import ai.rapids.cudf.NativeDepsLoader; - -/** Loads the native libraries */ -public class NativeLibraryLoader { - private static boolean loaded = false; - - /** Load native libraries if not loaded already */ - public static synchronized void loadNativeLibs() { - if (!loaded) { - try { - NativeDepsLoader.loadNativeDeps(); - NativeDepsLoader.loadNativeDeps(new String[]{"spark_rapids_jni"}); - loaded = true; - } catch (Exception e) { - throw new RuntimeException(e); - } - } - } -} +// Intentionally empty diff --git a/spark-rapids-jni/src/main/cpp/src/row_conversion.cu b/src/main/cpp/src/row_conversion.cu similarity index 100% rename from spark-rapids-jni/src/main/cpp/src/row_conversion.cu rename to src/main/cpp/src/row_conversion.cu diff --git a/spark-rapids-jni/src/main/cpp/src/row_conversion.hpp b/src/main/cpp/src/row_conversion.hpp similarity index 100% rename from spark-rapids-jni/src/main/cpp/src/row_conversion.hpp rename to src/main/cpp/src/row_conversion.hpp diff --git a/spark-rapids-jni/src/main/java/com/nvidia/spark/rapids/jni/RowConversion.java b/src/main/java/com/nvidia/spark/rapids/jni/RowConversion.java similarity index 96% rename from spark-rapids-jni/src/main/java/com/nvidia/spark/rapids/jni/RowConversion.java rename to src/main/java/com/nvidia/spark/rapids/jni/RowConversion.java index 854b089517..5c254b2a10 100644 --- a/spark-rapids-jni/src/main/java/com/nvidia/spark/rapids/jni/RowConversion.java +++ b/src/main/java/com/nvidia/spark/rapids/jni/RowConversion.java @@ -16,15 +16,12 @@ package com.nvidia.spark.rapids.jni; -import ai.rapids.cudf.ColumnView; -import ai.rapids.cudf.ColumnVector; -import ai.rapids.cudf.DType; -import ai.rapids.cudf.Table; +import ai.rapids.cudf.*; /** Utility class for converting between column major and row major data */ public class RowConversion { static { - NativeLibraryLoader.loadNativeLibs(); + NativeDepsLoader.loadNativeDeps(); } /** diff --git a/spark-rapids-jni/src/test/java/com/nvidia/spark/rapids/jni/RowConversionTest.java b/src/test/java/com/nvidia/spark/rapids/jni/RowConversionTest.java similarity index 100% rename from spark-rapids-jni/src/test/java/com/nvidia/spark/rapids/jni/RowConversionTest.java rename to src/test/java/com/nvidia/spark/rapids/jni/RowConversionTest.java From 830d55c9f0b1ac2b6c525193decd0af294f6e155 Mon Sep 17 00:00:00 2001 From: Jason Lowe Date: Fri, 8 Apr 2022 17:29:31 -0500 Subject: [PATCH 2/2] Pickup libcudf and its dependencies via rapids_find_package --- build-libcudf.xml | 4 ++- pom.xml | 3 +- src/main/cpp/CMakeLists.txt | 70 +++++++++++-------------------------- 3 files changed, 26 insertions(+), 51 deletions(-) diff --git a/build-libcudf.xml b/build-libcudf.xml index 83991d94c1..1be5d49c84 100644 --- a/build-libcudf.xml +++ b/build-libcudf.xml @@ -29,6 +29,7 @@ + + @@ -52,7 +54,7 @@ - + diff --git a/pom.xml b/pom.xml index 4aa3e8126b..540d79f4c2 100644 --- a/pom.xml +++ b/pom.xml @@ -90,6 +90,7 @@ ${cudf.path}/cpp/build false true + ${project.build.directory}/libcudf-install ${project.build.directory}/libcudfjni 1.8 1.8 @@ -195,6 +196,7 @@ + @@ -250,7 +252,6 @@ failonerror="true" executable="cmake"> - diff --git a/src/main/cpp/CMakeLists.txt b/src/main/cpp/CMakeLists.txt index a189198a3f..c6d88aefcd 100644 --- a/src/main/cpp/CMakeLists.txt +++ b/src/main/cpp/CMakeLists.txt @@ -36,7 +36,7 @@ rapids_cuda_init_architectures(SPARK_RAPIDS_JNI) project( SPARK_RAPIDS_JNI - VERSION 21.12.00 + VERSION 22.06.00 LANGUAGES C CXX CUDA ) @@ -63,6 +63,13 @@ set_property( ) message(VERBOSE "SPARK_RAPIDS_JNI: RMM_LOGGING_LEVEL = '${RMM_LOGGING_LEVEL}'.") +set(CUDF_INSTALL_DIR + "${PROJECT_BINARY_DIR}/../libcudf-install" + CACHE STRING "path to libcudf install root" +) + +set(CMAKE_PREFIX_PATH ${CUDF_INSTALL_DIR}) + set(CUDF_DIR "${PROJECT_BINARY_DIR}/../../thirdparty/cudf" CACHE STRING "path to cudf repository" @@ -88,48 +95,17 @@ else() endif() # cudf -set(CUDF_BUILD_DIR "${CUDF_DIR}/cpp/build") -set(CUDF_DEPS_DIR "${CUDF_BUILD_DIR}/_deps") -set(CUDF_INCLUDE_DIRS - "${CUDF_DIR}/cpp/include" - "${CUDF_DIR}/java/src/main/native/include" - "${CUDF_DIR}/java/src/main/native/src" - "${CUDF_DEPS_DIR}/arrow-src/cpp/src" - "${CUDF_DEPS_DIR}/nvcomp-src/include" -) - -# Thrust -include(${CUDF_DIR}/cpp/cmake/thirdparty/get_thrust.cmake) - -# RMM -include(${CUDF_DIR}/cpp/cmake/thirdparty/get_rmm.cmake) - -# Arrow -find_library(ARROW_LIB "libarrow.a" REQUIRED - HINTS "${CUDF_DEPS_DIR}/arrow-build/release" - "${CUDF_DEPS_DIR}/arrow-build/debug" -) - -# cudf -find_library(CUDF_LIB "cudf" REQUIRED HINTS ${CUDF_BUILD_DIR}) +rapids_find_package(cudf REQUIRED) # cudfjni -find_library(CUDFJNI_LIB "libcudfjni.a" REQUIRED +find_library(CUDFJNI_LIB "libcudfjni.a" REQUIRED NO_DEFAULT_PATH HINTS "${PROJECT_BINARY_DIR}/../libcudfjni" ) -# ZLIB -rapids_find_package(ZLIB REQUIRED) - -# ################################################################################################## -# * nvcomp ---------------------------------------------------------------------------------------- - -find_path(NVCOMP_INCLUDE "nvcomp" HINTS "${CUDF_BUILD_DIR}/_deps/nvcomp-src/include") - -message(STATUS "NVCOMP: NVCOMP_INCLUDE set to ${NVCOMP_INCLUDE}") - -set(NVCOMP_LIBNAME "libnvcomp.a") -find_library(NVCOMP_LIB "libnvcomp.a" REQUIRED HINTS "${CUDF_BUILD_DIR}/lib") +set(CUDFJNI_INCLUDE_DIRS + "${CUDF_DIR}/java/src/main/native/include" + "${CUDF_DIR}/java/src/main/native/src" +) # ################################################################################################## # * library targets ------------------------------------------------------------------------------- @@ -162,11 +138,9 @@ target_compile_options( # Specify include paths for the current target and dependents target_include_directories( spark_rapids_jni - PRIVATE cudf::Thrust - "${NVCOMP_INCLUDE}" - "${SPARK_RAPIDS_JNI_SOURCE_DIR}/src" - "${CUDF_INCLUDE_DIRS}" + PRIVATE "${SPARK_RAPIDS_JNI_SOURCE_DIR}/src" "${JNI_INCLUDE_DIRS}" + "${CUDFJNI_INCLUDE_DIRS}" "${CUDAToolkit_INCLUDE_DIRS}" ) @@ -184,13 +158,9 @@ target_link_libraries( spark_rapids_jni PRIVATE -Wl,--whole-archive ${CUDFJNI_LIB} - ${CUDF_LIB} + cudf::cudf -Wl,--no-whole-archive - rmm::rmm - ${ARROW_LIB} - ${NVCOMP_LIB} - ZLIB::ZLIB - CUDA::cuda_driver + cudf::cudf ) # For backwards-compatibility with the cudf Java bindings and RAPIDS accelerated UDFs, @@ -206,7 +176,9 @@ target_link_libraries(cudfjnistub -Wl,--no-as-needed spark_rapids_jni -Wl,--as-n if(USE_GDS) include(${CUDF_DIR}/cpp/cmake/Modules/FindcuFile.cmake) - find_library(CUFILEJNI_LIB "libcufilejni.a" REQUIRED HINTS "${PROJECT_BINARY_DIR}/../libcudfjni") + find_library(CUFILEJNI_LIB "libcufilejni.a" REQUIRED NO_DEFAULT_PATH + HINTS "${PROJECT_BINARY_DIR}/../libcudfjni" + ) add_library(cufilejni SHARED src/emptyfile.cpp) set_target_properties( cufilejni