diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index bdd46b298f..325b88dd15 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -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 diff --git a/.github/workflows/pr.yaml b/.github/workflows/pr.yaml index d6f7cd7d7e..dc2b4606d4 100644 --- a/.github/workflows/pr.yaml +++ b/.github/workflows/pr.yaml @@ -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 @@ -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. @@ -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: diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index c2ff71b3a2..bf2f2724af 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -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. @@ -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 diff --git a/ci/test_java_prebuilt.sh b/ci/test_java_prebuilt.sh new file mode 100755 index 0000000000..5f811aa9b5 --- /dev/null +++ b/ci/test_java_prebuilt.sh @@ -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 }" +CUVS_JAVA_ARTIFACT="${2:?Usage: $0 }" + +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} diff --git a/ci/test_lucene_prebuilt.sh b/ci/test_lucene_prebuilt.sh new file mode 100755 index 0000000000..477ff75ad3 --- /dev/null +++ b/ci/test_lucene_prebuilt.sh @@ -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 }" +CUVS_JAVA_ARTIFACT="${2:?Usage: $0 }" +CUVS_LUCENE_ARTIFACT="${3:?Usage: $0 }" + +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} diff --git a/java/cuvs-java/pom.xml b/java/cuvs-java/pom.xml index d4d7708a80..7b4fff9484 100644 --- a/java/cuvs-java/pom.xml +++ b/java/cuvs-java/pom.xml @@ -282,9 +282,46 @@ SPDX-License-Identifier: Apache-2.0 + + + skip-compile + + + skip.compile + + + + + + org.apache.maven.plugins + maven-compiler-plugin + + + default-compile + none + + + compile-java-22 + none + + + default-testCompile + none + + + + + + x86_64-cuda12 + + amd64 + cuda.version 12 @@ -368,6 +405,9 @@ SPDX-License-Identifier: Apache-2.0 x86_64-cuda13 + + amd64 + cuda.version 13 @@ -447,5 +487,177 @@ SPDX-License-Identifier: Apache-2.0 + + + aarch64-cuda12 + + + aarch64 + + + cuda.version + 12 + + + + aarch64-cuda12 + ${native.build.path}/cuda12 + + + + + org.apache.maven.plugins + maven-resources-plugin + 3.3.1 + + + copy-native-libs + prepare-package + + copy-resources + + + true + ${project.build.directory}/native-libs/${os.arch}/${os.name} + + + ${native.lib.path} + + libcuvs.so + libcuvs_c.so + + + + ${native.lib.path}/_deps/rmm-build + + librmm.so + + + + ${native.lib.path}/_deps/rapids_logger-build + + librapids_logger.so + + + + + + + + + org.apache.maven.plugins + maven-assembly-plugin + 3.4.2 + + + src/assembly/native-with-deps.xml + + + + true + true + 12 + + + + + + assemble-native + package + + single + + + + + + + + + + aarch64-cuda13 + + + aarch64 + + + cuda.version + 13 + + + + aarch64-cuda13 + ${native.build.path}/cuda13 + + + + + org.apache.maven.plugins + maven-resources-plugin + 3.3.1 + + + copy-native-libs + prepare-package + + copy-resources + + + true + ${project.build.directory}/native-libs/${os.arch}/${os.name} + + + ${native.lib.path} + + libcuvs.so + libcuvs_c.so + + + + ${native.lib.path}/_deps/rmm-build + + librmm.so + + + + ${native.lib.path}/_deps/rapids_logger-build + + librapids_logger.so + + + + + + + + + org.apache.maven.plugins + maven-assembly-plugin + 3.4.2 + + + src/assembly/native-with-deps.xml + + + + true + true + 13 + + + + + + assemble-native + package + + single + + + + + + + diff --git a/java/cuvs-java/src/main/java/com/nvidia/cuvs/spi/CuVSServiceProvider.java b/java/cuvs-java/src/main/java/com/nvidia/cuvs/spi/CuVSServiceProvider.java index 874f35ee20..b4f16a084c 100644 --- a/java/cuvs-java/src/main/java/com/nvidia/cuvs/spi/CuVSServiceProvider.java +++ b/java/cuvs-java/src/main/java/com/nvidia/cuvs/spi/CuVSServiceProvider.java @@ -39,7 +39,7 @@ static CuVSProvider builtinProvider() { var osArch = System.getProperty("os.arch"); var supportedJavaRuntime = javaRuntimeVersion > 21; var supportedOs = osName.startsWith("Linux"); - var supportedArchitecture = osArch.equals("amd64"); + var supportedArchitecture = osArch.equals("amd64") || osArch.equals("aarch64"); if (supportedJavaRuntime && supportedOs && supportedArchitecture) { try { var cls = Class.forName("com.nvidia.cuvs.spi.JDKProvider"); @@ -63,7 +63,8 @@ static CuVSProvider builtinProvider() { unsupportedReasons.add("cuvs-java supports only Linux, but os.name is " + osName); } if (!supportedArchitecture) { - unsupportedReasons.add("cuvs-java supports only x86-64 (amd64), but os.arch is " + osArch); + unsupportedReasons.add( + "cuvs-java supports only x86-64 (amd64) and arm64 (aarch64), but os.arch is " + osArch); } return new UnsupportedProvider(String.join("; ", unsupportedReasons)); diff --git a/java/cuvs-java/src/test/java/com/nvidia/cuvs/BruteForceAndSearchIT.java b/java/cuvs-java/src/test/java/com/nvidia/cuvs/BruteForceAndSearchIT.java index ab59395dd2..1f28c45950 100644 --- a/java/cuvs-java/src/test/java/com/nvidia/cuvs/BruteForceAndSearchIT.java +++ b/java/cuvs-java/src/test/java/com/nvidia/cuvs/BruteForceAndSearchIT.java @@ -23,7 +23,7 @@ public class BruteForceAndSearchIT extends CuVSTestCase { @Before public void setup() { - assumeTrue("not supported on " + System.getProperty("os.name"), isLinuxAmd64()); + assumeTrue("not supported on " + System.getProperty("os.name"), isLinuxSupportedArch()); CuVSProvider.provider().enableRMMPooledMemory(10, 60); } diff --git a/java/cuvs-java/src/test/java/com/nvidia/cuvs/BruteForceRandomizedIT.java b/java/cuvs-java/src/test/java/com/nvidia/cuvs/BruteForceRandomizedIT.java index 22af6fb4c3..96c10a0936 100644 --- a/java/cuvs-java/src/test/java/com/nvidia/cuvs/BruteForceRandomizedIT.java +++ b/java/cuvs-java/src/test/java/com/nvidia/cuvs/BruteForceRandomizedIT.java @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: Copyright (c) 2025, NVIDIA CORPORATION. + * SPDX-FileCopyrightText: Copyright (c) 2025-2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved. * SPDX-License-Identifier: Apache-2.0 */ package com.nvidia.cuvs; @@ -25,7 +25,7 @@ public class BruteForceRandomizedIT extends CuVSTestCase { @Before public void setup() { - assumeTrue(isLinuxAmd64()); + assumeTrue(isLinuxSupportedArch()); initializeRandom(); log.trace("Random context initialized for test."); CuVSProvider.provider().enableRMMPooledMemory(10, 60); diff --git a/java/cuvs-java/src/test/java/com/nvidia/cuvs/CagraAceBuildAndSearchIT.java b/java/cuvs-java/src/test/java/com/nvidia/cuvs/CagraAceBuildAndSearchIT.java index f762334619..423c58db35 100644 --- a/java/cuvs-java/src/test/java/com/nvidia/cuvs/CagraAceBuildAndSearchIT.java +++ b/java/cuvs-java/src/test/java/com/nvidia/cuvs/CagraAceBuildAndSearchIT.java @@ -36,7 +36,7 @@ public class CagraAceBuildAndSearchIT extends CuVSTestCase { @Before public void setup() { - assumeTrue("not supported on " + System.getProperty("os.name"), isLinuxAmd64()); + assumeTrue("not supported on " + System.getProperty("os.name"), isLinuxSupportedArch()); initializeRandom(); log.trace("Random context initialized for test."); } diff --git a/java/cuvs-java/src/test/java/com/nvidia/cuvs/CagraBuildAndSearchIT.java b/java/cuvs-java/src/test/java/com/nvidia/cuvs/CagraBuildAndSearchIT.java index 500ef451f3..5bcd7a00d0 100644 --- a/java/cuvs-java/src/test/java/com/nvidia/cuvs/CagraBuildAndSearchIT.java +++ b/java/cuvs-java/src/test/java/com/nvidia/cuvs/CagraBuildAndSearchIT.java @@ -47,7 +47,7 @@ public class CagraBuildAndSearchIT extends CuVSTestCase { @Before public void setup() { - assumeTrue("not supported on " + System.getProperty("os.name"), isLinuxAmd64()); + assumeTrue("not supported on " + System.getProperty("os.name"), isLinuxSupportedArch()); initializeRandom(); log.trace("Random context initialized for test."); } diff --git a/java/cuvs-java/src/test/java/com/nvidia/cuvs/CagraMultiThreadStabilityIT.java b/java/cuvs-java/src/test/java/com/nvidia/cuvs/CagraMultiThreadStabilityIT.java index 371e842973..17790eb2fc 100644 --- a/java/cuvs-java/src/test/java/com/nvidia/cuvs/CagraMultiThreadStabilityIT.java +++ b/java/cuvs-java/src/test/java/com/nvidia/cuvs/CagraMultiThreadStabilityIT.java @@ -44,7 +44,7 @@ private interface ResourcesSupplier { @Before public void setup() { - assumeTrue("not supported on " + System.getProperty("os.name"), isLinuxAmd64()); + assumeTrue("not supported on " + System.getProperty("os.name"), isLinuxSupportedArch()); initializeRandom(); log.trace("Multi-threaded stability test initialized"); } diff --git a/java/cuvs-java/src/test/java/com/nvidia/cuvs/CagraRandomizedIT.java b/java/cuvs-java/src/test/java/com/nvidia/cuvs/CagraRandomizedIT.java index 2dcb8b1cd0..9110f6ddc2 100644 --- a/java/cuvs-java/src/test/java/com/nvidia/cuvs/CagraRandomizedIT.java +++ b/java/cuvs-java/src/test/java/com/nvidia/cuvs/CagraRandomizedIT.java @@ -24,7 +24,7 @@ public class CagraRandomizedIT extends CuVSTestCase { @Before public void setup() { - assumeTrue("not supported on " + System.getProperty("os.name"), isLinuxAmd64()); + assumeTrue("not supported on " + System.getProperty("os.name"), isLinuxSupportedArch()); initializeRandom(); log.trace("Random context initialized for test."); } diff --git a/java/cuvs-java/src/test/java/com/nvidia/cuvs/CuVSMatrixIT.java b/java/cuvs-java/src/test/java/com/nvidia/cuvs/CuVSMatrixIT.java index cd3cf43e55..954a7d1e4f 100644 --- a/java/cuvs-java/src/test/java/com/nvidia/cuvs/CuVSMatrixIT.java +++ b/java/cuvs-java/src/test/java/com/nvidia/cuvs/CuVSMatrixIT.java @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: Copyright (c) 2025, NVIDIA CORPORATION. + * SPDX-FileCopyrightText: Copyright (c) 2025-2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved. * SPDX-License-Identifier: Apache-2.0 */ package com.nvidia.cuvs; @@ -25,7 +25,7 @@ public class CuVSMatrixIT extends CuVSTestCase { @Before public void setup() { - assumeTrue("not supported on " + System.getProperty("os.name"), isLinuxAmd64()); + assumeTrue("not supported on " + System.getProperty("os.name"), isLinuxSupportedArch()); initializeRandom(); } diff --git a/java/cuvs-java/src/test/java/com/nvidia/cuvs/CuVSResourcesIT.java b/java/cuvs-java/src/test/java/com/nvidia/cuvs/CuVSResourcesIT.java index 00753b42c4..632eefc6a1 100644 --- a/java/cuvs-java/src/test/java/com/nvidia/cuvs/CuVSResourcesIT.java +++ b/java/cuvs-java/src/test/java/com/nvidia/cuvs/CuVSResourcesIT.java @@ -20,7 +20,7 @@ public class CuVSResourcesIT extends CuVSTestCase { @Before public void setup() { - assumeTrue("not supported on " + System.getProperty("os.name"), isLinuxAmd64()); + assumeTrue("not supported on " + System.getProperty("os.name"), isLinuxSupportedArch()); } @Test diff --git a/java/cuvs-java/src/test/java/com/nvidia/cuvs/CuVSTestCase.java b/java/cuvs-java/src/test/java/com/nvidia/cuvs/CuVSTestCase.java index 62e636eb82..53cbe47392 100644 --- a/java/cuvs-java/src/test/java/com/nvidia/cuvs/CuVSTestCase.java +++ b/java/cuvs-java/src/test/java/com/nvidia/cuvs/CuVSTestCase.java @@ -155,9 +155,10 @@ public boolean equals(Object o) { assertEquals(sortedExpected, sortedActual); } - protected static boolean isLinuxAmd64() { + protected static boolean isLinuxSupportedArch() { String name = System.getProperty("os.name"); - return (name.startsWith("Linux")) && System.getProperty("os.arch").equals("amd64"); + String arch = System.getProperty("os.arch"); + return (name.startsWith("Linux")) && (arch.equals("amd64") || arch.equals("aarch64")); } protected static int[][] createIntMatrix() { diff --git a/java/cuvs-java/src/test/java/com/nvidia/cuvs/FilterBitsetHandleIT.java b/java/cuvs-java/src/test/java/com/nvidia/cuvs/FilterBitsetHandleIT.java index 2abb153207..d7464ca97e 100644 --- a/java/cuvs-java/src/test/java/com/nvidia/cuvs/FilterBitsetHandleIT.java +++ b/java/cuvs-java/src/test/java/com/nvidia/cuvs/FilterBitsetHandleIT.java @@ -52,7 +52,7 @@ public class FilterBitsetHandleIT extends CuVSTestCase { @Before public void setup() { - assumeTrue("not supported on " + System.getProperty("os.name"), isLinuxAmd64()); + assumeTrue("not supported on " + System.getProperty("os.name"), isLinuxSupportedArch()); initializeRandom(); } diff --git a/java/cuvs-java/src/test/java/com/nvidia/cuvs/GPUInfoIT.java b/java/cuvs-java/src/test/java/com/nvidia/cuvs/GPUInfoIT.java index fbfab24518..4b9fc045a3 100644 --- a/java/cuvs-java/src/test/java/com/nvidia/cuvs/GPUInfoIT.java +++ b/java/cuvs-java/src/test/java/com/nvidia/cuvs/GPUInfoIT.java @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: Copyright (c) 2025, NVIDIA CORPORATION. + * SPDX-FileCopyrightText: Copyright (c) 2025-2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved. * SPDX-License-Identifier: Apache-2.0 */ package com.nvidia.cuvs; @@ -19,7 +19,7 @@ public class GPUInfoIT extends CuVSTestCase { @Before public void setup() { - assumeTrue("not supported on " + System.getProperty("os.name"), isLinuxAmd64()); + assumeTrue("not supported on " + System.getProperty("os.name"), isLinuxSupportedArch()); } @Test diff --git a/java/cuvs-java/src/test/java/com/nvidia/cuvs/HnswAceBuildAndSearchIT.java b/java/cuvs-java/src/test/java/com/nvidia/cuvs/HnswAceBuildAndSearchIT.java index 835fcd6e23..351873ce9a 100644 --- a/java/cuvs-java/src/test/java/com/nvidia/cuvs/HnswAceBuildAndSearchIT.java +++ b/java/cuvs-java/src/test/java/com/nvidia/cuvs/HnswAceBuildAndSearchIT.java @@ -40,7 +40,7 @@ public class HnswAceBuildAndSearchIT extends CuVSTestCase { @Before public void setup() { - assumeTrue("not supported on " + System.getProperty("os.name"), isLinuxAmd64()); + assumeTrue("not supported on " + System.getProperty("os.name"), isLinuxSupportedArch()); initializeRandom(); log.trace("Random context initialized for test."); } diff --git a/java/cuvs-java/src/test/java/com/nvidia/cuvs/HnswBuildAndSearchIT.java b/java/cuvs-java/src/test/java/com/nvidia/cuvs/HnswBuildAndSearchIT.java index 7cb4f0c3fa..78f86bd964 100644 --- a/java/cuvs-java/src/test/java/com/nvidia/cuvs/HnswBuildAndSearchIT.java +++ b/java/cuvs-java/src/test/java/com/nvidia/cuvs/HnswBuildAndSearchIT.java @@ -28,7 +28,7 @@ public class HnswBuildAndSearchIT extends CuVSTestCase { @Before public void setup() { - assumeTrue("not supported on " + System.getProperty("os.name"), isLinuxAmd64()); + assumeTrue("not supported on " + System.getProperty("os.name"), isLinuxSupportedArch()); } // Sample data and query diff --git a/java/cuvs-java/src/test/java/com/nvidia/cuvs/HnswRandomizedIT.java b/java/cuvs-java/src/test/java/com/nvidia/cuvs/HnswRandomizedIT.java index fe5ca88073..4ace8fc92e 100644 --- a/java/cuvs-java/src/test/java/com/nvidia/cuvs/HnswRandomizedIT.java +++ b/java/cuvs-java/src/test/java/com/nvidia/cuvs/HnswRandomizedIT.java @@ -28,7 +28,7 @@ public class HnswRandomizedIT extends CuVSTestCase { @Before public void setup() { - assumeTrue("not supported on " + System.getProperty("os.name"), isLinuxAmd64()); + assumeTrue("not supported on " + System.getProperty("os.name"), isLinuxSupportedArch()); initializeRandom(); log.trace("Random context initialized for test."); } diff --git a/java/cuvs-java/src/test/java/com/nvidia/cuvs/MemoryTrackingResourcesIT.java b/java/cuvs-java/src/test/java/com/nvidia/cuvs/MemoryTrackingResourcesIT.java index b80a789025..1d9d40ab27 100644 --- a/java/cuvs-java/src/test/java/com/nvidia/cuvs/MemoryTrackingResourcesIT.java +++ b/java/cuvs-java/src/test/java/com/nvidia/cuvs/MemoryTrackingResourcesIT.java @@ -18,7 +18,7 @@ public class MemoryTrackingResourcesIT extends CuVSTestCase { @Before public void setup() { - assumeTrue("not supported on " + System.getProperty("os.name"), isLinuxAmd64()); + assumeTrue("not supported on " + System.getProperty("os.name"), isLinuxSupportedArch()); } @Test diff --git a/java/cuvs-java/src/test/java/com/nvidia/cuvs/MultiPartitionCagraSearchIT.java b/java/cuvs-java/src/test/java/com/nvidia/cuvs/MultiPartitionCagraSearchIT.java index 62e13b733e..2d1e33484a 100644 --- a/java/cuvs-java/src/test/java/com/nvidia/cuvs/MultiPartitionCagraSearchIT.java +++ b/java/cuvs-java/src/test/java/com/nvidia/cuvs/MultiPartitionCagraSearchIT.java @@ -40,7 +40,7 @@ public class MultiPartitionCagraSearchIT extends CuVSTestCase { @Before public void setup() { - assumeTrue("not supported on " + System.getProperty("os.name"), isLinuxAmd64()); + assumeTrue("not supported on " + System.getProperty("os.name"), isLinuxSupportedArch()); initializeRandom(); log.trace("Random context initialized for test."); } diff --git a/java/cuvs-java/src/test/java/com/nvidia/cuvs/TieredIndexIT.java b/java/cuvs-java/src/test/java/com/nvidia/cuvs/TieredIndexIT.java index 7965ca34b6..6a47e506ca 100644 --- a/java/cuvs-java/src/test/java/com/nvidia/cuvs/TieredIndexIT.java +++ b/java/cuvs-java/src/test/java/com/nvidia/cuvs/TieredIndexIT.java @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: Copyright (c) 2025, NVIDIA CORPORATION. + * SPDX-FileCopyrightText: Copyright (c) 2025-2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved. * SPDX-License-Identifier: Apache-2.0 */ package com.nvidia.cuvs; @@ -31,7 +31,7 @@ public class TieredIndexIT extends CuVSTestCase { @Before public void setup() { - assumeTrue("not supported on " + System.getProperty("os.name"), isLinuxAmd64()); + assumeTrue("not supported on " + System.getProperty("os.name"), isLinuxSupportedArch()); initializeRandom(); CuVSProvider.provider().enableRMMPooledMemory(10, 60); log.debug("Random context initialized for test"); diff --git a/java/cuvs-java/src/test/java/com/nvidia/cuvs/internal/common/UtilIT.java b/java/cuvs-java/src/test/java/com/nvidia/cuvs/internal/common/UtilIT.java index b6a5664831..3bd8d81464 100644 --- a/java/cuvs-java/src/test/java/com/nvidia/cuvs/internal/common/UtilIT.java +++ b/java/cuvs-java/src/test/java/com/nvidia/cuvs/internal/common/UtilIT.java @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: Copyright (c) 2025, NVIDIA CORPORATION. + * SPDX-FileCopyrightText: Copyright (c) 2025-2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved. * SPDX-License-Identifier: Apache-2.0 */ package com.nvidia.cuvs.internal.common; @@ -22,7 +22,7 @@ public class UtilIT extends CuVSTestCase { @Before public void setup() { - assumeTrue("not supported on " + System.getProperty("os.name"), isLinuxAmd64()); + assumeTrue("not supported on " + System.getProperty("os.name"), isLinuxSupportedArch()); } @Test diff --git a/java/cuvs-java/src/test/java/com/nvidia/cuvs/spi/CuVSProviderIT.java b/java/cuvs-java/src/test/java/com/nvidia/cuvs/spi/CuVSProviderIT.java index c40c42204e..076db40553 100644 --- a/java/cuvs-java/src/test/java/com/nvidia/cuvs/spi/CuVSProviderIT.java +++ b/java/cuvs-java/src/test/java/com/nvidia/cuvs/spi/CuVSProviderIT.java @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: Copyright (c) 2025, NVIDIA CORPORATION. + * SPDX-FileCopyrightText: Copyright (c) 2025-2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved. * SPDX-License-Identifier: Apache-2.0 */ package com.nvidia.cuvs.spi; @@ -18,7 +18,7 @@ public class CuVSProviderIT extends CuVSTestCase { @Before public void setup() { - assumeTrue("not supported on " + System.getProperty("os.name"), isLinuxAmd64()); + assumeTrue("not supported on " + System.getProperty("os.name"), isLinuxSupportedArch()); // Clear sysprop from previous runs/command line System.clearProperty("cuvs.max_version"); } diff --git a/java/cuvs-lucene/pom.xml b/java/cuvs-lucene/pom.xml index 48dc6d7889..afa593cdfd 100644 --- a/java/cuvs-lucene/pom.xml +++ b/java/cuvs-lucene/pom.xml @@ -248,4 +248,37 @@ SPDX-License-Identifier: Apache-2.0 + + + + + skip-compile + + + skip.compile + + + + + + org.apache.maven.plugins + maven-compiler-plugin + + + default-compile + none + + + default-testCompile + none + + + + + + + diff --git a/java/panama-bindings/generate-bindings.sh b/java/panama-bindings/generate-bindings.sh index cdefd1ae1c..315b58f89f 100755 --- a/java/panama-bindings/generate-bindings.sh +++ b/java/panama-bindings/generate-bindings.sh @@ -10,7 +10,16 @@ REPODIR=$(cd "$(dirname "$0")"; cd ../../ ; pwd) CURDIR=$(cd "$(dirname "$0")"; pwd) TARGET_PACKAGE="com.nvidia.cuvs.internal.panama" -TARGET_DIR="targets/x86_64-linux/include" +ARCH=$(uname -m) +case "${ARCH}" in + x86_64) CUDA_TARGET_ARCH="x86_64-linux" ;; + aarch64) CUDA_TARGET_ARCH="sbsa-linux" ;; + *) + echo "Unsupported architecture for CUDA include directory lookup: ${ARCH}" + exit 1 + ;; +esac +TARGET_DIR="targets/${CUDA_TARGET_ARCH}/include" if [ -n "${CONDA_PREFIX:-}" ] && [ -d "${CONDA_PREFIX}/${TARGET_DIR}" ]; then CUDA_INCLUDE_DIR="${CONDA_PREFIX}/${TARGET_DIR}" elif [ -d "/usr/local/cuda/${TARGET_DIR}" ]; then @@ -25,7 +34,15 @@ export PATH if [[ $(command -v jextract) == "" ]]; then - JEXTRACT_FILENAME="openjdk-22-jextract+6-47_linux-x64_bin.tar.gz" + case "${ARCH}" in + x86_64) JEXTRACT_ARCH="linux-x64" ;; + aarch64) JEXTRACT_ARCH="linux-aarch64" ;; + *) + echo "Unsupported architecture for jextract download: ${ARCH}" + exit 1 + ;; + esac + JEXTRACT_FILENAME="openjdk-22-jextract+6-47_${JEXTRACT_ARCH}_bin.tar.gz" JEXTRACT_DOWNLOAD_URL="https://download.java.net/java/early_access/jextract/22/6/${JEXTRACT_FILENAME}" echo "jextract doesn't exist. Downloading it from $JEXTRACT_DOWNLOAD_URL."; wget -c $JEXTRACT_DOWNLOAD_URL