Skip to content

Commit

Permalink
Dev env using baremetal conda.
Browse files Browse the repository at this point in the history
  • Loading branch information
Ethan Rublee committed Sep 30, 2018
1 parent 8ac01b5 commit e800c36
Show file tree
Hide file tree
Showing 5 changed files with 71 additions and 45 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ torchgeometry.egg-info/
.eggs/*
.cache/*
.pytest_cache/*
.dev_env
30 changes: 26 additions & 4 deletions README.rst
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

.. image:: https://github.com/arraiy/torchgeometry/blob/master/docs/source/_static/img/torchgeometry_logo.svg
:width: 350 px
:align: center
Expand Down Expand Up @@ -31,7 +30,7 @@ Quick Usage
x_deg = dgm.rad2deg(x_rad)
torch.allclose(x_rad, dgm.deg2rad(x_deg)) # True
-------------------------------------------------------

.. code:: python
Expand All @@ -44,8 +43,31 @@ Quick Usage
warper = dgm.HomographyWarper(32, 32)
img_ref_to_dst = warper(img_ref, dst_homo_ref) # NxCxHxW
Development Setup
=================

Assuming that you are on ubuntu 16.04, with nvidia-drivers installed.

In bash, source the ``path.bash.inc`` script. This will install a
local conda environment under ``./.dev_env``, which includes pytorch
and some dependencies (no root required).

.. code:: bash
source ./path.bash.inc
python -c "import torchgeometry; print(torchgeometry.__version__)"
To install, or update the conda environment run ``setup_dev_env.sh``

.. code:: bash
./setup_dev_env.sh
Installation
============

Expand Down
41 changes: 0 additions & 41 deletions dev_env.sh

This file was deleted.

15 changes: 15 additions & 0 deletions path.bash.inc
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# The purpose of this script is simplify running scripts inside of our
# dev_env docker container. It mounts the workspace and the
# workspace/../build directory inside of the container, and executes
# any arguments passed to the dev_env.sh
script_link="$( readlink "$BASH_SOURCE" )" || script_link="$BASH_SOURCE"
apparent_sdk_dir="${script_link%/*}"
if [ "$apparent_sdk_dir" == "$script_link" ]; then
apparent_sdk_dir=.
fi
sdk_dir="$( command cd -P "$apparent_sdk_dir" > /dev/null && pwd -P )"
if [ ! -e $sdk_dir/.dev_env/bin/conda ]; then
$sdk_dir/setup_dev_env.sh
fi
source $sdk_dir/.dev_env/bin/activate $sdk_dir/.dev_env
export PYTHONPATH=$PYTHONPATH:$sdk_root
29 changes: 29 additions & 0 deletions setup_dev_env.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/bin/bash -ex
script_link="$( readlink "$BASH_SOURCE" )" || script_link="$BASH_SOURCE"
apparent_sdk_dir="${script_link%/*}"
if [ "$apparent_sdk_dir" == "$script_link" ]; then
apparent_sdk_dir=.
fi
sdk_dir="$( command cd -P "$apparent_sdk_dir" > /dev/null && pwd -P )"

mkdir -p $sdk_dir/.dev_env

if [ ! -e $sdk_dir/.dev_env/miniconda.sh ]; then
curl -o $sdk_dir/.dev_env/miniconda.sh \
-O https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh
chmod +x $sdk_dir/.dev_env/miniconda.sh
fi
if [ ! -e $sdk_dir/.dev_env/bin/conda ]; then
$sdk_dir/.dev_env/miniconda.sh -b -u -p $sdk_dir/.dev_env
fi

$sdk_dir/.dev_env/bin/conda install -y \
ipython \
numpy \
pytorch \
torchvision \
opencv \
-c pytorch

$sdk_dir/.dev_env/bin/conda clean -ya

0 comments on commit e800c36

Please sign in to comment.