diff --git a/.DS_Store b/.DS_Store index 882c49b..fb8a1e7 100644 Binary files a/.DS_Store and b/.DS_Store differ diff --git a/config_template/.DS_Store b/config_template/.DS_Store new file mode 100644 index 0000000..9df0dd2 Binary files /dev/null and b/config_template/.DS_Store differ diff --git a/config_template/.ipynb_checkpoints/template-checkpoint.ipynb b/config_template/.ipynb_checkpoints/template-checkpoint.ipynb new file mode 100644 index 0000000..912590c --- /dev/null +++ b/config_template/.ipynb_checkpoints/template-checkpoint.ipynb @@ -0,0 +1,53 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 1, + "metadata": {}, + "outputs": [], + "source": [ + "import numpy as np\n", + "import tensorflow as tf\n", + "import matplotlib.pyplot as plt\n", + "import seaborn as sns\n", + "import pandas as pd\n", + "\n", + "plt.style.use('seaborn-notebook')\n", + "\n", + "%load_ext autoreload\n", + "%autoreload 2\n", + "\n", + "np.random.seed(42)\n", + "tf.set_random_seed(42)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.7.2" + } + }, + "nbformat": 4, + "nbformat_minor": 2 +} diff --git a/config_template/Dockerfile b/config_template/Dockerfile deleted file mode 100644 index 6c1ffbc..0000000 --- a/config_template/Dockerfile +++ /dev/null @@ -1,6 +0,0 @@ -FROM nvcr.io/nvidia/pytorch:19.06-py3 - -RUN conda install --quiet --yes -c conda-forge nodejs &&\ - conda clean --all -f -y &&\ - jupyter labextension install @jupyterlab/toc &&\ - npm cache clean --force diff --git a/config_template/docker_sync_templates/docker-compose_cpu.yml b/config_template/docker_sync_templates/docker-compose_cpu.yml deleted file mode 100644 index 8680ad5..0000000 --- a/config_template/docker_sync_templates/docker-compose_cpu.yml +++ /dev/null @@ -1,17 +0,0 @@ -version: "2.3" -services: - compute: - image: {{IMAGE}} - ipc: "host" - ports: - - "8888:8888" - - "6006:6006" - volumes: - - simplest-sync:/home/jovyan/work/:nocopy - command: bash -c "cd /home/jovyan/work/ && - python setup.py develop && - jupyter lab --ip 0.0.0.0 --no-browser --allow-root --NotebookApp.token=''" - -volumes: - simplest-sync: - external: true diff --git a/config_template/docker_sync_templates/docker-compose_gpu.yml b/config_template/docker_sync_templates/docker-compose_gpu.yml deleted file mode 100644 index 4f49f94..0000000 --- a/config_template/docker_sync_templates/docker-compose_gpu.yml +++ /dev/null @@ -1,18 +0,0 @@ -version: "2.3" -services: - compute: - image: {{IMAGE}} - runtime: nvidia - ipc: "host" - ports: - - "8888:8888" - - "6006:6006" - volumes: - - simplest-sync:/home/jovyan/work/:nocopy - command: bash -c "cd /home/jovyan/work/ && - python setup.py develop && - jupyter lab --ip 0.0.0.0 --no-browser --allow-root --NotebookApp.token=''" - -volumes: - simplest-sync: - external: true diff --git a/config_template/docker_sync_templates/docker-sync_template.yml b/config_template/docker_sync_templates/docker-sync_template.yml deleted file mode 100644 index 9bd277f..0000000 --- a/config_template/docker_sync_templates/docker-sync_template.yml +++ /dev/null @@ -1,5 +0,0 @@ -version: "2" - -syncs: - simplest-sync: - src: {{PROJECT_FOLDER}} diff --git a/config_template/start_notebook.sh b/config_template/start_notebook.sh index 7ae12a7..3dcc762 100755 --- a/config_template/start_notebook.sh +++ b/config_template/start_notebook.sh @@ -1,21 +1,42 @@ #!/bin/bash +container_name="diffusion_characterization" +image="phimal/projects:diffusioncharacterization" + #First automatically find project directory cd ../ projectdir=$(pwd) cd config/ -# Make docker-sync for project -sed "s#{{PROJECT_FOLDER}}#$projectdir#g" docker_sync_templates/docker-sync_template.yml > docker-sync.yml - -if hash nvidia-docker 2>/dev/null; then - sed "s#{{IMAGE}}#[PASTE DOCKER IMAGE NAME HERE]#g" docker_sync_templates/docker-compose_gpu.yml > docker-compose.yml +if [ "$(docker ps -aq -f name=$container_name)" ]; then + echo "Restarting container." + docker restart $container_name + else + if hash nvidia-docker 2>/dev/null; then + echo 'Starting container with gpu.' + docker run -d\ + -p 8888:8888 -p 6006:6006 \ + -v $projectdir:/home/working/ \ + --ipc=host \ + --name=$container_name \ + --runtime=nvidia + $image bash -c "cd /home/working/ && \ + python setup.py develop && \ + jupyter lab --ip 0.0.0.0 --no-browser --allow-root --NotebookApp.token=''" else - sed "s#{{IMAGE}}#[PASTE DOCKER IMAGE NAME HERE]#g" docker_sync_templates/docker-compose_cpu.yml > docker-compose.yml - fi + echo 'Starting container without gpu.' + docker run -d\ + -p 8888:8888 -p 6006:6006 \ + -v $projectdir:/home/working/ \ + --ipc=host \ + --name=$container_name \ + $image bash -c "cd /home/working/ && \ + python setup.py develop && \ + jupyter lab --ip 0.0.0.0 --no-browser --allow-root --NotebookApp.token=''" + fi +fi -# Clean old docker-sync -sudo docker-sync-stack clean +# Also create a nice stop script +echo "You can stop this container by running stop_notebook.sh" +echo "docker stop $container_name" > stop_notebook.sh -# Run docker sync -sudo docker-sync-stack start diff --git a/config_template/stop_notebook.sh b/config_template/stop_notebook.sh new file mode 100755 index 0000000..b2d9912 --- /dev/null +++ b/config_template/stop_notebook.sh @@ -0,0 +1 @@ +docker stop diffusion_characterization diff --git a/config_template/workspace.code-workspace b/config_template/workspace.code-workspace new file mode 100644 index 0000000..9702f6f --- /dev/null +++ b/config_template/workspace.code-workspace @@ -0,0 +1,7 @@ +{ + "folders": [ + { + "path": "/home/working" + } + ] +} \ No newline at end of file diff --git a/docker_images/.DS_Store b/docker_images/.DS_Store new file mode 100644 index 0000000..7c1c389 Binary files /dev/null and b/docker_images/.DS_Store differ diff --git a/docker_images/pytorch/DOCKERFILE b/docker_images/pytorch/DOCKERFILE index a7319b6..6c1ffbc 100644 --- a/docker_images/pytorch/DOCKERFILE +++ b/docker_images/pytorch/DOCKERFILE @@ -1,2 +1,6 @@ FROM nvcr.io/nvidia/pytorch:19.06-py3 +RUN conda install --quiet --yes -c conda-forge nodejs &&\ + conda clean --all -f -y &&\ + jupyter labextension install @jupyterlab/toc &&\ + npm cache clean --force diff --git a/docker_images/tensorflow/DOCKERFILE b/docker_images/tensorflow/DOCKERFILE index 68afbbc..ff79730 100644 --- a/docker_images/tensorflow/DOCKERFILE +++ b/docker_images/tensorflow/DOCKERFILE @@ -1,2 +1,6 @@ FROM nvcr.io/nvidia/tensorflow:19.06-py3 +RUN conda install --quiet --yes -c conda-forge nodejs &&\ + conda clean --all -f -y &&\ + jupyter labextension install @jupyterlab/toc &&\ + npm cache clean --force