nikigoli commited on
Commit
5611ce6
1 Parent(s): 7c89875

Printing CUDA_HOME location

Browse files
Files changed (1) hide show
  1. app.py +21 -0
app.py CHANGED
@@ -23,6 +23,7 @@ import os
23
  import subprocess
24
  from subprocess import call
25
  import shlex
 
26
  os.environ["GRADIO_TEMP_DIR"] = os.path.join(os.getcwd(), "tmp")
27
  cwd = os.getcwd()
28
  print("Current working directory:", cwd)
@@ -51,6 +52,26 @@ with open('./build_ops.sh', 'rb') as file:
51
  script = file.read()
52
  call(script, shell=True)
53
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
54
  class AppSteps(Enum):
55
  JUST_TEXT = 1
56
  TEXT_AND_EXEMPLARS = 2
 
23
  import subprocess
24
  from subprocess import call
25
  import shlex
26
+ import shutil
27
  os.environ["GRADIO_TEMP_DIR"] = os.path.join(os.getcwd(), "tmp")
28
  cwd = os.getcwd()
29
  print("Current working directory:", cwd)
 
52
  script = file.read()
53
  call(script, shell=True)
54
 
55
+ def find_cuda():
56
+ # Check if CUDA_HOME or CUDA_PATH environment variables are set
57
+ cuda_home = os.environ.get('CUDA_HOME') or os.environ.get('CUDA_PATH')
58
+
59
+ if cuda_home and os.path.exists(cuda_home):
60
+ return cuda_home
61
+
62
+ # Search for the nvcc executable in the system's PATH
63
+ nvcc_path = shutil.which('nvcc')
64
+
65
+ if nvcc_path:
66
+ # Remove the 'bin/nvcc' part to get the CUDA installation path
67
+ cuda_path = os.path.dirname(os.path.dirname(nvcc_path))
68
+ return cuda_path
69
+
70
+ return None
71
+
72
+ cuda_path = find_cuda()
73
+ print("Cuda path: " + str(cuda_path))
74
+
75
  class AppSteps(Enum):
76
  JUST_TEXT = 1
77
  TEXT_AND_EXEMPLARS = 2