Skip to content

Commit

Permalink
document how to override ~/.cache/torch_extensions (#959)
Browse files Browse the repository at this point in the history
  • Loading branch information
stas00 authored Apr 14, 2021
1 parent c87118b commit 7003d44
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions docs/_tutorials/advanced-install.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,23 @@ script in the repo. This will build a python wheel locally and copy it to all
the nodes listed in your hostfile (either given via --hostfile, or defaults to
/job/hostfile).

When the code using DeepSpeed is used for the first time it'll automatically build only the CUDA
extensions, required for the run, and by default it'll place them under
`~/.cache/torch_extensions/`. The next time the same program is executed these now precompiled
extensions will be loaded form that directory.

If you use multiple virtual environments this could be a problem, since by default there is only one
extensions directory, but different virtual environments may use different setups (e.g. different
python or cuda versions) and then the loading of a CUDA extension built by another environment will
fail. Therefore, if you need to you can override the default location with the help of the
`TORCH_EXTENSIONS_DIR` environment variable. So in each virtual environment you can point it to a
unique directory and DeepSpeed will use it to save and load CUDA extensions.

You can also change it just for a specific run with:

```bash
TORCH_EXTENSIONS_DIR=./torch-extensions deepspeed ...
```

## Building for the correct architectures

Expand Down

0 comments on commit 7003d44

Please sign in to comment.