Skip to content

Commit a393581

Browse files
authored
Enable to build pgvector simultaneously for ARM and Intel (#509)
Signed-off-by: Artem Barger <artemb@plartemb-mac.local>
1 parent 13e3629 commit a393581

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

ann_benchmarks/algorithms/pgvector/Dockerfile

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,20 @@ RUN apt-get update && apt-get install -y --no-install-recommends build-essential
99
RUN /usr/share/postgresql-common/pgdg/apt.postgresql.org.sh -y
1010
RUN apt-get install -y --no-install-recommends postgresql-16 postgresql-server-dev-16
1111
RUN sh -c 'echo "local all all trust" > /etc/postgresql/16/main/pg_hba.conf'
12-
RUN cd /tmp/pgvector && \
13-
make clean && \
14-
make OPTFLAGS="-march=native -mprefer-vector-width=512" && \
15-
make install
12+
13+
# Dynamically set OPTFLAGS based on the architecture
14+
RUN ARCH=$(uname -m) && \
15+
if [ "$ARCH" = "aarch64" ]; then \
16+
OPTFLAGS="-march=native -msve-vector-bits=512"; \
17+
elif [ "$ARCH" = "x86_64" ]; then \
18+
OPTFLAGS="-march=native -mprefer-vector-width=512"; \
19+
else \
20+
OPTFLAGS="-march=native"; \
21+
fi && \
22+
cd /tmp/pgvector && \
23+
make clean && \
24+
make OPTFLAGS="$OPTFLAGS" && \
25+
make install
1626

1727
USER postgres
1828
RUN service postgresql start && \

0 commit comments

Comments
 (0)