SWATGenXSWATGenX
ResearchDocs
Open Explorer Work with us

How we run SWAT+ in parallel

A watershed model can take hours to run a single simulation, and calibration needs thousands of them. Our Peace River model in Florida has nearly fifty-eight thousand land units, each updated every simulated day.

1:42 · captions on by default

Transcript

A watershed model can take hours to run a single simulation, and calibration needs thousands of them.

Our Peace River model in Florida has nearly fifty-eight thousand land units, each updated every simulated day. A standard SWAT+ run does all of that on one processor core, while the others sit idle.

Within a day, the land units do not depend on each other, so they can run side by side. The rivers cannot: water flows downstream, so the channel network is a directed graph.

We group its channels into levels, a wavefront, so each channel waits only for the channels upstream of it, and the hydrology is untouched.

We built this into SWAT+ with OpenMP, in two layers: the land units in parallel, then the routing wavefront. Any state shared between threads had to be made private, or the answer changes silently.

We test it by running the same watershed on one thread and on many, and comparing the output.

On the Peace River model, one simulated year: the serial build our engine started from takes one hundred ninety-two seconds; our engine at twenty-four threads takes twenty-eight, about seven times faster. On one thread our engine already takes one hundred fifty-two seconds; the threads give the rest. Eight threads take thirty-nine seconds, and tripling them to twenty-four takes it to twenty-eight. So we turn threads on where they pay off: calibration in the cloud.

Same input, same equations, several times faster.

swatgenx.com.

Credits

SWAT+ model by USDA-ARS and Texas A&M AgriLife Research; engine source under LGPL-2.1.

All films