Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Request to Add DirDist to pyTorch3D #1739

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file modified .circleci/regenerate.py
100755 → 100644
Empty file.
24 changes: 22 additions & 2 deletions INSTALL.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
# Installation


## Requirements

### Core library

The core library is written in PyTorch. Several components have underlying implementation in CUDA for improved performance. A subset of these components have CPU implementations in C++/PyTorch. It is advised to use PyTorch3D with GPU support in order to use all the features.
The core library is written in PyTorch. Several components have underlying implementation in CUDA for improved performance. A subset of these components have CPU implementations in C++/PyTorch. It is advised to use PyTorch3D with GPU support in order to use all the features.

- Linux or macOS or Windows
- Python
Expand All @@ -17,6 +16,7 @@ The core library is written in PyTorch. Several components have underlying imple
- If CUDA older than 11.7 is to be used and you are building from source, the CUB library must be available. We recommend version 1.10.0.

The runtime dependencies can be installed by running:

```
conda create -n pytorch3d python=3.9
conda activate pytorch3d
Expand All @@ -25,12 +25,15 @@ conda install -c iopath iopath
```

For the CUB build time dependency, which you only need if you have CUDA older than 11.7, if you are using conda, you can continue with

```
conda install -c bottler nvidiacub
```

Otherwise download the CUB library from https://github.com/NVIDIA/cub/releases and unpack it to a folder of your choice.
Define the environment variable CUB_HOME before building and point it to the directory that contains `CMakeLists.txt` for CUB.
For example on Linux/Mac,

```
curl -LO https://github.com/NVIDIA/cub/archive/1.10.0.tar.gz
tar xzf 1.10.0.tar.gz
Expand All @@ -40,6 +43,7 @@ export CUB_HOME=$PWD/cub-1.10.0
### Tests/Linting and Demos

For developing on top of PyTorch3D or contributing, you will need to run the linter and tests. If you want to run any of the notebook tutorials as `docs/tutorials` or the examples in `docs/examples` you will also need matplotlib and OpenCV.

- scikit-image
- black
- usort
Expand All @@ -53,6 +57,7 @@ For developing on top of PyTorch3D or contributing, you will need to run the lin
- opencv-python

These can be installed by running:

```
# Demos and examples
conda install jupyter
Expand All @@ -64,6 +69,7 @@ pip install black usort flake8 flake8-bugbear flake8-comprehensions
```

## Installing prebuilt binaries for PyTorch3D

After installing the above dependencies, run one of the following commands:

### 1. Install with CUDA support from Anaconda Cloud, on Linux only
Expand All @@ -74,21 +80,25 @@ conda install pytorch3d -c pytorch3d
```

Or, to install a nightly (non-official, alpha) build:

```
# Anaconda Cloud
conda install pytorch3d -c pytorch3d-nightly
```

### 2. Install wheels for Linux

We have prebuilt wheels with CUDA for Linux for PyTorch 1.11.0, for each of the supported CUDA versions,
for Python 3.8 and 3.9. This is for ease of use on Google Colab.
These are installed in a special way.
For example, to install for Python 3.8, PyTorch 1.11.0 and CUDA 11.3

```
pip install --no-index --no-cache-dir pytorch3d -f https://dl.fbaipublicfiles.com/pytorch3d/packaging/wheels/py38_cu113_pyt1110/download.html
```

In general, from inside IPython, or in Google Colab or a jupyter notebook, you can install with

```
import sys
import torch
Expand All @@ -103,14 +113,18 @@ version_str="".join([
```

## Building / installing from source.

CUDA support will be included if CUDA is available in pytorch or if the environment variable
`FORCE_CUDA` is set to `1`.

### 1. Install from GitHub

```
pip install "git+https://github.com/facebookresearch/pytorch3d.git"
```

To install using the code of the released version instead of from the main branch, use the following instead.

```
pip install "git+https://github.com/facebookresearch/pytorch3d.git@stable"
```
Expand All @@ -119,18 +133,22 @@ For CUDA builds with versions earlier than CUDA 11, set `CUB_HOME` before buildi

**Install from Github on macOS:**
Some environment variables should be provided, like this.

```
MACOSX_DEPLOYMENT_TARGET=10.14 CC=clang CXX=clang++ pip install "git+https://github.com/facebookresearch/pytorch3d.git"
```

### 2. Install from a local clone

```
git clone https://github.com/facebookresearch/pytorch3d.git
cd pytorch3d && pip install -e .
```

To rebuild after installing from a local clone run, `rm -rf build/ **/*.so` then `pip install -e .`. You often need to rebuild pytorch3d after reinstalling PyTorch. For CUDA builds with versions earlier than CUDA 11, set `CUB_HOME` before building as described above.

**Install from local clone on macOS:**

```
MACOSX_DEPLOYMENT_TARGET=10.14 CC=clang CXX=clang++ pip install -e .
```
Expand All @@ -140,12 +158,14 @@ MACOSX_DEPLOYMENT_TARGET=10.14 CC=clang CXX=clang++ pip install -e .
Depending on the version of PyTorch, changes to some PyTorch headers may be needed before compilation. These are often discussed in issues in this repository.

After any necessary patching, you can go to "x64 Native Tools Command Prompt for VS 2019" to compile and install

```
cd pytorch3d
python3 setup.py install
```

After installing, you can run **unit tests**

```
python3 -m unittest discover -v -s tests -t .
```
Expand Down
Empty file modified dev/linter.sh
100755 → 100644
Empty file.
Empty file modified docs/examples/pulsar_basic.py
100755 → 100644
Empty file.
Empty file modified docs/examples/pulsar_basic_unified.py
100755 → 100644
Empty file.
Empty file modified docs/examples/pulsar_cam.py
100755 → 100644
Empty file.
Empty file modified docs/examples/pulsar_cam_unified.py
100755 → 100644
Empty file.
Empty file modified docs/examples/pulsar_multiview.py
100755 → 100644
Empty file.
Empty file modified docs/examples/pulsar_optimization.py
100755 → 100644
Empty file.
Empty file modified docs/examples/pulsar_optimization_unified.py
100755 → 100644
Empty file.
Empty file modified docs/tutorials/data/cow_mesh/cow.mtl
100755 → 100644
Empty file.
Empty file modified docs/tutorials/data/cow_mesh/cow.obj
100755 → 100644
Empty file.
Empty file modified docs/tutorials/data/cow_mesh/cow_texture.png
100755 → 100644
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified packaging/build_wheel.sh
100755 → 100644
Empty file.
Empty file modified packaging/conda/build_pytorch3d.sh
100755 → 100644
Empty file.
Empty file modified packaging/conda/switch_cuda_version.sh
100755 → 100644
Empty file.
Empty file modified projects/implicitron_trainer/experiment.py
100755 → 100644
Empty file.
Loading