diff --git a/ui/sd_internal/runtime.py b/ui/sd_internal/runtime.py index e9131b4d..5756aaf2 100644 --- a/ui/sd_internal/runtime.py +++ b/ui/sd_internal/runtime.py @@ -130,7 +130,7 @@ def device_init(device_selection=None): device_selection = device_selection.lower() if device_selection.startswith('gpu:'): device_selection = int(device_selection[4:]) - if device_selection != 'cuda' and device_selection != 'current': + if device_selection != 'cuda' and device_selection != 'current' and device_selection != 'gpu': if device_select(device_selection): if isinstance(device_selection, int): print(f'Setting GPU:{device_selection} as active') @@ -152,6 +152,8 @@ def is_first_cuda_device(device): if device is None: return False if device == 0 or device == '0': return True if device == 'cuda' or device == 'cuda:0': return True + if device == 'gpu' or device == 'gpu:0': return True + if device == 'current': return True if device == torch.device(0): return True return False diff --git a/ui/sd_internal/task_manager.py b/ui/sd_internal/task_manager.py index 55c6320c..a47e4263 100644 --- a/ui/sd_internal/task_manager.py +++ b/ui/sd_internal/task_manager.py @@ -305,9 +305,12 @@ def is_alive(name=None): nbr_alive = 0 try: for rthread in render_threads: - thread_name = rthread.name[len(THREAD_NAME_PREFIX):] - if name and thread_name != name: - if not runtime.is_first_cuda_device(name) and not runtime.is_first_cuda_device(thread_name): + thread_name = rthread.name[len(THREAD_NAME_PREFIX):].lower() + if name is not None: + if runtime.is_first_cuda_device(name): + if not runtime.is_first_cuda_device(thread_name): + continue + elif thread_name != name: continue if rthread.is_alive(): nbr_alive += 1