@@ -10,35 +10,74 @@ CHECK_WHEEL=false
10
10
PYTORCH_CURRENT_COMMIT=" "
11
11
VENV=false
12
12
CLEAN=true
13
- for arg in " $@ " ; do
14
- case $arg in
13
+ TRITON_REPO=intel/intel-xpu-backend-for-triton
14
+ TRITON_REPO_BRANCH=main
15
+ while [[ $# -gt 0 ]]; do
16
+ case " $1 " in
15
17
--source)
16
18
BUILD_PYTORCH=true
19
+ shift
17
20
;;
18
21
--latest)
19
22
# Build from the latest pytorch commit in the main branch.
20
23
BUILD_PYTORCH=true
21
24
BUILD_LATEST=true
25
+ shift
22
26
;;
23
27
--force-reinstall)
24
28
FORCE_REINSTALL=true
29
+ shift
25
30
;;
26
31
--check-wheel)
27
32
# Check if PyTorch wheel exists
28
33
CHECK_WHEEL=true
34
+ shift
29
35
;;
30
36
--venv)
31
37
VENV=true
38
+ shift
32
39
;;
33
40
-nc|--no-clean)
34
41
CLEAN=false
42
+ shift
43
+ ;;
44
+ --triton-repo)
45
+ TRITON_REPO=" $2 "
46
+ shift 2
47
+ ;;
48
+ --triton-repo-branch)
49
+ TRITON_REPO_BRANCH=" $2 "
50
+ shift 2
35
51
;;
36
52
--help)
37
- echo " Example usage: ./install-pytorch.sh [--source | --latest | --force-reinstall | --check-wheel | --venv]"
53
+ cat << EOF
54
+ Usage: ./install-pytorch.sh [options]
55
+
56
+ Options:
57
+ --source Build PyTorch from source using pinned commit.
58
+ --latest Build PyTorch from the latest commit in the main branch.
59
+ --force-reinstall Force reinstallation of PyTorch and pinned dependencies.
60
+ --check-wheel Check if a prebuilt PyTorch wheel already exists before building.
61
+ --venv Activate Python virtual environment from .venv/ before installation.
62
+ -nc, --no-clean Do not clean existing PyTorch source directory before build.
63
+
64
+ --triton-repo <repo> GitHub repo to fetch prebuilt PyTorch wheels from
65
+ (default: intel/intel-xpu-backend-for-triton)
66
+
67
+ --triton-repo-branch <branch> Branch to fetch prebuilt PyTorch wheels from
68
+ (default: main)
69
+
70
+ --help Show this help message and exit.
71
+
72
+ Examples:
73
+ ./install-pytorch.sh --source
74
+ ./install-pytorch.sh --latest --venv
75
+ ./install-pytorch.sh --triton-repo my_fork/intel-xpu-backend-for-triton --triton-repo-branch dev
76
+ EOF
38
77
exit 1
39
78
;;
40
79
* )
41
- echo " Unknown argument: $arg ."
80
+ echo " Unknown argument: $1 ."
42
81
exit 1
43
82
;;
44
83
esac
@@ -117,11 +156,11 @@ if [ "$BUILD_PYTORCH" = false ]; then
117
156
fi
118
157
echo " **** Download nightly builds. ****"
119
158
PYTHON_VERSION=$( python -c " import sys; print(f'{sys.version_info.major}.{sys.version_info.minor}')" )
120
- RUN_ID=$( gh run list --workflow nightly-wheels.yml --branch main -R intel/intel-xpu-backend-for-triton --json databaseId,conclusion | jq -r ' [.[] | select(.conclusion=="success")][0].databaseId' )
159
+ RUN_ID=$( gh run list --workflow nightly-wheels.yml --branch $TRITON_REPO_BRANCH -R $TRITON_REPO --json databaseId,conclusion | jq -r ' [.[] | select(.conclusion=="success")][0].databaseId' )
121
160
TEMP_DIR=$( mktemp -d)
122
161
WHEEL_PATTERN=" wheels-pytorch-py${PYTHON_VERSION} *"
123
162
gh run download $RUN_ID \
124
- --repo intel/intel-xpu-backend-for-triton \
163
+ --repo $TRITON_REPO \
125
164
--pattern " $WHEEL_PATTERN " \
126
165
--dir $TEMP_DIR
127
166
cd $TEMP_DIR /$WHEEL_PATTERN
0 commit comments