Simulation: have simulation tasks run in their own thread#569
Open
agarny wants to merge 8 commits into
Open
Conversation
There was a problem hiding this comment.
Pull request overview
This PR implements asynchronous SED-ML simulation execution so simulations can run without blocking the caller/UI, while exposing per-instance and per-task progress plus pause/resume/stop controls (addressing #294).
Changes:
- Added async run lifecycle to
SedInstance(startRun,isRunning,waitForRun,pauseRun,resumeRun,stopRun) and progress reporting (progresson instance + tasks). - Updated Emscripten/WebAssembly build/runtime plumbing to support threaded/shared-memory execution and worker-local WASM instances.
- Expanded C++/Python/JavaScript test coverage and updated the JavaScript demo UI to exercise async execution + progress.
Reviewed changes
Copilot reviewed 74 out of 75 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| VERSION.txt | Version bump. |
| tests/bindings/python/test_sed_instance.py | Python async/progress tests. |
| tests/bindings/javascript/sed.instance.test.js | JS async/progress tests. |
| tests/bindings/javascript/res/res/libopencor.js | Demo: async run + progress UI. |
| tests/bindings/javascript/res/res/libopencor.css | Demo: stop button styling. |
| tests/bindings/javascript/res/index.html | Demo: async toggle + progress bar UI. |
| tests/api/sed/instancetests.cpp | C++ async/progress tests. |
| src/support/sedml/sedmlfile.cpp | Lambda capture fix. |
| src/support/cellml/cellmlfileruntime.cpp | Worker-local WASM init + dispatch. |
| src/support/cellml/cellmlfileruntime_p.h | Remove old WASM instance id. |
| src/support/cellml/cellmlfile.cpp | Include solver headers. |
| src/solver/solverodefixedstep.cpp | Lambda capture fix. |
| src/solver/solvernla.cpp | WASM objective-function dispatch updates. |
| src/solver/solvernla_p.h | NLA solve signature updates. |
| src/solver/solverkinsol.cpp | Worker-local objective-function dispatch. |
| src/solver/solverkinsol_p.h | Updated solve signature. |
| src/solver/solvercvode.cpp | Lambda capture fix. |
| src/sed/sedtask.cpp | Lambda capture fix. |
| src/sed/sedsimulation.cpp | Lambda capture fix. |
| src/sed/sedmodel.cpp | Avoid implicit captures in find_if. |
| src/sed/sedinstancetask.cpp | Pause/stop + task progress tracking. |
| src/sed/sedinstancetask_p.h | Task progress + pause/stop state. |
| src/sed/sedinstance.cpp | Async run lifecycle + instance progress. |
| src/sed/sedinstance_p.h | Async state fields for SedInstance. |
| src/sed/seddocument.cpp | Avoid implicit captures in find_if. |
| src/sed/sedchangeattribute.cpp | Lambda capture fix. |
| src/misc/utils.h | Move <map> include here. |
| src/misc/utils.cpp | Add logger include. |
| src/misc/compiler.cpp | WASM shared-memory patching + atomics flags. |
| src/file/filemanager.cpp | Avoid implicit captures in find_if. |
| src/CMakeLists.txt | Emscripten threaded/shared-memory flags. |
| src/bindings/python/solver.cpp | Python docstring/API wording tweaks. |
| src/bindings/python/sed.cpp | Python bindings for async/progress APIs. |
| src/bindings/python/logger.cpp | Python docstring/API wording tweaks. |
| src/bindings/python/file.cpp | Python docstring/API wording tweaks. |
| src/bindings/javascript/solver.cpp | JS bindings: updated NLA solve wiring. |
| src/bindings/javascript/sed.cpp | JS bindings for async/progress APIs. |
| src/bindings/javascript/file.cpp | JS formatting tweak in EM_ASM_PTR block. |
| src/bindings/javascript/CMakeLists.txt | Propagate Emscripten thread flags. |
| src/api/libopencor/types.h | Remove <map> include. |
| src/api/libopencor/solverodefixedstep.h | Docstring wording updates. |
| src/api/libopencor/solvernla.h | Updated Emscripten solve signature. |
| src/api/libopencor/solverkinsol.h | Docstring wording updates. |
| src/api/libopencor/solvercvode.h | Docstring wording updates. |
| src/api/libopencor/solver.h | Docstring wording updates. |
| src/api/libopencor/seduniformtimecourse.h | Docstring wording updates. |
| src/api/libopencor/sedtask.h | Docstring wording updates. |
| src/api/libopencor/sedsimulation.h | Docstring wording updates. |
| src/api/libopencor/sedonestep.h | Docstring wording updates. |
| src/api/libopencor/sedmodel.h | Docstring wording updates. |
| src/api/libopencor/sedinstancetask.h | New task progress API docs. |
| src/api/libopencor/sedinstance.h | New async/progress instance API docs. |
| src/api/libopencor/seddocument.h | Docstring wording updates. |
| src/api/libopencor/sedchangeattribute.h | Docstring wording updates. |
| src/api/libopencor/sedchange.h | Docstring wording updates. |
| src/api/libopencor/sedbase.h | Docstring wording updates. |
| src/api/libopencor/logger.h | Remove unused include. |
| src/api/libopencor/issue.h | Docstring wording updates. |
| src/api/libopencor/filemanager.h | Docstring wording updates. |
| src/api/libopencor/file.h | Docstring wording updates. |
| src/3rdparty/zlib/CMakeLists.txt | Update EMSCRIPTEN package hash. |
| src/3rdparty/zipper/CMakeLists.txt | Update EMSCRIPTEN package hash. |
| src/3rdparty/SUNDIALS/CMakeLists.txt | Update EMSCRIPTEN package hash. |
| src/3rdparty/LLVMClang/CMakeLists.txt | Update EMSCRIPTEN package hash. |
| src/3rdparty/libxml2/CMakeLists.txt | Update EMSCRIPTEN package hash. |
| src/3rdparty/libSEDML/CMakeLists.txt | Update EMSCRIPTEN package hash. |
| src/3rdparty/libSBML/CMakeLists.txt | Update EMSCRIPTEN package hash. |
| src/3rdparty/libNuML/CMakeLists.txt | Update EMSCRIPTEN package hash. |
| src/3rdparty/libCOMBINE/CMakeLists.txt | Update EMSCRIPTEN package hash. |
| src/3rdparty/libCellML/CMakeLists.txt | Update EMSCRIPTEN package hash. |
| cmake/packages.cmake | Safer arg quoting + threaded wasm target. |
| cmake/common.cmake | Add compiler warning suppression. |
| cmake/buildpackage.cmake.in | Use quoted ExternalProject args. |
| .gitignore | Ignore .omo/. |
| .github/workflows/buildThirdPartyLibrary.yml | Artifact pattern broadened. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #294.