-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #550 from genn-team/docker_stevinson
Docker
- Loading branch information
Showing
5 changed files
with
141 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
.git | ||
build | ||
dist | ||
documentation | ||
doxygen | ||
lib | ||
obj* | ||
tests | ||
userproject | ||
!userproject/include | ||
**/*.so | ||
**/*.lib |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
ARG BASE=11.5.0-devel-ubuntu20.04 | ||
FROM nvidia/cuda:${BASE} | ||
|
||
LABEL maintainer="[email protected]" | ||
LABEL version="4.8.0" | ||
LABEL org.opencontainers.image.documentation="https://genn-team.github.io/" | ||
LABEL org.opencontainers.image.source="https://github.com/genn-team/genn" | ||
LABEL org.opencontainers.image.title="GeNN Docker image" | ||
|
||
# Update APT database and upgrade any outdated packages | ||
RUN apt-get update && \ | ||
apt-get upgrade -y | ||
|
||
# Install Python, pip and swig | ||
RUN apt-get install -yq --no-install-recommends python3-dev python3-pip swig gosu nano | ||
|
||
# Set CUDA environment variable | ||
ENV CUDA_PATH=/usr/local/cuda-11.5 | ||
|
||
ENV GENN_PATH=/opt/genn | ||
|
||
# Upgrade pip itself | ||
RUN pip install --upgrade pip | ||
|
||
# Install numpy and jupyter | ||
RUN pip install numpy jupyter matplotlib | ||
|
||
# Copy GeNN into /opt | ||
COPY . ${GENN_PATH} | ||
|
||
# Use this as working directory | ||
WORKDIR ${GENN_PATH} | ||
|
||
# Install GeNN and PyGeNN | ||
RUN make install -j `lscpu -p | egrep -v '^#' | sort -u -t, -k 2,4 | wc -l` | ||
RUN make DYNAMIC=1 LIBRARY_DIRECTORY=${GENN_PATH}/pygenn/genn_wrapper/ -j `lscpu -p | egrep -v '^#' | sort -u -t, -k 2,4 | wc -l` | ||
RUN python3 setup.py develop | ||
|
||
# Default command will be to launch bash | ||
CMD ["/bin/bash"] | ||
|
||
# Start entrypoint | ||
# **NOTE** in 'exec' mode shell arguments aren't expanded so can't use environment variables | ||
ENTRYPOINT ["/opt/genn/bin/genn-docker-entrypoint.sh"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#!/bin/bash | ||
# Read desired user and group ID from environment varibles (typically set on docker command line with -e) | ||
USER_ID=${LOCAL_USER_ID:-9001} | ||
GROUP_ID=${LOCAL_GROUP_ID:-$USER_ID} | ||
|
||
# Add GeNN user with matching user and group ID | ||
groupadd -g $GROUP_ID genn | ||
useradd --shell /bin/bash -u $USER_ID -g genn -o -c "" -m genn | ||
export HOME=/home/genn | ||
|
||
# If script command passed | ||
if [[ "$1" = "script" ]]; then | ||
# Shift script command itself off arguments | ||
shift | ||
|
||
# Change to directory script is in and launch | ||
# **YUCK** this should not really be necessary but PyGeNN does | ||
# not work nicely running scripts not in working directory | ||
CWD=$(dirname "$1") | ||
cd "$CWD" | ||
exec gosu genn:genn python3 "$@" | ||
# Otherwise, if notebook is passes | ||
elif [[ "$1" = "notebook" ]]; then | ||
# Extract notebook directory from next command line argument, otherwise use home | ||
CWD=${2:-$HOME} | ||
exec gosu genn:genn /usr/local/bin/jupyter-notebook --ip=0.0.0.0 --port=8080 --no-browser --notebook-dir="$CWD" | ||
# Otherwise, change directory to home directory and execute arguments | ||
else | ||
cd $HOME | ||
exec gosu genn:genn "$@" | ||
fi |