find cuda home
Browse files
app.py
CHANGED
@@ -1,6 +1,23 @@
|
|
1 |
import os
|
2 |
import subprocess
|
3 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
# Set the CUDA_HOME environment variable
|
5 |
os.environ['CUDA_HOME'] = '/usr/local/cuda'
|
6 |
os.environ['PATH'] = os.environ['CUDA_HOME'] + '/bin:' + os.environ['PATH']
|
|
|
1 |
import os
|
2 |
import subprocess
|
3 |
|
4 |
+
# Check common CUDA installation paths and set the correct one
|
5 |
+
cuda_paths = [
|
6 |
+
'/usr/local/cuda', # Default path
|
7 |
+
'/usr/local/cuda-11.0', # Example of a versioned path
|
8 |
+
'/usr/local/cuda-11.1',
|
9 |
+
'/usr/local/cuda-11.2'
|
10 |
+
]
|
11 |
+
|
12 |
+
cuda_home = None
|
13 |
+
for path in cuda_paths:
|
14 |
+
if os.path.exists(path):
|
15 |
+
cuda_home = path
|
16 |
+
break
|
17 |
+
|
18 |
+
if cuda_home is None:
|
19 |
+
raise EnvironmentError('CUDA installation not found. Please install CUDA or set CUDA_HOME manually.')
|
20 |
+
|
21 |
# Set the CUDA_HOME environment variable
|
22 |
os.environ['CUDA_HOME'] = '/usr/local/cuda'
|
23 |
os.environ['PATH'] = os.environ['CUDA_HOME'] + '/bin:' + os.environ['PATH']
|