Managing Memory and CPU Time for large models
With small and medium-sized models, you don't usually have to worry about memory or waiting for long computations. Analytica handles things for you. But, for larger models, you may run out of RAM memory and/or the model may take an unreasonably long time to compute. This Section explains how Analytica uses memory, and suggests ways to make it faster or more memory-efficient.
How much memory does Analytica need?
Analytica represents numbers as double-precision, using 8 bytes each, plus 2 bytes overhead, for a total of 12 bytes. So, 2D Array with index I of size 100 and J of size 1000, may need about 100 x 1000 x 12 = 1,200,000 bytes = 1.2 Megabytes of memory (approximately -- actually a Megabyte is 1024x1024 = 1,048,576 bytes). If it is uncertain, and your Sample size is 200, it may take 240 Megabytes to store.
If the array is "sparse" -- most of its values are zero -- Analytica uses a more efficient representation, and may take much less memory.
If one array is a copy of part or all of another, the arrays may share elements, and again, they may need less memory than you would expect.
How can I measure how much time and memory is used by each variable?
Analytica Enterprise provides a function MemoryInUseBy(v) that returns the number of bytes used by the cached Mid and Probvalue of variable v. (If v hasn't yet been evaluated, it doesn't cause it to be evaluated. It just returns zero.) It also provides two read-only Attributes that apply to variables and User-defined Functions: EvaluationTime gives the time in seconds to evaluate the variable, not including its inputs. EvaluationTimeAll gives the time, including time to evaluate all its inputs (and their inputs, and so on). since the last call to ResetElapsedTimings, which resets all thes attributes back to zero.
Analytica Enterprise including a Profiling Library, which lists the memory used, evaluation time, for every variable in the model. You can order the results in descending order, to see the variables that use the most memory or most evaluation time at the top.
Enable comment auto-refresher