[vtkusers] Profiling VTK/Performance improvements (with Python)

Felix Mayr felix.mayr at tum.de
Thu Jan 17 04:14:09 EST 2019

Hey, thanks for your reply

> - Did you set the VTK_SMP_IMPLEMENTATION_TYPE flag to the correct backend
> for your compiler?

I did so, though (I'm using LLVM for the MESA-acceleration only). For 
GCC it should be the same though. Probably this has something to do with 
the python-wrappers, are they releasing the GIL?
> - For timing, you can possibly start by measuring the time elapsed when
> calling Update(). See for instance the timer.StartTimer() calls in this
> python code:
> https://vtk.org/gitweb?p=VTK.git;a=blob;f=Filters/Points/Testing/Python/TestPointInterpolator.py
Ok, this is not what I was after, as I hoped for something which could 
profile the whole pipeline in one go (preferably also breaking down on 
memory usage, etc). But apparently the best is to measure how much time 
the Update-call is blocking (which I did with time.time())

> - What do you call slow? 41 million cells is not a particularly big test
> case, so no need to worry about that. What you do need to keep an eye on,
> though, is your memory usage. If you run out of memory and your system
> starts swapping to disk, then VTK will be unbearably slow for sure..

Memory is no problem, there's plenty of it available. And also with a 
smaller grid, the pipeline takes long. Anyways, I just "instrumented" 
all the Update()-calls one by one and found this:

After isocontours update 4.545
After isonormalizer update 11.738
After isoclipper update 146.398
After filter update 146.399

So basically the vtkClipPolyData ist taking enormously long (the other 
steps might be slow, but are bearable. Especially as they are twice as 
fast on the server-nodes). Is there anything which is faster? I tried 
vtkExtractPolyDataGeometry (don't need cell subdivision), but this was 
not significantly faster and for the vtkBooleanOperationPolyDataFilter I 
didn't find any examples... Maybe the clipFunction (135 points) is to 
complicated, I will try to first cut the bounding box, then apply the 
vtkClipPolyData (tough this is not really improving to a point where I 
could get interactive performance, but a constant 30s would be better I 

Felix Mayr
<felix.mayr at tum.de>
Technical University of Munich, Simulation of Nanosystems for Energy 
Conversion [www.sne.ei.tum.de]

More information about the vtkusers mailing list