Parallel processing in water distribution system analysis

HydraCAL simulates thousands of scenarios in a short amount of time. You might ask, how this is done? Apart from preparing all of the scenarios automatically, which was discussed at “How can HydraCAL help me?” page, HydraCAL benefits from parallel processing.

Cmputer Stack HydraCAL

What is parallel processing?

People often imagine a room staked with computer racks when it comes to parallel processing, This was true 10 year ago. Except your laptops, these days you can find dual or quad core CPUs on your cell phones or gamming consuls, which allow you to benefit from parallel processing. In a nonprofessional’s term, parallel processing means dividing a task (simulation) among several persons (computers). Each person undertakes part of the job and together, they can deliver the results in a much shorter time. The reality is that not all tasks could be done in parallel. For instance, it is not possible to build a building floors in parallel. You have to build the first floor then the second and so on. In these type of tasks, you have to finish the first step to start the next one. In contrary to building floors you can build each floor’s walls in parallel. You do not necessarily need to build the east wall first to be able to start the west wall, you may start both walls at the same time. Needless to say that you need two masons.

Simulation is the same. Some calculations/algorithms can run in parallel and some cannot. HydraCAL needs to simulate thousands of scenarios. These scenarios are independent, therefore it is possible to run one and start the second, third, and so on, at the same time.

Now let us say your laptop has 8 cores (which is very common these days), Is it possible to run eight simulations at the same time? Absolutely. HydraCAL benefits from a method of parallelization called multi-threading. This allows the program to utilize all of the computers cores and speed up the simulation while neither your operating system (i.e., Windows) nor the host program (i.e., HydraCAL) would freeze.

Those who previously used parallel computation know that setting up a software to benefit from high performance computing is generally not a straightforward process. However, HydraCAL has been designed in the way that user only needs to specify the number of cores to be utilized in the simulations and all of the required settings happens in background without the need for user to be involved in the process.

How much speed up is achievable by multi-threading?

Contrary to general believe, if you divide your simulation among 8 cores you cannot speed up the simulations by 8 folds. Why? Because although you have 8 cores, at least one of the cores are used by the operating system to handle all other processes or dividing the simulations and merging the results. By average you may reach a speed up factor between 6 ~ 7 using 8 cores.

A more detailed explanation of various parallelization algorithms and how they could be utilized in analyzing water distribution systems could be found in one of my previously published papers in Water Distribution System Analysis conference proceeding which was co-authored with my dear friend Dr. Yves Filion form Queen’s University. You may also download it from the following link.


How to recognize if a model is using parallel processing?

The easiest way to see if a software is using parallel processing on your computer is to look at the Performance Tab of Windows Task Manager program and see if all of your CPU cores are fully utilized or not. To load Windows Task Manager right click on the Windows “Date and Time” and select “Start Task Manager” option and then go to the “Performance” tab.

You may also take a look at the above video which shows HydraCAL using all of available 8 cores on the computer. We intentionally utilized only all of the cores while recording software was recording the simulations. As you may see, even using all of your cores would not result in freezing your computer. This is archived by the special multithreading architecture that has been used to develop HydraCAL.