Commit 5539340f authored by Yeldar Toktasynov's avatar Yeldar Toktasynov

some gpu modification trials

parent e89470d3
FROM python:3.6 FROM meadml/cuda10.1-cudnn7-devel-ubuntu18.04-python3.6
ENV PATH="/root/miniconda3/bin:${PATH}"
ARG PATH="/root/miniconda3/bin:${PATH}"
WORKDIR /app WORKDIR /app
COPY pip_requirements.txt /app RUN apt-get update
RUN pip install -r pip_requirements.txt RUN apt-get install -y wget && rm -rf /var/lib/apt/lists/*
RUN python3 -V
RUN wget \
https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh \
&& mkdir /root/.conda \
&& bash Miniconda3-latest-Linux-x86_64.sh -b \
&& rm -f Miniconda3-latest-Linux-x86_64.sh
RUN conda --version
RUN conda install faiss-gpu cudatoolkit=10.1 -c pytorch # For CUDA10
RUN python3 -V
COPY requirements.txt /app
RUN pip install -r requirements.txt
COPY . /app COPY . /app
......
import time
while(True):
time.sleep(20)
print("Another 20 seconds of your life")
...@@ -11,20 +11,20 @@ xb[:, 0] += np.arange(nb) / 1000. ...@@ -11,20 +11,20 @@ xb[:, 0] += np.arange(nb) / 1000.
xq = np.random.random((nq, d)).astype('float32') xq = np.random.random((nq, d)).astype('float32')
xq[:, 0] += np.arange(nq) / 1000. xq[:, 0] += np.arange(nq) / 1000.
print("HUITAA")
while(True):
time.sleep(20)
res = faiss.StandardGpuResources() # use a single GPU
# build a flat (CPU) index while(True):
index_flat = faiss.IndexFlatL2(d) print("HUITAA")
# make it into a gpu index time.sleep(20)
gpu_index_flat = faiss.index_cpu_to_gpu(res, 0, index_flat) res = faiss.StandardGpuResources() # use a single GPU
# build a flat (CPU) index
# index_flat = faiss.IndexFlatL2(d)
# # make it into a gpu index
# gpu_index_flat = faiss.index_cpu_to_gpu(res, 0, index_flat)
gpu_index_flat.add(xb) # add vectors to the index # gpu_index_flat.add(xb) # add vectors to the index
print(gpu_index_flat.ntotal) # print(gpu_index_flat.ntotal)
k = 4 # we want to see 4 nearest neighbors # k = 4 # we want to see 4 nearest neighbors
D, I = gpu_index_flat.search(xq, k) # actual search # D, I = gpu_index_flat.search(xq, k) # actual search
print(I[:5]) # neighbors of the 5 first queries # print(I[:5]) # neighbors of the 5 first queries
print(I[-5:]) # neighbors of the 5 last queries # print(I[-5:]) # neighbors of the 5 last queries
--extra-index-url http://10.20.4.25:8080/ --trusted-host 10.20.4.25 --index-url http://10.20.4.25:8080/ --trusted-host 10.20.4.25
arase==0.1.7 arase==0.1.7
alem_lemmatizer==0.0.1 alem_lemmatizer==0.0.1
gensim==3.8.3 gensim==3.8.3
sqlalchemy==1.3.20 sqlalchemy==1.3.20
psycopg2==2.8.6 psycopg2==2.8.6
pandas==1.0.5 pandas==1.0.5
faiss_gpu==1.7.2
RUN apt-get update
RUN apt-get -y install python3.6
RUN apt-get -y install python3-pip
FROM plippe/faiss-docker:1.4.0-gpu
faiss_gpu==1.7.2
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment