Using multiple CPU cores may allow you to finish individual simulations in shorter time. This is called parallel computing, and the way FLACS implements parallelism is called multithreading.
This article assumes that you have already set up a FLACS scenario ready for simulation.

What is a parallel/multithreaded simulation and when should you use it?

A computer has at least one Central Processing Unit (CPU) where calculations are done. For computers with multiple CPUs, or a single CPU with several cores, it is possible to use more than one core for the same FLACS simulation. This is called parallel processing. The work is split between the cores, which may allow your simulation to finish faster.

The speed gain over single thread runs is generally less than the number of cores used. For instance, using two CPU cores a simulation will run less than twice as fast as using a single core. The additional gain is less for each core added, and at some point the process is slowed by adding more cores, as the work of the different cores must be coordinated and data exchanged.

You should normally use no more than 4 cores for a single simulation. If you have a large number of simulations to run, it is faster to run as many simulations as you have cores, rather than using multiple cores for fewer simulations.

Only the following FLACS simulators currently support parallel processing:

  • FLACS-Explo
  • FLACS-Pool
  • FLACS-Dispersion

Parallel processing is not supported in the other FLACS modules, i.e. FLACS-DustEx, -Blast, -DDT, -Exhaust, -Fire, and -Inert.

How to run a multithreaded simulation from the command line

To run the FLACS parallel solver from the command line, type the following:
On Windows: runflacs version _omp <jobnumber> NumThreads=4
On Linux: run runflacs version _omp <jobnumber> NumThreads=4

NumThreads is the number of CPU cores used by Flacs.

To run one of the special variants of FLACS that have been parallelized, the variant argument has to be extended, for example (to start FLACS-Pool):
On Windows: runflacs version pool_omp <jobnumber> NumThreads=4
On Linux: run runflacs version pool_omp <jobnumber> NumThreads=4

How to run a multithreaded simulation in the RunManager

Select Options/Preferences and choose the Flacs tab. Here you can check the Parallel run box and select the number of threads to use per simulation.

Setting the number of threads for future FLACS simulations started from the RunManager.

Set the number of threads to 2-4 threads and click OK. Any simulations started after you have made this selection will be run in parallel with the given number of threads. Changing the setting will not affect simulations that are already running.

Note that this setting is retained if you close and open RunManager. You should make sure that this option is set to what you want it to be before starting simulations.

The RunManager will show you how many threads a running simulation is using:

The information about the FLACS simulations in the RunManager includes how many threads are used for a job.

Other programs may also be using CPU capacity. Check the overall CPU usage, e.g. by going to the Windows Task Manger (Ctrl-Shift-Esc). Here, you can see the CPU load from FLACS, from other processes, as well as the total CPU load. Under the Processes tab, scroll down until you see the FLACS process(es) (e.g. flacs2.5.4) (the threads are not used by the RunManager process itself).

The Windows Task Manager shows the resource consumption of the running processes.

If the total load is close to 100%, system slowdown may occur.