Skip to content

enable `await` in catalyst scripts

This MR updates the core classes related to catalyst 2.0. This involves initializing the event loop before any catalyst calls and binding the python event loop to the async paraview event loop so that tasks can be added from both ways. One key difference with the existing implementations in async paraview is that we need to be able to orchestrate everything from the C++ side where the catalyst library is instead of inside the python script itself as we do currently in tests or in trame applications.

The requirement for async paraview calls to be able to be called from catalyst scripts is that the catalyst family of calls catalyst_initialize,execute,... needs to be coroutines ie. async def.

The high-level view of the changes required for this include:

  1. Add infrastructure to initialize python asyncio loop from C++. In particular during vtkInSituInitializationHelper::Initialize which is called from catalyst_initialize.
  2. Allow async functions in catalyst scripts which requires to update all python methods in the callstack to be async.
  3. Adapt vtkCPPythonScriptV2Helper::Catalyst{Initialize,Execute,...} (which act as a bridge between C++ and Python) to call the coroutines introduced in 2.
  4. Bring and adapt catalyst examples to expose and test the new functionality. Note, when adapting examples we need to always use MPI_Init_thread with MPI_THREAD_MULTIPLE as requested level instead of MPI_Init. This is required because different services on different thread are going to use MPI to communicate among ranks.

depends on !332 (merged) and !333 (merged), !339 (merged) , !335 (merged), !340 (merged)

Edited by Christos Tsolakis

Merge request reports

Loading