-
Notifications
You must be signed in to change notification settings - Fork 5
/
Dockerfile
153 lines (117 loc) · 4.67 KB
/
Dockerfile
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
150
151
152
153
#
# This script builds a Docker based Container
# for the HPL (rochpl) application, via Spack.
# It is based on AMD ROCm 5.3.2 code and
# requires the host system to have a ROCm V 5.x kernel.
#
FROM ubuntu:20.04
ENV DEBIAN_FRONTEND=noninteractive \
SPACK_ROOT=/usr/local \
FORCE_UNSAFE_CONFIGURE=1
WORKDIR /home/user
# Install basic Spack requirements
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
autoconf \
build-essential \
ca-certificates \
coreutils \
curl \
environment-modules \
git \
python \
unzip \
vim \
&& rm -rf /var/lib/apt/lists/*
# Install python 3.9 (Spack requirement)
RUN apt-get update \
&& apt-get install -y software-properties-common \
&& add-apt-repository ppa:deadsnakes/ppa \
&& apt-get install -y python3.9
RUN echo "source $SPACK_ROOT/share/spack/setup-env.sh" \
> /etc/profile.d/spack.sh
RUN cat /etc/profile.d/spack.sh
# Install spack
RUN curl -s -L https://api.github.com/repos/spack/spack/tarball \
| tar xzC $SPACK_ROOT --strip 1
# Show where spack is installed
RUN find $SPACK_ROOT -name spack
# Copyright 2013-2022 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
#
# A Dockerfile that will create an instance of the rocHPL application via Spack.
#
# We expect the sources subdirectory will have the files:
#
# ./sources/rochpl.package.py spack definition of building rochpl
#
# This currently builds a Ubuntu 20.04 O/S image and an AMD ROCm(tm) 5.3.2 based applications.
#
# Spack is an open source project that offers a package management framework and tool for installing complex scientific software.
# It is designed to support multiple versions and configurations of a software on many different platforms and environments.
# Spack is development by Lawrence Livermore National Laboratory.
# RUN env
# Other system dependencies (some entries may be removed in the future)
RUN apt-get update -y \
&& DEBIAN_FRONTEND=noninteractive \
apt-get install -y \
g++ \
gfortran \
libnuma-dev \
libgmp-dev \
libboost-all-dev \
autoconf \
libtool \
flex \
cmake \
tar \
pkg-config \
initramfs-tools \
unzip \
bison \
python3 \
python3-distutils \
tmux \
vim emacs \
dos2unix \
wget curl \
bindfs sudo
# HPL needs omp.h so add the required include directory
RUN find / -name omp.h
ENV HIPCC_COMPILE_FLAGS_APPEND="-I /usr/lib/gcc/x86_64-linux-gnu/9/include/"
# ROCm install based on: https://docs.amd.com/bundle/ROCm-Installation-Guide-v5.3.2/page/Introduction_to_ROCm_Installation_Guide_for_Linux.html
RUN apt-get update -y
RUN wget https://repo.radeon.com/amdgpu-install/5.3.2/ubuntu/focal/amdgpu-install_5.3.50302-1_all.deb
RUN apt-get install -y ./amdgpu-install_5.3.50302-1_all.deb
RUN amdgpu-install -y --usecase=hiplibsdk,rocm --no-dkms
RUN echo "gfx906" > /opt/rocm/bin/target.lst
RUN echo "gfx908" >> /opt/rocm/bin/target.lst
RUN echo "gfx90a" >> /opt/rocm/bin/target.lst
ENV ROCM_TARGET_LST=/opt/rocm/bin/target.lst
######################
# Install rocHPL via Spack
######################
# copy the rochpl package file into place
COPY ./sources/rochpl.package.py .
RUN mkdir -p /usr/local/var/spack/repos/builtin/packages/rochpl/ \
&& cp -p rochpl.package.py /usr/local/var/spack/repos/builtin/packages/rochpl/package.py \
&& ls -lsa /usr/local/var/spack/repos/builtin/packages/rochpl/package.py \
&& cat /usr/local/var/spack/repos/builtin/packages/rochpl/package.py
RUN spack env create -d . \
&& eval `spack env activate --sh . ` \
&& spack add rochpl +rocm amdgpu_target="gfx906,gfx908,gfx90a" build_type=Release \
&& spack install
# create a benchmark directory to make it easier to run rochpl
RUN ln -s `spack location --install-dir rochpl` benchmark
RUN mkdir -p /opt
RUN ln -s `spack location --install-dir rochpl` /opt/rochpl
WORKDIR /home/user/benchmark
ENV PATH=/home/user/benchmark:/home/user/benchmark/bin:$PATH
ENV OMPI_MCA_pml=ucx \
OMPI_MCA_osc=ucx \
OMPI_MCA_pml_ucx_tls=any \
OMPI_MCA_pml_ucx_devices=any \
OMPI_MCA_pml_ucx_verbose=100
CMD ["/bin/bash"]