run the CoProcess function by a separate thread

Hello,

My in-situ process run well if I compose simulation iteration and CoProcss function in the main thread. But if I tried to run the CoProcss function (data visualization) asynchronously based on a new thread, I got this error message:

MandelbulbDynamic: .../paraview/VTK/Common/Core/vtkGarbageCollector.cxx:907: static void vtkGarbageCollector::DeferredCollectionPush(): Assertion `vtkGarbageCollectorIsMainThread()' failed.

It looks that I need to define the VTK_USE_PTHREADS somewhere, but in the vtk documentation (deprecate-vtkconfigure.md), it said that the VTK_USE_PTHREADS is deprecated, I’m a little bit confused about it.

Thanks a lot for your help!

this is not supported. All Catalyst calls should happen from the same thread.

Thanks a lot for the information!

Are there some reasons for this design consideration? I just thought naively that maybe there are some values to fully utilize the CPU by overlapping the simulation computation with the in-situ tasks on same node.

You can do that, but make sure all of the catalyst calls are made from the same thread — which need not be the same thread that the simulation is running under.

Thanks for the reply, and It look that the error message is generated at this step (https://gitlab.kitware.com/vtk/vtk/-/blob/master/Common/Core/vtkGarbageCollector.cxx#L907)
Based on the comment here, it seems that the functions related with the paraview and vtk should be executed by main thread? If I try to do that, should I let the Catalyst run by main thread and let the simulation to run by a new thread? (it might be a little bit unconventional)

that is a little weird… I do not understand why vtkGarbageCollector needs to be the main thread so long as it’s the same thread … try updating the code for now…maybe expose some API to update the main-thread ivar and set that before creating any VTK objects.

Thanks a lot for the information!