comp.lang.ada
 help / color / mirror / Atom feed
From: rodemann@mathematik.uni-ulm.de (Joerg Rodemann)
Subject: Ada-95 for numerics?
Date: 1996/04/01
Date: 1996-04-01T00:00:00+00:00	[thread overview]
Message-ID: <4jocek$h5h@rigel.rz.uni-ulm.de> (raw)

Hello!

Since I will have to do a lot of matrix diagonalization in the near future
(matrix dimensions will be about 1000x1000) I checked the speed different
languages produce. I used the routine tred2 from the "Numerical Recipes in C"
which brings a real symmetric matrix to a tri-diagonal form. 
I tested the following languages/compilers:

   1.) C:
       Compilers: HP/UX cc, gcc-2.7.2
                  Solaris   gcc-2.7.2
   2.) Fortran-77: 
          the routine was called from an Ada-95 main.
       Compilers: HP-UX f77
   3.) Ada-95:
       Compilers: GNAT 3.01/gcc-2.7.2

In order to minimize other effects I entered NxN symmetrical random matrices
and called the routine 10000 times. With gcc/GNAT I used optimization level 4,
for cc I used +Oall. The Ada package containing tred2 included a pragma
Optimization (Time). 

This were the results:

   1.) All programs showed for larger N the expected N**3 behaviour.
   2.) Their speed differed by a seemingly constant factor (This not so for
       small N --- there the overhead is dominating.)
   3.) The C and f77 versions had a quite similar speed. (C needed about 1.x
       the time the f77-routine did with x between 1 and 2
   4.) The Ada-95 version was about a factor of 6 slower than the other ones.
   5.) For C the results from gcc and the original HP cc were nearly equal.
   6.) Using pragma Suppress (All_Checks) in the tred2 routine still left
       the Ada program a factor of 2 behind the other ones.

My questions now are the following:

  a.) Has anybody out there used/tested Ada for similar problems? What were
      the results?
  b.) What is the reason for the slow down? Especially if suppressing all
      checks still leaves a factor of 2...what is the runtime system doing
      with the extra time?
  c.) Is this a GNAT specific result or do the commercial compilers show the
      same behaviour?
  d.) Is there a way to speed up the program? Perhaps without suppressing all
      checks? (It seems somewhat brute to take away a lot of those things
      that are real advantages of Ada...)

For now I will do the global program structure with Ada and call some
Fortran routines with pragma Import. By the way: I was really surprised how
easy it is to import Fortran routines. IMHO if more languages provide such
an easy to use interface perhaps there would not be any language wars anymore.
Just use the language that is best suited for each single problem and build
the whole thing together... (Just thinking...)

Thanks to all

greetings

George






             reply	other threads:[~1996-04-01  0:00 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-04-01  0:00 Joerg Rodemann [this message]
1996-04-01  0:00 ` Ada-95 for numerics? Ted Dennison
1996-04-01  0:00   ` Robert Dewar
1996-04-01  0:00 ` Robert Dewar
1996-04-02  0:00   ` michael
1996-04-02  0:00 ` Dale Stanbrough
1996-04-03  0:00 ` Robert I. Eachus
  -- strict thread matches above, loose matches on Subject: below --
1996-04-02  0:00 Joerg Rodemann
1996-04-02  0:00 ` Robert Dewar
1996-04-02  0:00 Jean-Pierre Rosen
1996-04-03  0:00 ` Robert I. Eachus
1996-04-05  0:00  Dr J Parker
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox