[Insight-developers] Visual C++ .NET 2003 and vnl_test_qsvd timeout

Miller, James V (Research) millerjv at crd . ge . com
Thu, 14 Aug 2003 15:02:59 -0400


This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.

------_=_NextPart_001_01C36296.AD7CB19A
Content-Type: text/plain;
	charset="iso-8859-1"

This is a good one.
 
I checked in a fix to netlib that allows the qsvd code to run without
getting into an infinite loop on an optimized build with Visual C++ .NET
2003.  I had to turn off the optimizer for a single routine.  If this
routine is optimized, the SVD code will run forever.  Here is code that
cannot be optimized:
 
double slamc3_(double *a, double *b)
{
  return *a + *b;
}
 
Here is the netlib documentation from the routine:
 
"SLAMC3  is intended to force  A  and  B  to be stored prior to doing the
addition of  A  and  B ,  for use in situations where optimizers might hold
one of these in a register."

Hard to imagine why this routine cannot be optimized.  But here's my best
guess.  The Intel processors use floating point registers that are bigger
than an IEEE floating point number.  Netlib is using this routine to
determine some numerical precision limits prior to running the SVD
calculation.  Due to the increased precision of the Intel floating point
registers, a precision limit is being calculated that the SVD routine can
never really attain.
 
Now for the sad part.  I think I put in this same fix around this same
routine two years ago when trying to get the Intel C++ compiler to produce
the correct answers for vnl_test_qsvd.
 

Jim Miller 
_____________________________________
Visualization & Computer Vision
GE Research
Bldg. KW, Room C218B
P.O. Box 8, Schenectady NY 12301

millerjv at research . ge . com <mailto:millerjv at research . ge . com> 

james . miller at research . ge . com
(518) 387-4005, Dial Comm: 8*833-4005, 
Cell: (518) 505-7065, Fax: (518) 387-6981 

 

------_=_NextPart_001_01C36296.AD7CB19A
Content-Type: text/html;
	charset="iso-8859-1"

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">


<META content="MSHTML 6.00.2800.1141" name=GENERATOR></HEAD>
<BODY>
<DIV><SPAN class=872365418-14082003><FONT size=2>This is a good 
one.</FONT></SPAN></DIV>
<DIV><SPAN class=872365418-14082003><FONT size=2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=872365418-14082003><FONT size=2>I checked in a fix to netlib 
that allows the qsvd code to run without getting into an infinite loop&nbsp;on 
an optimized build with&nbsp;Visual C++ .NET 2003.&nbsp; I had to turn off the 
optimizer for a single routine.&nbsp; If this routine is optimized, the SVD code 
will run forever.&nbsp; Here is code that cannot be 
optimized:</FONT></SPAN></DIV>
<DIV><SPAN class=872365418-14082003><FONT size=2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=872365418-14082003><FONT size=2>double slamc3_(double *a, 
double *b)</FONT></SPAN></DIV>
<DIV><SPAN class=872365418-14082003><FONT size=2>{</FONT></SPAN></DIV>
<DIV><SPAN class=872365418-14082003><FONT size=2>&nbsp; return *a + 
*b;</FONT></SPAN></DIV>
<DIV><SPAN class=872365418-14082003><FONT size=2>}</FONT></SPAN></DIV>
<DIV><SPAN class=872365418-14082003><FONT size=2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=872365418-14082003><FONT size=2>Here is the netlib 
documentation from the routine:</FONT></SPAN></DIV>
<DIV><SPAN class=872365418-14082003><FONT size=2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=872365418-14082003><FONT size=2><EM>"SLAMC3&nbsp; is intended 
to force&nbsp; A&nbsp; and&nbsp; B&nbsp; to be stored prior to doing&nbsp;the 
addition of&nbsp; A&nbsp; and&nbsp; B ,&nbsp; for use in situations where 
optimizers might hold one of these in a register."</EM><BR></FONT></SPAN></DIV>
<DIV><SPAN class=872365418-14082003><FONT size=2>Hard to imagine why this 
routine cannot be optimized.&nbsp; But here's my best guess.&nbsp; The Intel 
processors use floating point registers that are bigger than an IEEE floating 
point number.&nbsp; Netlib is using this routine to determine some numerical 
precision limits prior to running the SVD calculation.&nbsp; Due to the 
increased precision of the Intel floating point registers, a precision limit is 
being calculated that the SVD routine can never really 
attain.</FONT></SPAN></DIV>
<DIV><SPAN class=872365418-14082003><FONT size=2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=872365418-14082003><FONT size=2>Now for the sad part.&nbsp; I 
think I put in this same fix around this same routine two years ago when trying 
to get the Intel C++ compiler to produce the correct answers for 
vnl_test_qsvd.</FONT></SPAN></DIV>
<DIV><FONT size=2></FONT>&nbsp;</DIV>
<DIV>
<P style="MARGIN: 0in 0in 0pt"><B><SPAN 
style="COLOR: navy; FONT-FAMILY: 'Comic Sans MS'">Jim Miller</SPAN></B> 
<BR><B><I><SPAN 
style="FONT-SIZE: 10pt; COLOR: red; FONT-FAMILY: Arial">_____________________________________</SPAN></I></B><BR><EM><SPAN 
style="FONT-SIZE: 7.5pt; COLOR: black; FONT-FAMILY: Arial">Visualization &amp; 
Computer Vision</SPAN></EM><I><SPAN 
style="FONT-SIZE: 7.5pt; COLOR: black; FONT-FAMILY: Arial"><BR><EM>GE 
Research</EM><BR><EM>Bldg. KW, Room C218B</EM><BR><EM>P.O. Box 8, Schenectady NY 
12301</EM><BR><BR></SPAN></I><EM><U><SPAN 
style="FONT-SIZE: 7.5pt; COLOR: blue"><A 
href="mailto:millerjv at research . ge . com">millerjv at research . ge . com</A></SPAN></U></EM></P>
<P style="MARGIN: 0in 0in 0pt"><EM><U><SPAN 
style="FONT-SIZE: 7.5pt; COLOR: blue">james . miller at research . ge . com</SPAN></U></EM><BR><I><SPAN 
style="FONT-SIZE: 7.5pt; COLOR: black; FONT-FAMILY: Arial">(518) 387-4005, Dial 
Comm: 8*833-4005, </SPAN></I><BR><I><SPAN 
style="FONT-SIZE: 7.5pt; COLOR: black; FONT-FAMILY: Arial">Cell: (518) 505-7065, 
Fax: (518) 387-6981</SPAN></I> </P></DIV>
<DIV>&nbsp;</DIV></BODY></HTML>

------_=_NextPart_001_01C36296.AD7CB19A--