Skip to content

[Java] Replace the C wrapper layer with the Panama API-based Java implementation#916

Merged
rapids-bot[bot] merged 31 commits intorapidsai:branch-25.08from
SearchScale:vivek/replace-c-layer-with-panama-impl
Jun 5, 2025
Merged

[Java] Replace the C wrapper layer with the Panama API-based Java implementation#916
rapids-bot[bot] merged 31 commits intorapidsai:branch-25.08from
SearchScale:vivek/replace-c-layer-with-panama-impl

Conversation

@narangvivek10
Copy link
Copy Markdown
Contributor

The code changes in this pull request intends to replace the C wrapper layer with the Panama API-based Java implementation.

@copy-pr-bot
Copy link
Copy Markdown

copy-pr-bot Bot commented May 21, 2025

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@github-actions github-actions Bot added the cpp label May 21, 2025
@cjnolet cjnolet moved this to In Progress in Unstructured Data Processing May 21, 2025
@cjnolet cjnolet added improvement Improves an existing functionality non-breaking Introduces a non-breaking change labels May 22, 2025
@github-actions github-actions Bot removed the cpp label May 22, 2025
@narangvivek10 narangvivek10 changed the title [Java API] Replace the C wrapper layer with the Panama API-based Java implementation [Java] Replace the C wrapper layer with the Panama API-based Java implementation May 26, 2025
@chatman
Copy link
Copy Markdown
Contributor

chatman commented May 27, 2025

@cjnolet This is not ready to merge yet, but can you please trigger a CI run once? I want to make sure that the tests are able to find the correct .so file in the CI environment after my latest commit.

@cjnolet
Copy link
Copy Markdown
Member

cjnolet commented May 27, 2025

/ok to test 442a67e

@chatman
Copy link
Copy Markdown
Contributor

chatman commented May 27, 2025

Thanks Corey. There's a failure, perhaps related to jextract?

Error:  Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.13.0:compile (compile-java-22) on project cuvs-java: Compilation failure: Compilation failure: 
Error:  /__w/cuvs/cuvs/java/cuvs-java/src/main/java22/com/nvidia/cuvs/internal/BruteForceIndexImpl.java:[43,1] cannot find symbol
Error:    symbol:   static cudaMemcpy
Error:    location: class com.nvidia.cuvs.internal.panama.PanamaFFMAPI_1
Error:  /__w/cuvs/cuvs/java/cuvs-java/src/main/java22/com/nvidia/cuvs/internal/common/Util.java:[26,1] cannot find symbol
Error:    symbol:   static cudaMemGetInfo
Error:    location: class com.nvidia.cuvs.internal.panama.PanamaFFMAPI_1
Error:  /__w/cuvs/cuvs/java/cuvs-java/src/main/java22/com/nvidia/cuvs/internal/CagraIndexImpl.java:[43,1] cannot find symbol
Error:    symbol:   static cudaMemcpy
Error:    location: class com.nvidia.cuvs.internal.panama.PanamaFFMAPI_1
Error:  /__w/cuvs/cuvs/java/cuvs-java/src/main/java22/com/nvidia/cuvs/internal/common/Util.java:[155,23] cannot find symbol
Error:    symbol:   method cudaMemGetInfo(java.lang.foreign.MemorySegment,java.lang.foreign.MemorySegment)
Error:    location: class com.nvidia.cuvs.internal.common.Util
Error:  /__w/cuvs/cuvs/java/cuvs-java/src/main/java22/com/nvidia/cuvs/internal/BruteForceIndexImpl.java:[165,21] cannot find symbol
Error:    symbol:   method cudaMemcpy(java.lang.foreign.MemorySegment,java.lang.foreign.MemorySegment,long,int)
Error:    location: class com.nvidia.cuvs.internal.BruteForceIndexImpl
Error:  /__w/cuvs/cuvs/java/cuvs-java/src/main/java22/com/nvidia/cuvs/internal/BruteForceIndexImpl.java:[256,21] cannot find symbol
Error:    symbol:   method cudaMemcpy(java.lang.foreign.MemorySegment,java.lang.foreign.MemorySegment,long,int)
Error:    location: class com.nvidia.cuvs.internal.BruteForceIndexImpl
Error:  /__w/cuvs/cuvs/java/cuvs-java/src/main/java22/com/nvidia/cuvs/internal/BruteForceIndexImpl.java:[282,23] cannot find symbol
Error:    symbol:   method cudaMemcpy(java.lang.foreign.MemorySegment,java.lang.foreign.MemorySegment,long,int)
Error:    location: class com.nvidia.cuvs.internal.BruteForceIndexImpl
Error:  /__w/cuvs/cuvs/java/cuvs-java/src/main/java22/com/nvidia/cuvs/internal/BruteForceIndexImpl.java:[301,21] cannot find symbol
Error:    symbol:   method cudaMemcpy(java.lang.foreign.MemorySegment,java.lang.foreign.MemorySegment,long,int)
Error:    location: class com.nvidia.cuvs.internal.BruteForceIndexImpl
Error:  /__w/cuvs/cuvs/java/cuvs-java/src/main/java22/com/nvidia/cuvs/internal/BruteForceIndexImpl.java:[303,21] cannot find symbol
Error:    symbol:   method cudaMemcpy(java.lang.foreign.MemorySegment,java.lang.foreign.MemorySegment,long,int)
Error:    location: class com.nvidia.cuvs.internal.BruteForceIndexImpl
Error:  /__w/cuvs/cuvs/java/cuvs-java/src/main/java22/com/nvidia/cuvs/internal/CagraIndexImpl.java:[253,21] cannot find symbol
Error:    symbol:   method cudaMemcpy(java.lang.foreign.MemorySegment,java.lang.foreign.MemorySegment,long,int)
Error:    location: class com.nvidia.cuvs.internal.CagraIndexImpl
Error:  /__w/cuvs/cuvs/java/cuvs-java/src/main/java22/com/nvidia/cuvs/internal/CagraIndexImpl.java:[280,21] cannot find symbol
Error:    symbol:   method cudaMemcpy(java.lang.foreign.MemorySegment,java.lang.foreign.MemorySegment,long,int)
Error:    location: class com.nvidia.cuvs.internal.CagraIndexImpl
Error:  /__w/cuvs/cuvs/java/cuvs-java/src/main/java22/com/nvidia/cuvs/internal/CagraIndexImpl.java:[282,21] cannot find symbol
Error:    symbol:   method cudaMemcpy(java.lang.foreign.MemorySegment,java.lang.foreign.MemorySegment,long,int)
Error:    location: class com.nvidia.cuvs.internal.CagraIndexImpl
Error:  -> [Help 1]
Error:  
Error:  To see the full stack trace of the errors, re-run Maven with the -e switch.
Error:  Re-run Maven using the -X switch to enable full debug logging.
Error:  
Error:  For more information about the errors and possible solutions, please read the following articles:
Error:  [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException

FYI @narangvivek10

Seems like cudaMemcpy isn't found by jextract. In my local build, the following file contains the cudaMemcpy signatures:

/usr/local/cuda-12.6/targets/x86_64-linux/include/cuda_runtime_api.h

Wondering why it wasn't found on the CI machine?

chatman added a commit to SearchScale/cuvs that referenced this pull request Jun 1, 2025
chatman added a commit to SearchScale/cuvs that referenced this pull request Jun 1, 2025
chatman added a commit to SearchScale/cuvs that referenced this pull request Jun 2, 2025
@mythrocks
Copy link
Copy Markdown
Contributor

/ok to test ff0c7a3

@mythrocks
Copy link
Copy Markdown
Contributor

Given that 25.06 has sailed, we should retarget this to the 25.08 branch.

Comment thread java/cuvs-java/pom.xml
@mythrocks mythrocks changed the base branch from branch-25.06 to branch-25.08 June 3, 2025 22:28
@narangvivek10
Copy link
Copy Markdown
Contributor Author

Remaining conflicts fixed with 410de12

@cjnolet please trigger CI run when you can. Thanks!

@mythrocks
Copy link
Copy Markdown
Contributor

/ok to test 39f92d7

@chatman
Copy link
Copy Markdown
Contributor

chatman commented Jun 4, 2025

The java tests passed, but some Python tests (unrelated to this change) failed. Should we merge this now?

@cjnolet
Copy link
Copy Markdown
Member

cjnolet commented Jun 4, 2025

@chatman as mentioned before, we cannot merge PRs until all checks pass.

@cjnolet
Copy link
Copy Markdown
Member

cjnolet commented Jun 4, 2025

@viclafargue it looks like there are a couple mg test failures. Are you able to look into this?

@cjnolet
Copy link
Copy Markdown
Member

cjnolet commented Jun 4, 2025

/ok to test 2b56f59

@chatman
Copy link
Copy Markdown
Contributor

chatman commented Jun 4, 2025

In the latest run, the following test failed with a segfault:

[       OK ] AnnMGTest/AnnMGTestF_float.AnnMG/4 (633 ms)
[ RUN      ] AnnMGTest/AnnMGTestF_float.AnnMG/5
CMake Error at run_gpu_test.cmake:35 (execute_process):
  execute_process failed command indexes:

    1: "Abnormal exit with child return code: Segmentation fault"

@cjnolet In case this is a flaky test, can we re-run this?

Comment thread java/internal/CMakeLists.txt Outdated
Comment thread java/build.sh Outdated
@cjnolet
Copy link
Copy Markdown
Member

cjnolet commented Jun 5, 2025

/ok to test b104f19

@cjnolet
Copy link
Copy Markdown
Member

cjnolet commented Jun 5, 2025

/merge

@cjnolet cjnolet removed the request for review from msarahan June 5, 2025 01:57
@rapids-bot rapids-bot Bot merged commit b18e199 into rapidsai:branch-25.08 Jun 5, 2025
53 checks passed
@github-project-automation github-project-automation Bot moved this from In Progress to Done in Unstructured Data Processing Jun 5, 2025
bkarsin pushed a commit to bkarsin/cuvs that referenced this pull request Jun 19, 2025
…lementation (rapidsai#916)

The code changes in this pull request intends to replace the C wrapper layer with the Panama API-based Java implementation.

Authors:
  - Vivek Narang (https://github.com/narangvivek10)
  - Ishan Chattopadhyaya (https://github.com/chatman)

Approvers:
  - Corey J. Nolet (https://github.com/cjnolet)
  - Kyle Edwards (https://github.com/KyleFromNVIDIA)

URL: rapidsai#916
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CMake improvement Improves an existing functionality non-breaking Introduces a non-breaking change

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

7 participants