<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<!--[if !mso]><style>v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style><![endif]--><style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:#0563C1;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:#954F72;
        text-decoration:underline;}
p.msonormal0, li.msonormal0, div.msonormal0
        {mso-style-name:msonormal;
        mso-margin-top-alt:auto;
        margin-right:0in;
        mso-margin-bottom-alt:auto;
        margin-left:0in;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
span.EmailStyle18
        {mso-style-type:personal;
        font-family:"Calibri",sans-serif;}
span.EmailStyle19
        {mso-style-type:personal;
        font-family:"Calibri",sans-serif;}
span.EmailStyle21
        {mso-style-type:personal-reply;
        font-family:"Calibri",sans-serif;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="#0563C1" vlink="#954F72">
<div class="WordSection1">
<p class="MsoNormal">Thanks, Andras, I’ll try out TBB again.  I had tried to use it in preference to OpenMP initially, but had trouble building it and bailed out.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b>From:</b> Andras Lasso <lasso@queensu.ca> <br>
<b>Sent:</b> Tuesday, January 15, 2019 18:25<br>
<b>To:</b> Fahlgren, Eric <eric.fahlgren@smith-nephew.com>; vtkusers@vtk.org<br>
<b>Subject:</b> RE: Slower rendering with OpenMP and Python?<o:p></o:p></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<div>
<p class="MsoNormal" style="background:#7C7C7B"><b><span style="font-size:10.0pt;font-family:"Arial",sans-serif;color:white">CAUTION: External email
</span></b><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="background:#7C7C7B"><b><span style="font-size:10.0pt;font-family:"Arial",sans-serif;color:white">REMINDER: Do not click links or open attachments unless you know the sender & are expecting the email.</span></b><o:p></o:p></p>
</div>
</div>
<div class="MsoNormal" align="center" style="text-align:center">
<hr size="3" width="100%" align="center">
</div>
<div>
<p class="MsoNormal">We experienced terrible performance on desktop systems with strong Nvidia GPUs when we switched to VTK OpenGL2 rendering backend. Apparently, Nvidia’s threaded optimization off-loaded some work on the CPU and that interfered with VTK’s
 multithreading. Maybe OpenMP backend has the same issue. Switching to SMP backend to TBB solved the issue for us. See more details in this pull request:
<a href="https://github.com/Slicer/Slicer/pull/930">https://github.com/Slicer/Slicer/pull/930</a><o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Andras <o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b>From:</b> vtkusers <<a href="mailto:vtkusers-bounces@vtk.org">vtkusers-bounces@vtk.org</a>>
<b>On Behalf Of </b>Fahlgren, Eric<br>
<b>Sent:</b> Tuesday, January 15, 2019 6:53 PM<br>
<b>To:</b> <a href="mailto:vtkusers@vtk.org">vtkusers@vtk.org</a><br>
<b>Subject:</b> [vtkusers] Slower rendering with OpenMP and Python?<o:p></o:p></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Seeing Felix’s thread on attempts to speed up his contour filtering, I wanted to try this myself.  So, Windows 10, VTK 8.1.2, MSVC 2017, Python 3.7, installed MS MPI tools and SDK v 10.0.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">I added these to my configuration script:<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><span style="font-family:"Courier New"">        -D VTK_SMP_IMPLEMENTATION_TYPE:STRING=OpenMP                 \<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New"">        -D Module_vtkFiltersParallelFlowPaths:BOOL=ON                \<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New"">        -D Module_vtkFiltersParallelGeometry:BOOL=ON                 \<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New"">        -D Module_vtkFiltersParallelStatistics:BOOL=ON               \<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New"">        -D Module_vtkFiltersParallelVerdict:BOOL=ON                  \<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New"">        -D Module_vtkParallelMPI4Py:BOOL=ON                          \<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New"">        -D Module_vtkRenderingParallel:BOOL=ON                       \<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New"">        -D Module_vtkRenderingParallelLIC:BOOL=ON                    \<o:p></o:p></span></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">The test is an animation sequence of the lower spine in a flexion-extension event with a dozen bones, most set to 50% transparency and texture mapped, various other synthetic geometry like cylinders and toroids, pretty simple stuff (no
 images of any sort, so no pixels or voxels).  Animation does reconfigure some rubber-banding objects (spinal discs and some cables from the test rig), but mostly the geometry remains as-is and the rendering at new xforms is the overwhelming time sink.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">The SMP=Sequential baseline runs on Intel i7-7700k with HD 630 integrated graphics at 35 FPS.  With all the above parallelism enabled, it’s at about half that, best case maybe 18 FPS.  Notably, the CPU usage is 12% (typical one thread on
 an 8-thread CPU) with Sequential, but pegs 80-90% with OpenMP enabled.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">When we test on a machine with a GPU, GTX 1050 Ti, we see the baseline for SMP=Sequential is about 41 FPS, but with OpenMP it’s 18 FPS here, too.  CPU usage is same as above, one-thread max with Sequential and “use it all” with OpenMP.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Is this expected for this mix of mostly static geometry?  Or am I setting the wrong configuration variables?  Or am I just doing something dumb?<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Thanks,<o:p></o:p></p>
<p class="MsoNormal">Eric<o:p></o:p></p>
</div>
</div>
</body>
</html>