<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 14 (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:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p.MsoAcetate, li.MsoAcetate, div.MsoAcetate
        {mso-style-priority:99;
        mso-style-link:"Balloon Text Char";
        margin:0in;
        margin-bottom:.0001pt;
        font-size:8.0pt;
        font-family:"Tahoma","sans-serif";}
span.wdi
        {mso-style-name:wdi;}
span.pln
        {mso-style-name:pln;}
span.pun
        {mso-style-name:pun;}
span.typ
        {mso-style-name:typ;}
span.lit
        {mso-style-name:lit;}
span.wdc
        {mso-style-name:wdc;}
span.EmailStyle23
        {mso-style-type:personal;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
span.EmailStyle24
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;
        font-weight:normal;
        font-style:normal;}
span.BalloonTextChar
        {mso-style-name:"Balloon Text Char";
        mso-style-priority:99;
        mso-style-link:"Balloon Text";
        font-family:"Tahoma","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="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">I would at least remove the  “*2” from the initialization.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">We could initialize the number of threads in the pool to 0 or 1.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">But I don’t understand why initializing threads for the thread pool may cause an error whereas initializing threads for a filter in the pre-thread pool implementation
 does not.  Both should be creating GetGlobalDefaultNumberOfThreads() threads in rapid succession.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Jim<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<div>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">From:</span></b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif""> Brahmakshatriya, Umang (GE Global Research)
<br>
<b>Sent:</b> Monday, April 07, 2014 9:28 AM<br>
<b>To:</b> Bradley Lowekamp; Miller, James V (GE Global Research)<br>
<b>Cc:</b> insight-developers@itk.org<br>
<b>Subject:</b> RE: [ITK-dev] [ITK] Thread Pool patch<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<table class="MsoNormalTable" border="0" cellpadding="0" width="1440" style="width:15.0in;background:white">
<tbody>
<tr>
<td valign="top" style="border:none;border-bottom:solid #DDFFDD 1.0pt;background:#DDFFDD;padding:0in 0in 0in 0in">
<p class="MsoNormal"><b><span style="font-size:8.0pt;font-family:"Courier New";color:#440044;background:#DDFFDD">MultiThreader</span></b><span style="font-size:8.0pt;font-family:"Courier New";color:#444400;background:#DDFFDD">::</span><b><span style="font-size:8.0pt;font-family:"Courier New";color:#440044;background:#DDFFDD">MultiThreader</span></b><span style="font-size:8.0pt;font-family:"Courier New";color:#444400;background:#DDFFDD">()</span><span style="font-size:8.0pt;font-family:"Courier New";color:black;background:#99FF99">
</span><span style="font-size:8.0pt;font-family:"Courier New";color:#444400;background:#99FF99">:</span><span style="font-size:8.0pt;font-family:"Courier New";color:black;background:#99FF99"> m_ThreadPool</span><span style="font-size:8.0pt;font-family:"Courier New";color:#444400;background:#99FF99">(</span><b><span style="font-size:8.0pt;font-family:"Courier New";color:#440044;background:#99FF99">ThreadPool</span></b><span style="font-size:8.0pt;font-family:"Courier New";color:#444400;background:#99FF99">::</span><b><span style="font-size:8.0pt;font-family:"Courier New";color:#440044;background:#99FF99">New</span></b><span style="font-size:8.0pt;font-family:"Courier New";color:#444400;background:#99FF99">()</span><span style="font-size:8.0pt;font-family:"Courier New";color:black;background:#99FF99">
</span><span style="font-size:8.0pt;font-family:"Courier New";color:#444400;background:#99FF99">)</span><span style="font-size:8.0pt;font-family:"Courier New";color:black"><o:p></o:p></span></p>
</td>
<td width="173" colspan="4" style="width:129.75pt;padding:0in 0in 0in 0in">
<p class="MsoNormal"> <o:p></o:p></p>
</td>
</tr>
<tr>
<td width="1" style="width:.75pt;padding:0in 0in 0in 0in"></td>
<td width="56" valign="top" style="width:42.0pt;border-top:none;border-left:none;border-bottom:solid white 1.0pt;border-right:solid #B0BDCC 1.0pt;padding:0in 2.4pt 0in 2.4pt">
</td>
<td valign="top" style="border:none;border-bottom:solid #FFEEEE 1.0pt;background:#FFEEEE;padding:0in 0in 0in 0in">
</td>
<td width="56" valign="top" style="width:42.0pt;border-top:none;border-left:none;border-bottom:solid white 1.0pt;border-right:solid #B0BDCC 1.0pt;padding:0in 2.4pt 0in 2.4pt">
<p class="MsoNormal" align="right" style="text-align:right"><span style="font-size:8.0pt;font-family:"Courier New";color:black"><a href="javascript:void(0)"><span style="color:#0000AA">187</span></a><o:p></o:p></span></p>
</td>
<td valign="top" style="border:none;border-bottom:solid #DDFFDD 1.0pt;background:#DDFFDD;padding:0in 0in 0in 0in">
<p class="MsoNormal"><span style="font-size:8.0pt;font-family:"Courier New";color:#444400;background:#DDFFDD">{</span><span style="font-size:8.0pt;font-family:"Courier New";color:black"><o:p></o:p></span></p>
</td>
</tr>
<tr>
<td width="1" style="width:.75pt;padding:0in 0in 0in 0in"></td>
<td width="56" valign="top" style="width:42.0pt;border-top:none;border-left:none;border-bottom:solid white 1.0pt;border-right:solid #B0BDCC 1.0pt;padding:0in 2.4pt 0in 2.4pt">
</td>
<td valign="top" style="border:none;border-bottom:solid #FFEEEE 1.0pt;background:#FFEEEE;padding:0in 0in 0in 0in">
</td>
<td width="56" valign="top" style="width:42.0pt;border-top:none;border-left:none;border-bottom:solid white 1.0pt;border-right:solid #B0BDCC 1.0pt;padding:0in 2.4pt 0in 2.4pt">
<p class="MsoNormal" align="right" style="text-align:right"><span style="font-size:8.0pt;font-family:"Courier New";color:black"><a href="javascript:void(0)"><span style="color:#0000AA">188</span></a><o:p></o:p></span></p>
</td>
<td valign="top" style="border:none;border-bottom:solid #99FF99 1.0pt;background:#99FF99;padding:0in 0in 0in 0in">
<p class="MsoNormal"><span style="font-size:8.0pt;font-family:"Courier New";color:black;background:#99FF99">  m_ThreadPool</span><span style="font-size:8.0pt;font-family:"Courier New";color:#444400;background:#99FF99">-></span><b><span style="font-size:8.0pt;font-family:"Courier New";color:#440044;background:#99FF99">InitializeThreads</span></b><span style="font-size:8.0pt;font-family:"Courier New";color:#444400;background:#99FF99">(</span><b><span style="font-size:8.0pt;font-family:"Courier New";color:#440044;background:#99FF99">GetGlobalDefaultNumberOfThreads</span></b><span style="font-size:8.0pt;font-family:"Courier New";color:#444400;background:#99FF99">()</span><span style="font-size:8.0pt;font-family:"Courier New";color:black;background:#99FF99">
</span><span style="font-size:8.0pt;font-family:"Courier New";color:#444400;background:#99FF99">*</span><span style="font-size:8.0pt;font-family:"Courier New";color:black;background:#99FF99">
</span><span style="font-size:8.0pt;font-family:"Courier New";color:#004444;background:#99FF99">2</span><span style="font-size:8.0pt;font-family:"Courier New";color:#444400;background:#99FF99">);</span><span style="font-size:8.0pt;font-family:"Courier New";color:black"><o:p></o:p></span></p>
</td>
</tr>
</tbody>
</table>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">I was aware of this issue and had mentioned about this to Jim – If we demand too many simumtaneous pthreads to be started, the pthread_create call returns error
 code 11 (<a href="http://pubs.opengroup.org/onlinepubs/7908799/xsh/pthread_create.html">http://pubs.opengroup.org/onlinepubs/7908799/xsh/pthread_create.html</a> ). So if the above call returns the correct number of threads, I think we should be fine unless
 we are creating more than one “thread pools”.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><b><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Umang Brahmakshatriya</span></b><b><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:black"><o:p></o:p></span></b></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Advanced Computing Lab</span><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:black"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">GE Global Research</span><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:black"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">1 Research Circle K1-3A37C</span><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:black"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Niskayuna, NY 12309</span><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:black"><o:p></o:p></span></p>
</div>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<div>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">From:</span></b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif""> Bradley Lowekamp [<a href="mailto:blowekamp@mail.nih.gov">mailto:blowekamp@mail.nih.gov</a>]
<br>
<b>Sent:</b> Monday, April 07, 2014 9:13 AM<br>
<b>To:</b> Miller, James V (GE Global Research)<br>
<b>Cc:</b> Brahmakshatriya, Umang (GE Global Research); <a href="mailto:insight-developers@itk.org">
insight-developers@itk.org</a><br>
<b>Subject:</b> Re: [ITK-dev] [ITK] Thread Pool patch<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Jim,<o:p></o:p></p>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">Yes it was. But I set ITK_GLOBAL_DEFAULT_NUMBER_OF_THREADS to 8, and did ctest -j 8 initially, then I scaled back from there with lack of complete success in testing. There are thread management issue with the current patch. <o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">Brad<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<div>
<p class="MsoNormal">On Apr 4, 2014, at 2:06 PM, Miller, James V (GE Global Research) <<a href="mailto:millerjv@ge.com">millerjv@ge.com</a>> wrote:<o:p></o:p></p>
</div>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<p class="MsoNormal"><br>
"Too many threads" is a bit odd.  Umang does initialize the pool with a set of threads, then adds threads as needed. I believe the thread initialization is based on the number of cores.  But in principle, the initialization could be as low as 0 or 1 threads.<o:p></o:p></p>
</blockquote>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">I missed that in the patch. This is what I saw:<o:p></o:p></p>
</div>
<div>
<table class="MsoNormalTable" border="0" cellpadding="0" width="1440" style="width:15.0in;background:white;border-spacing: 0px">
<tbody>
<tr>
<td valign="top" style="border:none;border-bottom:solid #DDFFDD 1.0pt;background:#DDFFDD;padding:0in 0in 0in 0in;background-position:initial initial;background-repeat:initial initial">
<p class="MsoNormal"><span class="pln"><span style="font-size:8.0pt;font-family:"Courier New";color:black;background:#99FF99">m_Threadpool</span></span><span class="pun"><span style="font-size:8.0pt;font-family:"Courier New";color:#444400;background:#99FF99">(</span></span><span class="pln"><span style="font-size:8.0pt;font-family:"Courier New";color:black;background:#99FF99">m_Threadpoolfactory</span></span><span class="pun"><span style="font-size:8.0pt;font-family:"Courier New";color:#444400;background:#99FF99">.</span></span><span class="typ"><b><span style="font-size:8.0pt;font-family:"Courier New";color:#440044;background:#99FF99">GetSmartThreadPool</span></b></span><span class="pun"><span style="font-size:8.0pt;font-family:"Courier New";color:#444400;background:#99FF99">(</span></span><span class="typ"><b><span style="font-size:8.0pt;font-family:"Courier New";color:#440044;background:#99FF99">GetGlobalDefaul</span></b></span><b><span style="font-size:8.0pt;font-family:"Courier New";color:#440044;background:#99FF99"><br>
<span class="typ">tNumberOfThreads</span></span></b><span class="pun"><span style="font-size:8.0pt;font-family:"Courier New";color:#444400;background:#99FF99">()</span></span><span class="pln"><span style="font-size:8.0pt;font-family:"Courier New";color:black;background:#99FF99">
</span></span><span class="pun"><span style="font-size:8.0pt;font-family:"Courier New";color:#444400;background:#99FF99">*</span></span><span class="pln"><span style="font-size:8.0pt;font-family:"Courier New";color:black;background:#99FF99">
</span></span><span class="lit"><span style="font-size:8.0pt;font-family:"Courier New";color:#004444;background:#99FF99">2</span></span><span class="pun"><span style="font-size:8.0pt;font-family:"Courier New";color:#444400;background:#99FF99">)</span></span><span class="pln"><span style="font-size:8.0pt;font-family:"Courier New";color:black;background:#99FF99">
</span></span><span class="pun"><span style="font-size:8.0pt;font-family:"Courier New";color:#444400;background:#99FF99">)</span></span><span style="font-size:8.0pt;font-family:"Courier New";color:black"><o:p></o:p></span></p>
</td>
<td width="173" colspan="4" style="width:129.75pt;padding:0in 0in 0in 0in">
<p class="MsoNormal"> <o:p></o:p></p>
</td>
</tr>
<tr>
<td width="1" style="width:.75pt;border:none;border-bottom:solid blue 1.0pt;background:#FFFFCC;padding:0in 0in 0in 0in;background-position:initial initial;background-repeat:initial initial">
<p class="MsoNormal"><span style="font-size:8.0pt;font-family:"Courier New";color:black"><img border="0" width="1" height="1" id="A3467D1E-293E-4E1C-95FF-0F6B980E64CD" src="cid:image001.gif@01CF5245.401A4C00"><o:p></o:p></span></p>
</td>
<td width="56" valign="top" style="width:42.0pt;border-top:none;border-left:none;border-bottom:solid blue 1.0pt;border-right:solid #B0BDCC 1.0pt;background:#FFFFCC;padding:0in 2.4pt 0in 2.4pt;background-position:initial initial;background-repeat:initial initial">
</td>
<td valign="top" style="border:none;border-bottom:solid blue 1.0pt;background:#FFEEEE;padding:0in 0in 0in 0in;background-position:initial initial;background-repeat:initial initial">
</td>
<td width="56" valign="top" style="width:42.0pt;border-top:none;border-left:none;border-bottom:solid blue 1.0pt;border-right:solid #B0BDCC 1.0pt;background:#FFFFCC;padding:0in 2.4pt 0in 2.4pt;background-position:initial initial;background-repeat:initial initial">
<p class="MsoNormal" align="right" style="text-align:right"><span style="font-size:8.0pt;font-family:"Courier New";color:black">185<o:p></o:p></span></p>
</td>
<td valign="top" style="border:none;border-bottom:solid blue 1.0pt;background:#DDFFDD;padding:0in 0in 0in 0in;background-position:initial initial;background-repeat:initial initial">
<p class="MsoNormal"><span class="pun"><span style="font-size:8.0pt;font-family:"Courier New";color:#444400">{</span></span><span style="font-size:8.0pt;font-family:"Courier New";color:black"><o:p></o:p></span></p>
</td>
</tr>
</tbody>
</table>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</div>
<p class="MsoNormal" style="margin-bottom:12.0pt"><o:p> </o:p></p>
<p class="MsoNormal" style="margin-bottom:12.0pt"><br>
Was this on one of your giant core machines?<br>
<br>
Jim<br>
<br>
Brad<br>
<br>
On Apr 4, 2014, at 10:42 AM, Brahmakshatriya, Umang (GE Global Research) <<a href="mailto:brahmaks@ge.com">brahmaks@ge.com</a><<a href="mailto:brahmaks@ge.com">mailto:brahmaks@ge.com</a>>> wrote:<br>
<br>
Hi All,<br>
<br>
My name is Umang, I am working to submit the Thread Pool patch. Can anyone help me through the final steps of submitting it? I had a few issues creating the patches.<br>
I am available next week at these times:<br>
Tuesday 4/8 – 2.30p to 5p EST<br>
Wednesday 4/9 -  9.30am to 12p EST<br>
Thursday 4/10 - 2.30p to 5p EST<br>
<br>
Let me know which time works best and I will setup a t-con and webex / google hangout.<br>
<br>
<br>
<br>
Umang Brahmakshatriya<br>
Advanced Computing Lab<br>
GE Global Research<br>
1 Research Circle K1-3A37C<br>
Niskayuna, NY 12309<br>
<br>
_______________________________________________<br>
Powered by <a href="http://www.kitware.com">www.kitware.com</a><<a href="http://www.kitware.com/">http://www.kitware.com/</a>><br>
<br>
Visit other Kitware open-source projects at<br>
<a href="http://www.kitware.com/opensource/opensource.html">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Kitware offers ITK Training Courses, for more information visit:<br>
<a href="http://kitware.com/products/protraining.php">http://kitware.com/products/protraining.php</a><br>
<br>
Please keep messages on-topic and check the ITK FAQ at:<br>
<a href="http://www.itk.org/Wiki/ITK_FAQ">http://www.itk.org/Wiki/ITK_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.itk.org/mailman/listinfo/insight-developers">http://www.itk.org/mailman/listinfo/insight-developers</a><br>
_______________________________________________<br>
Community mailing list<br>
<a href="mailto:Community@itk.org%3cmailto:Community@itk.org">Community@itk.org<mailto:Community@itk.org</a>><br>
<a href="http://public.kitware.com/cgi-bin/mailman/listinfo/community">http://public.kitware.com/cgi-bin/mailman/listinfo/community</a><br>
<br>
_______________________________________________<br>
Powered by <a href="http://www.kitware.com%3chttp:/www.kitware.com">www.kitware.com<http://www.kitware.com</a>><br>
<br>
Visit other Kitware open-source projects at<br>
<a href="http://www.kitware.com/opensource/opensource.html">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Kitware offers ITK Training Courses, for more information visit:<br>
<a href="http://kitware.com/products/protraining.php">http://kitware.com/products/protraining.php</a><br>
<br>
Please keep messages on-topic and check the ITK FAQ at:<br>
<a href="http://www.itk.org/Wiki/ITK_FAQ">http://www.itk.org/Wiki/ITK_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.itk.org/mailman/listinfo/insight-developers">http://www.itk.org/mailman/listinfo/insight-developers</a><o:p></o:p></p>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</div>
</body>
</html>