Skip to content

Installation

Tzu-Mao Li edited this page Dec 12, 2019 · 25 revisions

Install through pip

With PyTorch (any version >= 1.0) or TensorFlow (version >= 2.0) installed, do

pip install redner-gpu

if you have CUDA 10.0 installed and is on Linux. Otherwise do

pip install redner

Build from source

With PyTorch (any version >= 1.0) or TensorFlow (version >= 2.0) installed, first, install pybind11 and scikit-image (e.g. conda install pybind11 scikit-image). Next, make sure you have CMake (https://cmake.org) with version >= 3.13 installed.

Now you can clone the redner repository and all the submodules:

git clone --recursive https://github.com/BachiLi/redner.git

If you forgot to add --recursve, do:

git submodule update --init --recursive

Next, install using the Python script:

python setup.py install

If you wish to build the Python wheels as well, do

python -m pip wheel -w dist --verbose .

Docker environment

We provide two dockerfiles for cpu and gpu modes: manylinux.Dockerfile and manylinux-gpu.Dockerfile.

Build a Docker image

$ git clone --recurse-submodules [email protected]:BachiLi/redner.git

# Build the image
$ cd redner

# CPU version.
$ docker build -t username/redner:cpu -f manylinux.Dockerfile .
# GPU version.
$ docker build -t username/redner:gpu -f manylinux-gpu.Dockerfile .

# NOTE: the build process is very CPU heavy. It will use all your cores. 
#       Do not build multiple images at the same time unless you have more 
#       than 8 cores. On 6 cores, it may freeze the computer.

Using the Docker image

# Start a shell in your container. 

# CPU version
docker run --cap-add=SYS_PTRACE --security-opt seccomp=unconfined -it --rm -v /your-path-to/redner:/app -w /app  username/redner:cpu /bin/bash
# GPU version
docker run --runtime=nvidia --cap-add=SYS_PTRACE --security-opt seccomp=unconfined -it --rm -v /your-path-to/redner:/app -w /app  username/redner:gpu /bin/bash

$ pwd
/app
# Test the setup
$ python -c 'import redner'

# Run some test
$ cd tests
$ python test_two_triangles.py
# Check your result in redner/tests/results/test_two_triangles/

Now you are ready to begin the tutorial.