Parallel Processing
Parallel Processing shares out the runs that make up a Trial to two or more processor cores or other machines on your network. This allows your Trial or optimization to be executed more quickly. Runs are done in parallel, rather than sequentially.
What is Parallel Processing?
Simul8's parallel processing feature can dramatically reduce the time it takes for your simulation to run. Parallel Processing shares out the runs that make up a Trial or Optimization to spare cores on your PC or any networked PCs with Simul8 installed. This means the Trial or optimization is completed much quicker. If you had two cores available you can expect your Trial results in about half the time, if you have 4 cores available and another networked PC with 4 cores and with Simul8 installed, that's a total of 8 cores so you could expect to get your results in one eighth of the normal time, etc, potentially saving you vast amounts of time, and time is money!
Simul8's parallel processing only uses spare CPU cycles on the other PCs. Technical jargon that means you don’t have to worry about slowing down the processing power of the other networked PCs or your own PCs processing power being affected by other Simul8 users. Simul8 will only use the other PCs processing power when it is free, so if the PC is busy processing other tasks Simul8 won’t use it.
How to set it up
With recent releases of Simul8 the Parallel Processing feature is installed and set up ready to use. It is used automatically if the PC has more than 1 real* processor core (even cheap modern laptops do). Simul8 won't use it for Trials unless Simul8 judges the Trial will be quicker via Parallel Processing (there is a small overhead to start each parallel run and to collate the results so if your simulation runs very quickly and the number of runs is relatively low then Simul8 will still do the Trial sequentially). (The vast majority of real simulations of any size will always benefit from running trials in parallel.)
To force runs to be parallel, or to force runs to be sequential, use the check boxes in the Trials dialog, but the default of “Let Simul8 decide” is likely to be best.
How to set it up (multiple computers)
The above automated setup is only for using cores available on your PC. If you want to use Simul8s that are installed on other PCs on your local network do this:
Go to Files/Preferences/Results tab/Parallel Processor box.
Change the “Shared LAN folder” to the path of a folder on you local network where all the PCs and read and write files, eg \\MYserver\shared_folders\Simul8Team\parallel Use a foldername that people will not use for other purposes.
Do this on all the PCs where Simul8 is installed if you what them all to contribute processing power to getting results for anyone running Trials. You need a Simul8 license for each PC where it is installed.
What happens if multiple end users request Trials at the same time?
Requests to do runs for a trial are added to a queue and processed in the sequence in which the requests were received with all available cores in the network contributing to the workload. If user 1 starts a Trial at 12:01 and user 2 starts a Trial at 12:02 then all the runs for user 1 will be processed and then all the runs for user 2. User 2's visible instance of Simul8 will however start processing user 2's runs as fast as it would have if it had not been using the parallel feature so there is no disadvantage in attempting to make use of shared cores on the network.
What if a computer on the network closes down while working on my trial?
Your trial will still correctly complete because the runs to be conducted are placed in a pool and all the machines on the network monitor performance and, if a run allocated to a computer is later than expected returning results, then another machine on the network will duplicate that run and feed the results back.
Do all simulations work with parallel processing?
The default way most simulations are built and obtain their results works “out of the box” using parallel processing to run each of the runs of a trial on a different core (or even on a different computer) with no special action. This means the result in the Results Manager KPI tabs (the tabs that related to trial results at the end of a trial) will be exactly the same as had you run the trial sequentially.
However there are some special considerations if you have your own Visual Logic for processing the results of trials. This section explains how to make sure they still work in parallel mode.
For example if you use VL “On End Run” or “On Reset” to count the number of runs happening then the instance of Simul8 you are operating (and displays the results) will not “count” as many runs as the number of runs in the trial, because it won't directly perform them all. For example, on a 4-core computer, with 8 runs in the trial, it is likely that your Simul8 will only do two of the runs. It is very likely to do the first run in the trial, the other runs could be any of the remaining 7 runs.
If knowing which run in a trial is being executed is important then you must use the VL command “Get Trial Run Number”.
The common reason for wanting to know the run number is that modelers sometimes store data from each run in spreadsheets where the column relates to the run number. You will realize that, if your Simul8 only does a few of the runs in the trial, then many of the columns would be empty. To avoid this you should use the VL command “Set Sheet Column as First Run of Trial Results”. Do this at any time prior to the trial starting. This tells Simul8 it needs to pull back from each separate simulation run the data in this spreadsheet (or at least the relevant columns) for each run. Note: “Unset Sheet Column as First Run of Trial Results” will turn this command off.
By the time your Simul8's “On End Trial” VL event occurs (the place where you would use such data) the spreadsheet in your Simul8 will contain all the data from all the separate runs as if it had made all the runs itself.
Files: If your simulation saves data to files during each run of a trial then you should name the file in a way that relates to the run number (for example using Get Trial Run Number to help create the file name) so that every file has a unique name in that trial. Any files that your simulation creates during a run on any of the cores (or on other machines) will be automatically delivered back to the same location on your machine as if you had done the runs sequentially. All the files will be in the correct location by the time the “On End Trial” VL event occurs.
How many cores can I use?
The maximum number of cores you can use per Simul8 user license is 4.
If you install Simul8 on a server-class machine (or any machine where you want to use more than 4 cores) you can buy additional licenses to add to the machine to use a maximum of 16 cores (4 licenses) on each machine. Additional machines can be used together in a network with no theoretical limit to the number of cores that can be used together to get your results back quickly.
Please get in touch with us at Support@Simul8.com for further information and guidance to set this up.
Can I use cloud based machines (for example AWS) to run simulations in parallel?
Yes, this is a very effective way to get simulation results quickly. We have users making use of both AWS and Azure based server class VMs in groups to intensively run many simulations simultaneously.
The class of VM available changes over time so ask us when considering what type of cloud based VM to use. See the comment below* on Hyperthreading (avoid it because cloud services typically charge the same for Hyperthreaded cores as real cores and they are less effective (slower) for intensive analytical work).
Choose “compute class” machines where available because other classes typically ration/throttle available processing time to significantly less than 100% when the task is intense (like running Trials).
Notes
* Many processors have both “real” cores and “hyperthreaded” cores. Hyperthreaded cores emulate real cores and are useful for basic computing by less effective for analytical software. Many laptops and servers sold as “4-core” are really 2-core but with hyperthreading.