INSTALL
-
Install nvidia docker from nvidia website: https://github.com/NVIDIA/nvidia-docker.
NOTE: be sure to see the result of nvidia smi on test container after install. -
Clone https://github.com/google/swift-jupyter and build nvidia docker image
git clone https://github.com/google/swift-jupyter.git
cd swift-jupyter
# from inside the directory of this repository
docker build -f docker/Dockerfile -t swift-jupyter .
- Launch docker daemon:
sudo systemctl start docker
RUN
To run your docker container using –runtime=nvidia option:
# docker_swift_jupyter_start.sh
docker run --runtime=nvidia -p 8899:8888 --cap-add SYS_PTRACE -v /home/notebooks:/notebooks swift-jupyter
- Tested on ubuntu 16.04.
nvidia-smi
It works like a charm, monitoring a new “PID” for any S4TF notebook using GPU.
SSH INTO RUNNING DOCKER
# docker_swift_jupyter_ssh_into_container.sh
containerId=$(sudo docker ps -qf "ancestor=swift-jupyter")
echo Connecting to container: ${containerId}
sudo docker exec -it ${containerId} /bin/bash
CAVEATS
If you get the error "expecting number but found string"
As @stas said in this posts:
- https://github.com/fastai/course-v3/issues/64#issuecomment-434502865
-
Truncated Notebooks
For some reason the jupyter version (5.2.2) installed in the S4TF container has problems with
...
"execution_count": null,
...
Run this script in the root of “fastai_docs” to fix the problem:
perl -pi -e 's|execution_count": null|execution_count": 1|g' dev_swift/*ipynb