Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

There are some evaluations which are automatically parallelized or multithread if there are cores available.( for example, Eigenvalues)

But I don't want the evaluation to be automatically multithreaded, I want it to use only one core. How can I do it?

share|improve this question
    
Notice that you can run 2 threads on one core too, only if you have multithreaded processor. But it is not the same thing as parallel computing. –  Kuba Aug 30 '13 at 13:35
    
@Kuba Yeah! I always noticed this. Sometimes, my parallel evaluations automatically became several 50% cpu running, If there are other people running their calculation on the same remote computer –  matheorem Aug 30 '13 at 13:38

1 Answer 1

up vote 9 down vote accepted

For EigenValues this will work:

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

For functions which are using MKL libraries you can also use:

SetSystemOptions["MKLThreads" -> 1]

Source

It is wrriten there that you can reset it to the defaults by "ParallelThreadNumber" -> $ProcessorCount. But if you have cores that can be multithreaded then this number can be greater than $ProcessorCount.

  • Somewhere in documentation center is example with "MKLThreads" (I know it from there) but I can't find it :) I appreciate link if someone knows it :).
share|improve this answer
    
MKL libraries? I don't have an idea about "MKL libraries". What is this? –  matheorem Aug 30 '13 at 13:40
    
Math kernel library is used by for example Solve. –  Kuba Aug 30 '13 at 13:43
    
Its kind of an all in one math antibiotic for your Intel processor kernel ;) –  PlatoManiac Aug 30 '13 at 13:44
    
@Kuba It seems that it is undocumented? If I set it to one, After I restart the mathematica, can the value be back to one? –  matheorem Aug 30 '13 at 13:45
1  
@Kuba Oh, SetSystemOptions["MKLThreads" -> 1] actually works for the NIntegrate. My fault. Thank you for your help! But I still wish you could look at the post I mentioned, there are peculiarities which I can't understand. –  matheorem Aug 30 '13 at 13:57

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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