comp.lang.ada
 help / color / mirror / Atom feed
From: Vincent LAFAGE <lafage@ipno.in2p3.fr>
Subject: Re: Why is Ada considered  "too specialized" for scientific use
Date: Thu, 08 Apr 2010 15:40:10 +0200
Date: 2010-04-08T15:40:10+02:00	[thread overview]
Message-ID: <hpkmbq$4f0$1@ccpntc8.in2p3.fr> (raw)
In-Reply-To: <hp95j8$i29$1@speranza.aioe.org>

Nasser M. Abbasi a �crit :
> I was browsing the net for scientific software written in Ada, and came 
> across this strange statement:
> 
> http://farside.ph.utexas.edu/teaching/329/lectures/node7.html
> 
> "Scientific programming languages
> What is the best high-level language to use for scientific programming? 
> This, unfortunately, is a highly contentious question. Over the years, 
> literally hundreds of high-level languages have been developed. However, few 
> have stood the test of time. Many languages (e.g., Algol, Pascal, Haskell) 
> can be dismissed as ephemeral computer science fads. Others (e.g., Cobol, 
> Lisp, Ada) are too specialized to adapt for scientific use.
> 
> ......
> 
> The remaining options are FORTRAN 77 and C. I have chosen to use C "
> 
> I find this strange, because I think Ada can be the best programming 
> language for numerical work.  So, I do not know why the author above thinks 
> Ada is "too specialized to adapt for scientific use".  Is there something in 
> Ada which makes it hard to use for  scientific  programming?
> 
> The main problem I see with Ada for scientific use is that it does not have 
> as nearly as many packages and functions ready to use output of the box for 
> this, other than that, the language itself I think is better than Fortran 
> and C for scientific work.
> 
> (the above quote is from a course on Computational Physics at University of 
> Texas at Austin, may be I should write to the professor and ask him why he 
> said that, but I am not sure I'll get an answer, my experience is that most 
> professors do not answer email :)
> 
> --Nasser 

just my 2 (numerical) eurocents

I have been developping some Fortran (77) code during my PhD (17 years ago).
It was a basic MonteCarlo Code for simulation of electron-positron 
collision.
1001 SLOC (physical Sources Lines Of Code, measured with sloccount)
Not big, most work went into chiseling the analytical low-level 
expressions so that the numerical approach would be used at its most.
No dedicated simplification or hardware related optimisation beyond what 
the compiler provides with -O3.
Not much software engineering: only using Fortran 77 with COMMON thought 
as objects, and a minimum modular approach.
The result was fast, but it would be arrogant boasting to describe how 
much ;-)

Time passed and then Open MP appeared. I wanted to test my old pal 
reference code on my brand new two-core CPU, without much effort, I thought.
To ease the move to parallel code, and to learn more about the now 
unavoidable Fortran 90 (which simply copied the easiest part of Ada 83),
I first translated my code to F90 (not simply compiling the same code 
with an F90 compiler).
I turned the COMMON into modules (a.k.a. package) and a type within this 
package, and according to the famous equation :
     module + type = class
it resulted in an object oriented code ;-) .
1150 SLOC
Time-wise, I was paying only a 20% abstraction penalty with the same 
compiler. Not bad.

The objectification process was made in C++ at the same time. A quite 
painful translation indeed, but C++ was my way to earn money at that time...
1259 SLOC.
Not only the translation was painful, but the compilation gave me result 
flawed with memory faults that I had to debug. In the end, I finally had 
the same accuracy as Fortran 77, but...
The result looks like a good start for a flame war: C++ was 7.5 times 
slower than Fortran 77. With the same compiler (g++ versus g77/gfortran).
I do not think it is so significant in fact, as my algorithm relies 
heavily on complex number, which are well integrated in Fortran, but 
pays the full abstraction penalty in C++... The good way to do it in C++ 
would be to use libraries such as Boost or Blitz.
We can do it, but then do we really want to go through the hassle of 
extra layers?

My program wasn't still parallelized, and Ada became the next candidate 
for the test.
1120 SLOC.
The translation was swift, and when the compiler finaly let me go, the 
code ran (no debug needed) and was delivering the same accuracy as 
Fortran 77, and only a factor 2 of speed loss (compared to 7.5 for 
C++...). With gnat (to stay in the same compiler family).
Given that complex number are not hard-embedded in Ada, they should pay 
the abstraction price, but they keep the price low.

Later, I could capitalize on the tasks and protected objects to 
parallelize my program in Ada, which is as yet still not done in 
Fortran... But this is another story.

I plan to do it in Java as well, but I expect almost the same thing as 
for C++: it will not be testing the strong point of the language, but 
really peeking at its weakest point: complex numbers.

So, as far as performance is concerned, Fortran was, IN THIS CASE, the 
winner. Ada, was a strong contender.
I will not elaborate too much on the easiness of translation: when you 
have worked for many month with such a short program, and converted it 
to 2 other languages, the 3rd translation can not be so hard.

I believe that if I had to translate (or even write) other more 
significant codes, I would use the ability of Ada to interface with 
other languages: I would keep my low level routines in fast Fortran, and 
have the general flow of the computation driven by Ada, to make the 
whole picture clearer and more efficient.
In between, I try to code more in Fortran 90, which is a close nephew of 
Ada 83.

* I did the same kind of multi-language port for my education, with a 
quasi-random number generator, starting from a C++ version,
and I have not yet found a way as elegant, and memory-wise efficient, to 
store an upper triangular matrix as in C++.
* I also miss some syntaxic sugar of Fortran that allows to refer to 
line I of a matrix M as a vector with M(I, *)
=> If someone would like to discuss it, I will be glad to exchange on these.

Best regards,
Vincent

PS : for language crusade, I believe that the problem of Fortran is 
"Fortran users", who are mostly not computer scientist. I hear the Ada 
fans boast "Ada doesn't make assumptions about the programmer: he can be 
uneducated, but the compiler will save him", but I strongly doubt the 
actual population of Ada coders be AS uneducated (or 
software-engineering-unconscious) as the actual population of Fortran 
coders (averaged over the last 50 years).



  parent reply	other threads:[~2010-04-08 13:40 UTC|newest]

Thread overview: 195+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-04  4:46 Why is Ada considered "too specialized" for scientific use Nasser M. Abbasi
2010-04-04  5:30 ` J-P. Rosen
2010-04-06 15:04   ` Adam Beneschan
2010-04-04  7:10 ` Pascal Obry
2010-04-04 18:24 ` Charles H. Sampson
2010-04-06  9:52   ` Peter Hermann
2010-04-07 20:08   ` Denis McMahon
2010-04-04 20:53 ` Andrea Taverna
2010-04-13 20:31   ` Colin Paul Gloster
2010-04-14 16:00     ` Charles H. Sampson
2010-04-14 19:18       ` Colin Paul Gloster
2010-04-04 23:41 ` Jerry
2010-04-05  0:29   ` Nasser M. Abbasi
2010-04-05  9:09 ` mockturtle
2010-04-05 11:20   ` Dmitry A. Kazakov
2010-04-05 11:19 ` Georg Bauhaus
2010-04-05 16:44   ` Keith Thompson
2010-04-06 14:03     ` Georg Bauhaus
2010-04-06 16:39       ` Warren
2010-04-06 17:53         ` Sebastian Hanigk
2010-04-06 20:45           ` Warren
2010-04-07  9:17           ` MRE
2010-04-08 10:10           ` Ken Thomas
2010-04-08 16:40             ` Warren
2010-04-08 18:34               ` Georg Bauhaus
2010-04-08 20:13                 ` Charmed Snark
2010-04-06 19:53       ` J. Clarke
2010-04-06 21:37         ` Georg Bauhaus
2010-04-07  4:25           ` J. Clarke
2010-04-07  6:43             ` Georg Bauhaus
2010-04-07 12:53               ` J. Clarke
2010-04-07 16:19                 ` Georg Bauhaus
2010-04-07 17:05             ` Keith Thompson
2010-04-07 19:41               ` J. Clarke
2010-04-07  2:03       ` BrianG
2010-04-07  9:08         ` Georg Bauhaus
2010-04-08  0:20           ` BrianG
2010-04-08  2:29             ` Robert A Duff
2010-04-08  7:04             ` Georg Bauhaus
2010-04-14 21:34     ` Florian Weimer
2010-04-05 20:51   ` none
2010-04-06  1:18     ` robin
2010-04-06 12:00       ` Shmuel Metz
2010-04-06 15:30         ` robin
2010-04-06 23:44           ` Shmuel Metz
2010-04-14  9:32             ` robin
2010-04-14 12:12               ` J. Clarke
2010-04-14 15:20                 ` Dmitry A. Kazakov
2010-04-15  4:15                   ` J. Clarke
2010-04-15 10:04               ` Shmuel Metz
2010-04-15 15:10                 ` robin
2010-04-15 22:06                   ` Nomen Nescio
2010-04-16  0:02                   ` Shmuel Metz
2010-04-17  8:43                     ` robin
2010-04-18 17:15                       ` Shmuel Metz
2010-04-22  1:39                         ` robin
2010-04-22  9:59                           ` Shmuel Metz
2010-04-22 12:49                             ` Gary L. Scott
2010-04-22 13:20                             ` robin
2010-05-14 10:50                 ` robin
2010-05-16  1:23                   ` Shmuel Metz
2010-05-17  9:23                     ` robin
2010-05-17 10:05                       ` Shmuel Metz
2010-05-17 10:09                         ` robin
2010-05-17 15:57                         ` robin
2010-05-19 14:55                           ` Richard Harter
2010-04-07 19:27           ` Simon Wright
2010-04-08  2:01             ` robin
2010-04-08 15:27             ` Shmuel Metz
2010-04-14  9:27               ` robin
2010-04-15 10:02                 ` Shmuel Metz
2010-04-23  7:29                   ` robin
2010-04-23 16:14                     ` J. Clarke
2010-04-23 21:51                       ` Peter Flass
2010-04-23 23:25                         ` Sjouke Burry
2010-04-24  0:18                           ` Gary L. Scott
2010-04-24  1:05                             ` Richard Maine
2010-04-24  0:23                           ` Dick Hendrickson
2010-04-24  0:30                           ` glen herrmannsfeldt
2010-04-26 15:28                             ` Warren
2010-04-25  2:43                     ` Shmuel Metz
2010-04-16 11:04               ` sjw
2010-04-18 17:26                 ` Shmuel Metz
2010-06-05 10:58                 ` robin
2010-06-06  4:25                   ` Shmuel Metz
2010-06-06 14:53                     ` Arthur Evans Jr
2010-06-06 15:15                       ` J. Clarke
     [not found]                         ` <4c0cbc04$2$fuzhry+tra$mr2ice@news.patriot.net>
2010-06-07 13:23                           ` J. Clarke
2010-06-07 18:50                             ` George Orwell
2010-06-08  1:21                             ` Shmuel Metz
2010-06-08 12:26                         ` Peter Hermann
2010-06-06 17:10                       ` glen herrmannsfeldt
2010-06-06 19:17                         ` J. Clarke
2010-06-08  6:27                           ` James J. Weinkam
2010-06-08  7:13                             ` Georg Bauhaus
2010-06-08 10:43                               ` Peter Flass
2010-06-08 10:23                             ` Shmuel Metz
2010-06-08 12:03                             ` glen herrmannsfeldt
2010-06-07  9:39                         ` Shmuel Metz
2010-06-06 17:16                       ` Martin Krischik
2010-06-06 18:33                       ` Non scrivetemi
2010-06-06 15:12                     ` robin
2010-06-07  9:45                       ` Shmuel Metz
2010-06-08 11:10                         ` robin
2010-06-09 10:48                           ` Shmuel Metz
2010-06-09 23:59                             ` robin
2010-06-10 10:06                               ` Shmuel Metz
2010-06-10 10:52                                 ` robin
2010-06-10 13:49                                   ` Richard Harter
2010-06-06 15:19                     ` J. Clarke
2010-06-06 16:51                       ` Simon Wright
2010-06-06 17:51                         ` J. Clarke
2010-06-07  9:38                         ` robin
2010-06-08 10:07                           ` Shmuel Metz
2010-06-10 10:54                             ` robin
2010-06-07  9:41                         ` Shmuel Metz
2010-06-06 17:15                       ` Martin Krischik
2010-06-06 19:12                         ` J. Clarke
2010-06-06 20:39                           ` John B. Matthews
2010-06-07  0:17                             ` J. Clarke
2010-06-07  6:02                           ` Martin Krischik
2010-06-06 23:01                         ` Gib Bogle
2010-06-07  0:18                           ` J. Clarke
2010-06-07  5:34                             ` Martin Krischik
2010-06-07  9:48                               ` Shmuel Metz
2010-06-07 10:36                               ` Peter Flass
2010-06-07 16:18                                 ` Fritz Wuehler
2010-06-07 22:03                                   ` Peter Flass
2010-06-07 22:00                                     ` glen herrmannsfeldt
2010-06-08  1:16                                 ` Shmuel Metz
2010-06-07  5:31                           ` Martin Krischik
2010-06-07  6:15                         ` robin
2010-06-07 10:40                           ` Peter Flass
2010-06-07 12:35                             ` Yannick Duchêne (Hibou57)
2010-06-07 13:29                               ` J. Clarke
2010-06-07 21:04                                 ` Gib Bogle
2010-06-07 21:56                                 ` Peter Flass
2010-06-07 22:06                                   ` glen herrmannsfeldt
2010-06-08 10:11                                     ` Shmuel Metz
2010-06-08 10:01                                   ` Shmuel Metz
2010-06-08 11:16                                   ` robin
2010-06-08  1:22                                 ` Shmuel Metz
2010-06-07 14:35                               ` robin
2010-06-07 14:56                                 ` Yannick Duchêne (Hibou57)
2010-06-07 15:07                               ` Martin Krischik
2010-06-07 15:08                               ` Dick Hendrickson
2010-06-07 15:23                                 ` Yannick Duchêne (Hibou57)
2010-06-07 15:34                                   ` (see below)
2010-06-08  9:57                                     ` Shmuel Metz
2010-06-07 21:57                                 ` Peter Flass
2010-06-08 10:02                                   ` Shmuel Metz
2010-06-08  9:53                                 ` Shmuel Metz
2010-06-09 13:54                                   ` robin
2010-06-08 11:23                                 ` robin
2010-06-09 10:50                                   ` Shmuel Metz
2010-06-09 13:47                                     ` robin
     [not found]                                       ` <4c0fa318$1$fuzhry+tra$mr2ice@news.patriot.net>
2010-06-09 23:54                                         ` robin
2010-06-10 10:48                                           ` Non scrivetemi
2010-06-10 15:12                                             ` robin
     [not found]                                           ` <4c10b858$4$fuzhry+tra$mr2ice@news.patriot.net>
2010-06-10 10:59                                             ` robin
2010-06-07 12:50                             ` Robert AH Prins
2010-06-07 14:22                             ` Arthur Evans Jr
2010-06-07 21:07                               ` Gib Bogle
2010-06-08  9:54                               ` Shmuel Metz
2010-06-07 14:30                             ` robin
2010-06-08 10:14                               ` Shmuel Metz
2010-06-09 13:58                                 ` robin
2010-06-09 14:23                                   ` Shmuel Metz
2010-06-07 15:24                             ` Richard Harter
2010-06-07 21:05                               ` Wilson
2010-06-08  1:18                             ` Shmuel Metz
2010-06-07  9:32                       ` Shmuel Metz
2010-04-25 16:32       ` robin
2010-05-14 10:54     ` robin
2010-04-13 20:18   ` Colin Paul Gloster
2010-05-14 11:53     ` robin
2010-05-17 10:26       ` Colin Paul Gloster
2010-05-17 13:36         ` Dan Nagle
2010-04-05 17:33 ` Charmed Snark
2010-04-05 19:24   ` Nasser M. Abbasi
2010-04-05 20:28     ` Warren
2010-04-08 18:30       ` Alex Mentis
2010-04-06  0:38     ` Robert A Duff
2010-04-06  8:07       ` Maciej Sobczak
2010-04-06 21:55         ` Georg Bauhaus
2010-04-07  2:52           ` Nasser M. Abbasi
2010-04-07 20:07             ` Randy Brukardt
2010-04-07  7:28         ` Maciej Sobczak
2010-04-07  8:24           ` Dmitry A. Kazakov
2010-04-07 11:59             ` Maciej Sobczak
2010-04-07 13:44               ` Dmitry A. Kazakov
2010-04-07 20:21                 ` Maciej Sobczak
2010-04-08 11:53                   ` Dmitry A. Kazakov
2010-04-08 13:40 ` Vincent LAFAGE [this message]
2010-04-08 16:29   ` Georg Bauhaus
replies disabled

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