I was wondering if someone could point me in the right direction as to how to use TBB with VTK correctly. I managed to build VTK with TBB using cmake (if am correct, I had the VTK_SMP_IMPLEMENTATION_TYPE set to TBB, with the necessary directories and includes to the required libraries .dylib), built and compiled.
Everything seems to work properly, however I don’t notice any difference in performance. It’s worth mentioning that I’m using vtkProbeFilter which I was under the impression takes advantage of TBB’s capabilities from the thread below
How to evaluate TBB with VTK
Is there something I'm missing, something I ought to be doing that am not?
I looked at the code for vtkProbeFilter.cxx (which is really the only way to know for certain how any VTK filters are implemented), and SMP is only used when probing with a vtkImageData. The Input must be vtkImageData, but the Source can be any kind of data.
Thanks for the detailed response.
It’s rather unfortunate that it functions that way. Am feeding in a poly data as the input data and a vtkImageBlend’s output as the source connection, I guess that explains why I’m not seeing any benefits. By the way, I noticed a vtkPProbeFilter is of no benefit either. Although it’s worth mentioning I was using the vtkPProbeFilter without a MPI Controller setup (does that matter)?
I don’t think that vtkPProbeFilter is what you want, since MPI does its parallelization across processes (using network sockets so that it can work across multiple computers), while SMP does its parallelization via threads (and therefore has minimal overhead).
The vtkProbeFilter’s image SMP code was probably added because someone had a specific application that needed it. Adding SMP code to vtkProbeFilter for use with a vtkPolyData input should be straightforward, if you want to give it a go.
Oh I see, thanks for clarifying that. Is there any sample code for SMP with vtkProbeFilter? I can’t seem to find any out there.
You mean for using SMP with vtkProbeFilter with a vtkPolyData input? I just said that such code does not exist, someone would have to add it to vtkProbeFilter.
My bad, you are right. It’s the vtkProbeFilter’s image SMP code that was added, read that wrong. Thanks, I’ll try and give it a go at my end.
There is also a vtkmProbe, if you want to try using TBB through VTK-m. I have no experience with it.
Oh nice, I was never aware of vtkmProbe. I’ll check it out if all else fails.
I had a look at vtkProbeFilter with the intention of getting a vtkPolyData input take advantage of SMP and as I’m not that versed with the class It doesn’t seem to be clear to me on how to achieve this. There’s a different path specifically for vtkImageData that as you mentioned earlier makes use of SMP with the other branch just processing empty points.
An idea that occurred to me was the possibility of converting a poly data to an image data and feeding that in as the input thus taking the SMP route but am not quite sure if that’s even worth it without any overhead or drawbacks. I guess my question is is there any straight forward approach to getting a vtkPolyData to work.
With vtkProbeFilter, it doesn’t make sense to convert the “Source” data to a different format, because you want to probe at the original point locations.
If you are interested, for a fee I could write you a VTK filter that probes a vtkImageData with a polydata and that uses SMP. I’m very familiar with the vtkSMPTools and with the VTK pipeline architecture. You can PM me by clicking on my icon (the sushi roll) and clicking the “Message” button.
You are right, converting the source data to a different format is a bad idea hence why I didn’t go that route but I mentioned it so you could confirm my thinking. Sure, we (me & my team) would be interested in getting a poly data probed using SMP but I’ll have to get back to you on that after consulting with others at my end. Thank you so much for helping, will get back to you soon.