[vtk-developers] Checking SMP backend at runtime/compiletime?

David Gobbi david.gobbi at gmail.com
Tue Feb 9 10:15:31 EST 2016


Hi Sujin,

What I want is a clear path for the transition from the current situation
(all image filters implemented with vtkMultiThreader) to the eventual
destination (all image filters implemented solely with vtkSMPTools).

Clearly, we're not at the "destination" yet.  The default vtkSMPTools
backend is Sequential, which is an unsuitable replacement for
vtkMultiThreader for obvious reasons.  You say we should remove Simple in
favour of OpenMP, but you said the same thing many months ago :)  When is
that actually going to happen?

The VTK imaging pipeline has been multithreaded for nearly as long as VTK
has existed, so I'm not going to move forward into a situation where a VTK
build with default cmake config causes these filters to run sequential.
That would be a nasty surprise to the users who depend on these filters.

That's why, at least for the transition period, I want these filters to use
the old vtkMultiThreader implementation if the "Sequential" backend is
selected.  I don't want any nasty surprises for the users of these filters,
who expect them to continue to be multi-threaded just as they have been for
the past 15 years.

 - David


On Tue, Feb 9, 2016 at 7:13 AM, Sujin Philip <sujin.philip at kitware.com>
wrote:

> Hi David,
>
> I get what you are saying. Thanks for the correction :).
>
> Why would you want to continue using vtkMultiThreader when Sequential or
> Simple is used? In fact, now that there is an openmp backend, we should be
> removing simple. It was only there to ease debugging since tbb had very
> complex back-traces. Openmp back-traces are much more readable. Do you want
> the algorithm to be multithreaded even when Sequential is used?
>
> I think it should be quite easy to add a compile time "#define" based on
> VTK_SMP_IMPLEMENTATION_TYPE.
>
> Thanks
> Sujin
>
>
> On Mon, Feb 8, 2016 at 5:50 PM, David Gobbi <david.gobbi at gmail.com> wrote:
>
>> On Mon, Feb 8, 2016 at 3:37 PM, Sujin Philip <sujin.philip at kitware.com>
>> wrote:
>>
>>> Hi David,
>>>
>>> There is no official API to find out what the back-end is. I don't think
>>> there is a simple hack either. The back-end is supposed to be transparent
>>> to the user with the only visible difference being the performance. Why do
>>> you want to know?
>>>
>>
>> It's for the new vtkSMPTools implementation of
>> vtkThreadedImageAlgorithm.  It would be nice if it could automatically
>> default to using vtkSMPTools if a suitable backend is present, or use
>> vtkMultiThreader if a vtkSMPTools backend is "Sequential" or "Simple".
>>
>> Also, if there is no way to know what the backend is, then isn't it
>> "opaque" rather than "transparent"?  :)
>>
>>  - David
>>
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtk-developers/attachments/20160209/8ea9dee1/attachment-0001.html>


More information about the vtk-developers mailing list