From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,35ed85a9d92a025,start X-Google-Attributes: gid103376,public From: rodemann@mathematik.uni-ulm.de (Joerg Rodemann) Subject: Ada-95 for numerics? Date: 1996/04/01 Message-ID: <4jocek$h5h@rigel.rz.uni-ulm.de>#1/1 X-Deja-AN: 145214917 organization: University of Ulm, SAI, Germany newsgroups: comp.lang.ada Date: 1996-04-01T00:00:00+00:00 List-Id: 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