Skip to content
Open
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 .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,8 @@ jobs:
file_to_upload: "java/cuvs-java/target/"
sha: ${{ inputs.sha }}
lucene-build:
# Depends on the Java job for the cuvs-java artifact that cuvs-lucene builds against.
# Depends on the Java job for the cuvs-java artifact that cuvs-lucene builds against, and
# reuses its matrix so the two always agree on the set of CUDA versions.
needs: [java-build-matrix, java-build]
permissions:
actions: read
Expand Down
59 changes: 59 additions & 0 deletions .github/workflows/pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,10 @@ jobs:
- rocky8-clib-tests
- conda-java-build-and-tests-matrix
- conda-java-build-and-tests
- conda-java-tests-other-arch-matrix
- conda-java-tests-other-arch
- conda-lucene-build-and-tests
- conda-lucene-tests-other-arch
- rust-build-matrix
- rust-build
- go-build-matrix
Expand Down Expand Up @@ -613,6 +616,39 @@ jobs:
script: "ci/test_java.sh"
artifact-name: "cuvs-java-cuda${{ matrix.CUDA_VER }}"
file_to_upload: "java/cuvs-java/target/"
conda-java-tests-other-arch-matrix:
# All architectures the C++ core builds for, except amd64.
needs: [conda-cpp-build, changed-files]
permissions:
contents: read
uses: rapidsai/shared-workflows/.github/workflows/compute-matrix.yaml@main
if: fromJSON(needs.changed-files.outputs.changed_file_groups).test_java || fromJSON(needs.changed-files.outputs.changed_file_groups).test_cpp
with:
build_type: pull-request
matrix_name: conda-cpp-build
matrix_filter: map(select(.ARCH != "amd64"))
conda-java-tests-other-arch:
# Verifies that the amd64-built cuvs-java jar (jextract-generated Panama bindings and
# all) also works correctly on every non-amd64 architecture, by running its own IT test
# suite against the amd64-built classes without recompiling -- see ci/test_java_prebuilt.sh.
needs: [conda-java-tests-other-arch-matrix, conda-java-build-and-tests]
permissions:
actions: read
contents: read
id-token: write
packages: read
pull-requests: read
secrets: inherit # zizmor: ignore[secrets-inherit]
uses: rapidsai/shared-workflows/.github/workflows/custom-job.yaml@main
strategy:
fail-fast: false
matrix: ${{ fromJSON(needs.conda-java-tests-other-arch-matrix.outputs.matrix) }}
with:
build_type: pull-request
node_type: "gpu-l4-latest-1"
arch: "${{ matrix.ARCH }}"
container_image: "rapidsai/ci-conda:26.10-cuda${{ matrix.CUDA_VER }}-${{ matrix.LINUX_VER }}-py${{ matrix.PY_VER }}"
script: "ci/test_java_prebuilt.sh ${{ matrix.ARCH }} cuvs-java-cuda${{ matrix.CUDA_VER }}"
conda-lucene-build-and-tests:
# Depends on the Java job for the cuvs-java artifact that cuvs-lucene builds against, and
# reuses its matrix so the two always agree on the set of CUDA versions.
Expand All @@ -638,6 +674,29 @@ jobs:
script: "ci/test_lucene.sh cuvs-java-cuda${{ matrix.CUDA_VER }}"
artifact-name: "cuvs-lucene-cuda${{ matrix.CUDA_VER }}"
file_to_upload: "java/cuvs-lucene/target/"
conda-lucene-tests-other-arch:
# Verifies that cuvs-lucene, built against the amd64-built cuvs-java jar, also works
# correctly on every non-amd64 architecture, by running its test suite against the
# amd64-built classes without recompiling -- see ci/test_lucene_prebuilt.sh. Reuses
# conda-java-tests-other-arch-matrix so the two always agree on which architectures to test.
needs: [conda-java-tests-other-arch-matrix, conda-java-build-and-tests, conda-lucene-build-and-tests]
permissions:
actions: read
contents: read
id-token: write
packages: read
pull-requests: read
secrets: inherit # zizmor: ignore[secrets-inherit]
uses: rapidsai/shared-workflows/.github/workflows/custom-job.yaml@main
strategy:
fail-fast: false
matrix: ${{ fromJSON(needs.conda-java-tests-other-arch-matrix.outputs.matrix) }}
with:
build_type: pull-request
node_type: "gpu-l4-latest-1"
arch: "${{ matrix.ARCH }}"
container_image: "rapidsai/ci-conda:26.10-cuda${{ matrix.CUDA_VER }}-${{ matrix.LINUX_VER }}-py${{ matrix.PY_VER }}"
script: "ci/test_lucene_prebuilt.sh ${{ matrix.ARCH }} cuvs-java-cuda${{ matrix.CUDA_VER }} cuvs-lucene-cuda${{ matrix.CUDA_VER }}"
rust-build-matrix:
needs: [conda-cpp-build, changed-files]
permissions:
Expand Down
61 changes: 61 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,41 @@ jobs:
script: "ci/test_java.sh"
artifact-name: "cuvs-java-cuda${{ matrix.CUDA_VER }}"
file_to_upload: "java/cuvs-java/target/"
conda-java-tests-other-arch-matrix:
# All architectures the C++ core builds for, except amd64 -- so a newly added
# architecture is automatically picked up here without a workflow change.
permissions:
contents: read
uses: rapidsai/shared-workflows/.github/workflows/compute-matrix.yaml@main
with:
build_type: ${{ inputs.build_type }}
matrix_name: conda-cpp-build
matrix_filter: map(select(.ARCH != "amd64"))
conda-java-tests-other-arch:
# Verifies that the amd64-built cuvs-java jar (jextract-generated Panama bindings and
# all) also works correctly on every non-amd64 architecture, by running its own IT test
# suite against the amd64-built classes without recompiling -- see ci/test_java_prebuilt.sh.
needs: [conda-java-tests-other-arch-matrix, conda-java-build-and-tests]
permissions:
actions: read
contents: read
id-token: write
packages: read
pull-requests: read
secrets: inherit # zizmor: ignore[secrets-inherit]
uses: rapidsai/shared-workflows/.github/workflows/custom-job.yaml@main
strategy:
fail-fast: false
matrix: ${{ fromJSON(needs.conda-java-tests-other-arch-matrix.outputs.matrix) }}
with:
build_type: ${{ inputs.build_type }}
branch: ${{ inputs.branch }}
date: ${{ inputs.date }}
sha: ${{ inputs.sha }}
node_type: "gpu-l4-latest-1"
arch: "${{ matrix.ARCH }}"
container_image: "rapidsai/ci-conda:26.10-cuda${{ matrix.CUDA_VER }}-${{ matrix.LINUX_VER }}-py${{ matrix.PY_VER }}"
script: "ci/test_java_prebuilt.sh ${{ matrix.ARCH }} cuvs-java-cuda${{ matrix.CUDA_VER }}"
conda-lucene-build-and-tests:
# Depends on the Java job for the cuvs-java artifact that cuvs-lucene builds against, and
# reuses its matrix so the two always agree on the set of CUDA versions.
Expand Down Expand Up @@ -132,6 +167,32 @@ jobs:
script: "ci/test_lucene.sh cuvs-java-cuda${{ matrix.CUDA_VER }}"
artifact-name: "cuvs-lucene-cuda${{ matrix.CUDA_VER }}"
file_to_upload: "java/cuvs-lucene/target/"
conda-lucene-tests-other-arch:
# Verifies that cuvs-lucene, built against the amd64-built cuvs-java jar, also works
# correctly on every non-amd64 architecture, by running its test suite against the
# amd64-built classes without recompiling -- see ci/test_lucene_prebuilt.sh. Reuses
# conda-java-tests-other-arch-matrix so the two always agree on which architectures to test.
needs: [conda-java-tests-other-arch-matrix, conda-java-build-and-tests, conda-lucene-build-and-tests]
permissions:
actions: read
contents: read
id-token: write
packages: read
pull-requests: read
secrets: inherit # zizmor: ignore[secrets-inherit]
uses: rapidsai/shared-workflows/.github/workflows/custom-job.yaml@main
strategy:
fail-fast: false
matrix: ${{ fromJSON(needs.conda-java-tests-other-arch-matrix.outputs.matrix) }}
with:
build_type: ${{ inputs.build_type }}
branch: ${{ inputs.branch }}
date: ${{ inputs.date }}
sha: ${{ inputs.sha }}
node_type: "gpu-l4-latest-1"
arch: "${{ matrix.ARCH }}"
container_image: "rapidsai/ci-conda:26.10-cuda${{ matrix.CUDA_VER }}-${{ matrix.LINUX_VER }}-py${{ matrix.PY_VER }}"
script: "ci/test_lucene_prebuilt.sh ${{ matrix.ARCH }} cuvs-java-cuda${{ matrix.CUDA_VER }} cuvs-lucene-cuda${{ matrix.CUDA_VER }}"
wheel-tests-cuvs:
permissions:
actions: read
Expand Down
83 changes: 83 additions & 0 deletions ci/test_java_prebuilt.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
#!/bin/bash
# SPDX-FileCopyrightText: Copyright (c) 2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0

set -euo pipefail

# Runs cuvs-java's own IT test suite against the classes from a prior amd64 build job,
# without recompiling (or running jextract) on this host. cuvs-java is always built on
# amd64; this verifies that the resulting jextract-generated Panama bindings also work
# correctly against a native libcuvs_c.so on the given (non-amd64) architecture.
#
# Takes the target architecture (as used by the GitHub Actions job matrix, e.g. "arm64")
# and the name of the cuvs-java artifact uploaded by the amd64 Java job.

ARCH="${1:?Usage: $0 <arch> <cuvs-java-artifact-name>}"
CUVS_JAVA_ARTIFACT="${2:?Usage: $0 <arch> <cuvs-java-artifact-name>}"

rapids-logger "Testing the amd64-built cuvs-java artifact on ${ARCH}"

case "${ARCH}" in
amd64) CONDA_ARCH="x86_64" ;;
arm64) CONDA_ARCH="aarch64" ;;
*) CONDA_ARCH="${ARCH}" ;;
esac

if [ -e "/opt/conda/etc/profile.d/conda.sh" ]; then
. /opt/conda/etc/profile.d/conda.sh
fi

rapids-logger "Check GPU usage"
nvidia-smi

rapids-logger "Configuring conda strict channel priority"
conda config --set channel_priority strict

rapids-logger "Downloading artifacts from previous jobs"
CPP_CHANNEL=$(rapids-download-from-github "$(rapids-artifact-name conda_cpp libcuvs cuvs --cuda "$RAPIDS_CUDA_VERSION")")
CUVS_JAVA_DIR=$(rapids-download-from-github "${CUVS_JAVA_ARTIFACT}")

rapids-logger "Generate Java testing dependencies"

ENV_YAML_DIR="$(mktemp -d)"

rapids-dependency-file-generator \
--output conda \
--file-key java \
--prepend-channel "${CPP_CHANNEL}" \
--matrix "cuda=${RAPIDS_CUDA_VERSION%.*};arch=${CONDA_ARCH}" | tee "${ENV_YAML_DIR}/env.yaml"

rapids-mamba-retry env create --yes -f "${ENV_YAML_DIR}/env.yaml" -n java

# Temporarily allow unbound variables for conda activation.
set +u
conda activate java
set -u

rapids-print-env

# libcuvs comes from the conda environment here, matching the architecture this script is
# running on.
export LD_LIBRARY_PATH="${CONDA_PREFIX}/lib${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}"

rapids-logger "Restore the amd64-built target/ directory so Maven can run the tests without recompiling"

rm -rf java/cuvs-java/target
mkdir -p java/cuvs-java/target
cp -a "${CUVS_JAVA_DIR}/." java/cuvs-java/target/

EXITCODE=0
trap "EXITCODE=1" ERR
set +e

rapids-logger "Run cuvs-java IT tests against the amd64-built classes"

# -Dskip.compile activates the pom's "skip-compile" profile, which disables all
# compilation for this run, forcing test to use amd64-compiled jar instead of
# local code.
pushd java/cuvs-java
mvn --batch-mode verify -Dskip.compile=true
popd

rapids-logger "Test script exiting with value: $EXITCODE"
exit ${EXITCODE}
112 changes: 112 additions & 0 deletions ci/test_lucene_prebuilt.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
#!/bin/bash
# SPDX-FileCopyrightText: Copyright (c) 2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0

set -euo pipefail

# Runs cuvs-lucene's test suite against the classes from a prior amd64 build job, without
# recompiling on this host. cuvs-lucene is always built on amd64, against the amd64-built
# cuvs-java jar; this verifies that pairing also works correctly on the given (non-amd64)
# architecture. Since cuvs-lucene depends on the plain (no bundled natives) cuvs-java jar,
# this doubles as a cross-arch check that the jextract-generated Panama bindings baked
# into the amd64 jar work unmodified against a native libcuvs_c.so on that architecture.
#
# Takes the target architecture (as used by the GitHub Actions job matrix, e.g. "arm64")
# and the names of the cuvs-java and cuvs-lucene artifacts uploaded by the amd64 jobs.

ARCH="${1:?Usage: $0 <arch> <cuvs-java-artifact-name> <cuvs-lucene-artifact-name>}"
CUVS_JAVA_ARTIFACT="${2:?Usage: $0 <arch> <cuvs-java-artifact-name> <cuvs-lucene-artifact-name>}"
CUVS_LUCENE_ARTIFACT="${3:?Usage: $0 <arch> <cuvs-java-artifact-name> <cuvs-lucene-artifact-name>}"

rapids-logger "Testing the amd64-built cuvs-java/cuvs-lucene artifacts on ${ARCH}"

case "${ARCH}" in
amd64) CONDA_ARCH="x86_64" ;;
arm64) CONDA_ARCH="aarch64" ;;
*) CONDA_ARCH="${ARCH}" ;;
esac

if [ -e "/opt/conda/etc/profile.d/conda.sh" ]; then
. /opt/conda/etc/profile.d/conda.sh
fi

rapids-logger "Check GPU usage"
nvidia-smi

rapids-logger "Configuring conda strict channel priority"
conda config --set channel_priority strict

rapids-logger "Downloading artifacts from previous jobs"
CPP_CHANNEL=$(rapids-download-from-github "$(rapids-artifact-name conda_cpp libcuvs cuvs --cuda "$RAPIDS_CUDA_VERSION")")
CUVS_JAVA_DIR=$(rapids-download-from-github "${CUVS_JAVA_ARTIFACT}")
CUVS_LUCENE_DIR=$(rapids-download-from-github "${CUVS_LUCENE_ARTIFACT}")

rapids-logger "Generate Java testing dependencies"

ENV_YAML_DIR="$(mktemp -d)"

rapids-dependency-file-generator \
--output conda \
--file-key java \
--prepend-channel "${CPP_CHANNEL}" \
--matrix "cuda=${RAPIDS_CUDA_VERSION%.*};arch=${CONDA_ARCH}" | tee "${ENV_YAML_DIR}/env.yaml"

rapids-mamba-retry env create --yes -f "${ENV_YAML_DIR}/env.yaml" -n java

# Temporarily allow unbound variables for conda activation.
set +u
conda activate java
set -u

rapids-print-env

# libcuvs comes from the conda environment here, matching the architecture this script is
# running on. cuvs-lucene depends on the plain cuvs-java jar, which bundles no native
# libraries, so the JVM resolves libcuvs_c.so through the dynamic loader.
export LD_LIBRARY_PATH="${CONDA_PREFIX}/lib${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}"

rapids-logger "Install the amd64-built cuvs-java artifact into the local Maven repository"

# cuvs-lucene resolves cuvs-java from the local Maven repository. Its pom.xml travels with
# the artifact and supplies the coordinates, so no version needs to be hardcoded.
CUVS_JAVA_POM="${CUVS_JAVA_DIR}/pom.xml"
if [ ! -f "${CUVS_JAVA_POM}" ]; then
echo "Could not find pom.xml in the cuvs-java artifact at ${CUVS_JAVA_DIR}" >&2
exit 1
fi

# The artifact also carries the per-architecture native jar and the sources/javadoc/test jars;
# cuvs-lucene depends on the plain one.
mapfile -t CUVS_JAVA_JARS < <(find "${CUVS_JAVA_DIR}" -maxdepth 1 -name 'cuvs-java-*.jar' \
! -name '*-sources.jar' ! -name '*-javadoc.jar' ! -name '*-tests.jar' ! -name '*-cuda*.jar')
if [ "${#CUVS_JAVA_JARS[@]}" -ne 1 ]; then
echo "Expected exactly one cuvs-java jar in ${CUVS_JAVA_DIR}, found: ${CUVS_JAVA_JARS[*]:-none}" >&2
exit 1
fi

# Install cuvs-java jar into .m2, cd is needed to pick up pom.xml in order to avoid rate limit of main maven repo
pushd java/cuvs-lucene
mvn --batch-mode install:install-file -Dfile="${CUVS_JAVA_JARS[0]}" -DpomFile="${CUVS_JAVA_POM}"
popd

rapids-logger "Restore the amd64-built cuvs-lucene target/ directory so Maven can run the tests without recompiling"

rm -rf java/cuvs-lucene/target
mkdir -p java/cuvs-lucene/target
cp -a "${CUVS_LUCENE_DIR}/." java/cuvs-lucene/target/

EXITCODE=0
trap "EXITCODE=1" ERR
set +e

rapids-logger "Run cuvs-lucene tests against the amd64-built classes"

# -Dskip.compile activates the pom's "skip-compile" profile, which disables all
# compilation for this run, forcing test to use amd64-compiled jar instead of
# local code.
pushd java/cuvs-lucene
mvn --batch-mode test -Dskip.compile=true
popd

rapids-logger "Test script exiting with value: $EXITCODE"
exit ${EXITCODE}
Loading
Loading