5
5
6
6
set -e
7
7
8
- echo " Installing Triton from source..."
8
+ echo " 🚀 Installing Triton from source..."
9
+ START_TIME=$( date +%s)
10
+
11
+ # Function to show elapsed time
12
+ show_elapsed () {
13
+ CURRENT_TIME=$( date +%s)
14
+ ELAPSED=$(( CURRENT_TIME - START_TIME))
15
+ echo " ⏱️ Elapsed time: ${ELAPSED} s"
16
+ }
17
+
18
+ # Pre-flight checks
19
+ echo " 🔍 Running pre-flight checks..."
20
+
9
21
10
22
# Set Triton version/commit for cache consistency
11
23
TRITON_COMMIT=${TRITON_COMMIT:- " main" }
12
- echo " Target Triton commit/branch: $TRITON_COMMIT "
24
+ echo " 🎯 Target Triton commit/branch: $TRITON_COMMIT "
13
25
TRITON_CACHE_DIR=" /tmp/triton-cache"
14
26
TRITON_SOURCE_DIR=" /tmp/triton"
15
27
28
+ # Check disk space (need at least 10GB for Triton compilation)
29
+ AVAILABLE_SPACE=$( df /tmp | tail -1 | awk ' {print $4}' )
30
+ REQUIRED_SPACE=10485760 # 10GB in KB
31
+ if [ " $AVAILABLE_SPACE " -lt " $REQUIRED_SPACE " ]; then
32
+ echo " ⚠️ WARNING: Low disk space. Available: $(( $AVAILABLE_SPACE / 1024 / 1024 )) GB, Recommended: 10GB"
33
+ else
34
+ echo " ✅ Sufficient disk space available: $(( $AVAILABLE_SPACE / 1024 / 1024 )) GB"
35
+ fi
36
+
16
37
# Ensure we're in the conda environment
17
38
if [ -z " $CONDA_ENV " ]; then
18
39
echo " ERROR: CONDA_ENV is not set"
@@ -82,13 +103,24 @@ else
82
103
fi
83
104
84
105
echo " Cloning Triton repository..."
85
- git clone https://github.com/triton-lang/triton.git " $TRITON_SOURCE_DIR "
106
+ if ! git clone https://github.com/triton-lang/triton.git " $TRITON_SOURCE_DIR " ; then
107
+ echo " ❌ ERROR: Failed to clone Triton repository"
108
+ echo " This might be due to network issues or GitHub rate limiting"
109
+ exit 1
110
+ fi
111
+
86
112
cd " $TRITON_SOURCE_DIR "
87
113
88
114
# Checkout specific commit for reproducibility
89
- git checkout " $TRITON_COMMIT "
115
+ echo " Checking out commit: $TRITON_COMMIT "
116
+ if ! git checkout " $TRITON_COMMIT " ; then
117
+ echo " ❌ ERROR: Failed to checkout commit $TRITON_COMMIT "
118
+ echo " This might be due to an invalid commit hash or network issues"
119
+ exit 1
120
+ fi
121
+
90
122
ACTUAL_COMMIT=$( git rev-parse HEAD)
91
- echo " Using Triton commit: $ACTUAL_COMMIT "
123
+ echo " ✅ Using Triton commit: $ACTUAL_COMMIT "
92
124
fi
93
125
94
126
# Install build dependencies
@@ -115,21 +147,31 @@ else
115
147
echo " This will take 30-50 minutes for compilation"
116
148
fi
117
149
pip install -e .
150
+ show_elapsed
118
151
119
152
# Verify Triton installation
120
153
echo " Verifying Triton installation..."
121
- python -c " import triton; print(f'Triton version: {triton.__version__}')" || {
122
- echo " ERROR: Failed to import triton"
154
+ if python -c " import triton; print(f'Triton version: {triton.__version__}')" 2> /dev/null; then
155
+ python -c " import triton; print(f'Triton path: {triton.__file__}')"
156
+ echo " ✅ Triton installation verified successfully"
157
+
158
+ # Only save commit info after successful verification
159
+ echo " $ACTUAL_COMMIT " > " $TRITON_CACHE_DIR /commit"
160
+ echo " ✅ Cache information saved"
161
+
162
+ show_elapsed
163
+ echo " 🎉 Triton installation completed successfully!"
164
+ else
165
+ echo " ❌ ERROR: Failed to import triton"
123
166
echo " This might be due to libstdc++ version issues"
124
167
echo " Checking system libstdc++ version:"
125
- strings /usr/lib/x86_64-linux-gnu/libstdc++.so.6 | grep GLIBCXX | tail -5
168
+ strings /usr/lib/x86_64-linux-gnu/libstdc++.so.6 | grep GLIBCXX | tail -5 || echo " Could not check system libstdc++ "
126
169
echo " Checking conda libstdc++ version:"
127
- strings /opt/miniconda3/envs/tritonparse/lib/libstdc++.so.6 | grep GLIBCXX | tail -5
170
+ strings /opt/miniconda3/envs/tritonparse/lib/libstdc++.so.6 | grep GLIBCXX | tail -5 || echo " Could not check conda libstdc++"
171
+
172
+ # Clean up cache on failure to prevent corruption
173
+ echo " 🧹 Cleaning up cache due to installation failure..."
174
+ rm -f " $TRITON_CACHE_DIR /commit"
175
+
128
176
exit 1
129
- }
130
- python -c " import triton; print(f'Triton path: {triton.__file__}')"
131
-
132
- # Save commit info for cache validation
133
- echo " $ACTUAL_COMMIT " > " $TRITON_CACHE_DIR /commit"
134
-
135
- echo " Triton installation completed successfully!"
177
+ fi
0 commit comments