facebookresearch / faiss

A library for efficient similarity search and clustering of dense vectors.
https://faiss.ai
MIT License
30.48k stars 3.56k forks source link

Java interface of faiss #105

Open zjh-nudger opened 7 years ago

zjh-nudger commented 7 years ago

Hi, I am quite interest on faiss, a large-scale similarity search framework. However, I am not familier with C/C++. I want to know whether faiss can be packaged into Java interface(eg. JNI) for being utilized in Java application.

look forward to you reply. Best regards.

mdouze commented 7 years ago

Hi,

We have no plans for making a Java interface, but Java is supported by SWIG and we welcome pull requests for a Java interface.

zjh-nudger commented 7 years ago

Thanks very much. I try to implement Java interface in few days. I will ask for your help if I encounter some problems. Thanks in advance.

claeyzre commented 7 years ago

Hi,

Any updates on this one @zjh-nudger ?

KelvinNi commented 6 years ago

welcome the java interface, any updates by now @zjh-nudger .

ifeherva commented 6 years ago

I started working on it, but there are some classes with multiple inheritance that need to be solved first.

kumarivin commented 6 years ago

any updates on java implementation ?

seagullyoyo commented 6 years ago

any updates on java interface?

offbye commented 6 years ago

Have u solved it yet?

bvarghese1 commented 5 years ago

@zjh-nudger @ifeherva Let me know if I can be of any help.

batteryhp commented 5 years ago

Hi,

Any updates on this one @zjh-nudger ?

jiangshengwu commented 5 years ago

@mdouze

Hi, what about java jni api? Our tentative implement is about to working on the production env.

dexception commented 5 years ago

++1 on Java Interface.

dkulagin commented 5 years ago

Heavy plus on Java interface. It would be a wonderful bridge to have.

ashuezy commented 5 years ago

Java wrapper is better than python because of better MultiThreading support in Java.

I am sure the TPS would be way way better in Java.

beauby commented 5 years ago

To clarify the situation: there is no plan on our end to make Java wrappers for Faiss, so it would have to be a community effort.

ashuezy commented 5 years ago

@beauby Can you tell me the exact swig interface file used for python so that i can start working on for java interface ?

beauby commented 5 years ago

@ashuezy https://github.com/facebookresearch/faiss/blob/master/python/swigfaiss.swig

ssephillip commented 5 years ago

Any progress on this @ashuezy ?

youny626 commented 4 years ago

Hey guys, we have built upon FAISS a distributed large-scale similarity search engine called Milvus, where you can use Java SDK. Check it out at https://github.com/milvus-io/milvus-sdk-java if you are interested! :wink:

gameofdimension commented 4 years ago

a java interface, hope it help

https://github.com/gameofdimension/jni-faiss.git

raman-r-4978 commented 4 years ago

Hey guys,

I have tweaked a bit on @gameofdimension's work and created a JAR which contains src files and native .so lib. So far, it works only on Linux based systems and doesn't have support for GPU.

Project URL: https://github.com/RamanRajarathinam/JFaiss-CPU

Feedback is welcome!

mullerhai commented 1 year ago

I think use JavaCpp tools maybe could solve generate java api

scott01272001 commented 7 months ago

Hello, I've build a simple Faiss Java API using JavaCPP, but I've encountered an issue: the memory overhead is higher compared to C++. I think this is due to JavaCPP requires copying vectors from the Java heap to non-heap memory, resulting in duplicate vectors simultaneously occupying memory, any advice is appreciated.

https://github.com/scott01272001/faiss-java

welcome fork

sourcesync commented 7 months ago

Hi @scott01272001. I'll check out your repo at some point soon...but I'm wondering if you've tried 1) pass by reference and 2) BytePointer/ByteBuffer instead byte arrays. I'll move this conversation to your repo...

scott01272001 commented 7 months ago

Hi @sourcesync , thanks for your seggustion, currently I'm warpping the float array into a float pointer and passing it to the native function, is this how you mentioned "BytePointer/ByteBuffer instead of ByteArray"?

I tried using @CriticalRegion annotation on the method that needs to pass the array as parameter, It looks like the memory usage has been reduced, but as I know, using 'Get/ReleasePrimitiveArrayCritical' will freeze the GC. Are there any potential risks if I use this way?

thanks for your time

ashwini-mnnit commented 1 month ago

@sourcesync @scott01272001 , Any update on the Java interface for ?