Skip to content

Commit

Permalink
Updated without compose.
Browse files Browse the repository at this point in the history
  • Loading branch information
Gert-Jan committed Jul 8, 2019
1 parent e75a26b commit 4455295
Show file tree
Hide file tree
Showing 13 changed files with 101 additions and 57 deletions.
Binary file modified .DS_Store
Binary file not shown.
Binary file added config_template/.DS_Store
Binary file not shown.
53 changes: 53 additions & 0 deletions config_template/.ipynb_checkpoints/template-checkpoint.ipynb
Original file line number Diff line number Diff line change
@@ -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
}
6 changes: 0 additions & 6 deletions config_template/Dockerfile

This file was deleted.

17 changes: 0 additions & 17 deletions config_template/docker_sync_templates/docker-compose_cpu.yml

This file was deleted.

18 changes: 0 additions & 18 deletions config_template/docker_sync_templates/docker-compose_gpu.yml

This file was deleted.

This file was deleted.

43 changes: 32 additions & 11 deletions config_template/start_notebook.sh
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions config_template/stop_notebook.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
docker stop diffusion_characterization
7 changes: 7 additions & 0 deletions config_template/workspace.code-workspace
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"folders": [
{
"path": "/home/working"
}
]
}
Binary file added docker_images/.DS_Store
Binary file not shown.
4 changes: 4 additions & 0 deletions docker_images/pytorch/DOCKERFILE
Original file line number Diff line number Diff line change
@@ -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
4 changes: 4 additions & 0 deletions docker_images/tensorflow/DOCKERFILE
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 4455295

Please sign in to comment.