diff --git a/Dockerfile b/Dockerfile index 5ac5b134af926795fca033d0d56507e95a0ff478..383e51a8b1baa69fde1a8e06ad28edfb7b14f273 100644 --- a/Dockerfile +++ b/Dockerfile @@ -24,7 +24,7 @@ RUN if $GUI; then \ ### Python3 links and pip packages RUN ln -s /usr/bin/python3 /usr/local/bin/python && ln -s /usr/bin/pip3 /usr/local/bin/pip # NumPy version is conflicting with system's gdal dep and may require venv -ARG NUMPY_SPEC="~=1.19" +ARG NUMPY_SPEC="==1.19.*" RUN pip install --no-cache-dir -U pip wheel mock six future deprecated "numpy$NUMPY_SPEC" \ && pip install --no-cache-dir --no-deps keras_applications keras_preprocessing @@ -47,7 +47,7 @@ RUN wget -qO /opt/otbtf/bin/bazelisk https://github.com/bazelbuild/bazelisk/rele && ln -s /opt/otbtf/bin/bazelisk /opt/otbtf/bin/bazel ARG BZL_TARGETS="//tensorflow:libtensorflow_cc.so //tensorflow/tools/pip_package:build_pip_package" -# "--config=opt" will enable 'march=native' (otherwise edit CC_OPT_FLAGS in build-env-tf.sh) +# "--config=opt" will enable 'march=native' (otherwise read comments about CPU compatibilty and edit CC_OPT_FLAGS in build-env-tf.sh) ARG BZL_CONFIGS="--config=nogcp --config=noaws --config=nohdfs --config=opt" # "--compilation_mode opt" is already enabled by default (see tf repo .bazelrc and configure.py) ARG BZL_OPTIONS="--verbose_failures --remote_cache=http://localhost:9090" @@ -97,7 +97,7 @@ RUN git clone --single-branch -b $OTB https://gitlab.orfeo-toolbox.org/orfeotool && if $GUI; then \ sed -i -r "s/-DOTB_USE_(QT|OPENGL|GL[UFE][WT])=OFF/-DOTB_USE_\1=ON/" ../build-flags-otb.txt; fi \ # Possible ENH: superbuild-all-dependencies switch, with separated build-deps-minimal.txt and build-deps-otbcli.txt) - #&& if $OTB_SUPERBUILD_ALL; then sed -i -r "s/-DOTB_USE_SYSTEM_([A-Z0-9]*)=ON/-DOTB_USE_SYSTEM_\1=OFF/"" ../build-flags-otb.txt; fi \ + #&& if $OTB_SUPERBUILD_ALL; then sed -i -r "s/-DUSE_SYSTEM_([A-Z0-9]*)=ON/-DUSE_SYSTEM_\1=OFF/"" ../build-flags-otb.txt; fi \ && OTB_FLAGS=$(cat "../build-flags-otb.txt") \ && cmake ../otb/SuperBuild -DCMAKE_INSTALL_PREFIX=/opt/otbtf $OTB_FLAGS \ && make -j $(python -c "import os; print(round( os.cpu_count() * $CPU_RATIO ))") @@ -132,7 +132,7 @@ RUN for f in /src/otbtf/python/*.py; do if [ -x $f ]; then ln -s $f /opt/otbtf/b # ---------------------------------------------------------------------------- # Final stage FROM otbtf-base -MAINTAINER Remi Cresson <remi.cresson[at]inrae[dot]fr> +LABEL maintainer="Remi Cresson <remi.cresson[at]inrae[dot]fr>" # Copy files from intermediate stage COPY --from=builder /opt/otbtf /opt/otbtf diff --git a/tools/docker/build-env-tf.sh b/tools/docker/build-env-tf.sh index 406b5dd6478cb25588ef3f05b253c0b16e5a558b..1169190dfe7a93cd15403057a0e1239ccb514ec6 100644 --- a/tools/docker/build-env-tf.sh +++ b/tools/docker/build-env-tf.sh @@ -1,6 +1,8 @@ ### TF - bazel build env variables -# As in official TF wheels, you'll need to remove "-march=native" for old CPUs compatibity (no AVX2) +# As in official TF wheels, you'll need to remove "-march=native" to ensure portability (avoid AVX2 / AVX512 compatibility issues) +# You could also add CPUs instructions one by one, in this example to avoid only AVX512 but enable commons optimizations like FMA, SSE4.2 and AVX2 +#export CC_OPT_FLAGS="-Wno-sign-compare --copt=-mavx --copt=-mavx2 --copt=-mfma --copt=-mfpmath=both --copt=-msse4.2" export CC_OPT_FLAGS="-march=native -Wno-sign-compare" export GCC_HOST_COMPILER_PATH=$(which gcc) export PYTHON_BIN_PATH=$(which python)