Hi,

As Stefan suggested I tried to  change the compiler settings for building MITK 
and was able to greatly reduce the initialization lag time of the Volume 
Rendering Plugin in my debug configuration.
With the new debug build, the lag time dropped from over 90 seconds to less 
than 6 seconds what makes debugging so much more usable for me. Not only that, 
the overall performance is way better than before.

For those of you working with Visual Studio and experiencing the same lags try 
setting:

CMAKE_CXX_FLAGS_DEBUG
to
"/MDd /Zi /Ob2 /Zo"  (should be "/MDd /Zi /Ob0 /Od /RTC1" by default)

in your MITK cmake configuration.

I don't know too much about those compiler flags, I more or less stumbled over 
them on the web. I figure that it might have some downsides for debugging MITK 
related modules as the build now contains optimized code, but I really don't 
care too much about that as long as I can debug my own code (I left the CXX 
flags for my project unchanged).

So what I changed was:

/Ob0 to /Ob2: enable expand functions and auto in-lining.
Set /Zo: enhance optimized debugging
Unset /Od: disables optimization, speeding compilation and simplifying debugging
Unset /RTC1: enables runtime error checks

In case someone has more in-depth knowledge about choosing compiler flags for 
debug configurations, please let me know your suggestions.

Thank you!

Kind regards,
Bertram


From: Dinkelacker, Stefan [mailto:[email protected]]
Sent: 14 March 2018 16:25
To: Bertram Sabrowsky-Hirsch <[email protected]>; 
[email protected]
Subject: RE: [mitk-users] Volume Rendering Plugin initialization very slow in 
Debug configuration

Hi,

I just can point you to my last email. It's like I predicted: the random memory 
access (iterators) take magnitudes of order more time in debug mode because of 
all the checks that are made in each and every memory access. There might be a 
setting somewhere to disable or minimize those checks, but I didn't look into 
that any further.

Best,
Stefan

From: Bertram Sabrowsky-Hirsch 
[mailto:[email protected]]
Sent: Mittwoch, 14. März 2018 13:00
To: Dinkelacker, Stefan; 
[email protected]<mailto:[email protected]>
Subject: RE: [mitk-users] Volume Rendering Plugin initialization very slow in 
Debug configuration

Hi Stefan,

That's right I'm working with Windows and Visual Studio 2017. Thanks for the 
advice, I tried that yesterday but eventually gave up on using the Profiling 
Tools as I had multiple issues with it. Instead I used the Visual Studio 
Debugger to step and identify the parts of the code that slow down the app. 
There seem to be two major bottlenecks after enabling Volume Rendering for a 
selected Image:

1. (54 seconds)
In QmitkTransferFunctionGeneratorWidget::SetDataNode there is a call to 
ImageStatistcsHolder::GetScalarValueMin(). The time is spent in 
mitk::_ComputeExtremaInItkImage when the 
itk::ImageRegionConstIterator<ItkImageType> iterates over each pixel.

2. (6 seconds)
In vtkVolumeTexture::LoadTexture the call to 
vtkVolumeTexture::SelectTextureFormat. The time is spent in the calls to 
vtkDataArray::GetFiniteRange.

3. (22 seconds)
In vtkVolumeTexture::LoadTexture when tupPtr is filled in a 3D loop.

I can't figure out why those operations are so slow in debug mode when they 
perform well in release mode. Do you have any suggestions?

Thank you very much in advance.

Kind regards,
Bertram

From: Dinkelacker, Stefan [mailto:[email protected]]
Sent: 12 March 2018 12:37
To: Bertram Sabrowsky-Hirsch 
<[email protected]<mailto:[email protected]>>;
 [email protected]<mailto:[email protected]>
Subject: AW: [mitk-users] Volume Rendering Plugin initialization very slow in 
Debug configuration


Hi,



I guess you are working on Windows to have such big differences between Debug 
and Release configurations? With Visual Studio 2017 you can use the profiling 
tools to easily get an idea of where the time is spent. Such huge differences 
between debug and release configurations usually means that there is a lot of 
random memory access going which is encapsualated in debug configuration by 
expensive checks. There might be a compiler setting to disable these checks and 
gain some speed.



Best,

Stefan

________________________________
Von: Bertram Sabrowsky-Hirsch 
<[email protected]<mailto:[email protected]>>
Gesendet: Montag, 12. März 2018 12:00
An: [email protected]<mailto:[email protected]>
Betreff: [mitk-users] Volume Rendering Plugin initialization very slow in Debug 
configuration

Hi,

I am working on an Aneurysm Simulation Plugin relying on the Volume Rendering 
Plugin for 3D Rendering of some steps. For that I just set the volume rendering 
property of my Image data node.
It is working both in the Release and the Debug Configuration, however the 
Debug configuration has an awful initialization lag/freeze (I suppose from the 
Mapper Initialization) of more than 90 seconds after I set the flag. Its 
independent of the size of the Image data and will only occur the first time in 
one execution run, subsequently setting the property for different nodes runs 
smoothly. In the release configuration there is a lag but that lasts only for 
less than 2 seconds. I'm working with MITK 2016.11.99-974bf5ad.

Does anyone experience the same issue? I thought about using RelWithDebInfo but 
failed to build MITK for that configuration. The lag is quite frustrating and I 
now tend to avoid using the Debug configuration. Any advice would be much 
appreciated.

Thank you very much in advance.

Kind regards,

Bertram
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
mitk-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mitk-users

Reply via email to