Skip to content

Commit 7019759

Browse files
committed
Added a complete Docker build pathway via Spack, dramatically simplifying the build procedure
1 parent 63a1cb8 commit 7019759

File tree

9 files changed

+413
-0
lines changed

9 files changed

+413
-0
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
FROM chimbuko/chimbuko-spack-release:ubuntu18.04
2+
3+
RUN apt-get update && apt-get install -y vim emacs-nox gdb
4+
5+
WORKDIR /src
6+
7+
RUN git clone https://github.com/CODARcode/PerformanceAnalysis.git -b ckelly_develop --single-branch && mv PerformanceAnalysis/benchmark_suite . && rm -rf PerformanceAnalysis
8+
9+
ENV TAU_OPTIONS "-optShared -optRevert -optVerbose -optCompInst"
10+
11+
WORKDIR /bld/benchmark_suite/func_multimodal
12+
13+
RUN cp -s /src/benchmark_suite/func_multimodal/main.C . && cp /src/benchmark_suite/func_multimodal/*.sh . && cp /src/benchmark_suite/func_multimodal/Makefile .
14+
15+
RUN source /etc/profile.d/z10_spack_environment.sh && make
16+
17+
COPY chimbuko_config.sh /bld/benchmark_suite/func_multimodal/
18+
19+
ENTRYPOINT ["/bin/bash", "--rcfile", "/etc/profile", "-l"]
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
FROM ubuntu:18.04 as base
2+
3+
SHELL ["/bin/bash", "-c"]
4+
5+
RUN mkdir -p /Downloads
6+
7+
ENV DEBIAN_FRONTEND=noninteractive
8+
RUN apt-get update && \
9+
apt-get install -y tzdata && \
10+
ln -fs /usr/share/zoneinfo/America/New_York /etc/localtime && \
11+
dpkg-reconfigure --frontend noninteractive tzdata && \
12+
apt-get install -y build-essential wget git-core libtool libtool-bin \
13+
python3 python3-dev \
14+
curl psmisc iproute2 gfortran libssl-dev locales && \
15+
apt autoremove -y && \
16+
rm -rf /var/lib/apt/lists/* && \
17+
locale-gen en_US.UTF-8 && dpkg-reconfigure locales
18+
19+
ENV LANG en_US.UTF-8
20+
ENV LANGUAGE en_US:en
21+
ENV LC_ALL en_US.UTF-8
22+
23+
from base as build
24+
25+
RUN mkdir /spack && cd /spack && git clone https://github.com/spack/spack.git -b v0.21.2 --single-branch
26+
27+
RUN cd /Downloads && git clone https://github.com/CODARcode/PerformanceAnalysis.git -b ckelly_develop --single-branch && cd PerformanceAnalysis && git checkout 9350a0f00dc6fb2b52f055d31177b3c3b4d61c88 && mkdir /sds && mv spack/repo/chimbuko /sds/ && cd /Downloads && rm -rf PerformanceAnalysis
28+
29+
RUN cd /sds && git clone https://github.com/mochi-hpc/mochi-spack-packages.git && cd mochi-spack-packages && git checkout f82b74bf1eb55baf7a369c6c3031ec9bc96ed01f && echo " depends_on('py-setuptools', type=('build'))" >> /sds/mochi-spack-packages/packages/py-mochi-sonata/package.py
30+
31+
RUN mkdir -p /opt/spack-environment
32+
33+
RUN echo "RESET 3" >> /dev/null
34+
35+
COPY env.yaml /opt/spack-environment/spack.yaml
36+
37+
RUN sed -i '210i \\ options.append("-disable-no-pie-on-ubuntu")' /spack/spack/var/spack/repos/builtin/packages/tau/package.py
38+
39+
COPY package.py /sds/chimbuko/packages/py-eventlet
40+
41+
RUN source /spack/spack/share/spack/setup-env.sh && cd /opt/spack-environment && spack env activate . && spack concretize -f && spack install && spack gc -y && spack clean -a
42+
43+
COPY modules.yaml /root/.spack
44+
45+
ENTRYPOINT ["/bin/bash"]
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
FROM ubuntu:18.04 as base
2+
3+
SHELL ["/bin/bash", "-c"]
4+
5+
ENV DEBIAN_FRONTEND=noninteractive
6+
RUN apt-get update && \
7+
apt-get install -y tzdata && \
8+
ln -fs /usr/share/zoneinfo/America/New_York /etc/localtime && \
9+
dpkg-reconfigure --frontend noninteractive tzdata && \
10+
apt-get install -y build-essential wget git-core libtool libtool-bin \
11+
curl psmisc iproute2 gfortran libssl-dev locales && \
12+
apt autoremove -y && \
13+
rm -rf /var/lib/apt/lists/* && \
14+
locale-gen en_US.UTF-8 && dpkg-reconfigure locales
15+
16+
ENV LANG en_US.UTF-8
17+
ENV LANGUAGE en_US:en
18+
ENV LC_ALL en_US.UTF-8
19+
20+
FROM chimbuko/chimbuko-spack-env:ubuntu18.04 as chimbu_spack_env
21+
22+
RUN source /spack/spack/share/spack/setup-env.sh && cd /opt/spack-environment && \
23+
spack env activate --sh -d . >> /etc/profile.d/z10_spack_environment.sh
24+
25+
RUN source /spack/spack/share/spack/setup-env.sh && cd /opt/spack-environment && spack env activate . && DIR=$(spack location -i chimbuko-visualization2) && echo "export CHIMBUKO_VIZ_ROOT=${DIR}" >> /etc/profile.d/z10_spack_environment.sh
26+
27+
from base
28+
29+
COPY --from=chimbu_spack_env /opt/spack-environment /opt/spack-environment
30+
COPY --from=chimbu_spack_env /opt/software /opt/software
31+
COPY --from=chimbu_spack_env /opt/view /opt/view
32+
COPY --from=chimbu_spack_env /etc/profile.d/z10_spack_environment.sh /etc/profile.d/z10_spack_environment.sh
33+
34+
#Fix broken soft links for python (known spack issue)
35+
RUN cd /opt/view/bin && rm idle3 2to3 python-config python3-config python3 python pydoc3 && \
36+
ln -s /opt/view/bin/idle3.8 /opt/view/bin/idle && \
37+
ln -s /opt/view/bin/2to3-3.8 /opt/view/bin/2to3 && \
38+
ln -s /opt/view/bin/python3.8-config /opt/view/bin/python-config && \
39+
ln -s /opt/view/bin/python3.8-config /opt/view/bin/python3-config && \
40+
ln -s /opt/view/bin/python3.8 /opt/view/bin/python3 && \
41+
ln -s /opt/view/bin/python3.8 /opt/view/bin/python && \
42+
ln -s /opt/view/bin/pydoc3.8 /opt/view/bin/pydoc3
43+
44+
RUN sed -i '1s|.*|#!/opt/view/bin/python3|' /opt/view/bin/celery
45+
46+
ENTRYPOINT ["/bin/bash", "--rcfile", "/etc/profile", "-l"]
Lines changed: 139 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,139 @@
1+
#Note: This configuration file is sourced into the bash environment for Chimbuko startup scripts, thus the user must follow correct shell conventions
2+
#Please do not remove any of the variables!
3+
4+
#IMPORTANT NOTE: Variables that cannot be left as default are marked as <------------ ***SET ME***
5+
6+
####################################
7+
#Options for visualization module
8+
####################################
9+
use_viz=1 #enable or disable the visualization
10+
viz_root=${CHIMBUKO_VIZ_ROOT} #the root directory of the visualization module <------------ ***SET ME (if using viz)***
11+
viz_worker_port=6379 #the port on which to run the redis server for the visualization backend
12+
viz_port=5002 #the port on which to run the webserver
13+
export C_FORCE_ROOT=1 #required only for docker runs, allows celery to execute properly as root user <----------------- *** SET ME (if using Docker)
14+
15+
############################################################
16+
#General options for Chimbuko backend (pserver, ad, provdb)
17+
############################################################
18+
backend_root="infer" #The root install directory of the PerformanceAnalysis libraries. If set to "infer" it will be inferred from the path of the executables
19+
chimbuko_services="infer" #The location of the Chimbuko service script. If set to "infer" it will be inferred from backend_root
20+
21+
####################################
22+
#Options for the provenance database
23+
####################################
24+
use_provdb=1 #enable or disable the provDB. If disabled the provenance data will be written as JSON ASCII into the ${provdb_writedir} set below
25+
provdb_extra_args="" #any extra command line arguments to pass
26+
provdb_nshards=4 #number of database shards
27+
provdb_ninstances=1 #number of database server instances. Shards are distributed over instances
28+
provdb_engine="ofi+tcp;ofi_rxm" #the OFI libfabric provider used for the Mochi stack
29+
provdb_port=5000 #the port of the provenance database. For >1 instance the port of instance i will be provdb_port+i
30+
provdb_writedir=chimbuko/provdb #the directory in which the provenance database is written. Chimbuko creates chimbuko/provdb which can be used as a default
31+
provdb_commit_freq=10000 #frequency ms at which the provenance database is committed to disk. If set to 0 it will commit only at the end
32+
33+
#provdb_interface : network interface upon which communication to the provdb is performed. <------------ ***SET ME***
34+
# This variable has several options:
35+
# auto - let Mercury automatically choose an interface for all instances
36+
# <iface> - a single interface used for all instances
37+
# <iface1>:<iface2>:<iface3> .... - a colon-separated list of interfaces, one per instance
38+
# Obtain a list of interfaces from, e.g. "ip link show" (cf https://www.cyberciti.biz/faq/linux-list-network-interfaces-names-command/).
39+
provdb_interface=auto
40+
41+
#provdb_domain : With "verbs" provider (used for infiniband, iWarp, etc) we need to also specify the domain, which can be found by running fi_info (on a compute node)
42+
# If left blank it will be chosen automatically. <------------ ***SET ME (if using verbs)***
43+
provdb_domain=
44+
45+
#provdb_numa_bind : specify NUMA domain binding for the provdb instances (requires numactl)
46+
# This variable has several options:
47+
# <blank> - if left blank, no binding will be performed
48+
# <index> - a single NUMA domain for all instances
49+
# <idx1>:<idx2>:<idx3> ... - a colon-separated list of NUMA domains, one per instance
50+
provdb_numa_bind=
51+
52+
commit_extra_args="" #extra arguments for the committer
53+
54+
export FI_UNIVERSE_SIZE=1600 # Defines the expected number of provenance DB clients per instance <------------- *** SET ME (should be larger than the number of clients/instance)
55+
export FI_MR_CACHE_MAX_COUNT=0 # disable MR cache in libfabric; still problematic as of libfabric 1.10.1
56+
export FI_OFI_RXM_USE_SRX=1 # use shared recv context in RXM; should improve scalability
57+
58+
####################################
59+
#Options for the parameter server
60+
####################################
61+
use_pserver=1 #enable or disable the pserver
62+
pserver_extra_args="" #any extra command line arguments to pass
63+
pserver_interface=eth0 #network interface upon which communication to the pserver is performed. Obtain from, e.g. "ip link show" (cf https://www.cyberciti.biz/faq/linux-list-network-interfaces-names-command/). <------------ ***SET ME***
64+
pserver_port=5559 #port for parameter server
65+
pserver_nt=2 #number of worker threads
66+
pserver_numa_bind= #specify NUMA domain binding for the pserver (requires numactl). If left blank, no binding will be performed
67+
####################################
68+
#Options for the AD module
69+
####################################
70+
ad_extra_args="-perf_outputpath chimbuko/logs -perf_step 1" #any extra command line arguments to pass. Note: chimbuko/logs is automatically created by services script
71+
ad_win_size=5 #number of events around an anomaly to store; provDB entry size is proportional to this so keep it small!
72+
ad_alg="hbos" #the anomaly detection algorithm. Valid values are "hbos" and "sstd"
73+
ad_outlier_hbos_threshold=0.99 #the percentile of events outside of which are considered anomalies by the HBOS algorithm
74+
ad_outlier_sstd_sigma=12 #number of standard deviations that defines an outlier in the SSTD algorithm
75+
####################################
76+
#Options for TAU
77+
#Note: Only the TAU_ADIOS2_PATH, TAU_ADIOS2_FILE_PREFIX, EXE_NAME, TAU_ADIOS2_ENGINE and tau_monitoring_conf variables are used by the Chimbuko services script and there only to generate the suggested
78+
# command to launch the AD (output to chimbuko/vars/chimbuko_ad_cmdline.var); they can be overridden by the run script if desired providing the appropriate modifications
79+
# are made to the AD launch command. The remainder of the variables are used only by TAU and can be freely overridden.
80+
####################################
81+
export TAU_ADIOS2_ENGINE=SST #online communication engine (alternative BP4 although this goes through the disk system and may be slower unless the BPfiles are stored on a burst disk)
82+
export TAU_ADIOS2_ONE_FILE=FALSE #a different connection file for each rank
83+
export TAU_ADIOS2_PERIODIC=1 #enable/disable ADIOS2 periodic output
84+
export TAU_ADIOS2_PERIOD=1000000 #period in us between ADIOS2 io steps
85+
export TAU_THREAD_PER_GPU_STREAM=1 #force GPU streams to appear as different TAU virtual threads
86+
export TAU_THROTTLE=0 #enable/disable throttling of short-running functions
87+
88+
#export TAU_MAKEFILE=/opt/tau2/x86_64/lib/Makefile.tau-papi-mpi-pthread-pdt-adios2 #The TAU makefile to use. If using a TAU installation built by Spack, this variable is already set in the environment and can be commented out here <------------ ***SET ME***
89+
90+
tau_monitoring_conf="default" #Provide a configuration file for the TAU monitoring plugin. It will be copied to the work directory as "tau_monitoring.json" (unless it is already there!). If set to default, Chimbuko will generate one automatically
91+
92+
#Note: the following 2 variables are not used by the service script but are included here for use from the user's run script allowing the application to be launched with either "${TAU_EXEC} <app>" or "${TAU_PYTHON} <app>"
93+
#Note: the "binding" -T ... is used by Tau to find the appropriate configuration. It can typically be inferred from the name of the Makefile. If using a non-MPI job the 'mpi' should be changed to 'serial' and a non-MPI build of
94+
# ADIOS2/TAU must exist
95+
#Suggestion: It is useful to test the command without Chimbuko first to ensure TAU picks up the correct binding; this can be done by 'export TAU_ADIOS2_ENGINE=BPFile' and then running the application with Tau but without Chimbuko.
96+
TAU_EXEC="tau_exec -T papi,mpi,pthread,pdt,adios2 -adios2_trace -monitoring" #how to execute tau_exec; the -T arguments should mirror the makefile name <------------ ***SET ME***
97+
TAU_PYTHON="tau_python -T papi,mpi,pthread,pdt,adios2 -tau-python-interpreter=python3 -adios2_trace -tau-python-args=-u" #how to execute tau_python. Note that passing -u to python forces it to not buffer stdout so we can pipe it
98+
#to tee in realtime <--- SET ME (if !python3)
99+
100+
export EXE_NAME=main #the name of the executable (without path). For multi-component workflows this argument also accepts a list, e.g. (main1 main2) <------------ ***SET ME***
101+
102+
TAU_ADIOS2_PATH=chimbuko/adios2 #path where the adios2 files are to be stored. Chimbuko services creates the directory chimbuko/adios2 in the working directory and this should be used by default
103+
TAU_ADIOS2_FILE_PREFIX=tau-metrics #the prefix of tau adios2 files; full filename is ${TAU_ADIOS2_PREFIX}-${EXE_NAME}-${RANK}.bp
104+
105+
106+
107+
108+
109+
110+
111+
112+
113+
114+
115+
116+
117+
###########################################################################
118+
# NON-USER VARIABLES BELOW = DON'T MODIFY THESE!!
119+
###########################################################################
120+
#Extra processing
121+
export TAU_ADIOS2_FILENAME="${TAU_ADIOS2_PATH}/${TAU_ADIOS2_FILE_PREFIX}"
122+
123+
if [[ ${backend_root} == "infer" ]]; then
124+
if [[ $(which provdb_admin) == "" ]]; then
125+
echo "When inferring the backend root directory, could not find provdb_admin in PATH. Please add your Chimbuko bin directory to PATH"
126+
exit 1
127+
fi
128+
129+
backend_root=$( readlink -f $(which provdb_admin | sed 's/provdb_admin//')/../ )
130+
fi
131+
132+
if [[ ${chimbuko_services} == "infer" ]]; then
133+
chimbuko_services="${backend_root}/scripts/launch/run_services.sh"
134+
if [ ! -f "${chimbuko_services}" ]; then
135+
echo "Could not infer service script location: service script does not exist at ${chimbuko_services}!"
136+
exit 1
137+
fi
138+
fi
139+
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/bin/bash
2+
3+
set -e
4+
5+
#docker build -f Dockerfile.spack_env -t chimbuko/chimbuko-spack-env:ubuntu18.04 .
6+
#docker build -f Dockerfile.spack_release -t chimbuko/chimbuko-spack-release:ubuntu18.04 .
7+
docker build -f Dockerfile.playground -t chimbuko/chimbuko-spack-playground:ubuntu18.04 .
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
spack:
2+
specs:
3+
- chimbuko-performance-analysis @git.bcb0f724d8579abeb620a0f9f4a9fdd839f3475f ^mochi-sonata~bedrock~unqlite_st ^[email protected]
4+
- tau+mpi+openmp+adios2+python+binutils@git.9ec064a2f5ebc6deb63cfb3c10595ccba902b017=2.33.1
5+
- libfabric fabrics=sockets,tcp,udp,rxm
6+
7+
concretizer:
8+
unify: true
9+
compilers:
10+
- compiler:
11+
spec: gcc@=7.5.0
12+
paths:
13+
cc: /usr/bin/gcc
14+
cxx: /usr/bin/g++
15+
f77: /usr/bin/gfortran
16+
fc: /usr/bin/gfortran
17+
flags: {}
18+
operating_system: ubuntu18.04
19+
target: x86_64
20+
modules: []
21+
environment: {}
22+
extra_rpaths: []
23+
repos:
24+
- /sds/chimbuko
25+
- /sds/mochi-spack-packages
26+
packages:
27+
all:
28+
compiler: [gcc@=7.5.0]
29+
providers: {}
30+
coreutils:
31+
externals:
32+
33+
prefix: /usr
34+
buildable: False
35+
diffutils:
36+
externals:
37+
38+
prefix: /usr
39+
buildable: False
40+
findutils:
41+
externals:
42+
43+
prefix: /usr
44+
buildable: False
45+
openssh:
46+
externals:
47+
48+
prefix: /usr
49+
buildable: False
50+
openssl:
51+
externals:
52+
53+
prefix: /usr
54+
buildable: False
55+
git:
56+
externals:
57+
- spec: [email protected]~tcltk
58+
prefix: /usr
59+
buildable: False
60+
gmake:
61+
externals:
62+
63+
prefix: /usr
64+
buildable: False
65+
libtool:
66+
externals:
67+
68+
prefix: /usr
69+
buildable: False
70+
71+
config:
72+
install_tree: /opt/software
73+
view: /opt/view
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
modules:
2+
prefix_inspections:
3+
lib: [LIBRARY_PATH]
4+
lib64: [LIBRARY_PATH]
5+
include:
6+
- C_INCLUDE_PATH
7+
- CPLUS_INCLUDE_PATH
8+
- INCLUDE
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
2+
# Spack Project Developers. See the top-level COPYRIGHT file for details.
3+
#
4+
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
5+
6+
from spack import *
7+
8+
9+
class PyEventlet(PythonPackage):
10+
"""Concurrent networking library for Python. Override builtin with more recent version"""
11+
12+
homepage = "https://github.com/eventlet/eventlet"
13+
url = "https://github.com/eventlet/eventlet/archive/v0.30.0.tar.gz"
14+
git = "https://github.com/eventlet/eventlet"
15+
16+
version('0.36.1',tag='0.36.1')
17+
version('0.30.0', sha256='20612435e2a4d35f41fc2af5d4c902410fab9d59da833de942188b12c52b51f7')
18+
19+
20+
depends_on('py-setuptools', type='build')
21+
depends_on('[email protected]:', when='@0.36.1')
22+
depends_on('[email protected]:', when='@0.30.0')
23+
24+
#depends_on('[email protected]:', type=('build', 'run'), when='@0.36.1')
25+
#depends_on('[email protected]:1.16.0', type=('build', 'run'), when='@0.30.0')
26+
depends_on('[email protected]:', type=('build', 'run'))
27+
28+
depends_on('[email protected]:', type=('build', 'run'), when='^python@:3.5')
29+
depends_on('py-hatchling', type='build', when='@0.36.1')
30+
depends_on('py-hatch-vcs', type='build', when='@0.36.1')

0 commit comments

Comments
 (0)