pangeo-data / xESMF

Universal Regridder for Geospatial Data
http://xesmf.readthedocs.io/
MIT License
188 stars 34 forks source link

Weights generation is `extremely` slow when working with large grids #41

Open andersy005 opened 3 years ago

andersy005 commented 3 years ago

When working with large/complex grids, the weights generation step appears to be computationally expensive. I am wondering whether this is documented somewhere? If so, can we improve this?

Here's an example

Screen Shot 2020-10-27 at 4 57 34 PM

Here's an interactive version of profiling results: https://gist.githack.com/andersy005/329d52f08aaa654527921de609016b77/raw/ad2973e74e990d2bf5cad7586a364968425bb13e/xesmf-profiler.svg?x=0.5529%25&y=100

raphaeldussin commented 3 years ago

my understanding is that xESMF only runs the regridding weights computation on one core so this is maybe why your computation is slow. The workaround is to built weights using the command line tool ESMF_RegridWeightGen like I described in the doc. A further development could be to have xESMF runs the ESMpy code in parallel using mpi4py

huard commented 11 months ago

Version 0.8 supports chunking along the horizontal axes. It's slower for small grids, but faster for large ones.

guigrpa commented 7 months ago

@huard v0.8 looks very promising for our use case, thanks! One question: Are the weight files generated by v0.8+ compatible with xesmf v0.6?

And conversely, are weight files generated by xesmf v0.6 compatible with xesmf v0.8+?

Even if we'll be testing before going into Production, we would be grateful if you could provide us your insights!

huard commented 7 months ago

Yes to both, the weights format has not changed.