0

Currently have a data-intensive process running on Ubuntu Version 11.04 that needs multiple CPU usage.

I wrote the command, given I have 4 cores

taskset -c 0,1,2,3 python sample.py

I am only achieving 100% on one CPU, and the others are idle <2%.

Any tips how to ramp all 4 CPUs up to 100% to make the task faster?

Cheers!

msturdy
  • 10,479
  • 11
  • 41
  • 52

2 Answers2

0

Application needs to be prepared to use more than one core, its tasks need to be divided into separate threads. Otherwise there is little to no usage of more than one CPU.

larw
  • 37
  • 5
0

Standard python interpreter (CPython) has GIL that prevents running more than one thread on a CPU. Consider using multiprocessing module or use alternative implementations such as PyPy.

myaut
  • 11,174
  • 2
  • 30
  • 62