respec / HSPsquared

Hydrologic Simulation Program Python (HSPsquared)
GNU Affero General Public License v3.0
43 stars 17 forks source link

make state float64 instead of float32 #136

Closed rburghol closed 4 months ago

rburghol commented 4 months ago

Runtime difference of ~ +1%

Benchmark.py with state_ix as float32:

cd tests/testcbp/HSP2results/                                                                  
PS C:\usr\local\home\git\HSPsquared\tests\testcbp\HSP2results> py .\benchmark.py
Init HYDR state context for domain /STATE/RCHRES_R001
Tokenizing models
1001 components iterated over state_ix 324336 time steps took 51.58777570724487 seconds
1001 components iterated over np_state_ix 324336 time steps took 19.793294191360474 seconds
PS C:\usr\local\home\git\HSPsquared\tests\testcbp\HSP2results> 

With state_ix as float64

py benchmark.py 
Init HYDR state context for domain /STATE/RCHRES_R001
Tokenizing models
1001 components iterated over state_ix 324336 time steps took 51.935609102249146 seconds
1001 components iterated over np_state_ix 324336 time steps took 20.172362565994263 seconds
PaulDudaRESPEC commented 4 months ago

Perfect, thanks!