Loading...
 

Multi processing


As from version 2.4 the Huygens Compute Engine (CE) uses the OpenMP standard for multiprocessing.

The multiprocessing behavior of the CE can be controlled with OpenMP environment variables or from the Tcl Huygens layer.

Environment variables:
  • The number of threads to be used is controlled through OMP_NUM_THREADS, for example: setenv OMP_NUM_THREADS 2
  • Allow the operating system to dynamically adjust the number of threads depending on system load: OMP_DYNAMIC (TRUE, FALSE), for example setenv OMP_DYNAMIC TRUE. If OMP_NUM_THREADS is set then the number of threads varies between 1 and OMP_NUM_THREADS, at least on Irix.

Tcl Huygens layer:

huOpt cpu ?-min ? ?-max? ?-mode ? ?-query ?

This allows setting of the minimum and maximum to the number of threads. Mode compliant is equal to OMP_DYNAMIC TRUE. With '-mode ignore' the CE tries to always use the max thread number.
With the 'query' mode the current state can be queried.
Example: huOpt cpu -max 4 -mode ignore to run on four threads regardless of system load.


Multithread check


If you used the linux program top to monitor system activity note that in some versions you need to type 'H' (capital!!) or sometimes '1' in order to enable the threads display. Otherwise merely the primary process will be listed. Another simple graphical tool which can be handy for monitoring cpu usage
is xosview.


 Cpu0  : 68.3% us,  9.9% sy,  0.0% ni,  0.0% id,  0.0% wa,  4.0% hi, 17.8% si
Cpu1  : 100.0% us,  0.0% sy,  0.0% ni,  0.0% id,  0.0% wa,  0.0% hi, 0.0% si

Try running a deconvolution task in the huygens e.g. with Classic Maximum Likelihood Estimation (CMLE), or visualize an image in the Huygens Essential with the Fast Mip renderer or the iso Surface Renderer, and you will clearly see that both cpus work "full speed".
Only one huygens process is shown, but that is only because the
new 'top's display merely the master processes and not their children.

Benchmarking


You can also test the multi-processing capabilities of the Huygens with a
→ Huygens Benchmark.

Run the benchmark twice: once on 1 cpu and the second time on 2 cpus. The results will unequivocally show a substantial speed gain in the later case.

There are two ways to force the Huygens to run on merely a single cpu. One
is by setting the environmental variable OMP_NUM_THREADS to 1, and the
other with the huygens-tcl command:

huOpt cpu -max 1

Thus, the benchmarks can be executed as explained in → Huygens Benchmark and using this command to change the cpu usage.

Unpack the benchmark file and go to the directory to which the files were extracted.

One cpu:

1. Start the Huygens Scripting with the command huscript <br>
2. type in the tclsh of the huscript
% huOpt cpu -max 1
3. Execute the benchmark script.

Two cpus:

1. Start the Huygens Scripting with the command huscript <br>
2. type in the tclsh of the huscript
% huOpt cpu -max 2
3. Execute the benchmark script.