2
$\begingroup$

I am using Mathematica on a Linux machine with 52 CPUs. I am sending my jobs in a batch mode and I am not using any parallel evaluation like ParallelTable[] or so. Unfortunately Mathematica is massively using CPUs without any benefit in speed (one job uses up to 4000% CPU). To reduce this waste CPU usage I want to limit the number of kernels each job can use to one. I tried KernelLaunch[1] and indeed

$KernelCount

is equal to one. However,

$ConfiguredKernels

gives me

{SubKernels`LocalKernels`LocalMachine[16, SubKernels`LocalKernels`LowerPriority -> True]}

which I interpret that still 16 (sub)kernels are running leading to 1600% CPU usage. I also tried

SetSystemOptions["ParallelOptions" -> "ParallelThreadNumber" -> 1] 

but again with no success.

How can I configure Mathematica such that only 100% of CPU power is used for one job?

$\endgroup$
  • 7
    $\begingroup$ If you are not using Parallel* functions then only one kernel is running. One kernel can make use of multiple CPU cores for certain functionality, e.g. linear algebra. To control this, take a look at SystemOptions["ParallelOptions"] and set the MKLThreadNumber and ParallelThreadNumber. $\endgroup$ – Szabolcs Jul 9 '18 at 11:26
  • $\begingroup$ It worked with this:LaunchKernels[1]; SetSystemOptions["ParallelOptions" -> "ParallelThreadNumber" -> 1]; SetSystemOptions["ParallelOptions" -> "MKLThreadNumber" -> 1]; The command SetSystemOptions["MKLThreads" -> 1] is no longer working. The new one ist SetSystemOptions["ParallelOptions" -> "MKLThreadNumber" -> 1] $\endgroup$ – Volker Jul 9 '18 at 13:54
  • 1
    $\begingroup$ @Volker probably you can post this as an answer including the code in formatted form. $\endgroup$ – rhermans Jul 9 '18 at 22:30

Your Answer

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

Browse other questions tagged or ask your own question.