cpu file, needs testing
This commit is contained in:
+91
-5
@@ -23,19 +23,105 @@ RUN apt-get install -y dpkg-dev cmake g++ gcc binutils libx11-dev libxpm-dev lib
|
||||
#RUN python3 --version && python3 -m ensurepip
|
||||
RUN python3 -m pip install --upgrade pip
|
||||
|
||||
RUN python3 -m pip install pandas numpy matplotlib MarkupSafe wandb uproot setuptools
|
||||
RUN python3 -m pip install --no-cache-dir torch torchvision torchaudio
|
||||
RUN python3 -m pip install pandas numpy matplotlib MarkupSafe wandb uproot setuptools awkward-pandas plotly
|
||||
RUN python3 -m pip install --no-cache-dir torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118
|
||||
RUN python3 -m pip install torch_geometric
|
||||
RUN python3 -m pip install torch-cluster -f https://data.pyg.org/whl/torch-2.1.0+cu118.html
|
||||
|
||||
# # # # NO GEANT
|
||||
# # # # GEANT
|
||||
RUN apt-get -y install libxmu-dev \
|
||||
libgl1-mesa-dev \
|
||||
libxerces-c-dev \
|
||||
libexpat1 \
|
||||
libx11-dev \
|
||||
libglu1-mesa-dev \
|
||||
freeglut3-dev \
|
||||
mesa-common-dev \
|
||||
imagemagick \
|
||||
gv wget autotools-dev libicu-dev libbz2-dev
|
||||
|
||||
|
||||
|
||||
## DAWN FOR VIS
|
||||
|
||||
RUN mkdir dawn-source \
|
||||
&& wget -q -O - http://geant4.kek.jp/~tanaka/src/dawn_3_91a.tgz | tar xzf - -C "dawn-source" \
|
||||
&& export DAWN_PS_PREVIEWER=NONE && cd dawn-source/dawn_3_91a \
|
||||
&& make clean && make guiclean && make && make install \
|
||||
&& cd - && rm -rf "dawn-source"
|
||||
|
||||
## main package
|
||||
|
||||
RUN cd && wget -q https://gitlab.cern.ch/geant4/geant4/-/archive/v11.1.2/geant4-v11.1.2.tar.gz && \
|
||||
tar -xzf geant4-v11.1.2.tar.gz -C /tmp && \
|
||||
mkdir /tmp/geant4-v11.1.2-build && \
|
||||
cd /tmp/geant4-v11.1.2-build && \
|
||||
cmake -DCMAKE_INSTALL_PREFIX=/opt/geant4-v11.1.2 -DCMAKE_RULE_MESSAGES=OFF -DGEANT4_INSTALL_DATA=ON \
|
||||
-DGEANT4_USE_GDML=ON -DGEANT4_USE_OPENGL_X11=ON \
|
||||
-DGEANT4_BUILD_MULTITHREADED=ON \
|
||||
-DGEANT4_BUILD_TLS_MODEL=global-dynamic \
|
||||
-DGEANT4_USE_RAYTRACER_X11=ON /tmp/geant4-v11.1.2 >/dev/null && \
|
||||
make -j4 >/dev/null && \
|
||||
make install >/dev/null
|
||||
|
||||
RUN rm -rf /tmp/geant4-v11.1.2 && \
|
||||
rm -rf /tmp/geant4-v11.1.2-build
|
||||
|
||||
|
||||
RUN python3 -m pip install geant4-pybind
|
||||
|
||||
ENV LD_LIBRARY_PATH="/opt/geant4-v11.1.2/lib:${LD_LIBRARY_PATH}"
|
||||
|
||||
RUN apt-get install -y git
|
||||
|
||||
RUN python3 -m pip install ipython
|
||||
RUN apt-get install -y tk # for dawn
|
||||
|
||||
# add jupyter packages for UC2 on top so they don't need to be installed every time
|
||||
RUN python3 -m pip install jupyterlab jupyterhub==3.1.1 batchspawner
|
||||
RUN python3 -m pip install jupyterlab jupyterhub==4.1.5 batchspawner
|
||||
RUN ln -s /usr/bin/python3 /usr/bin/python
|
||||
|
||||
# no calo sim package
|
||||
|
||||
RUN python3 -m pip install torch-scatter -f https://data.pyg.org/whl/torch-2.1.0+cu118.html
|
||||
|
||||
#finally the package; use the commit hash to check out the correct version and only get them here, such that the rest can be cached
|
||||
ARG BUILD_DATE
|
||||
LABEL org.label-schema.build-date=$BUILD_DATE
|
||||
ARG COMMIT
|
||||
ARG USER
|
||||
|
||||
# copy minicalosim and checkout the correct commit
|
||||
ADD minicalosim /root/minicalosim
|
||||
|
||||
RUN cd /root/minicalosim && git checkout $COMMIT && \
|
||||
mkdir -p build && cd build && rm -rf * && cmake ../ && make -j4 &&\
|
||||
cp minicalo* ../bind/G4Calo.py /usr/local/lib/python3.8/dist-packages/
|
||||
|
||||
|
||||
|
||||
RUN cp /root/minicalosim/docker/start-notebook.py /usr/local/bin/
|
||||
RUN cp /root/minicalosim/docker/start-notebook.sh /usr/local/bin/
|
||||
RUN cp /root/minicalosim/docker/start-singleuser.py /usr/local/bin/
|
||||
RUN cp /root/minicalosim/docker/start-singleuser.sh /usr/local/bin/
|
||||
RUN cp /root/minicalosim/docker/fix-permissions /usr/local/bin/
|
||||
RUN cp /root/minicalosim/docker/check_cuda_torch.py /usr/local/bin/
|
||||
|
||||
ARG NB_USER="jovyan"
|
||||
ARG NB_UID="1000"
|
||||
ARG NB_GID="100"
|
||||
|
||||
USER root
|
||||
|
||||
#RUN groupadd -g ${NB_GID} ${NB_USER} && \
|
||||
RUN useradd -m -s /bin/bash -N -u ${NB_UID} -g ${NB_GID} ${NB_USER}
|
||||
|
||||
RUN mkdir /etc/jupyter
|
||||
RUN fix-permissions /etc/jupyter/
|
||||
|
||||
|
||||
# clean up
|
||||
RUN rm -rf /root/minicalosim
|
||||
|
||||
USER ${NB_UID}
|
||||
CMD ["start-notebook.sh"]
|
||||
|
||||
|
||||
Executable
+73
@@ -0,0 +1,73 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
# a simple parser for the args <commit> and --no-cache
|
||||
# if no commit is given, the latest commit is used
|
||||
# if --no-cache is given, the --no-cache flag is passed to the docker build command
|
||||
# if only --no-cache is given, the latest commit is used
|
||||
|
||||
# check if commit is given as argument, if not use the latest commit
|
||||
# check if an argument is given at all
|
||||
|
||||
|
||||
if [ -n "$1" ]; then
|
||||
#check if the first arg is --no-cache
|
||||
if [ "$1" == "--no-cache" ]; then
|
||||
FORCE_NO_CACHE="--no-cache"
|
||||
COMMIT=$(git rev-parse --short HEAD)
|
||||
else
|
||||
COMMIT=$1
|
||||
#check if this is a valid commit
|
||||
if ! git cat-file -e $COMMIT^{commit} 2>/dev/null; then
|
||||
echo "ERROR: Commit $COMMIT not found in local repository."
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
else #default to last commit
|
||||
COMMIT=$(git rev-parse --short HEAD)
|
||||
fi
|
||||
|
||||
|
||||
# COMMIT is a valid commit at this point. If COMMIT is the last commit and changes are not commited, the user is warned.
|
||||
|
||||
#check if the commit is the last commit
|
||||
if [ "$COMMIT" == "$(git rev-parse --short HEAD)" ]; then
|
||||
# check if we have uncommitted changes and if so warn the user.
|
||||
if [ -n "$(git status --porcelain)" ]; then
|
||||
echo "WARNING: You are building the latest commit ${COMMIT}, but you have uncommitted changes."
|
||||
echo " This means that the image will not be reproducible."
|
||||
echo " If you want to build the latest commit, please commit your changes first."
|
||||
read -p "Do you want to continue anyway? [y/N] " -n 1 -r
|
||||
echo
|
||||
if [[ ! $REPLY =~ ^[Yy]$ ]]; then
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
# check if the commit has been pushed
|
||||
REMOTE_COMMIT=$(git ls-remote https://gitlab.etp.kit.edu/jkiesele/minicalosim.git | grep $COMMIT)
|
||||
if [ -z "$REMOTE_COMMIT" ]; then
|
||||
echo "ERROR: Commit $COMMIT not found in remote repository."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# check if no-cache is given as second argument
|
||||
if [ "$2" == "--no-cache" ]; then
|
||||
FORCE_NO_CACHE="--no-cache"
|
||||
fi
|
||||
|
||||
#switch to directory this script is located in
|
||||
cd "$(dirname "$0")"
|
||||
cd ../../ #switch to the root directory of the project
|
||||
echo "Building minicalosim_cpu:$COMMIT"
|
||||
|
||||
#print the current working directory
|
||||
echo "Current working directory: $(pwd)"
|
||||
|
||||
docker build $FORCE_NO_CACHE -t jkiesele/minicalosim_cpu:$COMMIT --build-arg USER=$USER --build-arg BUILD_DATE="$(date)" --build-arg COMMIT=$COMMIT -f minicalosim/docker/Dockerfile-cpu .
|
||||
|
||||
echo "sucessfully built container jkiesele/minicalosim_cpu:${COMMIT}"
|
||||
|
||||
docker tag jkiesele/minicalosim_cpu:$COMMIT jkiesele/minicalosim_cpu:latest
|
||||
|
||||
echo "also tagged as jkiesele/minicalosim_cpu:latest"
|
||||
Reference in New Issue
Block a user