hsma-programme / Teaching_DES_Concepts_Streamlit

A streamlit app (running from github pages using the stlite package) for teaching concepts of discrete event simulation, including animated entity flow plots created in Plotly. IMPORTANT NOTE: Works in Chrome, Edge or Safari - not Firefox.
https://hsma-programme.github.io/Teaching_DES_Concepts_Streamlit/
MIT License
10 stars 5 forks source link

Investigate potential for using joblib around the multiple replication function #1

Open Bergam0t opened 1 year ago

Bergam0t commented 1 year ago

Monks and Harper mention the following in their paper on improving the usability of open health service delivery simulation models using Python and web apps:

Another strength of our approach is that our multiple_replications function is easily parallelisable using Python’s joblib library. If the model is used locally, there may be a large time saving benefit of taking this approach, i.e. running parallel replications on a laptop with 20 virtual cores. However, in general these benefits do not transfer to web based models10, i.e., streamlit’s community cloud deployment will limit model execution to a single CPU https://openresearch.nihr.ac.uk/articles/3-48

This web app uses the sample multiple_replications approach.

Joblib appears to be available in pyodide as one of their built packages (https://pyodide.org/en/stable/usage/packages-in-pyodide.html) - is it worth exploring whether this might work? People have got it working within standard streamlit apps (e.g. https://discuss.streamlit.io/t/update-st-progress-with-joblib-multiprocessing-tasks/44729) so it's just whether it plays nice with stlite. There's some oddities around blocking processes within stlite so don't know if that will interfere.