Python Forum
CPU load at approx. 30% when multiprocessing
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
CPU load at approx. 30% when multiprocessing
#1
Hi,
I am having trouble understanding the issue with my code. (This is just a part of my project with changed names to make it the code clearer)

def eval(val_list, value1):
   prod = partial(boolean_func, value1= value1)
   boolean_list = pool.map(func = prod, iterable = val_list, chunksize = 50)
val_list is a list of roughly 250 items und boolean_func checks if a item of val_list and value1 match to a specific "rule"
boolean_list later in the code is iterated over to work with based on the evaluation.

When I run my code the CPU load is rather evenly distributed between the cores to reach a maximal CPU load of approx. 30% on each core. How can I increase the CPU usage?
Because if I compare my code to the following loop:

boolean_list = []
for item in val_list:
   boolean_list.append(boolean_func(item, value1))
The loop runs faster than my code although it doesn't use multiprocessing.
What am I missing?

Thank you
Reply


Messages In This Thread
CPU load at approx. 30% when multiprocessing - by freak14 - Jun-19-2019, 12:10 PM

Forum Jump:

User Panel Messages

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