@@ -10,35 +10,74 @@ CHECK_WHEEL=false
1010PYTORCH_CURRENT_COMMIT=" "
1111VENV=false
1212CLEAN=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
1517 --source)
1618 BUILD_PYTORCH=true
19+ shift
1720 ;;
1821 --latest)
1922 # Build from the latest pytorch commit in the main branch.
2023 BUILD_PYTORCH=true
2124 BUILD_LATEST=true
25+ shift
2226 ;;
2327 --force-reinstall)
2428 FORCE_REINSTALL=true
29+ shift
2530 ;;
2631 --check-wheel)
2732 # Check if PyTorch wheel exists
2833 CHECK_WHEEL=true
34+ shift
2935 ;;
3036 --venv)
3137 VENV=true
38+ shift
3239 ;;
3340 -nc|--no-clean)
3441 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
3551 ;;
3652 --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
3877 exit 1
3978 ;;
4079 * )
41- echo " Unknown argument: $arg ."
80+ echo " Unknown argument: $1 ."
4281 exit 1
4382 ;;
4483 esac
@@ -117,11 +156,11 @@ if [ "$BUILD_PYTORCH" = false ]; then
117156 fi
118157 echo " **** Download nightly builds. ****"
119158 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' )
121160 TEMP_DIR=$( mktemp -d)
122161 WHEEL_PATTERN=" wheels-pytorch-py${PYTHON_VERSION} *"
123162 gh run download $RUN_ID \
124- --repo intel/intel-xpu-backend-for-triton \
163+ --repo $TRITON_REPO \
125164 --pattern " $WHEEL_PATTERN " \
126165 --dir $TEMP_DIR
127166 cd $TEMP_DIR /$WHEEL_PATTERN
0 commit comments