Installation - budmonde/redner GitHub Wiki

Redner is expected to be used together with PyTorch. Most of the code is written in C++, and we use pybind11 to interface with Python. To install redner, you need to first install CMake with version >= 3.13 and Miniconda (optional but recommended). Redner is tested under gcc 7 and clang 7 in Mac OS and Linux. There is a preliminary support for windows, see https://github.com/BachiLi/redner/pull/11.

Next, install pybind11, PyTorch, numpy, scikit-image using conda:

conda install pybind11
conda install pytorch -c pytorch
conda install numpy
conda install scikit-image

Next, install openexr using your favorite package manager. If you are on MacOS I recommend using homebrew (brew install openexr). For Ubuntu use apt-get install libopenexr-dev.

Redner depends on Embree, a CPU-based ray tracing library. You can install Embree separately, or redner's CMake installation will automatically build Embree from the submodule and install it. If you choose to install Embree separately, and if you install Embree to a custom location (e.g. other than /usr/local), make sure to set the EMBREE_INCLUDE_PATH and EMBREE_LIBRARY CMake variables to the location. If you choose to rely on our CMake installation, by default we install Embree to CMAKE_INSTALL_PREFIX/embree, if you do not have system admin access you may want to change this to somewhere you have access with by setting the EMBREE_INSTALL_PREFIX.

Redner has both CPU and GPU backends. If you want to use the GPU backend, you need to download and install CUDA 10 and optix. After you install optix, set the CMake variable OptiX_INSTALL_DIR to your installed path (/path/to/NVIDIA-OptiX-SDK-[version]-linux64). Also make sure you have installed the NVIDIA driver that is compatiable with your downloaded version of OptiX.

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

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

Next, use CMake to generate makefiles, e.g.,

mkdir build
cd build
cmake .. -DEMBREE_ISPC_SUPPORT=false -DEMBREE_TUTORIALS=false -DOptiX_INSTALL_DIR=/path/to/NVIDIA-OptiX-SDK-[version]-linux64
make install -j 8

or you can use ccmake to configure the variables.

Finally, make sure your LD_LIBRARY_PATH environment variable points to the directories of Embree and OptiX runtimes. For Embree the default is /usr/local/lib and for OptiX it is /path/to/NVIDIA-OptiX-SDK-[version]-linux64/lib64.

If you still have trouble installing, and you are using Unix systems, consider using the dockerfiles we provided. Following is the instructions for using the dockerfiles.

Docker environment

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

Unfortunately, for the gpu dockerfile, we cannot provide a Docker image due to the NVIDIA Optix license. Users need to agree the license and download it to dockerfiles/dependencies/. Note that, the dockerfiles have OPTIX_VERSION=5.1.0. Remember to change it in the dockerfiles if you use a different version of Optix,

Docker environment requirement

  • CUDA driver 10.x
  • NVIDIA driver 418.x
  • NVIDIA Optix 5.1.0

The docker images are tested on

  • CUDA driver 10.1
  • NVIDIA driver 418.67
  • GeForce RTX 2060
  • Intel(R) Xeon(R) W-2133 CPU @ 3.60GHz (model: 85)

Build a Docker image

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

# Download NVIDIA Optix 5.1.0 and unpack to the corresponding directory. 
$ mv {optix_library} redner

# Build the image
$ cd redner

# CPU version. This may take 30 min.
$ docker build -t username/redner:cpu -f cpu.Dockerfile .
# GPU version. This may take 40 min.
$ docker build -t username/redner:gpu -f 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.