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