-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ae8db65
commit fd7287d
Showing
3 changed files
with
1,099 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
FROM centos:7 | ||
|
||
RUN yum install -y lapack lapack-devel | ||
|
||
# Install necessary build tools | ||
RUN yum install -y gcc-c++ make swig3 | ||
RUN yum install -y java-1.8.0-openjdk java-1.8.0-openjdk-devel maven | ||
|
||
COPY . /opt/JFaiss | ||
WORKDIR /opt/JFaiss/faiss | ||
|
||
# Install faiss | ||
RUN ./configure --prefix=/usr --libdir=/usr/lib64 --without-cuda | ||
RUN make -j $(nproc) | ||
RUN make install | ||
|
||
# Create source files | ||
WORKDIR /opt/JFaiss/jni | ||
RUN make |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
# Copyright (c) Facebook, Inc. and its affiliates. | ||
# | ||
# This source code is licensed under the MIT license found in the | ||
# LICENSE file in the root directory of this source tree. | ||
|
||
-include ../faiss/makefile.inc | ||
|
||
ifneq ($(strip $(NVCC)),) | ||
SWIGFLAGS += -DGPU_WRAPPER | ||
endif | ||
|
||
JAVACFLAGS = -I /usr/lib/jvm/java/include/ -I /usr/lib/jvm/java/include/linux/ | ||
SWIGJAVASRC = ../cpu/src/main/java/com/vectorsearch/faiss/swig | ||
|
||
all: build | ||
|
||
# Also silently generates swigfaiss.py. | ||
swigfaiss.cpp: swigfaiss.swig ../faiss/libfaiss.a | ||
mkdir -p $(SWIGJAVASRC) | ||
$(SWIG) -java -c++ -Doverride= -I../ $(SWIGFLAGS) -package com.vectorsearch.faiss.swig -outdir $(SWIGJAVASRC) -o $@ $< | ||
|
||
swigfaiss_avx2.cpp: swigfaiss.swig ../faiss/libfaiss.a | ||
mkdir -p $(SWIGJAVASRC) | ||
$(SWIG) -java -c++ -Doverride= -module swigfaiss_avx2 -I../ $(SWIGFLAGS) -package com.vectorsearch.faiss.swig -outdir $(SWIGJAVASRC) -o $@ $< | ||
|
||
%.o: %.cpp | ||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) $(CPUFLAGS) $(JAVACFLAGS) \ | ||
-I../ -c $< -o $@ | ||
|
||
# Extension is .so even on OSX. | ||
_%.so: %.o ../faiss/libfaiss.a | ||
$(CXX) $(SHAREDFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS) | ||
|
||
build: _swigfaiss.so | ||
mkdir -p ../cpu/src/main/resources | ||
cp _swigfaiss.so ../cpu/src/main/resources/ | ||
|
||
# install: build | ||
# $(PYTHON) setup.py install | ||
# | ||
|
||
clean: | ||
rm -f swigfaiss*.cpp swigfaiss*.o _swigfaiss*.so | ||
rm -rf $(SWIGJAVASRC) | ||
|
||
|
||
.PHONY: all build install #clean install |
Oops, something went wrong.