Ask Your Question

How to maximize computing time

asked 2017-11-26 05:25:40 -0600

Gianni Petrella gravatar image

Hello everyone, I am running a short bruteforce program, and python is not using more than 40% of my CPU power, although there is no other software running and the RAM is at 20%... Since my software is quite heavy, I would like to force sage to use more CPU power. How can I do so? I am using Sagemath 8.0 for Windows

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2017-11-29 09:40:09 -0600

Richard_L gravatar image

Windows reports the total percentage of the CPU, that is, over all cores taken together. So, if your program runs one thread and it saturates one core of a four core machine, Windows will report 25%.

If your task is parallelizable, you can try adding


somewhere above the calculation. For "NN" substitute the number of threads you want to use.

Note that not all algorithms can be parallelized, so the directive might or might not help.

edit flag offensive delete link more


I would add that without knowing what the program is, it's hard to say whether the algorithm is purely CPU-bound. Since you the OP wrote that it's a "bruteforce" program I would think probably that it is, but depending on where data is coming from, or where results are written to, the use of exceptions/interrupts etc. there may be other bottlenecks preventing full CPU usage. But yes, one needs to make sure whether it's actually using 100% of a single core.

Iguananaut gravatar imageIguananaut ( 2018-01-05 07:03:39 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools


Asked: 2017-11-26 05:25:40 -0600

Seen: 56 times

Last updated: Nov 29 '17