Coder Social home page Coder Social logo

jni-faiss's Introduction

jni-faiss

linux only so far

cpu

  • git clone https://github.com/gameofdimension/jni-faiss.git && cd jni-faiss && git submodule update --init

  • docker build -t jni-faiss .

  • docker run -it jni-faiss java -cp cpu-demo/target/cpu-demo-0.0.1.jar com.gameofdimension.faiss.tutorial.OneFlat

gpu

  • git clone https://github.com/gameofdimension/jni-faiss.git && cd jni-faiss && git submodule update --init

  • docker build -t jni-faiss-gpu -f DockerfileGpu .

  • docker run --gpus 1 -it jni-faiss-gpu java -Xmx8g -cp gpu-demo/target/gpu-demo-0.0.1.jar com.gameofdimension.faiss.tutorial.GpuOneFlat

reference

jni-faiss's People

Contributors

gameofdimension avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

jni-faiss's Issues

C++ Source Constructor and Proxy Class Constructor Contradiction

I'm trying to use swig to automatically generate java code from C++ code. there are classes in C++ that have the original constructors (long, boolean), such as RangeSearchResult(Long, boolean)
In macos swig, this conflicts with the proxy classes generated by swig. (Similar to this issue swig/swig#1057)
But in linux swig, there is no such problem. swig automatically converts constructor arguments of this type to (int, boolean).

proxy class:
protected RangeSearchResult(long cPtr, boolean cMemoryOwn)
{
swigCMemOwn = cMemoryOwn;
swigCPtr = cPtr;
}

constructor on macOS:
public final static native long new_RangeSearchResult__SWIG_0(long jarg1, boolean jarg2);
(long, boolean) is the type of the original construct in C++ code, but it conflicts with the proxy class.

constructor on CentOS:
public final static native long new_RangeSearchResult__SWIG_0(int jarg1, boolean jarg2);

I would like to know how to have this effect on MacOS as well.Thanks a lot.

Published to maven central (CPU only)

Hi,

I had been looking for a complete package, something like faiss.jar instead of compiling everything from source, and I wanted to make it available to everyone just by adding as a dependency.

So I thought of bundling everything into a JAR. Hence I took your project, ran Docker image explicitly and took source codes, tweaked a little bit (removed unwanted code), and bundled them along with the .so file as a JAR. The JAR has been published into maven central now (under processing as of 1-Sep-2020).

And I have also published native-utils into a maven central which clearly avoids the need for copy-pasting the same code into every project.

JFaiss repo : https://github.com/RamanRajarathinam/JFaiss-CPU
native-utils : https://github.com/RamanRajarathinam/native-utils

Your comments/feedback are welcome!

MAC OS: Can I get swigfaiss.so?

on mac os:
I use :

  1. swig -c++ -java -package com.dapor.faiss.swig -o swigfaiss.cpp -outdir ./tmp -Doverride= -I../faiss swigfaiss.swig

  2. g++ -std=c++11 -DFINTEGER=int -fPIC -m64 -Wno-sign-compare -g -O3 -Wall -Wextra -msse4 -mpopcnt -I ../faiss/ -I /Library/Java/JavaVirtualMachines/jdk1.8.0_251.jdk/Contents/Home/include/ -I /Library/Java/JavaVirtualMachines/jdk1.8.0_251.jdk/Contents/Home/include/darwin/ -c swigfaiss.cpp -o swigfaiss.so

  3. get swigfaiss.so and copy to demo resource

  4. run. but error:

image

can u help me?
i think the swigfaiss.swig not suit for mac os.. but i dont know how to init it.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.