Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Low computing efficiency of saturation_7 #39

Open
kongdd opened this issue Sep 27, 2022 · 1 comment
Open

Low computing efficiency of saturation_7 #39

kongdd opened this issue Sep 27, 2022 · 1 comment

Comments

@kongdd
Copy link

kongdd commented Sep 27, 2022

https://github.com/wknoben/MARRMoT/blob/master/MARRMoT/Models/Flux%20files/saturation_7.m#L24

The integral operation leads to m_14_topmodel_7p_2s about 20 times slower than other models?
Any idea how to improve this?

The attachment is the consumed time for each model in my case.

Thanks and Regards,
Dongdong

@kongdd kongdd changed the title Low computing efficiency of saturation_7 and Low computing efficiency of saturation_7 and m_14_topmodel_7p_2s Sep 27, 2022
@kongdd kongdd changed the title Low computing efficiency of saturation_7 and m_14_topmodel_7p_2s Low computing efficiency of saturation_7 Sep 27, 2022
@wknoben
Copy link
Owner

wknoben commented Sep 28, 2022

Thanks for the report. This is an issue I have encountered too. It is related to the way Matlab's integral function works.

This suggests that replacing the anonymous function with a regular function could result in a marginal speedup. You could consider testing this and making a pull request if this results in a speedup.

Alternative approaches would involve either (1) changing the equation to something that is quicker to solve, or (2) changing the default solving tolerances of the integral function as described here as well. Either of these approaches has the downside of affecting the model simulations. For (1), using a different function than the integral will obviously result in different simulations. For (2), loosening the tolerances will affect the accuracy of the integral solution and this will (likely) lead to different simulations also.

A final option may be having an in-depth look at the integral function to figure out how it computes the integral, and see if there is something special in the MARRMoT case that lets us somehow short-circuit part of the solving. Intuitively I doubt this will be the case.

Summarizing, a slight speedup might be achievable fairly easily. Larger speedups are likely not possible without changing this flux equation and thus changing the model simulations. I'll leave this open for a while in case you want to try replacing the anonymous function with a real one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants