<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=Windows-1252">
</head>
<body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; color: rgb(0, 0, 0); font-size: 14px; font-family: Calibri, sans-serif;">
<div>Thank you for your answer.</div>
<div><br>
</div>
<div>I actually looked at it, but I’m still not sure what happen in this example.</div>
<div>Is each function run in one separated thread, or each function run in multiple threads ?</div>
<div><br>
</div>
<div>Here is what I have:</div>
<div><br>
</div>
<div>myMethod(void* arg)</div>
<div>{</div>
<div><span class="Apple-tab-span" style="white-space:pre"></span>For loop</div>
<div> For loop</div>
<div> Computation()</div>
<div>}</div>
<div><br>
</div>
<div>And then I use vtkMultiThreader to execute this method like this:</div>
<div><br>
</div>
<div>Threader->SetSingleMethod(myMethod,NULL);</div>
<div>Threader->SingleMethodExecute()</div>
<div><br>
</div>
<div>What I was expecting was that thread detect the function could be split in multiple thread (because of the loops) and run each iteration of Computation() in a different thread.</div>
<div><br>
</div>
<div>But I think I got it wrong. I think I have to do something like that:</div>
<div><br>
</div>
<div>For Loop</div>
<div> For Loop</div>
<div> Threader->SetSingleMethod(myMethod,data[i][j])</div>
<div> Threader->SingleMethodExecute()</div>
<div><br>
</div>
<div>Is it correct ?</div>
<div><br>
</div>
<div>Thank you.</div>
<div>-Laurent</div>
<div><br>
</div>
<span id="OLK_SRC_BODY_SECTION">
<div style="font-family:Calibri; font-size:11pt; text-align:left; color:black; BORDER-BOTTOM: medium none; BORDER-LEFT: medium none; PADDING-BOTTOM: 0in; PADDING-LEFT: 0in; PADDING-RIGHT: 0in; BORDER-TOP: #b5c4df 1pt solid; BORDER-RIGHT: medium none; PADDING-TOP: 3pt">
<span style="font-weight:bold">From: </span>Dan Lipsa <<a href="mailto:dan.lipsa@kitware.com">dan.lipsa@kitware.com</a>><br>
<span style="font-weight:bold">Date: </span>Friday, October 9, 2015 at 11:18 PM<br>
<span style="font-weight:bold">To: </span>"Chauvin, Laurent,Ph.D." <<a href="mailto:lchauvin@bwh.harvard.edu">lchauvin@bwh.harvard.edu</a>><br>
<span style="font-weight:bold">Cc: </span>Franz Neubert via vtkusers <<a href="mailto:vtkusers@vtk.org">vtkusers@vtk.org</a>><br>
<span style="font-weight:bold">Subject: </span>Re: [vtkusers] vtkMultiThreader question<br>
</div>
<div><br>
</div>
<div>
<div>
<div dir="ltr">Laurent,
<div>Did you look at the tests that come with this class. Do they work?</div>
<div><br>
</div>
<div><a href="http://www.vtk.org/doc/nightly/html/c2_vtk_t_12.html#c2_vtk_t_vtkMultiThreader">http://www.vtk.org/doc/nightly/html/c2_vtk_t_12.html#c2_vtk_t_vtkMultiThreader</a><br>
</div>
<div><br>
</div>
<div>Dan</div>
<div><br>
</div>
</div>
<div class="gmail_extra"><br>
<div class="gmail_quote">On Fri, Oct 9, 2015 at 5:00 PM, Chauvin, Laurent,Ph.D. <span dir="ltr">
<<a href="mailto:lchauvin@bwh.harvard.edu" target="_blank">lchauvin@bwh.harvard.edu</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div style="word-wrap:break-word;color:rgb(0,0,0);font-size:14px;font-family:Calibri,sans-serif">
<div>Hello,</div>
<div><br>
</div>
<div>I’m trying to use a vtkMultiThreader to compute several thing in parallel.</div>
<div>However I’m not sure how it works.</div>
<div><br>
</div>
<div>Here is what I did.</div>
<div>I created a single method that calculate some metric pairwise. So I have 2 for loops in this method.</div>
<div>What I want to do, is to have one thread per iteration (kind of), so I can calculate all metrics simultaneously.</div>
<div><br>
</div>
<div>So I created a vtkMultiThreader and set the single method, which contains the loops, and executed it. However when I do that, I can only see one core working. I thought SingleMethod was using multiple thread to run this method. Is it true ? Why then it
is not using all my other cores ?</div>
<div><br>
</div>
<div>Should I put the loops out of the single method then, and spawn a thread for each iteration, with different data as input ?</div>
<div><br>
</div>
<div>Thank you very much.</div>
<div>-Laurent</div>
<p></p>
<p>The information in this e-mail is intended only for the person to whom it is<br>
addressed. If you believe this e-mail was sent to you in error and the e-mail<br>
contains patient information, please contact the Partners Compliance HelpLine at<br>
<a href="http://www.partners.org/complianceline" target="_blank">http://www.partners.org/complianceline</a> . If the e-mail was sent to you in error<br>
but does not contain patient information, please contact the sender and properly<br>
dispose of the e-mail.</p>
</div>
<br>
_______________________________________________<br>
Powered by <a href="http://www.kitware.com" rel="noreferrer" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" rel="noreferrer" target="_blank">
http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the VTK FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ" rel="noreferrer" target="_blank">
http://www.vtk.org/Wiki/VTK_FAQ</a><br>
<br>
Search the list archives at: <a href="http://markmail.org/search/?q=vtkusers" rel="noreferrer" target="_blank">
http://markmail.org/search/?q=vtkusers</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://public.kitware.com/mailman/listinfo/vtkusers" rel="noreferrer" target="_blank">http://public.kitware.com/mailman/listinfo/vtkusers</a><br>
<br>
</blockquote>
</div>
<br>
</div>
</div>
</div>
</span>
</body>
</html>