Skip to content

Commit

Permalink
Support nvComp 2.3 if local, otherwise use nvcomp 2.2 (#10513)
Browse files Browse the repository at this point in the history
This will allow us to utilize new features in nvComp 2.3 when it already has been installed locally, otherwise we fallback to building 2.2 from source.

Loccal tests with CUDA 11.5 and 11.6 show no regressions

Authors:
  - Robert Maynard (https://github.com/robertmaynard)
  - Nghia Truong (https://github.com/ttnghia)
  - Paul Taylor (https://github.com/trxcllnt)

Approvers:
  - Vyas Ramasubramani (https://github.com/vyasr)
  - Jason Lowe (https://github.com/jlowe)

URL: #10513
  • Loading branch information
robertmaynard authored Apr 5, 2022
1 parent 3631860 commit f359ec7
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 572 deletions.
20 changes: 10 additions & 10 deletions cpp/cmake/thirdparty/get_nvcomp.cmake
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# =============================================================================
# Copyright (c) 2021, NVIDIA CORPORATION.
# Copyright (c) 2021-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. You may obtain a copy of the License at
Expand All @@ -13,14 +13,15 @@
# =============================================================================

# This function finds nvcomp and sets any additional necessary environment variables.
function(find_and_configure_nvcomp VERSION)

# Find or install nvcomp
function(find_and_configure_nvcomp VERSION_MIN VERSION_MAX)
# Search for latest version of nvComp
rapids_find_package(nvcomp ${VERSION_MAX} QUIET)
# If latest isn't found, fall back to building oldest support from source
rapids_cpm_find(
nvcomp ${VERSION}
nvcomp ${VERSION_MIN}
GLOBAL_TARGETS nvcomp::nvcomp
CPM_ARGS GITHUB_REPOSITORY NVIDIA/nvcomp
GIT_TAG c435afaf4ba8a8d12f379d688effcb185886cec1
GIT_TAG v${VERSION_MIN}
OPTIONS "BUILD_STATIC ON" "BUILD_TESTS OFF" "BUILD_BENCHMARKS OFF" "BUILD_EXAMPLES OFF"
)

Expand All @@ -32,9 +33,8 @@ function(find_and_configure_nvcomp VERSION)
if(TARGET nvcomp AND PER_THREAD_DEFAULT_STREAM)
target_compile_definitions(nvcomp PRIVATE CUDA_API_PER_THREAD_DEFAULT_STREAM)
endif()

endfunction()

set(CUDF_MIN_VERSION_nvCOMP 2.1.0)

find_and_configure_nvcomp(${CUDF_MIN_VERSION_nvCOMP})
set(CUDF_MIN_VERSION_nvCOMP 2.2.0)
set(CUDF_MAX_VERSION_nvCOMP 2.3.0)
find_and_configure_nvcomp(${CUDF_MIN_VERSION_nvCOMP} ${CUDF_MAX_VERSION_nvCOMP})
126 changes: 0 additions & 126 deletions java/src/main/java/ai/rapids/cudf/nvcomp/LZ4Compressor.java

This file was deleted.

118 changes: 0 additions & 118 deletions java/src/main/java/ai/rapids/cudf/nvcomp/LZ4Decompressor.java

This file was deleted.

96 changes: 1 addition & 95 deletions java/src/main/java/ai/rapids/cudf/nvcomp/NvcompJni.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020-2021, NVIDIA CORPORATION.
* Copyright (c) 2020-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 All @@ -24,100 +24,6 @@ class NvcompJni {
NativeDepsLoader.loadNativeDeps();
}

/**
* Determine if data is compressed with the nvcomp LZ4 compressor.
* @param inPtr device address of the compressed data
* @param inSize size of the compressed data in bytes
* @param stream CUDA stream to use
* @return true if the data is compressed with the nvcomp LZ4 compressor
*/
static native boolean isLZ4Data(long inPtr, long inSize, long stream);

/**
* Determine if the metadata corresponds to data compressed with the nvcomp LZ4 compressor.
* @param metadataPtr address of the metadata object
* @return true if the metadata describes data compressed with the nvcomp LZ4 compressor.
*/
static native boolean isLZ4Metadata(long metadataPtr);

/**
* Return the LZ4 compression configuration necessary for a particular chunk size.
* @param chunkSize maximum size of an uncompressed chunk in bytes
* @param uncompressedSize total size of the uncompressed data
* @return array of three longs containing metadata size, temp storage size,
* and output buffer size
*/
static native long[] lz4CompressConfigure(long chunkSize, long uncompressedSize);

/**
* Perform LZ4 compression asynchronously using the specified CUDA stream.
* @param compressedSizeOutputPtr host address of a 64-bit integer to update
* with the resulting compressed size of the
* data. For the operation to be truly
* asynchronous this should point to pinned
* host memory.
* @param inPtr device address of the uncompressed data
* @param inSize size of the uncompressed data in bytes
* @param inputType type of uncompressed data
* @param chunkSize size of an LZ4 chunk in bytes
* @param tempPtr device address of the temporary compression storage buffer
* @param tempSize size of the temporary storage buffer in bytes
* @param outPtr device address of the output buffer
* @param outSize size of the output buffer in bytes
* @param stream CUDA stream to use
*/
static native void lz4CompressAsync(
long compressedSizeOutputPtr,
long inPtr,
long inSize,
int inputType,
long chunkSize,
long tempPtr,
long tempSize,
long outPtr,
long outSize,
long stream);

/**
* Return the decompression configuration for a compressed input.
* NOTE: The resulting configuration object must be closed to destroy the corresponding
* host-side metadata created by this method to avoid a native memory leak.
* @param inPtr device address of the compressed data
* @param inSize size of the compressed data
* @return array of four longs containing metadata address, metadata size, temp storage size,
* and output buffer size
*/
static native long[] lz4DecompressConfigure(long inPtr, long inSize, long stream);

/**
* Perform LZ4 decompression asynchronously using the specified CUDA stream.
* @param inPtr device address of the uncompressed data
* @param inSize size of the uncompressed data in bytes
* @param metadataPtr host address of the metadata
* @param metadataSize size of the metadata in bytes
* @param tempPtr device address of the temporary compression storage buffer
* @param tempSize size of the temporary storage buffer in bytes
* @param outPtr device address of the output buffer
* @param outSize size of the output buffer in bytes
* @param stream CUDA stream to use
*/
static native void lz4DecompressAsync(
long inPtr,
long inSize,
long metadataPtr,
long metadataSize,
long tempPtr,
long tempSize,
long outPtr,
long outSize,
long stream);

/**
* Destroy host-side metadata created by {@link NvcompJni#lz4DecompressConfigure(long, long, long)}
* @param metadataPtr host address of metadata
*/
static native void lz4DestroyMetadata(long metadataPtr);

/**
* Get the temporary workspace size required to perform compression of entire LZ4 batch.
* @param batchSize number of chunks in the batch
Expand Down
Loading

0 comments on commit f359ec7

Please sign in to comment.