feat: allow users to specify the number of threads when running on CPU (#1601)

* CPU_NUM_THREADS

* refactor: optimize code, type is already strict

---------

Co-authored-by: Manuel Schmid <manuel.schmid@odt.net>
This commit is contained in:
Maxim Saplin
2024-02-25 17:14:17 +01:00
committed by GitHub
co-authored by Manuel Schmid
parent ef1999c52c
commit 4d34f31a72
3 changed files with 5 additions and 2 deletions
+3
View File
@@ -60,6 +60,9 @@ except:
pass
if args.always_cpu:
if args.always_cpu > 0:
torch.set_num_threads(args.always_cpu)
print(f"Running on {torch.get_num_threads()} CPU threads")
cpu_state = CPUState.CPU
def is_intel_xpu():