I have a Python script that manipulates a dataset of 3 million rows, and the CPU usage is 25% only, so how to improve the processing speed by using multiple cores in CPU or full utilization of CPU to increase the processing speed?
Inputs needed on multiprocessing and process pool.
import multiprocessing
pool = multiprocessing.Pool(multiprocessing.cpu_count())
def some_function_you_want_executed_in_parallel(args):
pass # logic goes here
arg_list = [] # put input arguments here
results = pool.map(some_function_you_want_executed_in_parallel, arg_list)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.