Skip to content

Commit

Permalink
assume I/O bound instead of CPU
Browse files Browse the repository at this point in the history
  • Loading branch information
adRn-s committed Oct 14, 2024
1 parent a29bd29 commit 46e3dd1
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions deeptools/mapReduce.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import multiprocessing
from deeptoolsintervals import GTF
from concurrent.futures import ThreadPoolExecutor
import random
from deeptoolsintervals import GTF

debug = 0

Expand Down Expand Up @@ -138,10 +138,8 @@ def mapReduce(staticArgs, func, chromSize,
"number of tasks".format(numberOfProcessors,
len(TASKS))))
random.shuffle(TASKS)
pool = multiprocessing.Pool(numberOfProcessors)
res = pool.map_async(func, TASKS).get(9999999)
pool.close()
pool.join()
with ThreadPoolExecutor(max_workers=numberOfProcessors) as executor:
res = list(executor.map(func, TASKS))
else:
res = list(map(func, TASKS))

Expand Down

0 comments on commit 46e3dd1

Please sign in to comment.