The memory requirements for a GoldSim simulation are affected by a number of parameters:
- The number of outputs that save final value and/or time history results
- The size of these outputs. A scalar data type requires 4-byte (float) for a single result value (i.e. one final value or a result at a single time point)
- The number of “time steps” divided by “plot every N-th point” value. Note: this only affects time history results.
- The number of phases for which the “Save phase final values” flag is checked. Note: this only affects final value results.
- The number of realizations simulated and the number of histories saved. If you save less histories than simulated GoldSim records and manages four extra result values for every output saving time histories, which are used to generate results statistics representing an approximation of the actual results. The data amount of these four extra values equals the data amount of four realization results. With other words, if you simulated 100 realization saving 97-99 histories would actually require more time history result memory than saving all 100 realizations. Saving 10 histories of 100 realizations requires only 14% (10% for 10 saved histories + 4% for statistics) of the time history result memory than saving all 100 histories.
Note: GoldSim stores the realization results in memory during the simulation of a realization. When the realization is complete, the results are offloaded to scratch files on disk (typically in your default temp location). During post-processing, these results are loaded on demand and, a certain amount of it, is cached in memory for faster access. When saving a model file with results, result data from the scratch files are compressed and saved in the GSM file.The runtime in memory requirement for time history results equals the time history result size for a single realization (if all histories are saved) or five realizations (if fewer histories are saved than realization are simulated).
Then there is the operating system… A 32-bit Windows allows a single process, such as GoldSim, to allocate a maximum of 2 GB of memory. With some tricks and hacks this can be expanded to slightly more than 3 GB. This technology is called 4-Gigabyte Tuning (4GT) and is supported by GoldSim. On 64-bit Windows Vista and Windows 7 a single GoldSim process can access up to 4 GB of memory.
Let’s put all this into perspective:
Assume a simple, new model with a single scalar Expression element. By pressing F2 and then clicking the Information tab you will get access to some model statistics:
It shows that the model saves one Time History and one Final Value result. A default model in GoldSim simulates a single realization in 100 steps (i.e. 101 time points). Hence, the memory requirement for one time history value is: 101 * 4 bytes = 404 bytes.
Let’s change the model duration to 100,000 days and the number of steps to 100,000. (Note: you have to close the Simulation Settings dialog to apply the changes and then re-open it to see the effect on result size and memory requirements.)
100,001 * 4 byte = 400,004 bytes = 390 KB (divided by 1,024 Bytes)
Of course, a typical model has many elements and many more outputs. Let’s simulate that by changing the scalar Expression to a matrix of 100 x 500 items. In terms of time history and final value results this is equivalent to 50,000 scalar outputs.
The model now requires 19 GB to store the results of all outputs (in our case represented by a single huge output) for a single realization (history). This number will further increase if I change the number of realizations to be simulated. Let’s say I set it to 100. The on-disk requirement increases to 100 * 19 GB, or 1.9 TB, assuming that all 100 histories are saved. However, the in-memory requirement would remain at 19 GB because GoldSim only keeps results of the current realization in memory.
Still, that’s way too much. So let’s see how this can be decreased. I already explained above which parameters affect the result size. First, I would focus on (time) resolution. Simulating 100,000 steps is one thing, and GoldSim will happily do it. But why do you need to save results in such a high resolution. If you were to display a time history chart on a huge screen you would still only see 1,000 or 2,000 points maximum (assuming a horizontal resolution of more than 2,000 pixels. I suggest to change the “Plot Every” setting on the Time tab of the Simulation Settings accordingly:
Again, this setting only affects how many time points are saved for each time history result. The change causes 1,000 instead of 100,000 results to be saved for each time history. Accordingly, the total memory requirement decreased to about 190 MB.
Another way to change the resolution of the saved values is to use "Reporting Periods".
The settings used above force GoldSim to save daily results every 10 days or every 10 Basis Steps. Obviously, memory requirements would increase to about 2 GB.
The second parameter you can control is for which outputs GoldSim saves results. You can do this at any output, element or containment level. Left-click the output port of an element (the red triangle) to open the output list of an element. Then right-click an output to see its context menu. In it you can define whether results should be saved:
For elements you can control result saving for all outputs of the element at once:
Pretty much all GoldSim elements support the Save Results check boxes.
Container elements allow you to change the setting for all elements inside the container, recursively.
If you uncheck the setting at the Model container result saving is disabled for all outputs of the model.
Active Result elements in GoldSim are smart enough to enable saving of results for any referenced output. If you only want to save results currently referenced in Result elements you would simple uncheck the above boxes at the model root container. When you start the simulation GoldSim automatically activates any required results without saving any extra overhead.