* GNU's gcc and g++ for DEC Unix 4.0 - Feedback Please
@ 1997-09-11 4:00 Greg Wilkins
1997-09-12 4:00 ` Homonnai Mihaly
0 siblings, 1 reply; 3+ messages in thread
From: Greg Wilkins @ 1997-09-11 4:00 UTC (permalink / raw)
Has anyone had any problems or any feedback they would like to input
to me, about compiling, or using the latest GNU gcc and g++ for DEC
Unix 4.0?
All repsonses (related to this subject) would be helpful
-Greg
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: GNU's gcc and g++ for DEC Unix 4.0 - Feedback Please
1997-09-11 4:00 GNU's gcc and g++ for DEC Unix 4.0 - Feedback Please Greg Wilkins
@ 1997-09-12 4:00 ` Homonnai Mihaly
1997-09-13 4:00 ` Randall Smith
0 siblings, 1 reply; 3+ messages in thread
From: Homonnai Mihaly @ 1997-09-12 4:00 UTC (permalink / raw)
Greg Wilkins (greg@wye.com) wrote:
: Has anyone had any problems or any feedback they would like to input
: to me, about compiling, or using the latest GNU gcc and g++ for DEC
: Unix 4.0?
As i know gnu's c compiler doesn't generate a highli optimised code for
alpha processors.
Mihaly
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: GNU's gcc and g++ for DEC Unix 4.0 - Feedback Please
1997-09-12 4:00 ` Homonnai Mihaly
@ 1997-09-13 4:00 ` Randall Smith
0 siblings, 0 replies; 3+ messages in thread
From: Randall Smith @ 1997-09-13 4:00 UTC (permalink / raw)
: Has anyone had any problems or any feedback they would like to input
: to me, about compiling, or using the latest GNU gcc and g++ for DEC
: Unix 4.0?
I'm including a short report I wrote regarding the various C compilers
for Dec Alphas running DU 4.0. The hydrocode referred to is a
one-dimensional code which models supernova explosions--it's nearly
all floating point arithmatic and pointer manipulations.
\documentstyle[12pt]{article}
\addtolength{\textheight}{1in}
\setlength{\voffset}{-0.25in}
\addtolength{\textwidth}{1in}
\setlength{\hoffset}{-0.5in}
\author{Randall Smith//rsmith@stars.gsfc.nasa.gov}
\title{Tests of compiler speed}
\begin{document}
\maketitle
A short project to determine what compilers and settings should be
used on the DEC Alpha. We have OSF/1 v3.2 cc, and GNU gcc v2.6.3. I
used the file test01.inp (given in Appendix 1) as input to the
hydrocode, and the program t\_malloc.c (Appendix 2).
All runs gave identical results, as expected. Some runs were done
twice, to get a feel for the random variation in the results and to
check results. The winner was the OSF c compiler, with maximal
optimization turned on. Coming in at 2\% slower was gcc with
maximum optimization and debugging information. Oddly enough, running
gcc at full optimization but without debugging resulted in a code
running even slower.
The results for the hydrocode are shown on the next page, both as a
summary and the raw results.
The t\_malloc program, designed to test only memory allocation, was run
only with --O3 optimization on each compiler. The program has three
cases: arrays, pointers allocated in a single space, and pointers
allocated semi-randomly, with intervening space. The results are
tabulated below, and show that if arrays can be used, there is a clear
10\% benefit at least. If pointers must be used, then grouping them
does not give a clear benefit. \footnote{Units are in clock ticks on a
DEC 3000/300LX}
\vskip 1 cm
\begin{tabular}{cccc}
Compiler&Arrays&Grouped Pointers&Disperse Pointers \\ \hline
gcc & 54 & 57 & 59 \\
cc & 43 & 48 & 49 \\
\end{tabular}
\eject
Summary of results:
\vskip .3cm
\begin{tabular}{lcrrl}
Compiler&Options&Wall Time&CPU time&Rating \\
gcc&--g &141.17 &81.308 & 1.443\\
gcc&--g --O &109.28 &60.979 & 1.082\\
gcc&--g --O2&128.04 &72.035 & 1.278\\
gcc&--g --O2&104.11 &59.210 & 1.051 (2nd try)\\
gcc&--g --O2&104.22 &58.621 & 1.040 (3rd try)\\
gcc&--g --O3&103.44 &58.164 & 1.032\\
gcc&--g --O3&106.29 &57.488 & 1.020 (2nd try) \\
cc &--g &139.89 &76.521 & 1.358\\
cc &--O &112.04 &60.761 & 1.078\\
cc &--O2 &104.07 &61.051 & 1.083\\
cc &--O3 & 98.59 &56.352 & 1.000\\
gcc&--O &108.88 &62.491 & 1.109\\
gcc&--O2 &105.57 &59.483 & 1.055\\
gcc&--O3 &107.81 &61.173 & 1.085\\
gcc&--O3 &113.88 &61.562 & 1.092 (2nd try)\\
\end{tabular}
\vskip .3 cm
Raw results, as reported by csh 'time' function:
\vskip .3 cm
\begin{tabular}{lclllllll}
Compiler&Options&CPU&System&Wall&\% Used&Memory&I/O&Faults+Swaps \\
gcc&--g & 81.308u& 3.988s& 2:21.17& 60.4\%& 0+6k& 0+0io& 0pf+0w \\
gcc&--g --O & 60.979u& 4.270s& 1:49.28& 59.6\%& 0+6k& 3+3io& 0pf+0w \\
gcc&--g --O2& 72.035u& 4.012s& 2:08.04& 59.3\%& 0+6k& 0+0io& 0pf+0w \\
gcc&--g --O2& 59.210u& 4.087s& 1:44.11& 60.7\%& 0+6k& 4+2io& 0pf+0w \\
gcc&--g --O2& 58.621u& 4.147s& 1:44.22& 60.2\%& 0+6k& 0+2io& 0pf+0w \\
gcc&--g --O3& 58.164u& 4.066s& 1:43.44& 60.1\%& 0+6k& 0+1io& 0pf+0w \\
gcc&--g --O3& 57.488u& 3.897s& 1:46.29& 57.7\%& 0+6k& 4+2io& 0pf+0w \\
cc &--g & 76.521u& 4.611s& 2:19.89& 57.9\%& 0+6k& 0+0io& 0pf+0w \\
cc &--O & 60.761u& 4.544s& 1:52.04& 58.2\%& 0+6k& 0+2io& 0pf+0w \\
cc &--O2 & 61.051u& 3.981s& 1:48.07& 60.1\%& 0+6k& 0+0io& 0pf+0w \\
cc &--O3 & 56.352u& 3.846s& 1:38.59& 61.0\%& 0+5k& 0+3io& 0pf+0w \\
gcc&--O & 62.491u& 3.905s& 1:48.88& 60.9\%& 0+6k& 4+2io& 0pf+0w \\
gcc&--O2 & 59.483u& 3.927s& 1:45.57& 60.0\%& 0+6k& 4+2io& 0pf+0w \\
gcc&--O3 & 61.173u& 3.952s& 1:47.81& 60.4\%& 0+6k& 4+2io& 0pf+0w \\
gcc&--O3 & 61.652u& 3.939s& 1:53.88& 57.5\%& 0+6k& 0+0io& 0pf+0w \\
\end{tabular}
\eject
\section*{Appendix 1}
The input file used to generate all these. The hydrocode
checkpoint.dat version was 1.16-1.18 in all cases; version 1.17 was
generated spuriously because cc -O3 stripped nearly all the RCS flags
from the final code.
\begin{verbatim}
SOUTFILE Test01
INCELLS 400
SBANG DRADIUS 3.0
SBANG DMASS 0.70812230
SBANG DTIME 0.
SBANG DE51 0.5
SBANG STYPE THERMAL
ADD_ZONES
DBFIELD 5.E-6
DDIMEN 3
DGAMMA 1.666666666666667
DTEMP 1.E4
DDENS .2
DDELTAR .1
DGRAVITY 0.
SABUNDTYPE AndersGrevesse
SCOOLING None
SDUST None
DMAXTIME 1.E4
CHECK_ENERGY
ISUBSDETAIL 2
DSUBSTIME 3.E1
DREPTTIME 3.E2
\end{verbatim}
\eject
\section*{Appendix 2}
\begin{verbatim}
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <sys/types.h>
#include <sys/times.h>
#define NUMRUNS 200000
/* #define ARRAY */
/* #define PTRS */
#define INDPTRS
struct element {
float x,y;
struct element *next;
};
float sum(float, float);
void fill_array(float *x, float *y);
void fill_ptrs(struct element *);
void fill_ind_ptrs(struct element **);
int main(int argc, char *argv) {
int i;
float x[NUMRUNS],y[NUMRUNS],total=0.;
struct element *top, *ptr, *indptr, *indtop;
clock_t r_time1, r_time2
time_t ut1, ut2, ut3, ut4;
struct tms buf;
#ifdef INDPTRS
/* Fill ind ptrs */
fill_ind_ptrs(&indptr);
indtop = indptr;
/* Do sum */
r_time1 = times(&buf);
ut1 = buf.tms_utime;
while (indptr != NULL) {
total += sum(indptr->x,indptr->y);
indptr=indptr->next;
}
r_time2 = times(&buf);
ut2 = buf.tms_utime;
printf("Elapsed time is %i ; Total equals %f\n",ut2-ut1,total);
#endif /* INDPTRS */
#ifdef ARRAY
/* Fill array */
fill_array(x,y);
/* Do sum */
r_time1 = times(&buf);
ut1 = buf.tms_utime;
for (i=0; i<NUMRUNS; i++) {
total += sum(x[i],y[i]);
}
r_time2 = times(&buf);
ut2 = buf.tms_utime;
printf("Elapsed time is %i ; Total equals %f\n",ut2-ut1,total);
#endif /* ARRAY */
#ifdef PTRS
/* Fill ptrs */
top = (struct element *) malloc(NUMRUNS*sizeof(struct element));
ptr = top;
for (i=0; i<NUMRUNS-1; i++) {
ptr->next = ptr+1;
ptr = ptr->next;
}
ptr->next = NULL;
fill_ptrs(top);
ptr = top;
/* Do sum */
r_time1 = times(&buf);
ut1 = buf.tms_utime;
while (ptr != NULL) {
total += sum(ptr->x,ptr->y);
ptr=ptr->next;
}
r_time2 = times(&buf);
ut2 = buf.tms_utime;
printf("Elapsed time is %i ; Total equals %f\n",ut2-ut1,total);
#endif /* PTRS */
return 1;
}
float sum(float x, float y) {
return sin(x)+cos(y);
}
void fill_array(float x[], float y[]) {
int i;
for (i=0; i<NUMRUNS; i++) {
x[i] = i*(10./NUMRUNS);
y[i] = i*(5./NUMRUNS);
}
}
void fill_ptrs(struct element *ptr) {
int i=0;
while (ptr != NULL) {
ptr->x = i*(10./NUMRUNS);
ptr->y = i*(5./NUMRUNS);
i++;
ptr = ptr->next;
}
}
void fill_ind_ptrs(struct element **top) {
int i=0,*waste;
struct element *ptr,*optr;
*top = (struct element *) malloc(sizeof(struct element));
ptr = *top;
for (i=0; i<NUMRUNS; i++) {
waste = (int *) malloc(5);
ptr->x = i*(10./NUMRUNS);
ptr->y = i*(5./NUMRUNS);
ptr->next = (struct element *) malloc(sizeof(struct element));
optr=ptr;
ptr=ptr->next;
}
optr->next = NULL;
}
\end{verbatim}
\end{document}
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~1997-09-13 4:00 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1997-09-11 4:00 GNU's gcc and g++ for DEC Unix 4.0 - Feedback Please Greg Wilkins
1997-09-12 4:00 ` Homonnai Mihaly
1997-09-13 4:00 ` Randall Smith
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox