11
11
12
12
HEADER_WIDTH = 60
13
13
14
- def execute_and_return (command_string : str ) -> Tuple [str , str ]:
15
- def _decode (subprocess_err_out_tuple ):
16
- return tuple (
17
- to_decode .decode ("UTF-8" ).strip ()
18
- for to_decode in subprocess_err_out_tuple
19
- )
20
-
21
- def execute_and_return_decoded_std_streams (command_string ):
22
- return _decode (
23
- subprocess .Popen (
24
- shlex .split (command_string ),
25
- stdout = subprocess .PIPE ,
26
- stderr = subprocess .PIPE ,
27
- ).communicate ()
28
- )
29
-
30
- std_out , std_err = execute_and_return_decoded_std_streams (command_string )
31
- return std_out , std_err
32
14
33
15
def find_file_recursive (folder , filename ):
34
- cmd = f'find { folder } -name { filename } '
35
- out , err = execute_and_return (cmd )
36
- if len (err ) > 0 :
37
- raise RuntimeError ('Something when wrong when trying to find file. Maybe you do not have a linux system?' )
16
+ import glob
17
+ outs = []
18
+ try :
19
+ for ext in ["so" , "dll" , "dylib" ]:
20
+ print (folder , filename , ext )
21
+ out = glob .glob (os .path .join (folder , "**" , filename + ext ))
22
+ outs .extend (out )
23
+ except Exception as e :
24
+ raise RuntimeError ('Error: Something when wrong when trying to find file. {e}' )
38
25
39
- return out
26
+ return outs
40
27
41
28
42
29
def generate_bug_report_information ():
@@ -46,26 +33,31 @@ def generate_bug_report_information():
46
33
print ('' )
47
34
48
35
if 'CONDA_PREFIX' in os .environ :
49
- paths = find_file_recursive (os .environ ['CONDA_PREFIX' ], '*cuda*so ' )
36
+ paths = find_file_recursive (os .environ ['CONDA_PREFIX' ], '*cuda*' )
50
37
print_header ("ANACONDA CUDA PATHS" )
51
38
print (paths )
52
39
print ('' )
53
40
if isdir ('/usr/local/' ):
54
- paths = find_file_recursive ('/usr/local' , '*cuda*so ' )
41
+ paths = find_file_recursive ('/usr/local' , '*cuda*' )
55
42
print_header ("/usr/local CUDA PATHS" )
56
43
print (paths )
57
44
print ('' )
45
+ if 'CUDA_PATH' in os .environ and isdir (os .environ ['CUDA_PATH' ]):
46
+ paths = find_file_recursive (os .environ ['CUDA_PATH' ], '*cuda*' )
47
+ print_header ("CUDA PATHS" )
48
+ print (paths )
49
+ print ('' )
58
50
59
51
if isdir (os .getcwd ()):
60
- paths = find_file_recursive (os .getcwd (), '*cuda*so ' )
52
+ paths = find_file_recursive (os .getcwd (), '*cuda*' )
61
53
print_header ("WORKING DIRECTORY CUDA PATHS" )
62
54
print (paths )
63
55
print ('' )
64
56
65
57
print_header ("LD_LIBRARY CUDA PATHS" )
66
58
if 'LD_LIBRARY_PATH' in os .environ :
67
59
lib_path = os .environ ['LD_LIBRARY_PATH' ].strip ()
68
- for path in set (lib_path .split (':' )):
60
+ for path in set (lib_path .split (':' if not os . sep == " \\ " else ";" )):
69
61
try :
70
62
if isdir (path ):
71
63
print_header (f"{ path } CUDA PATHS" )
0 commit comments