This commit is contained in:
67
0001-Handle-a-missing-joblib.patch
Normal file
67
0001-Handle-a-missing-joblib.patch
Normal file
@@ -0,0 +1,67 @@
|
||||
From e2a041ae39c644c17e808a4f6d9d8bc3beaa15f0 Mon Sep 17 00:00:00 2001
|
||||
From: Tom Rix <Tom.Rix@amd.com>
|
||||
Date: Tue, 4 Mar 2025 05:36:00 -0800
|
||||
Subject: [PATCH] Handle a missing joblib
|
||||
|
||||
---
|
||||
tensilelite/Tensile/Parallel.py | 29 ++++++++++++++++++++++-------
|
||||
1 file changed, 22 insertions(+), 7 deletions(-)
|
||||
|
||||
diff --git a/tensilelite/Tensile/Parallel.py b/tensilelite/Tensile/Parallel.py
|
||||
index cf9de09db788..a146c3f6f14d 100644
|
||||
--- a/tensilelite/Tensile/Parallel.py
|
||||
+++ b/tensilelite/Tensile/Parallel.py
|
||||
@@ -28,17 +28,28 @@ import sys
|
||||
import time
|
||||
import concurrent.futures
|
||||
|
||||
-from joblib import Parallel, delayed
|
||||
+try:
|
||||
+ import joblib
|
||||
+except:
|
||||
+ joblib = None
|
||||
+
|
||||
+if joblib != None:
|
||||
+ from joblib import Parallel, delayed
|
||||
|
||||
def joblibParallelSupportsGenerator():
|
||||
- import joblib
|
||||
+ try:
|
||||
+ import joblib
|
||||
+ except:
|
||||
+ joblib = None
|
||||
+ if joblib == None:
|
||||
+ return True
|
||||
from distutils.version import StrictVersion
|
||||
joblibVer = joblib.__version__
|
||||
return StrictVersion(joblibVer) >= StrictVersion("1.4.0")
|
||||
|
||||
def CPUThreadCount(enable=True):
|
||||
from .Common import globalParameters
|
||||
- if not enable:
|
||||
+ if not enable or joblib == None:
|
||||
return 1
|
||||
else:
|
||||
if os.name == "nt":
|
||||
@@ -190,10 +201,14 @@ def ParallelMap2(function, objects, message="", enable=True, multiArg=True, retu
|
||||
from . import Utils
|
||||
threadCount = CPUThreadCount(enable)
|
||||
|
||||
- if threadCount <= 1 and globalParameters["ShowProgressBar"]:
|
||||
- # Provide a progress bar for single-threaded operation.
|
||||
- callFunc = lambda args: function(*args) if multiArg else lambda args: function(args)
|
||||
- return [callFunc(args) for args in Utils.tqdm(objects, message)]
|
||||
+ if threadCount <= 1 :
|
||||
+ rv = []
|
||||
+ for args in Utils.tqdm(objects, message):
|
||||
+ if multiArg:
|
||||
+ rv.append(function(*args))
|
||||
+ else:
|
||||
+ rv.append(function(args))
|
||||
+ return rv
|
||||
|
||||
countMessage = ""
|
||||
try:
|
||||
--
|
||||
2.47.1
|
||||
|
Reference in New Issue
Block a user