Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Multiprocessing help
#1
Hello,

I have found the following lines of code to compute the array mx by the repeated calling of the function fun.

from tqdm import tqdm
from multiprocessing import Pool
from functools import partial

with Pool(processes = 16) as p_mx: 
    mx = tqdm(p_mx.imap(partial(fun, L), nodes()), total = n)
However, I would like to understand better what it does.

Also, I assigned 16 cores to the parallel pool, however, I noticed that during computations no more than 2 cores are running at the same time.

Could someone explain what this code does and why it could be that only part of the threads is working?

Thank you!
Reply


Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020