-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
142 lines (108 loc) · 5.52 KB
/
Dockerfile
File metadata and controls
142 lines (108 loc) · 5.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
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
# syntax=docker/dockerfile:latest
FROM nvcr.io/nvidia/cuda:12.4.0-runtime-ubuntu22.04 AS base
ARG DEBIAN_FRONTEND=noninteractive
# Install Spack package manager
RUN apt update \
&& apt install -y build-essential ca-certificates coreutils curl gfortran git gpg lsb-release unzip zip python3 \
&& apt clean \
&& rm -rf /var/lib/apt/lists/*
RUN apt update \
&& apt install -y curl cuda-nvcc-12-4 libcurand-dev-12-4 \
&& apt clean \
&& rm -rf /var/lib/apt/lists/*
RUN sed -i 's/ exec "$@"/ exec "\/bin\/bash" "-c" "$*"/g' /opt/nvidia/nvidia_entrypoint.sh
RUN mkdir -p /opt/spack && curl -sL https://github.com/spack/spack/archive/v1.0.1.tar.gz | tar -xz --strip-components 1 -C /opt/spack
RUN echo "source /opt/spack/share/spack/setup-env.sh" > /etc/profile.d/z09_source_spack_setup.sh
# Set up non-interactive shells by sourcing all of the scripts in /etc/profile.d/
RUN cat <<"EOF" > /etc/bash.nonint
if [ -d /etc/profile.d ]; then
for i in /etc/profile.d/*.sh; do
if [ -r $i ]; then
. $i
fi
done
unset i
fi
EOF
RUN cat /etc/bash.nonint >> /etc/bash.bashrc
SHELL ["/bin/bash", "-l", "-c"]
FROM base AS deps
RUN spack repo update -b develop builtin
RUN spack env create esi-env
RUN spack -e esi-env add cmake
RUN spack -e esi-env add python@3.12 py-pip
RUN spack -e esi-env add openssl
RUN spack -e esi-env add glew glfw glm glu nlohmann-json mesa@23.0.2 ~llvm
RUN spack -e esi-env add plog
RUN spack -e esi-env add optix-dev@7.7
RUN spack -e esi-env add automake autoconf libtool m4
RUN spack -e esi-env install
RUN spack -e esi-env env activate --sh --dir /opt/spack/var/spack/environments/esi-env > /etc/profile.d/z10_load_spack_environment.sh
ENV BASH_ENV=/etc/bash.nonint
ENV ESI_DIR=/esi
ENV OPTICKS_PREFIX=/opt/eic-opticks
ENV OPTICKS_HOME=${ESI_DIR}/eic-opticks
ENV OPTICKS_BUILD=/opt/eic-opticks/build
ENV SPACK_ENV=/opt/spack/var/spack/environments/esi-env
ENV LD_LIBRARY_PATH=${OPTICKS_PREFIX}/lib:$SPACK_ENV/.spack-env/view/lib:$SPACK_ENV/.spack-env/view/lib64:${LD_LIBRARY_PATH}
ENV PATH=${OPTICKS_PREFIX}/bin:${PATH}
ENV NVIDIA_DRIVER_CAPABILITIES=graphics,compute,utility
WORKDIR $ESI_DIR
RUN mkdir -p $OPTICKS_HOME && curl -sL https://github.com/BNLNPPS/eic-opticks/archive/f051f4a7a8.tar.gz | tar -xz --strip-components 1 -C $OPTICKS_HOME
FROM base AS esi-env
RUN spack env create esi-env
RUN spack -e esi-env repo update -b develop builtin
RUN spack -e esi-env repo add https://github.com/BNLNPPS/spack-packages
RUN spack -e esi-env external find --not-buildable --path /usr/local/cuda cuda
RUN spack -e esi-env install --keep-stage --add eic-opticks build_type=Debug ^mesa@23.0.2~llvm ^geant4@11.3.2 ^optix-dev@7.7
RUN spack env activate esi-env --sh > /etc/profile.d/z10_load_spack_environment.sh
FROM base AS no-env
RUN spack repo update -b develop builtin
RUN spack repo add https://github.com/BNLNPPS/spack-packages
RUN spack external find --not-buildable --path /usr/local/cuda cuda
RUN spack install eic-opticks ^mesa@23.0.2~llvm ^geant4@11.3.2 ^optix-dev@7.7
RUN echo "spack load eic-opticks" > /etc/profile.d/z10_load_spack_environment.sh
FROM deps AS release
RUN spack -e esi-env add geant4@11.3.2 +opengl +qt
RUN spack -e esi-env env activate \
&& spack load $(spack find --format '{name}{@version}' --explicit) \
&& spack -e esi-env env activate --sh --dir /opt/spack/var/spack/environments/esi-env > /etc/profile.d/z10_load_spack_environment.sh
RUN cmake -S $OPTICKS_HOME -B $OPTICKS_BUILD -DCMAKE_INSTALL_PREFIX=$OPTICKS_PREFIX -DCMAKE_BUILD_TYPE=Release \
&& cmake --build $OPTICKS_BUILD --parallel --target install
FROM deps AS develop
RUN spack -e esi-env install --add root@6.34 build_type=Debug
RUN spack -e esi-env install --add texinfo
RUN spack -e esi-env install --add gawk
RUN spack -e esi-env install --add geant4@11.3.2 +opengl +qt build_type=Debug
RUN spack -e esi-env install && spack clean -a
RUN spack -e esi-env env activate \
&& spack load $(spack find --format '{name}{@version}' --explicit) \
&& spack -e esi-env env activate --sh --dir /opt/spack/var/spack/environments/esi-env > /etc/profile.d/z10_load_spack_environment.sh
# Install RatPac
RUN git clone -b 3.2.0 https://github.com/rat-pac/ratpac-two.git \
&& cmake ratpac-two -B build \
&& cmake --build build/ --parallel
# Follow instructions at https://docs.nvidia.com/nsight-systems/InstallationGuide/index.html#package-manager-installation
RUN <<"EOF"
apt update
apt install -y --no-install-recommends gnupg
echo "deb http://developer.download.nvidia.com/devtools/repos/ubuntu$(source /etc/lsb-release; echo "$DISTRIB_RELEASE" | tr -d .)/$(dpkg --print-architecture) /" | tee /etc/apt/sources.list.d/nvidia-devtools.list
apt-key adv --fetch-keys http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/7fa2af80.pub
apt update
apt install -y qtbase5-dev qtchooser qt5-qmake qtbase5-dev-tools
apt install -y libqt5x11extras5
apt install -y libxcb-xinerama0 libxcb-xinerama0-dev
apt install -y libxkbcommon-x11-0
apt install -y nsight-systems-cli nsight-systems libgl1-mesa-glx libsm6 libx11-6 libxext6 libxrender1 libxtst6 libxcb1
apt install -y mesa-utils x11-apps
apt clean
EOF
COPY nsight-compute-linux-2024.3.2.3-34861637.run .
RUN <<"EOF"
./nsight-compute-linux-2024.3.2.3-34861637.run --quiet -- -noprompt
rm -fr nsight-compute-linux-2024.3.2.3-34861637.run
EOF
# Install Python dependencies
RUN python -m pip install --upgrade pip && pip install -e $OPTICKS_HOME
RUN cmake -S $OPTICKS_HOME -B $OPTICKS_BUILD -DCMAKE_INSTALL_PREFIX=$OPTICKS_PREFIX -DCMAKE_BUILD_TYPE=Debug \
&& cmake --build $OPTICKS_BUILD --parallel --target install