This repository has been archived by the owner on Oct 19, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathDockerfile.clang-mpich-dev
95 lines (83 loc) · 3.38 KB
/
Dockerfile.clang-mpich-dev
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
# syntax=docker/dockerfile:experimental
FROM jcsda/docker_base-clang-mpich-dev:__TAG__
LABEL maintainer "Maryam Abdi-Oskouei <[email protected]>"
# additional system packages
RUN apt-get update -y && \
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
libgmp-dev libmpfr-dev libboost-thread-dev && \
rm -rf /var/lib/apt/lists/*
# set environment variables manually
ENV NETCDF=/usr/local \
PNETCDF=/usr/local \
HDF5_ROOT=/usr/local \
PIO=/usr/local \
BOOST_ROOT=/usr/local \
EIGEN3_INCLUDE_DIR=/usr/local \
LAPACK_PATH=/usr/local \
LAPACK_DIR=$LAPACK_PATH \
LAPACK_LIBRARIES="$LAPACK_PATH/lib/liblapack.a;$LAPACK_PATH/lib/libblas.a" \
SERIAL_CC=clang \
SERIAL_CXX=clang++ \
SERIAL_FC=gfortran \
MPI_CC=mpicc \
MPI_CXX=mpicxx \
MPI_FC=mpifort \
PATH=/usr/local/bin:$PATH \
LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH \
LIBRARY_PATH=/usr/local/lib:$LIBRARY_PATH \
CPATH=/usr/local/include:$CPATH \
PYTHONPATH=/usr/local/lib
SHELL ["/bin/bash", "-c"]
# Download public key for github.com
RUN mkdir -p -m 0600 ~/.ssh && \
ssh-keyscan github.com >> ~/.ssh/known_hosts
# set up ssh authentication
RUN git config --global url.ssh://[email protected]/.insteadOf https://github.com/
# build the jedi stack
RUN --mount=type=ssh,id=github_ssh_key cd /root \
&& source /etc/profile \
&& git clone [email protected]:JCSDA-internal/jedi-stack.git \
&& cd jedi-stack/buildscripts \
&& git checkout develop \
&& ./build_stack.sh "container-clang-mpich-dev" \
&& mv ../jedi-stack-contents.log /etc \
&& chmod a+r /etc/jedi-stack-contents.log \
&& cd /root/jedi-stack/pkg/NCEPLIBS-bufr/build/python \
&& python setup.py build \
&& python setup.py install --prefix=/usr/local --install-lib=/usr/local/lib/python3.8/dist-packages\
&& rm -rf /root/jedi-stack \
&& rm -rf /var/lib/apt/lists/* \
&& mkdir /worktmp
# clean up
RUN git config --global --unset url.ssh://[email protected]/.insteadOf \
&& rm -rf /root/.ssh
#Setup the root users environment
ENV FC=mpifort \
CC=mpicc \
CXX=mpicxx
# build h5py and eccodes
RUN CC="mpicc" HDF5_MPI="ON" HDF5_DIR=/usr/local pip install --no-binary=h5py h5py \
&& pip install eccodes
# set time zone
RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install -y tzdata locales && \
ln -fs /usr/share/zoneinfo/America/Denver /etc/localtime && \
locale-gen --purge en_US.UTF-8 && \
dpkg-reconfigure --frontend noninteractive tzdata && \
dpkg-reconfigure --frontend=noninteractive locales && \
update-locale "LANG=en_US.UTF-8" && \
update-locale "LANGUAGE=en_US:en"
#Make a non-root user:jedi / group:jedi for running MPI
RUN useradd -U -k /etc/skel -s /bin/bash -d /home/jedi -m jedi --uid 43891 && \
echo "export FC=mpifort" >> ~jedi/.bashrc && \
echo "export CC=mpicc" >> ~jedi/.bashrc && \
echo "export CXX=mpicxx" >> ~jedi/.bashrc && \
echo "export PYTHONPATH=/usr/local/lib:$PYTHONPATH" >> ~jedi/.bashrc && \
echo "ulimit -s unlimited" >> ~jedi/.bashrc && \
echo "ulimit -v unlimited" >> ~jedi/.bashrc && \
printf "[credential]\n helper = cache --timeout=7200\n" >> ~jedi/.gitconfig && \
mkdir ~jedi/.openmpi && \
echo "rmaps_base_oversubscribe = 1" >> ~jedi/.openmpi/mca-params.conf && \
chown -R jedi:jedi ~jedi/.gitconfig ~jedi/.openmpi
VOLUME /var/lib/docker
CMD ["/bin/bash" , "-l"]