Skip to content

Simulation: have simulation tasks run in their own thread#569

Open
agarny wants to merge 8 commits into
opencor:mainfrom
agarny:issue294
Open

Simulation: have simulation tasks run in their own thread#569
agarny wants to merge 8 commits into
opencor:mainfrom
agarny:issue294

Conversation

@agarny

@agarny agarny commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Fixes #294.

Copilot AI review requested due to automatic review settings July 1, 2026 02:06

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 (progress on 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.

Comment thread src/sed/sedinstance.cpp Outdated
Comment thread src/sed/sedinstance_p.h
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

Successfully merging this pull request may close these issues.

Simulation: have simulation tasks run in their own thread

2 participants