How to Execute Multithreaded Calculation?

To speed up algorithm calculation, one can use multithreaded calculation that allows for using several threads working simultaneously. To set up multithreaded calculation:

  1. Select the Multithreaded Calculation checkbox in the Set Up Calculation Execution dialog box.

  2. Select the Multithreaded Calculation checkbox on the Consumer page in the calculation block and/or control block editing wizard to execute single-threaded calculation.

As a result, multithreaded calculation will be executed for the required calculation blocks and/or control blocks during algorithm calculation. The maximum of 8 threads is used by default on multithreaded calculation. To change the maximum number of threads that will be used for parallel calculation of iterations, create the MsNumThreads parameter of the REG_DWORD type and set a value for it in the registry key HKEY_CURRENT_USER\Software\Foresight\Foresight Analytics Platform\10.0\Debug on local computers of all users. If the specified parameter value is less than the number of processor cores, the number of threads specified in the parameter will be used. If the specified parameter value is greater than the number of processor cores, the number of threads equal to the number of cores will be used.

NOTE. When specifying the MsNumThreads parameters take into account the architecture specificity of Intel processor 2019 or later. When calculating iterations, the doubled number of streams is used relative to the specified parameter value.

Multithreaded calculation includes several stages:

  1. Initialization. At the initialization stage, an individual collection of data source dimension selections for calculation blocks is created for each thread. When single-threaded calculation is used, the collection of data source dimension selections is created once.

NOTE. If the number of threads used in multithreaded calculation is increased, the time required to execute the initialization stage is increased.

  1. Calculation. At the calculation stage, all collections of data source dimension selections are distributed by threads, after which each thread executes consecutive algorithm calculation for each selection in the collection.

After executing the operations at each stage, the multithreaded calculation is finished.

By default, algorithm calculation is executed in the single-threaded mode. It is recommended to use single-threaded calculation if:

If a calculation block contains formulas, which calculation takes long time, and the number of iterations in formulas exceeds the number of threads, use multithreaded calculation to increase performance and to speed up block calculation due to parallel iteration calculation. Multithreaded calculation is available in multi-core processor systems: the number of threads is equal to the number of processor cores.

NOTE. The use of multithreaded calculation for a calculation block or control block is available only if at least one data consumer dimension is selected.

Multithreaded Calculation with Configured Filtering by Data

If one of calculation block's source cubes matches with a destination cube during filtering by data setup, the Multithreaded Calculation checkbox on the Consumer page in the calculation block editing wizard and the Multithreaded Calculation checkbox in the Set Up Calculation Execution dialog box will be ignored, and calculation will be executed in single-threaded mode. Otherwise, multithreaded calculation will be executed according to the selected checkboxes.

When filtering by data is set, multithreaded calculation will be executed by data in sources and not by selection. Therefore, threads will be divided by data points in data sources. In this case, calculation performance will depend on the number of data points that are changed during the calculation. If the number of changed data points is less than the number of threads, multithreaded calculation will be slower compared with the single-threaded calculation because initialization of several threads takes some time.

See also:

Questions and Answers | Algorithm Calculation| Selecting and Setting Up Data Consumer