# DisableMultithreaded

*New to Analytica 5.2*

This system variable controls which multithreaded algorithms within Analytica are *disabled*. The system variable contains a table of checkboxes, one for each internal multithreaded algorithm. Note that when a checkbox is on, it means that the corresponding algorithm is *disabled*. The default is for all algorithms to be enabled, so none of the checkboxes start with checkmarks.

## When to use

There should be no reason to turn off a particular algorithm unless a bug is discovered at some point, especially if it discovered after Analytica has already been released. In that case, this system variable allows you to disable the problematic multithreaded algorithm without turning off all multithreading globally.

## What it does

When a multithreaded algorithm is enabled (the flag is off), then the engine has the option of using the multithreaded algorithm or the single-threaded version in each specific case it encounters. When the algorithm is disabled (the flag is on), the engine is restricted to using the single-threaded version of the algorithm. In most cases, the engine will only use the multithreaded version when the arrays being operated on are large enough to justify the overhead of multithreading.

Any particular flag can be overridden for a single expression using SetEvaluationFlag.

## How to change

To change the flags in DisableMultithreaded:

- Enter edit mode
- Press F12 to open the typescript window
- Type:
`ShowWindow(DisableMultithreaded,'EditTable')`

Remember that a checkbox *disables* the algorithm, so you probably want almost all checkboxes to be OFF.

## Saving

Changes to these flags are stored with the model file.

## Algorithms

The following multithreaded algorithm (calculations) can be disabled from DisableMultithreaded:

`'Aggregate'`

: evaluation of the function Aggregate.`'Arithmetic'`

: arithmetic operators (+, *, -, /, ^) on large arrays.`'Assignment'`

:copying arrays during assignment with :=.`'Beta'`

:evaluation of the Beta distribution function.`'Binomial'`

:evaluation of the Binomial distribution function.`'Comparison'`

:comparison operators (=, <>, >, >=, <, <=) on large arrays~`'DefineOptimization'`

:Populating multiple optimization instances in parallel during DefineOptimization`'DetermineCellTypes'`

:An numerous points during calculations and in the UI, the engine needs to determine which data types are and are not present in an array. When doing so, it can walk large arrays in parallel.`'FunctionIteration'`

:When the call to a thread-safe built-in function is iterated by array abstraction, the separate calls may be computed on separate threads. A different flag governs the more trivial scalar functions (such as Abs(x) that involves only scalars), whereas this one involves functions that might get passed arrays.`'Gamma`

:evaluation of the [[Gamma] distribution function.`'If'`

:After a, b and c are computed, this flag impacts the algorithm that merges these into the final result, for If, IfAll and IfOnly.`'IsEq'`

:Internal operations when Analytica needs to test whether two arrays' contents are equal.`'LogNormal'`

:evaluation of the LogNormal distribution function.`'MatrixMultiply'`

:evaluation of the MatrixMultiply function.`'NegBinomial'`

:evaluation of the NegBinomial distribution function.`'Normal`

':evaluation of the Normal distribution function.`'Reform'`

:The internal algorithm that transforms results into canonical order.`'ScalarFunctions'`

:When scalar functions (usually very simple functions, involving scalar inputs and outputs and no side effects, such as Sqrt, Abs, Sin, etc., are iterated over arrays.`'Sequence'`

:Evaluation of the Sequence function.`'SliceSubscript'`

|Evaluation of Slice and Subscript operations, including the functions, the operators, and internal use of slicing and subscripting by other functions and UI.`'Sort'`

:The sort performed within SortIndex, Sort, Rank, RankCorrel, GetFract (sometimes), as well as other internal algorithms and UI code that uses sorts.`'SumMax'`

:evaluation of function Sum, Max, SetUnion, and SetIntersection.

## Default

When the system variable has not been changed (and hence isn't already saved with the model), the default value is taken from the following registry setting, if present (which can be changed using RegEdit):

`HKEY_CURRENT_MACHINE/Software/Lumina Decision Systems/Analytica/5.2`

For ADE, replace "Analytica" with "ADE", and for releases after 5.2, change the version number accordingly.

A change to the registry setting changes the setting for all models running on your computer, except the rare cases where someone has changed the system variable explicitly.

Enable comment auto-refresher