Skip to content

Allow to share computation between kernels in particle models #321

@Mikolaj-A-Kowalski

Description

@Mikolaj-A-Kowalski

By looking at the profiling results for the runs of LOBSTER model with large number of SugarKelp particles (range of $2^{18} - 2^{20}$) the main extra contribution to the runtime comes from the photosynthesis function which involves expensive Newton iteration.

Furthermore, it appears that the heavy photosynthesis calculation is performed 6 times (in _update_traced_tendencies! kernel for :DIC, :O_2, :DOC and :DON tracers and in _tendency_kernel! for :N and :C). As far as I am able to tell the inputs come from current state of the fields and hence do not change between invocations of the _update_traced_tendencies! and _tendency_kernel! for different tracers. Hence, it appears that the same calculation is performed multiple times. This is the impression I got from looking at the code, but need o verify that this is indeed a case by logging values from the run.

If the above is correct, it would be beneficial to refactor 'Individual' models to give them ability to share some result across multiple kernels. I imagine we could allow them to declare some buffer space for each particle, which will be filled by new type of kernel run before _update_traced_tendencies! and _tendency_kernel!. Then when updating tendencies the photosynthesis result could just be read from memory 🤞

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions