Matlab workers

From Dynamo
Jump to: navigation, search

In the Matlab jargon, matlab workers represent threads used by Matlab (or the MCR libraries when using the Dynamo standalone) when a computation is launched in parallel modus on a single node. A parallel computation in Dynamo should not use more matlab workers than the number of physical cores available in your system.

Find out the number of cores in a system

Dynamo needs to know the number of physical cores: many vendors report the number of virtual cores, which is usually twice as large. There are different approaches to find out this number in your system.

Through Matlab

In general, the most reliable way is to let Matlab ask the system:

 >> feature('numcores')
MATLAB detected: 2 physical cores.
MATLAB detected: 4 logical cores.
MATLAB was assigned: 4 logical cores by the OS.
MATLAB is using: 2 logical cores.
MATLAB is not using all logical cores because hyper-threading is enabled. 

However, this feature is undocumented, and could disappear or change function in next releases.

In the Dynamo Standalone

This same readout can be attained thorough the dynamo console

  Dynamo >> \feature('numcores')
MATLAB detected: 2 physical cores.
MATLAB detected: 4 logical cores.
MATLAB was assigned: 4 logical cores by the OS.
MATLAB is using: 2 logical cores.
MATLAB is not using all logical cores because hyper-threading is enabled. 

In Linux

In the system terminal, write:

cat /proc/cpuinfo | egrep "core id|physical id" | tr -d "\n" | sed s/physical/\\nphysical/g | grep -v ^$ | sort | uniq | wc -l

In the Mac

In the system terminal, write:

sysctl -a | grep machdep.cpu | grep core_count

sysctl -a | grep machdep.cpu | grep thread_count