I am running a program written in python that makes heavy computations using theano.

As it is a very CPU-intensive program, it is disrupting all my other activies on my laptop.

For this reason I have been setting the nice level of the process to 19 and have used cpulimit to reduce its CPU usage to 10%.

Unfortunately these attempts were not effective, as the laptop sometimes gets stuck even for minutes.

Do you have any idea on how to tackle with this problem? How can I instruct the scheduler to behave properly?

The laptop is a Samsung Ultrabook (New Series 9) with an Intel Core i5-3317U. The operating system is Linux, Ubuntu 15.10 with kernel 4.2.0.

EDIT: The problem seems to be caused by trashing (low memory, constantly swapping)

  • 2
    Please update your question with information about memory usage of the program and your system. This sound like things being swapped out to disc, never good on a laptop with relatively slow drives. – Anthon Mar 18 '16 at 14:51
  • @Anthon : indeed, I was checking that and it seems that the process is using too much memory – fstab Mar 18 '16 at 15:01
  • @Anthon : yes, it was trashing all the way. Thanks! – fstab Mar 18 '16 at 15:23

This kind of non-responsiveness, although the CPU is limited is often caused by swapping (i.e. your process pushes other tasks out to disk and getting them back in is going to take a lot of time).

The best way to limit your memory usage is normally from within the program. If that is not possible and memory is consumed slowly (because it is not released) it might be necessary to kill the program ever so often and restart. Of course this only works if intermediate results are written on a regular basis.

From outside the program you can limit the amount of memory using the timeout script (this is not the timeout from coreutils!). It has a -m option to limit memory and will kill your process if it starts to consume too much memory.

If you cannot restart processing, then your options are

  • buying more memory for your machine if it can be installed
  • installing a SATA SSD if your laptop supports that and put swap on that
  • rewriting the software to work in smaller chunks

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.