forked from parflow/parflow
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile_CUDA
149 lines (132 loc) · 4.9 KB
/
Dockerfile_CUDA
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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
#Dockerfile for ParFlow GPU version
### IMPORTANT NOTES FOR GPU CONTAINER USAGE ###
# Prerequisites:
# -NVIDIA drivers, GPU with CUDA compute capability >=6.0, and "nvidia-container-toolkit" package
# -The container must be created with "--gpus all" flag, ie, "docker run -it --gpus all image_hash"
#-----------------------------------------------------------------------------
# Start by building the basic CUDA container
#-----------------------------------------------------------------------------
FROM nvidia/cuda:10.2-devel-ubuntu18.04
MAINTAINER Jaro Hokkanen <[email protected]>
#-----------------------------------------------------------------------------
# Set environment vars
#-----------------------------------------------------------------------------
ENV DEBIAN_FRONTEND noninteractive
ENV CMAKE_DIR /home/parflow/cmake-3.14.0-Linux-x86_64
ENV CUDA_HOME /usr/local/cuda
ENV PARFLOW_DIR /usr/local
ENV LD_LIBRARY_PATH $PARFLOW_DIR/openmpi-cuda/lib:$LD_LIBRARY_PATH
ENV PATH $CMAKE_DIR/bin:$PARFLOW_DIR/openmpi-cuda/bin:$PARFLOW_DIR/bin:$PATH
#-----------------------------------------------------------------------------
# Package dependencies
#-----------------------------------------------------------------------------
RUN apt-get update && \
apt-get install -y \
autoconf \
automake \
curl \
gcc \
g++ \
gfortran \
git \
hdf5-helpers \
libhdf5-openmpi-100 \
libhdf5-openmpi-dev \
libtool \
m4 \
make \
tcl-dev \
tk-dev \
wget && mkdir -p /home/parflow
#-----------------------------------------------------------------------------
# Install CMake
#-----------------------------------------------------------------------------
WORKDIR /home/parflow
RUN wget -nv --no-check-certificate http://cmake.org/files/v3.14/cmake-3.14.0-Linux-x86_64.tar.gz && \
tar -xvf cmake-3.14.0-Linux-x86_64.tar.gz && \
rm -fr cmake-3.14.0-Linux-x86_64.tar.gz
#-----------------------------------------------------------------------------
# Install UCX and OpenMPI
#-----------------------------------------------------------------------------
WORKDIR /home/parflow
RUN wget https://github.com/openucx/ucx/releases/download/v1.8.0-rc1/ucx-1.8.0.tar.gz && \
tar -xvf ucx-1.8.0.tar.gz && \
cd ucx-1.8.0 && \
./contrib/configure-release --prefix=$PARFLOW_DIR/ucx-cuda --with-cuda=$CUDA_HOME --with-java=no --disable-numa && \
make -j8 install && \
cd .. && \
rm -fr ucx-1.8.0 ucx-1.8.0.tar.gz
WORKDIR /home/parflow
RUN wget https://download.open-mpi.org/release/open-mpi/v4.0/openmpi-4.0.3.tar.gz && \
tar -xvf openmpi-4.0.3.tar.gz && \
cd openmpi-4.0.3 && \
./configure --prefix=$PARFLOW_DIR/openmpi-cuda --with-cuda=$CUDA_HOME --with-ucx=$PARFLOW_DIR/ucx-cuda && \
make -j8 install && \
ldconfig && \
cd .. && \
rm -fr openmpi-4.0.3 openmpi-4.0.3.tar.gz
#-----------------------------------------------------------------------------
# Build libraries
#-----------------------------------------------------------------------------
#
# SILO
#
WORKDIR /home/parflow
RUN wget -q https://github.com/LLNL/Silo/archive/refs/tags/4.10.2.tar.gz && \
tar -xf 4.10.2.tar.gz && \
cd Silo-4.10.2 && \
./configure --prefix=$PARFLOW_DIR --disable-silex --disable-hzip --disable-fpzip && \
make install && \
cd .. && \
rm -fr Silo-4.10.2 4.10.2.tar.gz
#
# Hypre
#
WORKDIR /home/parflow
RUN wget -q https://github.com/hypre-space/hypre/archive/v2.18.2.tar.gz && \
tar -xvf v2.18.2.tar.gz && \
cd hypre-2.18.2/src && \
./configure --prefix=$PARFLOW_DIR && \
make install && \
cd ../.. && \
rm -fr hypre-2.18.2 v2.18.2.tar.gz
#
# RMM
#
WORKDIR /home/parflow
RUN git clone -b branch-0.10 --single-branch --recurse-submodules https://github.com/rapidsai/rmm.git && \
cd rmm && \
cmake . -DCMAKE_INSTALL_PREFIX=$PARFLOW_DIR && \
make -j && \
make install && \
cd .. && \
rm -fr rmm
#-----------------------------------------------------------------------------
# Parflow configure and build
#-----------------------------------------------------------------------------
ENV UCX_MEMTYPE_CACHE n
ENV OMPI_ALLOW_RUN_AS_ROOT 1
ENV OMPI_ALLOW_RUN_AS_ROOT_CONFIRM 1
ENV OMPI_MCA_rmaps_base_oversubscribe 1
WORKDIR /home/parflow
RUN git clone -b master --single-branch https://github.com/parflow/parflow.git parflow
RUN mkdir -p build && \
cd build && \
CC=mpicc CXX=mpicxx FC=mpif90 && \
cmake ../parflow \
-DCMAKE_C_FLAGS=-lcuda \
-DPARFLOW_AMPS_LAYER=mpi1 \
-DPARFLOW_AMPS_SEQUENTIAL_IO=TRUE \
-DHYPRE_ROOT=$PARFLOW_DIR \
-DSILO_ROOT=$PARFLOW_DIR \
-DPARFLOW_ENABLE_HDF5=TRUE \
-DPARFLOW_ENABLE_TIMING=TRUE \
-DPARFLOW_HAVE_CLM=TRUE \
-DCMAKE_INSTALL_PREFIX=$PARFLOW_DIR \
-DPARFLOW_ACCELERATOR_BACKEND=cuda \
-DRMM_ROOT=$PARFLOW_DIR && \
make install
RUN cd .. && \
rm -fr parflow build
WORKDIR /data
ENTRYPOINT ["tclsh"]