@@ -729,14 +729,15 @@ def getfilename(var, text):
729
729
button .grid (row = row + 1 , column = 1 , stick = "nw" )
730
730
return
731
731
732
- from subprocess import run
732
+ from subprocess import run , CalledProcessError
733
733
def get_device_names ():
734
734
CUdevices = []
735
735
CLdevices = []
736
736
try : # Get OpenCL GPU names
737
737
output = run (['clinfo' ], capture_output = True , text = True , check = True , encoding = 'utf-8' ).stdout
738
738
CLdevices = [line .split (":" , 1 )[1 ].strip () for line in output .splitlines () if line .strip ().startswith ("Board name:" )]
739
- except FileNotFoundError : pass
739
+ except Exception as e :
740
+ pass
740
741
try : # Get AMD ROCm GPU names
741
742
output = run (['rocminfo' ], capture_output = True , text = True , check = True , encoding = 'utf-8' ).stdout
742
743
device_name = None
@@ -745,12 +746,14 @@ def get_device_names():
745
746
if line .startswith ("Marketing Name:" ): device_name = line .split (":" , 1 )[1 ].strip ()
746
747
elif line .startswith ("Device Type:" ) and "GPU" in line and device_name is not None : CUdevices .append (device_name )
747
748
elif line .startswith ("Device Type:" ) and "GPU" not in line : device_name = None
748
- except FileNotFoundError : pass
749
+ except Exception as e :
750
+ pass
749
751
# try: # Get NVIDIA GPU names , Couldn't test so probably not working yet.
750
752
# output = run(['nvidia-smi', '-L'], capture_output=True, text=True, check=True, encoding='utf-8').stdout
751
753
# CUdevices = [line.split(":", 1)[1].strip() for line in output.splitlines() if line.startswith("GPU:")]
752
754
# except FileNotFoundError: pass
753
- if CUdevices : CUdevices .append ('All' )
755
+ CUdevices .append ('All' ) if CUdevices else CUdevices .extend (['1' , '2' , '3' , 'All' ])
756
+ if not CLdevices : CLdevices .extend (['1' , '2' , '3' ])
754
757
return CUdevices , CLdevices
755
758
756
759
# Vars - should be in scope to be used by multiple widgets
0 commit comments