comp.lang.ada
 help / color / mirror / Atom feed
* GNAT use
@ 1999-12-15  0:00 psimdars
  1999-12-16  0:00 ` DuckE
  1999-12-17  0:00 ` GNAT use Preben Randhol
  0 siblings, 2 replies; 6+ messages in thread
From: psimdars @ 1999-12-15  0:00 UTC (permalink / raw)


I've been curious about ADA in Linux.  The one time I did something
about it, I went to a site and downloaded, supposedly, GNAT.   That was
as far as I got.  Is there someplace that has the list of 10 steps to
trying ADA in Linux?
e.g.
1. download the gz file
2. gunzip xvf  filename (?)
3. whatever for further installation
4. how to run  i.e. bash#  gnat xxx yyy zzz filename (?)

The reason I mentioned the simple list is that too often I have been
pointed to HOWTO files.  And, no offense, but the expression "using a
cannon to shoot a gnat" comes to mind.

Thanks a lot for your help.
I can be emailed at psimdars@lisco.com





^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: GNAT use
  1999-12-15  0:00 GNAT use psimdars
@ 1999-12-16  0:00 ` DuckE
  1999-12-17  0:00   ` Gnat optimizes better than gcc C? Ted Dennison
  1999-12-17  0:00 ` GNAT use Preben Randhol
  1 sibling, 1 reply; 6+ messages in thread
From: DuckE @ 1999-12-16  0:00 UTC (permalink / raw)


Check out "The Big Online Book of Linux Ada Programming" at
http://www.vaxxine.com/pegasoft/homes/kburtch.html


SteveD

psimdars <psimdars@lisco.com> wrote in message
news:385800DC.DE033376@lisco.com...
> I've been curious about ADA in Linux.  The one time I did something
> about it, I went to a site and downloaded, supposedly, GNAT.   That was
> as far as I got.  Is there someplace that has the list of 10 steps to
> trying ADA in Linux?
> e.g.
> 1. download the gz file
> 2. gunzip xvf  filename (?)
> 3. whatever for further installation
> 4. how to run  i.e. bash#  gnat xxx yyy zzz filename (?)
>
> The reason I mentioned the simple list is that too often I have been
> pointed to HOWTO files.  And, no offense, but the expression "using a
> cannon to shoot a gnat" comes to mind.
>
> Thanks a lot for your help.
> I can be emailed at psimdars@lisco.com
>






^ permalink raw reply	[flat|nested] 6+ messages in thread

* Gnat optimizes better than gcc C?
  1999-12-16  0:00 ` DuckE
@ 1999-12-17  0:00   ` Ted Dennison
  1999-12-17  0:00     ` Preben Randhol
  1999-12-22  0:00     ` Florian Weimer
  0 siblings, 2 replies; 6+ messages in thread
From: Ted Dennison @ 1999-12-17  0:00 UTC (permalink / raw)


In article <3859a321.0@news.pacifier.com>,
  "DuckE" <nospam_steved@pacifier.com> wrote:
> Check out "The Big Online Book of Linux Ada Programming" at
> http://www.vaxxine.com/pegasoft/homes/kburtch.html


Hmm. Section 7.4 shows an example of an algorithm coded in Ada and C
where the optimizer can make the Ada code run twice as fast as the C. I
knew it was theoreticaly possible for this to happen, due to the extra
info Ada's types provide the compiler. However, I was under the
impression that Gnat/gcc wasn't able to take advantage of this
information. Is this right?

--
T.E.D.


Sent via Deja.com http://www.deja.com/
Before you buy.




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: GNAT use
  1999-12-15  0:00 GNAT use psimdars
  1999-12-16  0:00 ` DuckE
@ 1999-12-17  0:00 ` Preben Randhol
  1 sibling, 0 replies; 6+ messages in thread
From: Preben Randhol @ 1999-12-17  0:00 UTC (permalink / raw)


psimdars <psimdars@lisco.com> writes:

| I've been curious about ADA in Linux.  The one time I did something
| about it, I went to a site and downloaded, supposedly, GNAT.   That was
| as far as I got.  Is there someplace that has the list of 10 steps to
| trying ADA in Linux?

Ada not ADA :-)

Which Linux distribution do you have?

If you have Mandrake, RedHat or Suse you should get the .rpm files. If you have
Debian, Corel or Stormix you download the .deb pacakges at <URL: http://www.gnuada.org/alt.html>

To start you need to install:
	                            gnat-3.12p_glibc2.1-1
	                            gnat-devel-3.12p_glibc2.1-1

If this works (it should) you can install more packages.

-- 
Preben Randhol -- [randhol@pvv.org] -- [http://www.pvv.org/~randhol/]     
         "Det eneste trygge stedet i verden er inne i en fortelling." 
                                                      -- Athol Fugard




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Gnat optimizes better than gcc C?
  1999-12-17  0:00   ` Gnat optimizes better than gcc C? Ted Dennison
@ 1999-12-17  0:00     ` Preben Randhol
  1999-12-22  0:00     ` Florian Weimer
  1 sibling, 0 replies; 6+ messages in thread
From: Preben Randhol @ 1999-12-17  0:00 UTC (permalink / raw)


Ted Dennison <dennison@telepath.com> writes:

| In article <3859a321.0@news.pacifier.com>,
|   "DuckE" <nospam_steved@pacifier.com> wrote:
| > Check out "The Big Online Book of Linux Ada Programming" at
| > http://www.vaxxine.com/pegasoft/homes/kburtch.html
| 
| 
| Hmm. Section 7.4 shows an example of an algorithm coded in Ada and C
| where the optimizer can make the Ada code run twice as fast as the C. I
| knew it was theoreticaly possible for this to happen, due to the extra
| info Ada's types provide the compiler. However, I was under the
| impression that Gnat/gcc wasn't able to take advantage of this
| information. Is this right?

I do not know, but I compiled the Ada and C programs as is with -O3
for C and -O3 -gnatp for Ada this gave 23 seconds for the C program
and 28 seconds for Ada. Including pragma pack(atype) reduced the time
for the Ada program to about 7 seconds. I didn't not include any
pentium opt. flags.

But isn't it a bit dubious to use a benchmark that produces an overflow
error?

-- 
Preben Randhol -- [randhol@pvv.org] -- [http://www.pvv.org/~randhol/]     
         "Det eneste trygge stedet i verden er inne i en fortelling." 
                                                      -- Athol Fugard




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Gnat optimizes better than gcc C?
  1999-12-17  0:00   ` Gnat optimizes better than gcc C? Ted Dennison
  1999-12-17  0:00     ` Preben Randhol
@ 1999-12-22  0:00     ` Florian Weimer
  1 sibling, 0 replies; 6+ messages in thread
From: Florian Weimer @ 1999-12-22  0:00 UTC (permalink / raw)


Ted Dennison <dennison@telepath.com> writes:

> Hmm. Section 7.4 shows an example of an algorithm coded in Ada and C
> where the optimizer can make the Ada code run twice as fast as the C. 

The code is:

procedure bench is
--Simple benchmark program to test optimization
pragma optimize( time );
type bench_integer is new long_integer range long_integer'range;
type small_integer is new long_integer range 0..9;
function p( param : bench_integer ) return bench_integer is
  divideby : constant bench_integer := 4;
begin
  return param / divideby;
end p;
pragma inline( p );
j : bench_integer := bench_integer'last;
-- deliberate error in main program for j * 2
type atype is array(0..9) of small_integer;
--pragma pack( atype );
a : atype;
begin
  for i in 1..100_000_000 loop
  j := abs( p( bench_integer( i ) ) - (j * 2) );
  a( integer( j mod 10 ) ) := small_integer( j mod
    bench_integer( small_integer'last ) );
 end loop;
end bench;

A strange thing happens here: if (and only if) the pragma Pack is
activated, GNAT optimizes away most of the statements in the for loop.
(I guess because with pragma Pack, "atype" is treated as a 40-bit part
of a 64-bit integer internally , not as an array.)  This is permitted,
because the results of this calculations are never used.  But if you use
"a" after the for loop, this kind of optimization can no longer take
place, and the code doesn't run twice as fast, but three times slower
than the Ada code without pragma Pack (and, of course, the corresponding
C code).

I guess the C code runs faster on SteveD's machine because he used
another GCC backend to compile it.  When using the same 2.8.1 as GNAT,
the execution times are almost identical.




^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~1999-12-22  0:00 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-12-15  0:00 GNAT use psimdars
1999-12-16  0:00 ` DuckE
1999-12-17  0:00   ` Gnat optimizes better than gcc C? Ted Dennison
1999-12-17  0:00     ` Preben Randhol
1999-12-22  0:00     ` Florian Weimer
1999-12-17  0:00 ` GNAT use Preben Randhol

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