In mathematica, Eigenvalues is implemented internally using intel MKL.
When running
Eigenvalues[RandomReal[1.,{2000,2000}]
you will notice mathematica uses all available threads predefined in
SystemOptions["ParallelOptions" -> "MKLThreadNumber"]
However, if we use Eigenvalues in ParallelDo or ParallelTable
ParallelDo[Eigenvalues[RandomReal[1.,{2000,2000}],{1}]
the Threading feature of MKL automatically disabled.
How to avoid this? It is important, since I am working with very large matrices, and my cluster node has 24 cores. I have 6 tasks to do, I want to parallelize them, and each use 4 threads, so all the resources can be utilized. And what is more, can mathematica like MPI. In MPI when calling MKL threaded functions, MPI automatically, dynamically and evenly distribute all threads to different MPI processes. Is it possible in Mathematica?
ParallelDo[Run["! MathKernel -script "<>filename[index], {index, indexRange}]. – Emilio Pisanty Apr 24 '16 at 17:57"MKLThreadNumber"on the subkernels. – ilian Apr 24 '16 at 19:17ParallelEvaluate@SetSystemOptions["ParallelOptions"->"MKLThreadNumber"->4]works. However, is it possible to make the thread distribution dynamic? I mean when one of the parallel tasks is done, the available threads can distributed to the running tasks. I tried settingMKLThreadNumber"->24at first, but it harms the whole performance. – matheorem Apr 25 '16 at 00:45MKL_DYNAMIC, MKL will itself take care of using fewer threads when necessary. – ilian Apr 25 '16 at 20:34MKL_DYNAMIC? If it is the default setting, whyParallelDodisable it? – matheorem Apr 26 '16 at 02:57