-
Notifications
You must be signed in to change notification settings - Fork 257
Expand file tree
/
Copy pathDockerfile.cpu
More file actions
69 lines (57 loc) · 2.52 KB
/
Copy pathDockerfile.cpu
File metadata and controls
69 lines (57 loc) · 2.52 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# syntax=docker/dockerfile:1
##############################################################
# This Dockerfile builds a base image to run Devito on generic CPU
# architectures using GCC compilers and OpenMPI.
##############################################################
# Base image
FROM ubuntu:22.04 AS base
ARG gcc=""
ENV DEBIAN_FRONTEND=noninteractive
# Install python
RUN apt-get update && \
apt-get install -y software-properties-common dh-autoreconf python3-venv python3-dev python3-pip
# Install for basic base not containing it
RUN apt-get install -y wget flex libnuma-dev hwloc curl cmake git \
autoconf libtool build-essential procps software-properties-common \
pkgconf gfortran libopenblas-serial-dev
# Install gcc
RUN if [ -n "$gcc" ]; then \
apt-get install libgmp-dev libmpc-dev libmpfr-dev libisl-dev binutils texinfo -y && \
cd /tmp && mkdir gcc && \
git clone git://gcc.gnu.org/git/gcc.git gcc && \
cd gcc && git checkout releases/gcc-${gcc} && \
mkdir build && cd build && \
../configure --prefix=/opt/gcc-${gcc} --enable-languages=c,c++,fortran --disable-multilib \
--enable-shared --enable-lto --enable-libstdcxx-time=yes --enable-libgomp && \
make -j $(nproc) && make install-strip && \
# Update alternatives
update-alternatives --install /usr/bin/gcc gcc /opt/gcc-${gcc}/bin/gcc 60 && \
update-alternatives --install /usr/bin/g++ g++ /opt/gcc-${gcc}/bin/g++ 60 && \
update-alternatives --install /usr/bin/gfortran gfortran /opt/gcc-${gcc}/bin/gfortran 60 && \
rm -rf /tmp/gcc; \
fi;
ARG OMPI_BRANCH="v5.0.x"
# Install OpenMPI
RUN cd /tmp && mkdir openmpi && \
git clone --depth 1 --recursive --branch ${OMPI_BRANCH} https://github.com/open-mpi/ompi.git openmpi && \
cd openmpi && ./autogen.pl && \
mkdir build && cd build && \
../configure --prefix=/opt/openmpi/ \
--enable-mca-no-build=btl-uct --enable-mpi1-compatibility && \
make -j ${nproc} && \
make install && \
cd /tmp && rm -rf /tmp/openmpi
# Set OpenMPI path
ENV PATH=${PATH}:/opt/openmpi/bin
ENV LD_LIBRARY_PATH=/opt/openmpi/lib
# Cleanup
RUN apt-get clean && apt-get autoclean && apt-get autoremove -y && rm -rf /var/lib/apt/lists/*
EXPOSE 8888
CMD ["/bin/bash"]
##############################################################
# GCC standard image
##############################################################
FROM base AS gcc
# Env vars defaults
ENV DEVITO_ARCH="gcc"
ENV DEVITO_LANGUAGE="openmp"