Skip to content

multi_backend shows how a filter can use multiple device adapter

This demo shows off using vtk-m in multiple threads in two different ways.

At a high level we have 2 primary threads, an IO thread and a Worker thread The IO thread will generate all data using the vtk-m serial device, and will post this data to a worker queue as a vtk-m multiblock. The Worker thread will pull down these vtk-m multiblock data and run a vtk-m filter on the multiblock. The vtk-m filter it runs will itself have a worker pool which it will distribute work too. The number of workers is based on what device adapters are enabled but uses the following logic:

  • If TBB is enabled construct a single TBB worker
  • If CUDA is enabled construct 4 workers for each GPU on the machine

Unfortunately due to some thread unsafe logic in VTK-m it is currently not possible to have CUDA and TBB workers at the same time. So the class will choose CUDA over TBB when possible. Once the thread unsafe logic is fixed a machine that has a single CPU and single GPU we should expect that we will have 2 primary 'main loop' threads, and 5 threads for heavy 'task' work.

Edited by Robert Maynard

Merge request reports

Loading