[vtkusers] vtk and OpenMP application

Trevor Irons trevorirons at gmail.com
Wed Jun 30 16:55:02 EDT 2010


I'm having some issues linking an application that uses OpenMP with VTK
libraries. I have experienced the problem on two 64 but linux machines with
4, and 8 cores. I am compiling with gcc-4.5.0. I also compiled vtk with this
compiler.

My library contains some classes with vtk members, but none of my OpenMP
directives involve these members. Inclusion of vtk is optional and all vtk
calls are #ifdef around so I can compile with and without vtk.

Across the board if I link with vtk and enable more than 2 cores I get
significant inefficiency. For example on my 8 core machine I have an
application that uses my library. (There are no vtk calls)

time
real    0m4.320s
user    0m21.155s
sys    0m10.306s

But if I don't link against vtk (no vtk code anywhere)

time
real    0m1.792s
user    0m13.716s
sys    0m0.327s

In fact by using the preprocessor catches, I can link against vtk but not
include any vtk objects in my library and I still see this behaviour: (Link
against vtk, but no vtk code)

time
real    0m4.379s
user    0m21.539s
sys    0m10.313s

So simply the act of linking these libraries is causing me a lot of headache
with OpenMP
-lvtkCommon -lvtkRendering -lvtkGraphics -lvtkHybrid -lvtkWidgets
-lvtkFiltering -lvtkVolumeRendering

Does anyone have any idea why this could be? Or any solutions. I tried
building vtk with and without the Parallel option, but that didn't help.

Thanks for any ideas. I'll try to assemble a minimal code example, but maybe
someone has an idea offhand.

-Trevor
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20100630/d8480264/attachment.htm>


More information about the vtkusers mailing list