Skip to content

Commit 1258e48

Browse files
authored
Update DDFacet_cpus.patch
1 parent 78245e0 commit 1258e48

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

patches/DDFacet_cpus.patch

+9-6
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
1-
--- AsyncProcessPool_original.py 2020-09-23 18:36:31.232447610 +0200
2-
+++ DDFacet/Other/AsyncProcessPool.py 2020-09-23 18:36:16.989634477 +0200
3-
@@ -261,23 +261,27 @@
1+
--- AsyncProcessPool.py_backup 2021-10-20 22:58:56.203711272 +0200
2+
+++ AsyncProcessPool.py 2021-10-20 23:06:34.614377662 +0200
3+
@@ -259,25 +259,28 @@
4+
print>> log, "Parent and I/O affinities not specified, leaving unset"
5+
else:
46
print>> log, ModColor.Str("Fixing parent process to vthread %d" % self.parent_affinity, col="green")
57
- psutil.Process().cpu_affinity(range(self.ncpu) if not self.parent_affinity else [self.parent_affinity])
8+
+
69
+ avail_cores = psutil.Process().cpu_affinity()
710
+ psutil.Process().cpu_affinity(avail_cores[:self.ncpu] if not self.parent_affinity else [self.parent_affinity])
8-
+
11+
912
# if NCPU is 0, set to number of CPUs on system
1013
if not self.ncpu:
1114
self.ncpu = maxcpu
@@ -21,7 +24,7 @@
2124
+ print(ModColor.Str("Falling back to NCPU=%d" % (maxcpu)))
2225
self.ncpu = maxcpu
2326
self.procinfo = psutil.Process() # this will be used to control CPU affinity
24-
27+
2528
# create a queue for compute-bound tasks
2629
# generate list of CPU cores for workers to run on
2730
if isinstance(self.affinity, int) and (not self.affinity or self.affinity == 1):
@@ -31,7 +34,7 @@
3134
elif isinstance(self.affinity, int) and self.affinity == 2:
3235
cores = range(0, self.ncpu * 2, 2)
3336
elif isinstance(self.affinity, int) and self.affinity == -2:
34-
@@ -285,9 +289,10 @@
37+
@@ -285,9 +288,10 @@
3538
elif isinstance(self.affinity, list):
3639
cores = self.affinity[:self.ncpu]
3740
elif not self.affinity:

0 commit comments

Comments
 (0)