Skip to content

Commit

Permalink
Merge pull request #387 from asogaard/update-docker
Browse files Browse the repository at this point in the history
Update Docker image
  • Loading branch information
asogaard authored Jan 26, 2023
2 parents b2bad25 + 922c82e commit 5c50936
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 14 deletions.
30 changes: 29 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,34 @@ depending on your setup to your `.bashrc` script or similar to make sure that th
</blockquote>
</details>

<details>
<summary><b>Running in Docker</b></summary>
<blockquote>

If you want to run GraphNeT (with IceTray), and don't intend to contribute to the package, consider using the provided [Docker image](https://hub.docker.com/repository/docker/asogaard/graphnet). With Docker, you can then run GraphNeT as:
```bash
$ docker run --rm -it asogaard/graphnet:latest
🐳 graphnet@dc423315742c ❯ ~/graphnet $ python examples/01_icetray/01_convert_i3_files.py sqlite icecube-upgrade
graphnet: INFO 2023-01-24 13:41:27 - get_logger - Writing log to logs/graphnet_20230124-134127.log
(...)
graphnet: INFO 2023-01-24 13:41:46 - SQLiteDataConverter.info - Saving results to /root/graphnet/data/examples/outputs/convert_i3_files/ic86
graphnet: INFO 2023-01-24 13:41:46 - SQLiteDataConverter.info - Processing 1 I3 file(s) in main thread (not multiprocessing)
0%| | 0/1 [00:00<?, ?file(s)/s]graphnet: WARNING 2023-01-24 13:42:26 - SQLiteDataConverter.warning - No data saved to /root/graphnet/data/examples/outputs/convert_i3_files/ic86/upgrade_genie_step4_140028_000998_first_5_frames.db
100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 1/1 [00:39<00:00, 39.79s/file(s)]
graphnet: INFO 2023-01-24 13:42:26 - SQLiteDataConverter.info - Merging files output by current instance.
graphnet: INFO 2023-01-24 13:42:26 - SQLiteDataConverter.info - Merging 1 database files
100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 1/1 [00:00<00:00, 413.88it/s]
```
This should allow you to run all provided examples (excluding the specialised ones requiring [PISA](https://github.com/icecube/pisa)) out of the box, and to start working on your own analysis scripts.

You can use any of the following Docker image tags:
* `main`: Image corresponding to the latest push to the `main` branch.
* `latest`: Image corresponding to the latest named tagged version of `graphnet`.
* `vX.Y.Z`: Image corresponding to the specific named tagged version of `graphnet`.

</blockquote>
</details>


## :ringed_planet: Use cases

Expand Down Expand Up @@ -170,4 +198,4 @@ GraphNeT has an Apache 2.0 license, as found in the [LICENSE](LICENSE) file.
This project has received funding from the European Union’s Horizon 2020 research and innovation programme under the Marie Skłodowska-Curie grant agreement No. 890778, and the PUNCH4NFDI consortium via DFG fund “NFDI39/1”.


[^1]: Examples of this are shown in the [examples/convert_i3_files.py](examples/convert_i3_files.py) script
[^1]: Examples of this are shown in the [examples/01_icetray/01_convert_i3_files.py](./examples/01_icetray/01_convert_i3_files.py) script
46 changes: 33 additions & 13 deletions docker/dockerfile
Original file line number Diff line number Diff line change
@@ -1,22 +1,42 @@
FROM icecube/icetray:combo-stable
# Reference image (large), for missing components.
FROM icecube/icetray:combo-stable as combo

ARG TORCH=1.9.1
ARG PYG=2.0.1
ARG CUDA=cpu
# Base image.
FROM icecube/icetray:combo-stable-slim as main

# Argument(s).
ARG HARDWARE=cpu

# Copy over missing libraries in slim.
COPY --from=combo /usr/lib/x86_64-linux-gnu/libboost_chrono.so.1.71.0 /usr/lib/x86_64-linux-gnu/
COPY --from=combo /usr/lib/x86_64-linux-gnu/libboost_atomic.so.1.71.0 /usr/lib/x86_64-linux-gnu/

# Install pip.
RUN wget https://bootstrap.pypa.io/get-pip.py && python3 get-pip.py && rm get-pip.py

# Updating python packages. Specific to `icecube/icetray:combo*`.
RUN pip install --upgrade pip && \
pip install wheel setuptools==59.5.0 && \
pip install --upgrade astropy && \
pip install --ignore-installed PyYAML && \
pip install torch==${TORCH}+${CUDA} -f https://download.pytorch.org/whl/${CUDA}/torch_stable.html && \
pip install torch-cluster==1.5.9 -f https://data.pyg.org/whl/torch-${TORCH}+${CUDA}.html && \
pip install torch-scatter==2.0.9 -f https://data.pyg.org/whl/torch-${TORCH}+${CUDA}.html && \
pip install torch-sparse==0.6.12 -f https://data.pyg.org/whl/torch-${TORCH}+${CUDA}.html && \
pip install torch-spline-conv==1.2.1 -f https://data.pyg.org/whl/torch-${TORCH}+${CUDA}.html && \
pip install torch-geometric==${PYG} -f https://data.pyg.org/whl/torch-${TORCH}+${CUDA}.html
pip install --ignore-installed PyYAML

# Copy checked out package code to appropriate destination in image.
WORKDIR /root/graphnet
ADD . /root/graphnet/

# Install GraphNeT and required dependencies.
RUN pip install -r requirements/torch_${HARDWARE}.txt
RUN pip install -e .[develop,torch]

# Create missing alias(es) in slim.
RUN echo 'alias python="python3"' >> ~/.bashrc

RUN pip install git+https://github.com/icecube/graphnet.git#egg=graphnet[develop,torch]
# Stylise command line prompt
RUN echo 'PS1="🐳 \[\033[38;2;86;138;242m\]graphnet@\h \[\033[0m\]❯ \[\033[0;34m\]\w \[\033[0m\]\$ "' >> ~/.bashrc
RUN echo 'PS2="\[\033[38;5;236m\]❯\[\033[38;5;239m\]❯\[\033[0m\]❯ "' >> ~/.bashrc

WORKDIR /root
# Enable colours in terminal.
#ENV TERM xterm-256color

# Default command for executing container.
CMD [ "/bin/bash" ]

0 comments on commit 5c50936

Please sign in to comment.