From 4580566247c29aa6d7275199cee93e0b5cd2323a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Franck=20P=C3=A9rignon?= <franck.perignon@univ-grenoble-alpes.fr> Date: Mon, 16 Sep 2024 18:35:20 +0200 Subject: [PATCH] =?UTF-8?q?[docker-build-cpu-intel-user]=20[docker-build-g?= =?UTF-8?q?pu-nvidia-user]=20-=C2=A0Try=20to=20fix=20docker=20images=20gen?= =?UTF-8?q?=20with=20CI=20(symlink=20loop=3F)=20-=20Use=20pyfft=20from=20m?= =?UTF-8?q?icromamba=20=20(last=20version=20is=20now=20available)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ci/docker_images/ci_user/Dockerfile | 73 +++++++++++------------------ ci/hysopenv.yaml | 1 + 2 files changed, 29 insertions(+), 45 deletions(-) diff --git a/ci/docker_images/ci_user/Dockerfile b/ci/docker_images/ci_user/Dockerfile index 79647cfad..7261525ec 100644 --- a/ci/docker_images/ci_user/Dockerfile +++ b/ci/docker_images/ci_user/Dockerfile @@ -88,60 +88,42 @@ RUN micromamba config prepend channels conda-forge && \ # HPTT # (longest time compilation) ######## FROM hysop-base-python AS hptt - +USER hysop-user +ARG MAMBA_DOCKERFILE_ACTIVATE=1 RUN git clone https://gitlab.com/keckj/hptt.git && \ cd hptt && \ sed -i "s#-mavx##g" CMakeLists.txt && \ sed -i "s#-march=native##g" CMakeLists.txt && \ sed -i "s#-mtune=native##g" CMakeLists.txt RUN cmake -S hptt -B build-hptt -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$CONDA_PREFIX && \ - cmake --build build-hptt -j$(nproc) && \ - cmake --install build-hptt + cmake --build build-hptt -j$(nproc) && \ + cmake --install build-hptt ENV HPTT_ROOT /opt/conda RUN cd hptt/pythonAPI && \ - pip install --no-cache-dir --upgrade . -RUN rm -rf hptt build-hptt + pip install --no-cache-dir --upgrade . && rm -rf hptt build-hptt ######### # FLINT # ######### FROM hysop-base-python AS flint - +ARG MAMBA_DOCKERFILE_ACTIVATE=1 +USER hysop-user # # python flint (FLINT2 + ARB + python-flint) # # flint 3.0.1 version is the last version (16 nov 2023) # (now ARB has been merged into flint 3) # +# Requires gmp and mpfr -> from micromamba env RUN wget -q https://github.com/flintlib/flint/archive/refs/tags/v3.0.1.tar.gz && \ tar -xzf v*.tar.gz && \ rm -f v*.tar.gz && \ mv flint* flint RUN cmake -S flint -B build-flint -DBUILD_SHARED_LIBS=ON -DCMAKE_INSTALL_PREFIX=$CONDA_PREFIX && \ cmake --build build-flint -j$(nproc) && \ - cmake --install build-flint -# RUN rm -rf flint* build-flint - -##################### -# HDF5_mpi and H5PY # -##################### -# NOT USED ! -FROM hysop-base-python AS hdf5_mpi_h5py - -ENV MPICC "mpicc" -ARG pip_install_opts='--upgrade --no-binary=h5py --no-deps --no-build-isolation' -RUN wget -q https://support.hdfgroup.org/ftp/HDF5/releases/hdf5-1.14/hdf5-1.14.3/src/hdf5-1.14.3.tar.gz && \ - tar -xzf hdf5-*.tar.gz && \ - rm -f hdf5-*.tar.gz -RUN cd hdf5-* && \ - CC="${MPICC}" ./configure --prefix=$CONDA_PREFIX --enable-parallel \ - --enable-shared=yes --enable-static=no && \ - make -j$(nproc) && \ - make install -RUN rm -rf hdf5-* && \ - CC="${MPICC}" HDF5_MPI="ON" HDF5_VERSION="1.14.3" \ - HDF5_DIR=$CONDA_PREFIX H5PY_SETUP_REQUIRES=0 \ - pip install ${pip_install_opts} h5py==3.11.0 + cmake --install build-flint && \ + rm -rf flint* build-flint + ########## # Stage # @@ -159,8 +141,7 @@ RUN pip install --no-cache-dir --upgrade \ RUN git clone https://github.com/geggo/gpyfft.git && \ cd gpyfft && \ sed 's#finalize(self, _destroy_plan, self.plan)##' -i gpyfft/gpyfftlib.pyx && \ - pip install --no-cache-dir . -RUN rm -rf gpyfft + pip install --no-cache-dir . && rm -rf gpyfft # # # FFTW latest version nov 2023 @@ -186,12 +167,12 @@ RUN rm -rf gpyfft # pyfftw is linked to fftw3 compiled above #ARG pip_install_opts='--no-binary=pyfftw --no-deps --no-build-isolation' -ARG pip_install_opts='--no-cache-dir --no-binary=pyfftw --no-deps' -RUN git clone https://github.com/pyFFTW/pyFFTW.git && \ - cd pyFFTW && \ -# PYFFTW_INCLUDE="/include" \ - pip install ${pip_install_opts} . -RUN rm -rf pyFFTW +#ARG pip_install_opts='--no-cache-dir --no-binary=pyfftw --no-deps' +#RUN git clone https://github.com/pyFFTW/pyFFTW.git && \ +# cd pyFFTW && \ +## PYFFTW_INCLUDE="/include" \ +# pip install ${pip_install_opts} . && \ +# cd && rm -rf pyFFTW ############### # Final-Stage # @@ -199,13 +180,16 @@ RUN rm -rf pyFFTW FROM hysop-full-python AS hysop-final # Copy only necessary files from previous stages -COPY --from=hptt /opt/conda/lib/libhptt* /opt/conda/lib -COPY --from=hptt /opt/conda/include /opt/conda/include -COPY --from=flint /opt/conda/include/flint /opt/conda/include/flint -COPY --from=flint /opt/conda/lib/libflint* /opt/conda/lib -# Copy only necessary parts of /opt/conda -COPY --from=hptt /opt/conda/lib/python3.12/site-packages/hptt \ - /opt/conda/lib/python3.12/site-packages/hptt +COPY --from=hptt --chown=hysop-user:hysop-user /opt/conda/lib/libhptt.so /opt/conda/lib/ +COPY --from=hptt --chown=hysop-user:hysop-user /opt/conda/include/compute_node.h /opt/conda/include/hptt*.h \ + /opt/conda/include/macros.h /opt/conda/include/plan.h /opt/conda/include/utils.h /opt/conda/include/transpose.h /opt/conda/include/ +COPY --from=hptt --chown=hysop-user:hysop-user /opt/conda/lib/python3.12/site-packages/hptt \ + /opt/conda/lib/python3.12/site-packages/hptt + +COPY --from=flint --chown=hysop-user:hysop-user /opt/conda/include/flint /opt/conda/include/flint +RUN mkdir -p /home/hysop-user/temp/lib +COPY --from=flint --chown=hysop-user:hysop-user /opt/conda/lib/libflint* /home/hysop-user/temp/lib/ +RUN mv /home/hysop-user/temp/lib/libflint* /opt/conda/lib/ && rm -rf /home/hysop-user/temp # Important for f2py command summit in meson build system! ENV MPIFC mpif90 @@ -223,7 +207,6 @@ ENV MPIEXEC_EXECUTABLE="${MPI_HOME}/bin/mpiexec" RUN rm -rf $HOME/.cache/pip/* && \ rm -rf /tmp/* - # ---- cpu image --- FROM hysop-final AS hysop-final-cpu diff --git a/ci/hysopenv.yaml b/ci/hysopenv.yaml index d25247755..3a0aeadfb 100644 --- a/ci/hysopenv.yaml +++ b/ci/hysopenv.yaml @@ -69,6 +69,7 @@ dependencies: - h5py=*=mpi* - fftw=*=mpi* - tox + - pyfftw channels: - numba dependencies: -- GitLab