metno / emep-ctm

Open Source EMEP/MSC-W model
GNU General Public License v3.0
30 stars 20 forks source link

Question: are there any plans to enable GPU acceleration? #89

Closed rubenww closed 3 years ago

rubenww commented 3 years ago

Hi, I have a question about current / future plans to enable GPU acceleration. Of course, GPU's have to potential to lead to significant speedups compared to CPU's on typically lower cost hardware. Several weather models (e.g. COSMO) have already taken advantage of this and I believe it is interesting for the EMEP model as well. Are there any possibilities / plans to run (parts of?) the model on GPU's? Thanks and best, Ruben

gitpeterwind commented 3 years ago

Hi @rubenww, Many years ago, I tried to port some part of the EMEP model (the chemistry transformations) on a GPU. GPU requires that a large number of identical operations are applied simultaneously. The chemistry module was relatively easy parallelized for GPU (same chemistry transformation for each gridcell). The result was disappointing; although more threads could be run at the same time, each one was too slow. This is because the data associated to one gridcell fits in the L1 cache and our (CPU) code therefore is very fast. The GPU does not have (at least when I tried) enough cache memory to held the necessary data, and the memory access is then the bottleneck. Chemistry would probably be the easiest part to port to GPU, but there are many other time consuming parts. I cannot say that it there is no way to do something better, but I do not see how. Certainly it would require a lot of work, and have many significant disadvantages: more complex setup, more complex code, etc. Even if there was a strong case, we do not have even have the resources for much more wanted developments.

So in short: we do not have plans to port the model to GPU in the near future!

Best wishes, Peter

rubenww commented 3 years ago

Thank you for the insightful answer Peter! Good to know that it was considered in the past but found to be worse than on the CPU. Best, Ruben