<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META NAME="Generator" CONTENT="MS Exchange Server version 5.5.2658.24">
<TITLE>RE: [Insight-users] Resampling 64-bit crash</TITLE>
</HEAD>
<BODY>

<P><FONT SIZE=2>Hi Florian:</FONT>
</P>

<P><FONT SIZE=2>I tried to use 8GB with 64-bit but didn't succeed. Now I move the part of program requiring </FONT>
<BR><FONT SIZE=2>more than 4GB memory out of the ITK, and it works. </FONT>
</P>

<P><FONT SIZE=2>Weiguang</FONT>
</P>

<P><FONT SIZE=2>-----Original Message-----</FONT>
<BR><FONT SIZE=2>From: insight-users-bounces+wyao=hrsrh.on.ca@itk.org</FONT>
<BR><FONT SIZE=2>[<A HREF="mailto:insight-users-bounces+wyao=hrsrh.on.ca@itk.org">mailto:insight-users-bounces+wyao=hrsrh.on.ca@itk.org</A>]On Behalf Of</FONT>
<BR><FONT SIZE=2>Florian Pierron</FONT>
<BR><FONT SIZE=2>Sent: Wednesday, February 14, 2007 10:21 AM</FONT>
<BR><FONT SIZE=2>To: Thomas Lambertz; insight-users@itk.org</FONT>
<BR><FONT SIZE=2>Subject: Re: [Insight-users] Resampling 64-bit crash</FONT>
</P>
<BR>

<P><FONT SIZE=2>Hi Thomas,</FONT>
</P>

<P><FONT SIZE=2>Thank you for your answer! Yes, I agree with you the allocated memory </FONT>
<BR><FONT SIZE=2>seems to be modulo 4GB as you said and that's why I was wondering if </FONT>
<BR><FONT SIZE=2>there's a problem in ITK to go over this 4GB limit of 32-bit </FONT>
<BR><FONT SIZE=2>applications. Thank you for your input, maybe my question should be </FONT>
<BR><FONT SIZE=2>reformulated to: &quot;Does anyone know if ITK support 64-bit addressing?&quot;</FONT>
</P>

<P><FONT SIZE=2>Thanks again,</FONT>
<BR><FONT SIZE=2>Florian</FONT>
</P>

<P><FONT SIZE=2>On 14/02/2007 15:02, Thomas Lambertz wrote:</FONT>
<BR><FONT SIZE=2>&gt; Hi Florian,</FONT>
<BR><FONT SIZE=2>&gt;</FONT>
<BR><FONT SIZE=2>&gt; i doubt ITK supports 64bit addressing even when compiled for the 64bit </FONT>
<BR><FONT SIZE=2>&gt; plattform.</FONT>
<BR><FONT SIZE=2>&gt;</FONT>
<BR><FONT SIZE=2>&gt; About 3)</FONT>
<BR><FONT SIZE=2>&gt; The allocated memory seemes to be modulo 4GB - (4GB = 4294967296 = </FONT>
<BR><FONT SIZE=2>&gt; approximatly 4.3 billion bytes)</FONT>
<BR><FONT SIZE=2>&gt; 5 - 4.3 = 0.7</FONT>
<BR><FONT SIZE=2>&gt; 7 - 4.3 = 2.7 (2.65)</FONT>
<BR><FONT SIZE=2>&gt; 10 - 2 * 4.3 = 1.4</FONT>
<BR><FONT SIZE=2>&gt; (looks you set 5 * 1,000 * 1,000 * 1,000Byte = 5GB)</FONT>
<BR><FONT SIZE=2>&gt;</FONT>
<BR><FONT SIZE=2>&gt; But i havent exceeded 4GB by myself - so more advanced users surely </FONT>
<BR><FONT SIZE=2>&gt; can tell you more about this.</FONT>
<BR><FONT SIZE=2>&gt;</FONT>
<BR><FONT SIZE=2>&gt; Regards,</FONT>
<BR><FONT SIZE=2>&gt; Tom</FONT>
<BR><FONT SIZE=2>&gt;</FONT>
<BR><FONT SIZE=2>&gt;</FONT>
<BR><FONT SIZE=2>&gt;</FONT>
<BR><FONT SIZE=2>&gt;</FONT>
<BR><FONT SIZE=2>&gt;</FONT>
<BR><FONT SIZE=2>&gt;</FONT>
<BR><FONT SIZE=2>&gt;</FONT>
<BR><FONT SIZE=2>&gt; Florian Pierron schrieb:</FONT>
<BR><FONT SIZE=2>&gt;&gt; Dear ITK users and developers,</FONT>
<BR><FONT SIZE=2>&gt;&gt;</FONT>
<BR><FONT SIZE=2>&gt;&gt; We need to resample big data and we decided to port our application </FONT>
<BR><FONT SIZE=2>&gt;&gt; in 64-bit version. We're currently working on Windows Server 2003, </FONT>
<BR><FONT SIZE=2>&gt;&gt; Enterprise x64 Edition, Dual Core AMD Opteron and using ITK-3-0 </FONT>
<BR><FONT SIZE=2>&gt;&gt; branch with VC2005. Unfortunately our application crashes when trying </FONT>
<BR><FONT SIZE=2>&gt;&gt; to resample big data.</FONT>
<BR><FONT SIZE=2>&gt;&gt;</FONT>
<BR><FONT SIZE=2>&gt;&gt; We reproduced the crash with the ResampleImageFilter example </FONT>
<BR><FONT SIZE=2>&gt;&gt; (D:\InsightToolkit-3.0.0\Examples\Filtering\ResampleImageFilter.cxx) </FONT>
<BR><FONT SIZE=2>&gt;&gt; by changing the size of the output image to be more than 3-4 GB:</FONT>
<BR><FONT SIZE=2>&gt;&gt; Line 279:&nbsp;&nbsp;&nbsp; size[0] = 5 * 1000 * 1000;&nbsp; // number of pixels along X</FONT>
<BR><FONT SIZE=2>&gt;&gt; Line 280:&nbsp;&nbsp;&nbsp; size[1] = 1 * 1000;&nbsp; // number of pixels along Y</FONT>
<BR><FONT SIZE=2>&gt;&gt;</FONT>
<BR><FONT SIZE=2>&gt;&gt; We run this example by setting the working directory to </FONT>
<BR><FONT SIZE=2>&gt;&gt; &quot;D:\InsightToolkit-3.0.0\Testing\Data\Input&quot; and the command line </FONT>
<BR><FONT SIZE=2>&gt;&gt; arguments to</FONT>
<BR><FONT SIZE=2>&gt;&gt; &quot;BrainSliceBinary.png BrainSliceBinaryOutput.png 0&quot; (a random image I </FONT>
<BR><FONT SIZE=2>&gt;&gt; found in the ITK folder).</FONT>
<BR><FONT SIZE=2>&gt;&gt;</FONT>
<BR><FONT SIZE=2>&gt;&gt; 1) If I run this example with the modified size above (5 GB), it </FONT>
<BR><FONT SIZE=2>&gt;&gt; crashes immediately in:</FONT>
<BR><FONT SIZE=2>&gt;&gt;</FONT>
<BR><FONT SIZE=2>&gt;&gt;&nbsp; /** Set the pixel. */</FONT>
<BR><FONT SIZE=2>&gt;&gt;&nbsp; inline void Set(TType &amp; output, const TType &amp; input) const</FONT>
<BR><FONT SIZE=2>&gt;&gt;&nbsp;&nbsp;&nbsp; {output = input;}</FONT>
<BR><FONT SIZE=2>&gt;&gt;</FONT>
<BR><FONT SIZE=2>&gt;&gt; with this call stack:</FONT>
<BR><FONT SIZE=2>&gt;&gt;</FONT>
<BR><FONT SIZE=2>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp; ResampleImageFilter.exe!itk::DefaultPixelAccessor&lt;unsigned </FONT>
<BR><FONT SIZE=2>&gt;&gt; char&gt;::Set(unsigned char &amp; output=, const unsigned char &amp; input=0)&nbsp; </FONT>
<BR><FONT SIZE=2>&gt;&gt; Line 67 + 0x1d bytes</FONT>
<BR><FONT SIZE=2>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp; </FONT>
<BR><FONT SIZE=2>&gt;&gt; ResampleImageFilter.exe!itk::DefaultPixelAccessorFunctor&lt;itk::Image&lt;unsigned </FONT>
<BR><FONT SIZE=2>&gt;&gt; char,2&gt; &gt;::Set(unsigned char &amp; output=, const unsigned char &amp; </FONT>
<BR><FONT SIZE=2>&gt;&gt; input=0)&nbsp; Line 77</FONT>
<BR><FONT SIZE=2>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp; </FONT>
<BR><FONT SIZE=2>&gt;&gt; ResampleImageFilter.exe!itk::ImageLinearIteratorWithIndex&lt;itk::Image&lt;unsigned </FONT>
<BR><FONT SIZE=2>&gt;&gt; char,2&gt; &gt;::Set(const unsigned char &amp; value=0)&nbsp; Line 106 + 0x47 bytes</FONT>
<BR><FONT SIZE=2>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp; </FONT>
<BR><FONT SIZE=2>&gt;&gt; ResampleImageFilter.exe!itk::ResampleImageFilter&lt;itk::Image&lt;unsigned </FONT>
<BR><FONT SIZE=2>&gt;&gt; char,2&gt;,itk::Image&lt;unsigned </FONT>
<BR><FONT SIZE=2>&gt;&gt; char,2&gt;,double&gt;::LinearThreadedGenerateData(const itk::ImageRegion&lt;2&gt; </FONT>
<BR><FONT SIZE=2>&gt;&gt; &amp; outputRegionForThread={...}, int threadId=2)&nbsp; Line 481</FONT>
<BR><FONT SIZE=2>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp; </FONT>
<BR><FONT SIZE=2>&gt;&gt; ResampleImageFilter.exe!itk::ResampleImageFilter&lt;itk::Image&lt;unsigned </FONT>
<BR><FONT SIZE=2>&gt;&gt; char,2&gt;,itk::Image&lt;unsigned </FONT>
<BR><FONT SIZE=2>&gt;&gt; char,2&gt;,double&gt;::ThreadedGenerateData(const itk::ImageRegion&lt;2&gt; &amp; </FONT>
<BR><FONT SIZE=2>&gt;&gt; outputRegionForThread={...}, int threadId=2)&nbsp; Line 192</FONT>
<BR><FONT SIZE=2>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp; ResampleImageFilter.exe!itk::ImageSource&lt;itk::Image&lt;unsigned </FONT>
<BR><FONT SIZE=2>&gt;&gt; char,2&gt; &gt;::ThreaderCallback(void * arg=0x0000000002c2f4f8)&nbsp; Line 282</FONT>
<BR><FONT SIZE=2>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp; </FONT>
<BR><FONT SIZE=2>&gt;&gt; ResampleImageFilter.exe!itk::MultiThreader::SingleMethodProxy(void * </FONT>
<BR><FONT SIZE=2>&gt;&gt; arg=0x0000000002c2f4f8)&nbsp; Line 748</FONT>
<BR><FONT SIZE=2>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp; msvcr80d.dll!_callthreadstartex()&nbsp; Line 348 + 0x17 bytes</FONT>
<BR><FONT SIZE=2>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp; msvcr80d.dll!_threadstartex(void * ptd=0x0000000002c3c8f0)&nbsp; Line 331</FONT>
<BR><FONT SIZE=2>&gt;&gt;</FONT>
<BR><FONT SIZE=2>&gt;&gt;</FONT>
<BR><FONT SIZE=2>&gt;&gt; 2) If I change the size to be 2GB, it's running fine. The limit </FONT>
<BR><FONT SIZE=2>&gt;&gt; between crashing and not crashing seems to be between 2 and 3 GB </FONT>
<BR><FONT SIZE=2>&gt;&gt; (with 8 threads).</FONT>
<BR><FONT SIZE=2>&gt;&gt;</FONT>
<BR><FONT SIZE=2>&gt;&gt; 3) If I force the SetNumberOfTheads to 1, it doesn't crash </FONT>
<BR><FONT SIZE=2>&gt;&gt; immediately (I think it crashes later, but it's quite slow so most of </FONT>
<BR><FONT SIZE=2>&gt;&gt; the time I killed it before). The funny thing is that when the number </FONT>
<BR><FONT SIZE=2>&gt;&gt; of threads is equal to 1:</FONT>
<BR><FONT SIZE=2>&gt;&gt; - if the size is 4 GB, then 4 GB of memory is allocated immediately</FONT>
<BR><FONT SIZE=2>&gt;&gt; - but if the size is 5 GB, only 700 MB is allocated</FONT>
<BR><FONT SIZE=2>&gt;&gt; - for 7 GB, 2.65 GB is allocated</FONT>
<BR><FONT SIZE=2>&gt;&gt; - for 10 GB, 1.4 GB is allocated (which is weirdly twice the 5GB)</FONT>
<BR><FONT SIZE=2>&gt;&gt; I have no idea if this is meaningful at all, I was just wondering if </FONT>
<BR><FONT SIZE=2>&gt;&gt; there's a problem during memory allocation when the 4GB limit is </FONT>
<BR><FONT SIZE=2>&gt;&gt; reached...</FONT>
<BR><FONT SIZE=2>&gt;&gt;</FONT>
<BR><FONT SIZE=2>&gt;&gt;</FONT>
<BR><FONT SIZE=2>&gt;&gt; Any ideas?</FONT>
<BR><FONT SIZE=2>&gt;&gt;</FONT>
<BR><FONT SIZE=2>&gt;&gt; Cheers,</FONT>
<BR><FONT SIZE=2>&gt;&gt; Florian</FONT>
<BR><FONT SIZE=2>&gt;&gt;</FONT>
<BR><FONT SIZE=2>&gt;&gt; _______________________________________________</FONT>
<BR><FONT SIZE=2>&gt;&gt; Insight-users mailing list</FONT>
<BR><FONT SIZE=2>&gt;&gt; Insight-users@itk.org</FONT>
<BR><FONT SIZE=2>&gt;&gt; <A HREF="http://www.itk.org/mailman/listinfo/insight-users" TARGET="_blank">http://www.itk.org/mailman/listinfo/insight-users</A></FONT>
<BR><FONT SIZE=2>&gt;&gt;</FONT>
<BR><FONT SIZE=2>&gt;</FONT>
<BR><FONT SIZE=2>&gt;</FONT>
<BR><FONT SIZE=2>_______________________________________________</FONT>
<BR><FONT SIZE=2>Insight-users mailing list</FONT>
<BR><FONT SIZE=2>Insight-users@itk.org</FONT>
<BR><FONT SIZE=2><A HREF="http://www.itk.org/mailman/listinfo/insight-users" TARGET="_blank">http://www.itk.org/mailman/listinfo/insight-users</A></FONT>
<BR><FONT SIZE=2>**********************************************************************</FONT>
<BR><FONT SIZE=2>The information contained in this email and document(s)attached are for the exclusive use of the addressee and may contain confidential, privileged and non-disclosable information. If the recipient of this e-mail is not the addressee, such recipient is strictly prohibited from reading, photocopying, distributing or otherwise using this e-mail or its content in any way.</FONT></P>

</BODY>
</HTML>