-
Notifications
You must be signed in to change notification settings - Fork 488
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[developer] Add a script to automate building torch_xla (#7876)
- Loading branch information
Showing
2 changed files
with
35 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#!/bin/bash | ||
|
||
set -e # Fail on any error. | ||
set -x # Display commands being run. | ||
|
||
# Change to pytorch directory. | ||
cd "$(dirname "$(readlink -f "$0")")" | ||
cd ../../ | ||
|
||
python3 setup.py bdist_wheel | ||
python3 setup.py install | ||
cd .. | ||
|
||
# Optionally install torchvision. | ||
if [ -d "vision" ]; then | ||
cd vision | ||
python3 setup.py develop | ||
fi | ||
|
||
cd .. | ||
cd pytorch/xla | ||
python3 setup.py develop | ||
|
||
# libtpu is needed to talk to the TPUs. If TPUs are not present, | ||
# installing this wouldn't hurt either. | ||
pip install torch_xla[tpu] -f https://storage.googleapis.com/libtpu-releases/index.html | ||
|
||
# Test that the library is installed correctly. | ||
python3 -c 'import torch_xla as xla; print(xla.device())' | ||
|