diff --git a/.gitignore b/.gitignore index e5c25df47..3ec1398e3 100644 --- a/.gitignore +++ b/.gitignore @@ -35,6 +35,7 @@ dump* !singularity/ !Dockerfile !swiftest.def +!environment.yml bin/ build/* diff --git a/Dockerfile b/Dockerfile index 33c82f700..4ac07ec7f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -125,12 +125,12 @@ ENV SHELL="/bin/bash" ENV PATH="/opt/conda/bin:${PATH}" ENV LD_LIBRARY_PATH="/usr/local/lib" -COPY environment.yml . - RUN conda update --all -y && \ conda install conda-libmamba-solver -y && \ - conda config --set solver libmamba && \ - conda env create -f environment.yml && \ + conda config --set solver libmamba + +COPY environment.yml . +RUN conda env create -f environment.yml && \ conda init bash && \ echo "conda activate swiftest-env" >> ~/.bashrc diff --git a/docker/.gitignore b/docker/.gitignore index c876f8c26..5c73deb60 100644 --- a/docker/.gitignore +++ b/docker/.gitignore @@ -4,4 +4,3 @@ !bin !bin/swiftest !bin/swiftest_driver -!Dockerfile.swiftest_driver diff --git a/docker/Dockerfile.swiftest_driver b/docker/Dockerfile.swiftest_driver deleted file mode 100644 index 08480c058..000000000 --- a/docker/Dockerfile.swiftest_driver +++ /dev/null @@ -1,99 +0,0 @@ -# Copyright 2023 - David Minton -# This file is part of Swiftest. -# Swiftest is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. -# Swiftest is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty -# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. -# You should have received a copy of the GNU General Public License along with Swiftest. -# If not, see: https://www.gnu.org/licenses. -# -# This Dockerfile will build the Swiftest driver program with minimal external dependencies using the Intel Oneapi toolkit. -# This is done by building static versions of a minimal set of libraries that NetCDF-Fortran needs (Netcdf-C, HDF5, and Zlib). -# These, along with the Intel runtime libraries, are linked statically to the executable. Only the OS-specific libraries are linked -# dynamically. -FROM intel/oneapi-hpckit:2023.1.0-devel-ubuntu20.04 as build - -ENV INSTALL_DIR="/usr/local" -ENV CC="${ONEAPI_ROOT}/compiler/latest/linux/bin/icx" -ENV FC="${ONEAPI_ROOT}/compiler/latest/linux/bin/ifx" -ENV CXX="${ONEAPI_ROOT}/compiler/latest/linux/bin/icpx" -ENV F77="${FC}" - -# Get the HDF5, NetCDF-C, and NetCDF-Fortran libraries -RUN wget -qO- https://support.hdfgroup.org/ftp/HDF5/releases/hdf5-1.14/hdf5-1.14.1/src/hdf5-1.14.1-2.tar.gz | tar xvz && \ - wget -qO- https://github.com/Unidata/netcdf-c/archive/refs/tags/v4.9.2.tar.gz | tar xvz && \ - wget -qO- https://github.com/Unidata/netcdf-fortran/archive/refs/tags/v4.6.1.tar.gz | tar xvz && \ - wget -qO- https://www.zlib.net/zlib-1.2.13.tar.gz | tar xvz - -RUN apt-get update && \ - DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \ - m4 && \ - rm -rf /var/lib/apt/lists/* - -RUN cd zlib-1.2.13 && \ - ./configure --prefix=${INSTALL_DIR} --static && \ - make && \ - make install - -RUN cd hdf5-1.14.1-2 && \ - ./configure --disable-shared \ - --enable-build-mode=production \ - --disable-fortran \ - --disable-java \ - --disable-cxx \ - --prefix=${INSTALL_DIR} \ - --with-zlib=${INSTALL_DIR} && \ - make && \ - make install - -RUN cd netcdf-c-4.9.2 && \ - ./configure --disable-shared \ - --disable-dap \ - --disable-libxml2 \ - --disable-byterange \ - --prefix=${INSTALL_DIR} && \ - make && \ - make install - -ENV NCDIR="${INSTALL_DIR}" -ENV NFDIR="${INSTALL_DIR}" -ENV HDF5_ROOT="${INSTALL_DIR}" -ENV HDF5_LIBDIR="${HDF5_ROOT}/lib" -ENV HDF5_INCLUDE_DIR="${HDF5_ROOT}/include" -ENV HDF5_PLUGIN_PATH="${HDF5_LIBDIR}/plugin" - -# NetCDF-Fortran library -ENV CFLAGS="-fPIC" -ENV FCFLAGS="${CFLAGS} -standard-semantics" -ENV FFLAGS=${CFLAGS} -ENV CPPFLAGS="-I${INSTALL_DIR}/include" -ENV LIBS="-L/usr/local/lib -L/usr/lib/x86_64-linux-gnu -lnetcdf -lhdf5_hl -lhdf5 -lm -lz" -RUN cd netcdf-fortran-4.6.1 && \ - ./configure --disable-shared --prefix=${NFDIR} && \ - make && \ - make install - -# Swiftest -ENV NETCDF_HOME=${INSTALL_DIR} -ENV NETCDF_FORTRAN_HOME=${NETCDF_HOME} -ENV NETCDF_LIBRARY=${NETCDF_HOME} -ENV FOR_COARRAY_NUM_IMAGES=1 -ENV OMP_NUM_THREADS=1 -ENV FC="${ONEAPI_ROOT}/mpi/latest/bin/mpiifort" -ENV FFLAGS="-fPIC -standard-semantics" -ENV LDFLAGS="-L/usr/local/lib" -ENV LIBS="-lhdf5_hl -lhdf5 -lz" -COPY ./cmake/ /swiftest/cmake/ -COPY ./src/ /swiftest/src/ -COPY ./CMakeLists.txt /swiftest/ -RUN cd swiftest && \ - cmake -S . -B build -DCMAKE_INSTALL_PREFIX="${INSTALL_DIR}" -DMACHINE_CODE_VALUE="sse2" -DUSE_COARRAY=OFF -DCMAKE_BUILD_TYPE=RELEASE -DBUILD_SHARED_LIBS=OFF && \ - cmake --build build && \ - cmake --install build - -# Production container -FROM ubuntu:20.04 - -COPY --from=build /usr/local/bin/swiftest_driver /usr/local/bin/ - -ENTRYPOINT ["/usr/local/bin/swiftest_driver"] \ No newline at end of file diff --git a/environment.yml b/environment.yml new file mode 100644 index 000000000..0e1dbb387 --- /dev/null +++ b/environment.yml @@ -0,0 +1,22 @@ +name: swiftest-env + +channels: + - conda-forge + - defaults + +dependencies: + - numpy + - scipy + - matplotlib + - pandas + - xarray + - h5netcdf + - netcdf4 + - dask + - bottleneck + - astropy + - astroquery + - tqdm + - x264 + - ffmpeg + - conda-build \ No newline at end of file