Skip to content

Commit 6452aa8

Browse files
committed
Merge remote-tracking branch 'origin/release/26.04' into valid_if-to-bools_to_mask
2 parents 505b3b6 + 995224e commit 6452aa8

34 files changed

+1104
-572
lines changed

.gitmodules

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
[submodule "thirdparty/cudf"]
22
path = thirdparty/cudf
33
url = https://github.com/rapidsai/cudf.git
4-
branch = main
4+
branch = release/26.04

build/Dockerfile.devel

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
#
2+
# Copyright (c) 2026, NVIDIA CORPORATION. All rights reserved.
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
#
16+
17+
###
18+
# Build the image for spark-rapids-jni local development environment.
19+
20+
# Inherit from the CICD docker image
21+
ARG JNI_DOCKER_CICD_IMAGE
22+
FROM ${JNI_DOCKER_CICD_IMAGE}
23+
24+
# Validate the CICD docker image is set
25+
ARG JNI_DOCKER_CICD_IMAGE
26+
RUN if [ -z "$JNI_DOCKER_CICD_IMAGE" ]; then \
27+
echo "Error: JNI_DOCKER_CICD_IMAGE is not set"; exit 1; \
28+
fi
29+
30+
# Enable the gcc-toolset by default for bash shell
31+
RUN echo "source scl_source enable gcc-toolset-${TOOLSET_VERSION}" >> /etc/bashrc
32+
33+
# Execute every time a new non-interactive bash shell is started
34+
ENV BASH_ENV=/etc/bashrc
35+
36+
### Remove the old version of git
37+
RUN rpm -e --nodeps git-core git || true
38+
39+
# Install a newer version of git to support worktree feature
40+
ARG GIT_VERSION=2.53.0
41+
ARG PARALLEL_LEVEL
42+
43+
# Install the dependencies for building git
44+
RUN dnf install -y libcurl-devel openssl-devel pcre2-devel && dnf clean all
45+
46+
RUN mkdir -p /tmp/git-src && cd /tmp/git-src && \
47+
wget -O "git-${GIT_VERSION}.tar.xz" "https://www.kernel.org/pub/software/scm/git/git-${GIT_VERSION}.tar.xz" && \
48+
tar -xf "git-${GIT_VERSION}.tar.xz" && \
49+
cd "git-${GIT_VERSION}" && \
50+
scl enable gcc-toolset-${TOOLSET_VERSION} -- bash -c " \
51+
./configure \
52+
--prefix=/usr \
53+
--with-libpcre2 \
54+
--with-openssl \
55+
--with-curl && \
56+
make -j\"${PARALLEL_LEVEL:-\$(nproc)}\" all && \
57+
make install" && \
58+
cd / && rm -rf /tmp/git-src
59+

build/run-in-docker

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,10 @@ GIT_COMMON_DIR_REL=$(git rev-parse --git-common-dir)
3333
GIT_COMMON_DIR=$(realpath "$GIT_COMMON_DIR_REL")
3434
WORKDIR=${WORKDIR:-$REPODIR}
3535
TZ=${TZ:-UTC}
36+
PARALLEL_LEVEL=${PARALLEL_LEVEL:-$(nproc)}
3637

3738
CUDA_VERSION=${CUDA_VERSION:-12.9.1}
39+
OS_RELEASE=${OS_RELEASE:-8}
3840
DOCKER_CMD=${DOCKER_CMD:-docker}
3941
DOCKER_BUILD_EXTRA_ARGS=${DOCKER_BUILD_EXTRA_ARGS:-""}
4042
if [ "$(uname -m)" == "aarch64" ]; then
@@ -46,23 +48,31 @@ DOCKER_RUN_EXTRA_ARGS=${DOCKER_RUN_EXTRA_ARGS:-""}
4648
LOCAL_CCACHE_DIR=${LOCAL_CCACHE_DIR:-"$HOME/.ccache"}
4749
LOCAL_MAVEN_REPO=${LOCAL_MAVEN_REPO:-"$HOME/.m2/repository"}
4850

49-
if [ "$JNI_DOCKER_DEV_BUILD" == "ON" ]; then
50-
echo "Building docker image for local development, gcc-toolset is enabled by default..."
51-
JNI_DOCKER_IMAGE="spark-rapids-jni-build:${CUDA_VERSION}-devel-rockylinux8"
52-
else
53-
echo "Building docker image for production, gcc-toolset is NOT enabled by default..."
54-
JNI_DOCKER_IMAGE="spark-rapids-jni-build:${CUDA_VERSION}-rockylinux8"
55-
fi
56-
5751
# ensure directories exist
5852
mkdir -p "$LOCAL_CCACHE_DIR" "$LOCAL_MAVEN_REPO"
5953

54+
echo "Building docker image for CICD environment..."
55+
JNI_DOCKER_CICD_IMAGE="spark-rapids-jni-build:${CUDA_VERSION}-rockylinux${OS_RELEASE}"
6056
$DOCKER_CMD build $DOCKER_BUILD_EXTRA_ARGS -f $REPODIR/ci/Dockerfile \
6157
--build-arg CUDA_VERSION=$CUDA_VERSION \
62-
--build-arg DEV_BUILD=$JNI_DOCKER_DEV_BUILD \
63-
-t $JNI_DOCKER_IMAGE \
58+
--build-arg OS_RELEASE=$OS_RELEASE \
59+
--build-arg PARALLEL_LEVEL=$PARALLEL_LEVEL \
60+
-t $JNI_DOCKER_CICD_IMAGE \
6461
$REPODIR/build
6562

63+
if [ "$JNI_DOCKER_DEV_BUILD" == "ON" ]; then
64+
echo "Building docker image for local development, in which gcc-toolset is enabled by default..."
65+
JNI_DOCKER_DEV_IMAGE=${JNI_DOCKER_CICD_IMAGE}-devel
66+
$DOCKER_CMD build -f $REPODIR/build/Dockerfile.devel \
67+
--build-arg JNI_DOCKER_CICD_IMAGE=$JNI_DOCKER_CICD_IMAGE \
68+
--build-arg PARALLEL_LEVEL=$PARALLEL_LEVEL \
69+
-t $JNI_DOCKER_DEV_IMAGE \
70+
$REPODIR/build
71+
JNI_DOCKER_IMAGE=$JNI_DOCKER_DEV_IMAGE
72+
else
73+
JNI_DOCKER_IMAGE=$JNI_DOCKER_CICD_IMAGE
74+
fi
75+
6676
if [[ "$DOCKER_CMD" == "docker" ]]; then
6777
DOCKER_GPU_OPTS=${DOCKER_GPU_OPTS:-"--gpus all"}
6878
fi

ci/Dockerfile

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
#
1616

1717
###
18-
# Build the image for spark-rapids-jni development environment.
18+
# Build the image for spark-rapids-jni CICD environment.
1919
#
2020
# Arguments: CUDA_VERSION=[12.X.Y], OS_RELEASE=[8, 9], TARGETPLATFORM=[linux/amd64, linux/arm64]
2121
#
@@ -28,15 +28,15 @@ ARG TARGETPLATFORM=linux/amd64
2828
# check available official arm-based docker images at https://hub.docker.com/r/nvidia/cuda/tags (OS/ARCH)
2929
FROM --platform=$TARGETPLATFORM nvidia/cuda:$CUDA_VERSION-devel-rockylinux$OS_RELEASE
3030

31-
# If DEV_BUILD is ON, the gcc-toolset will be enabled by default for bash shell
32-
ARG DEV_BUILD=OFF
33-
3431
# Dependency versions
3532
# Act as default GCC toolset in the image
3633
ARG TOOLSET_VERSION=14
3734
ARG CMAKE_VERSION=3.30.4
3835
ARG CCACHE_VERSION=4.11.2
3936

37+
# Make it available at runtime and to the inherited images (e.g. Dockerfile.devel)
38+
ENV TOOLSET_VERSION=${TOOLSET_VERSION}
39+
4040
# Default x86_64 from x86 build, aarch64 cmake for arm build
4141
ARG CMAKE_ARCH=x86_64
4242

@@ -47,11 +47,6 @@ RUN dnf --enablerepo=powertools install -y scl-utils gcc-toolset-11 gcc-toolset-
4747
alternatives --set python /usr/bin/python3 && \
4848
python -m pip install requests 'urllib3<2.0'
4949

50-
# Enable the gcc-toolset by default for bash shell if DEV_BUILD is ON
51-
RUN if [ "$DEV_BUILD" = "ON" ]; then \
52-
echo "source scl_source enable gcc-toolset-${TOOLSET_VERSION}" >> /etc/bashrc; \
53-
fi
54-
5550
# Execute every time a new non-interactive bash shell is started
5651
ENV BASH_ENV=/etc/bashrc
5752

@@ -66,6 +61,7 @@ RUN cd /usr/local && wget --quiet https://github.com/Kitware/CMake/releases/down
6661
RUN ln -s /usr/local/cmake-${CMAKE_VERSION}-linux-${CMAKE_ARCH}/bin/cmake /usr/local/bin/cmake
6762

6863
# ccache for interactive builds
64+
ARG PARALLEL_LEVEL
6965
RUN cd /tmp && wget --quiet https://github.com/ccache/ccache/releases/download/v${CCACHE_VERSION}/ccache-${CCACHE_VERSION}.tar.gz && \
7066
tar zxf ccache-${CCACHE_VERSION}.tar.gz && \
7167
rm ccache-${CCACHE_VERSION}.tar.gz && \

src/main/cpp/benchmarks/bloom_filter.cu

Lines changed: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2023-2024, NVIDIA CORPORATION.
2+
* Copyright (c) 2023-2026, NVIDIA CORPORATION.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -22,17 +22,18 @@
2222
#include <hash/hash.hpp>
2323
#include <nvbench/nvbench.cuh>
2424

25-
static void bloom_filter_put(nvbench::state& state)
25+
namespace {
26+
27+
void bloom_filter_put_impl(nvbench::state& state, int version)
2628
{
2729
constexpr int num_rows = 150'000'000;
2830
constexpr int num_hashes = 3;
2931

30-
// create the bloom filter
3132
cudf::size_type const bloom_filter_bytes = state.get_int64("bloom_filter_bytes");
3233
cudf::size_type const bloom_filter_longs = bloom_filter_bytes / sizeof(int64_t);
33-
auto bloom_filter = spark_rapids_jni::bloom_filter_create(num_hashes, bloom_filter_longs);
34+
auto bloom_filter =
35+
spark_rapids_jni::bloom_filter_create(version, num_hashes, bloom_filter_longs);
3436

35-
// create a column of hashed values
3637
data_profile_builder builder;
3738
builder.no_validity();
3839
auto const src = create_random_table({{cudf::type_id::INT64}}, row_count{num_rows}, builder);
@@ -41,7 +42,7 @@ static void bloom_filter_put(nvbench::state& state)
4142
auto const stream = cudf::get_default_stream();
4243
state.set_cuda_stream(nvbench::make_cuda_stream_view(stream.value()));
4344
state.exec(nvbench::exec_tag::timer | nvbench::exec_tag::sync,
44-
[&](nvbench::launch& launch, auto& timer) {
45+
[&](nvbench::launch&, auto& timer) {
4546
timer.start();
4647
spark_rapids_jni::bloom_filter_put(*bloom_filter, *input);
4748
stream.synchronize();
@@ -57,7 +58,24 @@ static void bloom_filter_put(nvbench::state& state)
5758
state.add_element_count(static_cast<double>(bytes_written) / time, "Write bytes/sec");
5859
}
5960

60-
NVBENCH_BENCH(bloom_filter_put)
61-
.set_name("Bloom Filter Put")
61+
void bloom_filter_put_v1(nvbench::state& state)
62+
{
63+
bloom_filter_put_impl(state, spark_rapids_jni::bloom_filter_version_1);
64+
}
65+
66+
void bloom_filter_put_v2(nvbench::state& state)
67+
{
68+
bloom_filter_put_impl(state, spark_rapids_jni::bloom_filter_version_2);
69+
}
70+
71+
} // namespace
72+
73+
NVBENCH_BENCH(bloom_filter_put_v1)
74+
.set_name("Bloom Filter Put V1")
75+
.add_int64_axis("bloom_filter_bytes",
76+
{512 * 1024, 1024 * 1024, 2 * 1024 * 1024, 4 * 1024 * 1024, 8 * 1024 * 1024});
77+
78+
NVBENCH_BENCH(bloom_filter_put_v2)
79+
.set_name("Bloom Filter Put V2")
6280
.add_int64_axis("bloom_filter_bytes",
6381
{512 * 1024, 1024 * 1024, 2 * 1024 * 1024, 4 * 1024 * 1024, 8 * 1024 * 1024});

src/main/cpp/src/BloomFilterJni.cpp

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2023-2025, NVIDIA CORPORATION.
2+
* Copyright (c) 2023-2026, NVIDIA CORPORATION.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -20,17 +20,33 @@
2020
#include "jni_utils.hpp"
2121
#include "utilities.hpp"
2222

23+
#include <limits>
24+
2325
extern "C" {
2426

2527
JNIEXPORT jlong JNICALL Java_com_nvidia_spark_rapids_jni_BloomFilter_creategpu(
26-
JNIEnv* env, jclass, jint numHashes, jlong bloomFilterBits)
28+
JNIEnv* env, jclass, jint version, jint numHashes, jlong bloomFilterBits, jint seed)
2729
{
2830
JNI_TRY
2931
{
3032
cudf::jni::auto_set_device(env);
3133

32-
int bloom_filter_longs = static_cast<int>((bloomFilterBits + 63) / 64);
33-
auto bloom_filter = spark_rapids_jni::bloom_filter_create(numHashes, bloom_filter_longs);
34+
// Per the Spark implementation, according to the BitArray class,
35+
// https://github.com/apache/spark/blob/5075ea6a85f3f1689766cf08a7d5b2ce500be1fb/common/sketch/src/main/java/org/apache/spark/util/sketch/BitArray.java#L34
36+
// the number of longs representing the bit array can only be Integer.MAX_VALUE, at the most.
37+
// (This is presumably because the BitArray is indexed with an int32_t.)
38+
// This implies that the maximum supported bloom filter bit count is Integer.MAX_VALUE * 64.
39+
40+
JNI_ARG_CHECK(
41+
env,
42+
bloomFilterBits > 0 &&
43+
bloomFilterBits <= static_cast<int64_t>(std::numeric_limits<int32_t>::max()) * 64,
44+
"bloom filter bit count must be positive and less than or equal to the maximum supported "
45+
"size",
46+
0);
47+
auto const bloom_filter_longs = static_cast<int32_t>((bloomFilterBits + 63) / 64);
48+
auto bloom_filter =
49+
spark_rapids_jni::bloom_filter_create(version, numHashes, bloom_filter_longs, seed);
3450
return reinterpret_cast<jlong>(bloom_filter.release());
3551
}
3652
JNI_CATCH(env, 0);

0 commit comments

Comments
 (0)