This is an old revision of the document!
Table of Contents
Parallel computing
Metafor can be run in parallel on several cores of your computer, but this is not done automatically. By default Metafor uses a single core for the calculation (and another one for the visualisation when it is enabled).
To enable parallelism, you should prescribe the number of threads by adding a -k flag to the command line: for example:
Metafor -k 4
starts Metafor with 4 threads.
If you use the graphical user interface and you want to double click on the icon, you can duplicate the shortcut on the desktop (click on it, then CTRL-C, CTRL-V to make a copy). Rename it to “Run Parallel Metafor”. Then right-click on the icon and go to properties. Add -k 4 to the end of the “target” line:
Then click OK.
Doucle-click on the new icon and check that 4 threads are enabled:
In order to take advantage of parallel loops, you must do 2 things:
- you must use a parallel linear solver
- you must explicitly enable parallel loops in your python file
Parallel linear solver
The default linear solver is a basic sequential solver. Change the linear solver used to solve each linear system at each iteration with:
solman = metafor.getSolverManager() solver = DSSolver() solman.setSolver(solver)
Parallel loops
Add these lines anywhere in your python file after the line from wrap import *:
StrVectorBase.useTBB() StrMatrixBase.useTBB() ContactInteraction.useTBB()
The first line enable the parallel assembly of vectors. The second line does the same for matrices. The third line activates parallel contact management.
