Article View: sci.math.num-analysis
Article #1300Numerical Computations With GCC
From: Steven Smith
Date: Sun, 21 Feb 1993 22:51
Date: Sun, 21 Feb 1993 22:51
38 lines
2933 bytes
2933 bytes
I encountered the following annoying problem while using gcc for numeric computations and am curious if other people have experienced similar difficulties. I wrote a conjugate gradient algorithm to compute the extrema of a certain function defined on the compact Stiefel manifold V(n,k) (n-by-k matrices with orthonormal columns). This algorithm is mostly QR decompositions and matrix-vector multiplications. The algorithm converges as predicted, but for moderately sized n and small k (n = 100, k = 3), I noticed that after about 80 steps or so, the algorithm slowed down considerably -- from about 0.01 seconds per step to over 1 second per step. This was very perplexing because the steps (should) have a constant flop count. I assumed that I had made some coding error that resulted in memory allocation at every step, or had done something that increased the flop count at every step. My memory requirements (about 3000 floats) were much too small for swapping to play a role. My timing experiments indicated that the slower running speed was not isolated in one part of the algorithm. After ruling out all these possibilities, I asked a friend for help. After some puzzling, he suggested that I use SUN's cc compiler instead of GNU's gcc compiler (v. 2.2.2). The problem vanished immediately after recompiling. Ironically, using gcc's optimization flag -O made the program run even slower. I am left wondering if I can trust gcc's reliability for numerical work. Has anyone else experienced similar difficulties with gcc, or C compilers in general, when doing intensive numerical work? I wish that I could report a specific bug, but I haven't taken the time (or have the time) to pare down my algorithm to some small kernel of code that exhibits this apparently subtle problem. Steven Smith
Technical Details
Message-ID:
<SMITH.93Feb21175110@minerva.harvard.edu>Path:
arc1-ca.pugleaf.net!sparky!uunet!stanford.edu!agate!howland.reston.ans.net!usc!sdd.hp.com!saimiri.primate.wisc.edu!usenet.coe.montana.edu!mintaka.lcs.mit.edu!ai-lab!prep.ai.mit.edu!gnulistsShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 11318c,497432ef72672d8,start X-Google-Attributes: gid11318c,public X-Google-Thread: 107079,497432ef72672d8,start X-Google-Attributes: gid107079,public X-Google-Thread: 1025b4,497432ef72672d8,start X-Google-Attributes: gid1025b4,public X-Google-Thread: 113d02,497432ef72672d8,start X-Google-Attributes: gid113d02,public X-Google-ArrivalTime: 1993-02-21 14:51:10 PST To: gnu-gcc-bug@eddie.mit.edu Distribution: world Approved: info-gnu@prep.ai.mit.edu Path: arc1-ca.pugleaf.net!sparky!uunet!stanford.edu!agate!howland.reston.ans.net!usc!sdd.hp.com!saimiri.primate.wisc.edu!usenet.coe.montana.edu!mintaka.lcs.mit.edu!ai-lab!prep.ai.mit.edu!gnulists Followup-To: gnu.gcc.help Newsgroups: sci.math.num-analysis,gnu.gcc.help,gnu.gcc.bug,gnu.misc.discuss From: smith@minerva.harvard.edu (Steven Smith) Subject: Numerical Computations With GCC Message-ID: <SMITH.93Feb21175110@minerva.harvard.edu> Bcc: bug-gcc@prep.ai.mit.edu Organization: Harvard Robotics Lab, Harvard University Date: Sun, 21 Feb 1993 22:51:10 GMT Lines: 39