Skip to content

Commit

Permalink
Enable to build pgvector simultaneously for ARM and Intel (#509)
Browse files Browse the repository at this point in the history
Signed-off-by: Artem Barger <artemb@plartemb-mac.local>
  • Loading branch information
C0rWin committed Apr 8, 2024
1 parent 13e3629 commit a393581
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions ann_benchmarks/algorithms/pgvector/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,20 @@ RUN apt-get update && apt-get install -y --no-install-recommends build-essential
RUN /usr/share/postgresql-common/pgdg/apt.postgresql.org.sh -y
RUN apt-get install -y --no-install-recommends postgresql-16 postgresql-server-dev-16
RUN sh -c 'echo "local all all trust" > /etc/postgresql/16/main/pg_hba.conf'
RUN cd /tmp/pgvector && \
make clean && \
make OPTFLAGS="-march=native -mprefer-vector-width=512" && \
make install

# Dynamically set OPTFLAGS based on the architecture
RUN ARCH=$(uname -m) && \
if [ "$ARCH" = "aarch64" ]; then \
OPTFLAGS="-march=native -msve-vector-bits=512"; \
elif [ "$ARCH" = "x86_64" ]; then \
OPTFLAGS="-march=native -mprefer-vector-width=512"; \
else \
OPTFLAGS="-march=native"; \
fi && \
cd /tmp/pgvector && \
make clean && \
make OPTFLAGS="$OPTFLAGS" && \
make install

USER postgres
RUN service postgresql start && \
Expand Down

0 comments on commit a393581

Please sign in to comment.