From 995766ae53089f89d155d2d9fae5fe358da36ce8 Mon Sep 17 00:00:00 2001 From: Alastair Porter Date: Mon, 26 Jul 2021 15:28:45 +0200 Subject: [PATCH] Upgrade annoy, force a CPU architecture to avoid unavailable extensions On github actions, sometimes we compile on a machine that has avx512 available, but this isn't available on our prod machines. Force something lower. --- Dockerfile | 6 ++++++ requirements.txt | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index e765d76c..6f3a8595 100644 --- a/Dockerfile +++ b/Dockerfile @@ -80,6 +80,12 @@ RUN chown acousticbrainz:acousticbrainz /code # Last version of pip that supports python2 RUN pip install pip==20.3.4 +# By default annoy compiles its C++ code using gcc's -march=native flag. This means that if it compiles +# on a recent Intel machine (e.g. in github actions) it might use extensions that aren't available +# on our production machines (AVX512). Force it to a lower arch that is compatible over all of our +# productions servers (skylake, zen1, zen2) +ENV ANNOY_COMPILER_ARGS=-D_CRT_SECURE_NO_WARNINGS,-DANNOYLIB_MULTITHREADED_BUILD,-march=haswell,-mno-rdrnd,-O3,-ffast-math,-fno-associative-math,-std=c++14 + # Python dependencies RUN mkdir /code/docs/ && chown acousticbrainz:acousticbrainz /code/docs/ COPY --chown=acousticbrainz:acousticbrainz docs/requirements.txt /code/docs/requirements.txt diff --git a/requirements.txt b/requirements.txt index 68d9510a..417a37bf 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,5 @@ git+https://github.com/metabrainz/brainzutils-python.git@v1.18.1 -annoy==1.16.0 +annoy==1.17.0 Flask-Admin==1.5.6 Flask-Login==0.5.0 Flask-SQLAlchemy==2.4.1