ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Fri, 05 Jan 2018 14:03:39 +0100How to maximize computing timehttps://ask.sagemath.org/question/39795/how-to-maximize-computing-time/ 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 WindowsSun, 26 Nov 2017 12:25:40 +0100https://ask.sagemath.org/question/39795/how-to-maximize-computing-time/Answer by Richard_L for <p>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</p>
https://ask.sagemath.org/question/39795/how-to-maximize-computing-time/?answer=39842#post-id-39842Windows 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
Parallelism().set(nproc=NN)
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.Wed, 29 Nov 2017 16:40:09 +0100https://ask.sagemath.org/question/39795/how-to-maximize-computing-time/?answer=39842#post-id-39842Comment by Iguananaut for <p>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%. </p>
<p>If your task is parallelizable, you can try adding </p>
<pre><code>Parallelism().set(nproc=NN)
</code></pre>
<p>somewhere above the calculation. For "NN" substitute the number of threads you want to use. </p>
<p>Note that not all algorithms can be parallelized, so the directive might or might not help.</p>
https://ask.sagemath.org/question/39795/how-to-maximize-computing-time/?comment=40471#post-id-40471I 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.Fri, 05 Jan 2018 14:03:39 +0100https://ask.sagemath.org/question/39795/how-to-maximize-computing-time/?comment=40471#post-id-40471