Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c > #142334 > unrolled thread
| Started by | jacobnavia <jacob@jacob.remcomp.fr> |
|---|---|
| First post | 2019-03-24 12:15 +0100 |
| Last post | 2019-04-07 19:38 +0430 |
| Articles | 20 on this page of 38 — 10 participants |
Back to article view | Back to comp.lang.c
clang jacobnavia <jacob@jacob.remcomp.fr> - 2019-03-24 12:15 +0100
Re: clang Melzzzzz <Melzzzzz@zzzzz.com> - 2019-03-24 12:56 +0000
Re: clang jacobnavia <jacob@jacob.remcomp.fr> - 2019-03-24 14:11 +0100
Re: clang Melzzzzz <Melzzzzz@zzzzz.com> - 2019-03-24 13:24 +0000
Re: clang David Brown <david.brown@hesbynett.no> - 2019-03-24 15:47 +0100
Re: clang Bart <bc@freeuk.com> - 2019-03-24 13:42 +0000
Re: clang Noob <root@127.0.0.1> - 2019-04-10 21:07 +0200
Re: clang already5chosen@yahoo.com - 2019-03-24 06:24 -0700
Re: clang Melzzzzz <Melzzzzz@zzzzz.com> - 2019-03-24 13:38 +0000
Re: clang jacobnavia <jacob@jacob.remcomp.fr> - 2019-03-26 21:06 +0100
Re: clang Melzzzzz <Melzzzzz@zzzzz.com> - 2019-03-26 20:48 +0000
Re: clang jacobnavia <jacob@jacob.remcomp.fr> - 2019-03-26 21:50 +0100
Re: clang Ian Collins <ian-news@hotmail.com> - 2019-03-27 09:52 +1300
Re: clang jacobnavia <jacob@jacob.remcomp.fr> - 2019-03-26 21:58 +0100
Re: clang already5chosen@yahoo.com - 2019-03-27 06:40 -0700
Re: clang jacobnavia <jacob@jacob.remcomp.fr> - 2019-03-27 17:31 +0100
Re: clang already5chosen@yahoo.com - 2019-03-27 06:29 -0700
Re: clang Ben Bacarisse <ben.usenet@bsb.me.uk> - 2019-03-27 14:57 +0000
Re: clang already5chosen@yahoo.com - 2019-03-27 08:16 -0700
Re: clang scott@slp53.sl.home (Scott Lurndal) - 2019-03-27 15:47 +0000
Re: clang Ben Bacarisse <ben.usenet@bsb.me.uk> - 2019-03-27 18:29 +0000
Re: clang already5chosen@yahoo.com - 2019-03-27 11:45 -0700
Re: clang Ben Bacarisse <ben.usenet@bsb.me.uk> - 2019-03-27 21:37 +0000
Re: clang already5chosen@yahoo.com - 2019-03-28 05:50 -0700
Re: clang already5chosen@yahoo.com - 2019-03-28 06:01 -0700
Re: clang scott@slp53.sl.home (Scott Lurndal) - 2019-03-28 15:21 +0000
Re: clang Ian Collins <ian-news@hotmail.com> - 2019-03-28 07:52 +1300
Re: clang David Brown <david.brown@hesbynett.no> - 2019-03-27 22:45 +0100
Re: clang jacobnavia <jacob@jacob.remcomp.fr> - 2019-03-28 00:12 +0100
Re: clang scott@slp53.sl.home (Scott Lurndal) - 2019-03-26 20:55 +0000
Re: clang jacobnavia <jacob@jacob.remcomp.fr> - 2019-03-26 22:05 +0100
Re: clang Melzzzzz <Melzzzzz@zzzzz.com> - 2019-03-26 21:59 +0000
Re: clang Bart <bc@freeuk.com> - 2019-03-26 21:42 +0000
Re: clang Melzzzzz <Melzzzzz@zzzzz.com> - 2019-03-26 22:00 +0000
Re: clang Bart <bc@freeuk.com> - 2019-03-27 14:32 +0000
Re: clang already5chosen@yahoo.com - 2019-03-27 06:54 -0700
Re: clang: release build jacobnavia <jacob@jacob.remcomp.fr> - 2019-03-28 23:31 +0100
Re: clang Mehdi Amini <atorrses@gmail.com> - 2019-04-07 19:38 +0430
Page 1 of 2 [1] 2 Next page →
| From | jacobnavia <jacob@jacob.remcomp.fr> |
|---|---|
| Date | 2019-03-24 12:15 +0100 |
| Subject | clang |
| Message-ID | <q77osi$1id$1@dont-email.me> |
What are your experiences with clang?
I have recently installed that compiler in an ARM64/Linux system, and it
seems very good (much better than gcc) when it works.
For instance, in a benchmark of floating point operations (matrix
operations) the results were:
1 clang -O2: 12.22
2 gcc -O2: 18.6
3 lcc -O : 21.4
The generated code of clang was fully 4 seconds faster than gcc, and
almost twice as fast as lcc.
But clang has several problems:
1) It is the slowest compiler known
For instance, to compile the source code of lcc (around 2.5MB of C)
we have compilation times of:
1 lcc 8.7 sec (with optimizations on)
2 gcc 38 sec (without optimization)
3 clang 5 minutes (without any optimizations).
WITH optimizations the landscape looks the same:
1 lcc: 8.7 sec
2 gcc 2minutes 48s
3 clang: 26 minutes
The problem is, that clang produces a FAULTY executable after all those
26 minutes and the generated program crashes. Apparently the compiler
has serious bugs. The bugs were reproducible also in the x86 version
where it crashes at the same place.
I installed it to use the "cling" C interpreter but the generated
"cling" executable is always crashing, completely unusable.
I thought that the bugs in clang make that cling crashes but I used gcc
to bootstrap clang... It is impossible to know since the build system
doesn't show at all what it is doing, all steps are hidden and it is
impossible to know which compiler (clang or gcc) is being used
I have figured out the error in the clang compiler and wanted to post a
bug report. Their bug reporting system requires you to send an email to
some address to be able to post a bug report!
I sent an email but apparently it is not an automatic system, there must
be someone reading those requests, so I have to wait until they agree
(or not) to accept me as a bug reporter.
[toc] | [next] | [standalone]
| From | Melzzzzz <Melzzzzz@zzzzz.com> |
|---|---|
| Date | 2019-03-24 12:56 +0000 |
| Message-ID | <m8LlE.156248$MT2.71591@fx21.am4> |
| In reply to | #142334 |
On 2019-03-24, jacobnavia <jacob@jacob.remcomp.fr> wrote: > What are your experiences with clang? > > I have recently installed that compiler in an ARM64/Linux system, and it > seems very good (much better than gcc) when it works. > > For instance, in a benchmark of floating point operations (matrix > operations) the results were: > > 1 clang -O2: 12.22 > 2 gcc -O2: 18.6 > 3 lcc -O : 21.4 Without code it is meaningless to say such figures. In my experience gcc is slightly faster. -- press any key to continue or any other to quit...
[toc] | [prev] | [next] | [standalone]
| From | jacobnavia <jacob@jacob.remcomp.fr> |
|---|---|
| Date | 2019-03-24 14:11 +0100 |
| Message-ID | <q77vl5$sh4$2@dont-email.me> |
| In reply to | #142339 |
Le 24/03/2019 à 13:56, Melzzzzz a écrit :
> On 2019-03-24, jacobnavia <jacob@jacob.remcomp.fr> wrote:
>> What are your experiences with clang?
>>
>> I have recently installed that compiler in an ARM64/Linux system, and it
>> seems very good (much better than gcc) when it works.
>>
>> For instance, in a benchmark of floating point operations (matrix
>> operations) the results were:
>>
>> 1 clang -O2: 12.22
>> 2 gcc -O2: 18.6
>> 3 lcc -O : 21.4
>
> Without code it is meaningless to say such figures. In my experience gcc
> is slightly faster.
>
Joined the code of matrix.c
-----------------------------------------------------------cut here
/* SCCS ID @(#)ge.h 1.1 2/4/86 */
/***************************************************************
******************************************************************
**** Matrix data structure(s) for Gaussian Elimination ****
******************************************************************
****************************************************************/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <tgmath.h>
#ifdef __LCC__
#include <fenv.h>
#endif
double sasum(int n,double * sx,int incx );
int isamax( int n, double *sx, int incx );
/*
This file contains the definitions of the structures used in
various algorithms for doing Gaussian Elimination.
The following gives an array (of length 10) of pointers to doubles.
double *a[10];
Now assume that each a[i] points to space for an array of doubles
(gotten
by a call to malloc, say).
Then the following is true:
a[i] can be thought of as a pointer to the i-th array of
doubles,
*(a[i]+j) is the j-th element of the i-th array.
The following shows how to reference things for the definition of
the FULL
structure given below.
a->cd is the value of (as apposed to a pointer to) the column
dimension.
a->rd is the value of (as apposed to a pointer to) the row dimension.
a->pd[j] is a pointer to the j-th column (an array of doubles).
*(a->pd[j]+i) is the i-th element of the j-th column, viz., a(i,j).
Here we think, as is natural in C, of all matrices and vectors indexed
from 0 insead of 1.
*/
#define MAXCOL 1000 /* Maximum number of Columns. */
struct FULL { /* Struct definition for the FULL matrix
structure. */
int cd; /* Column dimension of the matrix. */
int rd; /* Row Dimension of the matrix. */
double *pd[MAXCOL]; /* Array of pointers to the columns of a
matrix. */
};
void sgesl(struct FULL * a,int * ipvt,double b[],int job );
void saxpy(int n,double sa, double *sx,int incx,double * sy,int incy );
/* The following macro will get a(r,c) from a matrix in the FULL
structure. */
#define elem(a,r,c) (*(a.pd[(c)]+(r)))
/* The following macro will get a(r,c) from a pointer to a matrix
in the FULL structure. */
#define pelem(a,r,c) (*(a->pd[(c)]+(r)))
int sgeco( struct FULL *a,int * ipvt, double *rcond,double * z );
void matgen( int n,struct FULL * a,double * b );
int sgefa(struct FULL * a,int * ipvt );
#ifdef NEEDSCOPYSIGN
double copysign(double,double);
#endif
double second(void);
double sdot(int n,double * sx,int incx,double * sy, int incy );
/***************************************************************
******************************************************************
**** Sample driver for SGEFA/SL and CO ****
******************************************************************
****************************************************************/
/*
* SYSTEM DEPENENT ROUTINES:
* double second(); Returns cpu time used in seconds
*/
#define MAXN 800 /* Maximum problem size. */
int main()
{
/* Storage for the linear system and associates. */
struct FULL a;
double x[MAXCOL], b[MAXCOL], z[MAXCOL], rcond;
int ipvt[MAXCOL];
#if 0
DoublePrecision();
#endif
/* Local vars. */
double opsfa, opsco, opssl, xerrnrm, resnrm, xnrm;
double tfai, tfao, tsli, tslo, tcoi, tcoo;
int n, i, j, retval;
#ifdef sun
/* The following is a kludge for correct Sun FPA core dumps. */
unsigned newmode = 62464;
fpmode_(&newmode);
#endif
memset(&a,0,sizeof(a));
for( n=50; n<=MAXN; n+=50 ) {
/* Generate the linear system. */
matgen( n, &a, b );
opsfa = 1.0E-6*((2.0e0*(double)n*(double)n*(double)n)/3.0e0 +
2.0e0*(double)n*(double)n);
opsco = opsfa + 1.0E-6*(6.0e0*(double)n*(double)n);
opssl = 1.0e-6*(2.0e0*(double)n*(double)n);
/* Factor. */
tfai = second();
retval = sgefa( &a, ipvt );
tfao = second();
if( retval )
printf("Zero Column %d found.\n", retval );
else {
/* Solve the system. */
tsli = second();
sgesl( &a, ipvt, b, 0 );
tslo = second();
/* Compute a residual to verify results. */
for( i=0; i<n; i++ )
x[i] = b[i];
matgen( n, &a, b );
for( j=0; j<n; j++ ) {
double *col = a.pd[j];
double xj = x[j];
for( i=0; i<n; i++ ) {
b[i] -= col[i]*xj;
}
}
xerrnrm = 0.0;
resnrm = 0.0;
for( i=0; i<n; i++ ) {
xerrnrm += ((double)x[i]-1.0)*((double)x[i]-1.0);
resnrm += (double)b[i]*(double)b[i];
}
xnrm = sqrt( (double)n );
xerrnrm = sqrt( xerrnrm )/xnrm;
resnrm = sqrt( resnrm )/xnrm;
/* Now factor and est condition number. */
tcoi = second();
retval = sgeco( &a, ipvt, &rcond, z );
tcoo = second();
printf("\n\n\tLinpack Benchmark in C of size %d\n",n);
printf(" 1/COND(A) (Condition number of A) = %15e\n",rcond);
printf(" ||x-X||/||X|| (Solution Error) = %15e\n",xerrnrm);
printf(" ||b-Ax||/||X|| (Residual Error) = %15e\n",resnrm);
printf("\tWhere X = True solution and and x = computed
solution\n");
}
}
return 0;
}
void matgen(int n,struct FULL * a,double * b )
{
/* This routine generates a struct FULL matrix */
int i, j, init = 1325;
/* Allocate/Deallocate space for the columns. */
for( i=0; i<n; i++ ) {
if( a->pd[i] != NULL ) (void)free( a->pd[i] );
if( (a->pd[i] = (double *)malloc( (unsigned)n*sizeof(double) ))
== NULL ) {
fprintf(stderr, "MATGEN: Error allocating matrix for
n=%d\n",n);
exit( 1 );
}
}
/* Set the matrix elements and right hand side. */
a->cd = n;
a->rd = n;
for( j=0; j<n; j++ ) {
double *col = a->pd[j];
for( i=0; i<n; i++ ) {
init = 3125*init % 65536;
col[i] = ((double)init-32768.0)/16384.0;
}
}
for( j=0; j<n; j++ ) b[j] = 0.0;
for( j=0; j<n; j++ ) {
double *col = a->pd[j];
for( i=0; i<n; i++ ) {
b[i] += col[i];
}
}
}
/****************************************************************************
* Routines for getting elapsed CPU usage.
****************************************************************************/
#include <time.h>
static int epsilon=0;
double second(void)
/****************************************************************************
* Returns the total cpu time used in seconds.
* Emulates the Cray fortran library function of the same name.
****************************************************************************/
{
epsilon++;
return( (double)epsilon + ((double)clock())/1000.0 );
}
void sscal(int n,double sa,double * sx,int incx );
/***************************************************************
******************************************************************
**** Gaussian Elimination with partial pivoting ****
**** and condition number estimation. ****
**** This file contains the factorization driver and ****
**** contion number estimation routine SGECO ****
******************************************************************
****************************************************************/
int sgeco(struct FULL * a,int * ipvt,double * rcond,double * z )
/*
PURPOSE
SGECO factors a real matrix by gaussian elimination
and estimates the condition of the matrix.
REMARKS
If rcond is not needed, SGEFA is slightly faster.
to solve A*x = b , follow SGECO by SGESL.
To compute inverse(A)*c , follow SGECO by SGESL.
To compute determinant(A) , follow SGECO by SGEDI.
To compute inverse(A) , follow SGECO by SGEDI.
INPUT
a A pointer to the FULL matrix structure.
See the definition in ge.h.
OUTPUT
a A pointer to the FULL matrix structure containing
an upper triangular matrix and the multipliers
which were used to obtain it.
The factorization can be written a = l*u where
l is a product of permutation and unit lower
triangular matrices and u is upper triangular.
ipvt An integer vector (of length a->cd) of pivot indices.
rcond A double estimate of the reciprocal condition of A .
for the system A*x = b , relative perturbations
in A and b of size epsilon may cause
relative perturbations in x of size epsilon/rcond .
If rcond is so small that the logical expression
1.0 + rcond .eq. 1.0
is true, then a may be singular to working
precision. In particular, rcond is zero if
exact singularity is detected or the estimate
underflows.
z A double vector (of length a->cd) for a work vector
whose contents are usually unimportant. If A is
close to a singular matrix, then z is an approx-
imate null vector in the sense that:
norm(a*z) = rcond*norm(a)*norm(z) .
RETURNS
= -1 Matrix is not square.
= 0 Normal return value.
= k if u(k,k) .eq. 0.0 . This is not an error
condition for this subroutine, but it does
indicate that sgesl or sgedi will divide by zero
if called. Use rcond in sgeco for a reliable
indication of singularity.
ROUTINES
SGEFA(), blas sasum() and sdot(), copysign(), fabs();
WARNINGS
This routine uses the UN*X math library routines
copysign() and fabs().
*/
{
int j;
int k, n, info ;
double s;
double ek, anorm, ynorm;
n = a->cd;
/* Compute 1-norm of A. */
for( j=0, anorm=0.0; j<n; j++ ) {
double sum;
sum = sasum( n, a->pd[j], 1 );
anorm = (double)sum > anorm ? (double)sum : anorm;
}
/* Factor A. */
info = sgefa( a, ipvt );
/*
* rcond = 1/(norm(a)*(estimate of norm(inverse(a)))) .
* estimate = norm(z)/norm(y) where a*z = y and trans(a)*y = e .
* trans(a) is the transpose of a . The components of e are
* chosen to cause maximum local growth in the elements of w where
* trans(u)*w = e . The vectors are frequently rescaled to avoid
* overflow.
*/
/* solve trans(u)*w = e */
ek = 1.0;
for( j=0; j<n; j++ ) {
z[j] = 0.0e0;
}
for( k=0; k<n; k++ ) {
double zk = z[k];
double wk, wkm, sm;
int kp1 = k+1;
if( zk != 0.0 ) ek = (double)copysign( (double)ek, (double)-zk );
if( fabs( (double)(ek-zk) ) > fabs( (double)pelem(a,k,k) ) ) {
s = (double)fabs( (double)pelem(a,k,k) )/(double)fabs(
(double)(ek-zk) );
sscal( n, (double)s, z, 1 );
zk = z[k];
ek *= s;
}
wk = ek - zk;
wkm = -ek - zk;
s = (double)fabs( (double)wk );
sm = (double)fabs( (double)wkm );
if( pelem(a,k,k) == 0.0 ) {
wk = 1.0;
wkm = 1.0;
}
else {
wk /= pelem(a,k,k);
wkm /= pelem(a,k,k);
}
if( kp1<n ) {
for( j=kp1; j<n; j++ ) {
sm = sm + (double)fabs( (double)(z[j]+wkm*pelem(a,k,j)) );
z[j] += ((double)wk)*pelem(a,k,j);
s += (double)fabs( (double)z[j] );
}
if( s < sm ) {
double t = wkm-wk;
wk = wkm;
for( j=kp1; j<n; j++ ) {
z[j] += t*pelem(a,k,j);
}
}
}
z[k] = wk;
}
s = 1.0/(double)sasum( n, z, 1 );
sscal( n, (double)s, z, 1 );
/* Solve trans(L)*y = w. */
for( k=n-1; k>=0; k-- ) {
int l;
double t;
if( k < n-1 ) z[k] += (double)sdot( n-k-1, a->pd[k]+k+1, 1,
(z+k+1), 1 );
if( fabs( (double)z[k] ) > 1.0 ) {
s = 1.0/(double)fabs( (double)z[k] );
sscal( n, (double)s, z, 1 );
}
l = ipvt[k];
t = z[l];
z[l] = z[k];
z[k] = t;
}
s = 1.0/(double)sasum( n, z, 1 );
sscal( n, (double)s, z, 1);
ynorm = 1.0;
/* solve L*v = y. */
for( k=0; k<n; k++ ) {
int l;
double t;
l = ipvt[k];
t = z[l];
z[l] = z[k];
z[k] = t;
if( k < n-1 ) saxpy( n-k-1, (double)t, (a->pd[k]+k+1), 1,
(z+k+1), 1 );
if( fabs( (double)z[k] ) > 1.0) {
s = 1.0/(double)fabs( (double)z[k] );
sscal( n, (double)s, z, 1 );
ynorm *= s;
}
}
s = 1.0/(double)sasum( n, z, 1 );
sscal( n, (double)s, z, 1 );
ynorm *= s;
/* Solve U*z = v. */
for( k=n-1; k>=0; k-- ) {
double t;
if( fabs( (double)z[k] ) > fabs( (double)pelem(a,k,k) ) ) {
s = (double)fabs( (double)pelem(a,k,k) )/(double)fabs(
(double)z[k] );
sscal( n, (double)s, z, 1 );
ynorm *= s;
}
if( pelem(a,k,k) == 0.0 ) z[k] = 1.0;
else z[k] /= pelem(a,k,k);
t = -z[k];
saxpy( k, (double)t, a->pd[k], 1, z, 1 );
}
/* Make znorm = 1.0. */
s = 1.0/(double)sasum( n, z, 1 );
sscal( n, (double)s, z, 1 );
ynorm *= s;
if( anorm == 0.0e0) *rcond = 0.0;
else *rcond = ynorm/anorm;
return( info );
}
/***************************************************************
******************************************************************
**** Gaussian Elimination with partial pivoting. ****
**** This file contains the factorization routine SGEFA ****
******************************************************************
****************************************************************/
int sgefa(struct FULL *a,int * ipvt )
/*
PURPOSE
SGEFA factors a real matrix by gaussian elimination.
REMARKS
SGEFA is usually called by SGECO, but it can be called
directly with a saving in time if rcond is not needed.
(time for SGECO) = (1 + 9/n)*(time for SGEFA) .
INPUT
a A pointer to the FULL matrix structure.
See the definition in ge.h.
OUTPUT
a A pointer to the FULL matrix structure containing
an upper triangular matrix and the multipliers
which were used to obtain it.
The factorization can be written a = l*u where
l is a product of permutation and unit lower
triangular matrices and u is upper triangular.
ipvt An integer vector (of length a->cd) of pivot indices.
RETURNS
= -1 Matrix is not square.
= 0 Normal return value.
= k if u(k,k) .eq. 0.0 . This is not an error
condition for this subroutine, but it does
indicate that sgesl or sgedi will divide by zero
if called. Use rcond in sgeco for a reliable
indication of singularity.
ROUTINES
blas ISAMAX
*/
{
int i, j;
int k, l, nm1, info, n;
double *akk, *alk;
double t, *mik;
/* Gaussian elimination with partial pivoting. */
if( a->cd != a->rd ) return( -1 );
n = a->cd;
nm1 = n - 1;
akk = a->pd[0];
info = 0; /* Assume nothing will go wrong! */
if( n < 2 ) goto CLEAN_UP;
/* Loop over Diagional */
for( k=0; k<nm1; k++, ipvt++ ) {
/* Find index of max elem in col below the diagional (l = pivot
index). */
akk = a->pd[k] + k;
l = isamax( n-k, akk, 1 ) + k;
*ipvt = l;
/* Zero pivot implies this column already triangularized. */
alk = a->pd[k] + l;
if( *alk == 0.0e0) {
info = k;
continue;
}
/* Interchange a(k,k) and a(l,k) if necessary. */
if( l != k ) {
t = *alk;
*alk = *akk;
*akk = t;
}
/* Compute multipliers for this column. */
t = -1.0e0 / (*akk);
for( i=k+1, mik=a->pd[k]; i<n; i++ )
mik[i] *= t;
/* Column elimination with row indexing. */
if( l != k ) {
/* Interchange a(k,j) and a(l,j) if necessary. */
for( j=k+1; j<n; j++ ) {
t = pelem(a,k,j);
pelem(a,k,j) = pelem(a,l,j);
pelem(a,l,j) = t;
}
}
for( j=k+1; j<n; j++ ) {
double *aij = a->pd[j];
t = pelem(a,k,j);
for( i=k+1, mik=a->pd[k]; i<n; i++ )
aij[i] += t*mik[i];
}
} /* End of for k loop */
CLEAN_UP:
*ipvt = nm1;
if( *akk == 0.0e0 ) info = n;
return( info );
}
/***************************************************************
******************************************************************
**** Gaussian Elimination with partial pivoting. ****
**** This file contains the solution routine SGESL ****
******************************************************************
****************************************************************/
void sgesl(struct FULL * a,int * ipvt,double b[],int job )
/*
PURPOSE
SGESL solves the real system
a * x = b or trans(a) * x = b
using the factors computed by SGECO or SGEFA.
INPUT
a A pointer to the FULL matrix structure containing the
factored
matrix. See the definition of FULL in ge.h.
ipvt The pivot vector (of length a->cd) from SGECO or SGEFA.
b The right hand side vector (of length a->cd).
job = 0 to solve a*x = b ,
= nonzero to solve trans(a)*x = b where
trans(a) is the transpose.
OUTPUT
b The solution vector x.
REMARKS
Error condition:
A division by zero will occur if the input factor contains a
zero on the diagonal. Technically this indicates singularity
but it is often caused by improper arguments or improper
setting of lda . It will not occur if the subroutines are
called correctly and if sgeco has set rcond .gt. 0.0
or sgefa has set info .eq. 0 .
*/
{
double t, *mik;
double *akk;
int i, k;
int l, n, nm1;
n = a->cd;
nm1 = n - 1;
/* job = 0 , solve A * x = b. */
if( job == 0 ) {
/* Forward elimination. Solve L*y = b. */
for( k=0; k<nm1; k++ ) {
akk = a->pd[k] + k; /* akk points to a(k,k). */
/* Interchange b[k] and b[l] if necessary. */
l = ipvt[k];
t = b[l];
if( l != k ) {
b[l] = b[k];
b[k] = t;
}
for( i=k+1, mik=a->pd[k]; i<n; i++ )
b[i] += t*mik[i];
}
/* Back substitution. Solve U*x = y. */
for( k=nm1; k>=0; k-- ) {
double *uik = a->pd[k];
akk = uik + k;
b[k] /= (*akk);
for( i=0; i<k; i++ )
b[i] -= uik[i]*b[k];
}
return;
}
/* job = nonzero. Solve trans(A) * x = b. */
/* First solve trans(U)*y = b. */
for( k=0; k<n; k++ ) {
double *uik = a->pd[k];
akk = uik + k;
t = 0.0;
for( i=0; i<k; i++ )
t += uik[i]*b[i];
b[k] = (b[k] - t) / (*akk);
}
/* b now contains y. */
/* Solve trans(L)*x = y. */
for( k=n-2; k>=0; k-- ) {
mik = a->pd[k];
t = 0.0;
for( i=k+1; i<n; i++ )
t += mik[i]*b[i];
b[k] += t;
/* Interchange b(k) and b(ipvt(k)) if necessary. */
l = ipvt[k];
if( l == k ) continue;
t = b[l];
b[l] = b[k];
b[k] = t;
}
return;
}
/***************************************************************
*****************************************************************
*******************************************************************
***** *****
***** BLAS *****
***** Basic Linear Algebra Subroutines *****
***** Written in the C Programming Language. *****
***** *****
***** Functions include: *****
***** isamax, sasum, saxpy, scopy, sdot, snrm2, *****
***** *****
***** In addition a few other routines are included: *****
***** vexopy, vfill *****
***** *****
***** If your 3M library does not have the copysign function *****
***** then compile this file with -DCOPYSIGN and one will be *****
***** be supplied. *****
*******************************************************************
*****************************************************************
***************************************************************/
#ifndef HUGEsp
#define HUGEsp 1.0e+38
#endif
#ifndef SMALLsp
#define SMALLsp 1.0e-45
#endif
int isamax(int n, double *sx,int incx )
/*
PURPOSE
Finds the index of element having max. absolute value.
INPUT
n Number of elements to check.
sx Vector to be checked.
incx Every incx-th element is checked.
*/
{
double smax = 0.0e0;
int i, istmp = 0;
#ifndef abs
#define abs(x) ((x)<0.0?-(x):(x))
#endif
#ifdef alliant
int isamax_();
istmp = isamax_( &n, sx, &incx )-1; /* Remember 0 is first. */
return( istmp );
#else
if( n <= 1 ) return( istmp );
if( incx != 1 ) {
/* Code for increment not equal to 1. */
if( incx < 0 ) sx = sx + ((-n+1)*incx + 1);
istmp = 0;
smax = abs( *sx );
sx += incx;
for( i=1; i<n; i++, sx+=incx )
if( abs( *sx ) > smax ) {
istmp = i;
smax = abs( *sx );
}
return( istmp );
}
/* Code for increment equal to 1. */
istmp = 0;
smax = abs(*sx);
sx++;
for( i=1; i<n; i++, sx++ )
if( abs( *sx ) > smax ) {
istmp = i;
smax = abs( *sx );
}
return( istmp );
#endif
}
double sasum(int n,double * sx,int incx )
/*
PURPOSE
Returns sum of magnitudes of single precision SX.
sasum = sum from 0 to n-1 of ABS(SX(1+I*INCX))
INPUT
n Number of elements to multiply.
sx Pointer to double vector to take abs sum of.
incx Storage incrament for sx.
RETURNS
sasum Double variable with the result.
WARNINGS
This routine uses the UN*X math library function fabs().
*/
{
#ifndef abs
#define abs(x) ((x)<0.0?-(x):(x))
#endif
double sum = 0.0;
if( n<= 0 ) return( sum );
if( incx == 1 ) {
int i, m;
/* Code for increments equal to 1. */
/* Clean-up loop so remaining vector length is a multiple of 6. */
m = n % 6;
if( m != 0 ) {
for( i=0; i<m; i++ )
sum += abs( sx[i] );
if( n < 6 ) return( (double)sum );
}
for( i=m; i<n; i+=6 ) {
sum += abs( sx[i] ) + abs( sx[i+1]) + abs( sx[i+2] ) +
abs( sx[i+3] ) + abs( sx[i+4] ) + abs( sx[i+5] );
}
return( (double)sum );
}
else {
int i, ns;
/* Code for increments not equal to 1. */
ns = n*incx;
for( i=0; i<ns; i+=incx ) {
sum += abs( sx[i] );
}
return( (double)sum );
}
}
void saxpy(int n,double sa, double *sx,int incx,double * sy,int incy )
/*
PURPOSE
Vector times a scalar plus a vector. sy = sy + sa*sx.
INPUT
n Number of elements to multiply.
sa Scalar to multiply by (note that this is a double).
sx Pointer to double vector to scale.
incx Storage incrament for sx.
sy Pointer to double vector to add.
incy Storage incrament for sy.
OUTPUT
sy sy = sy + sa*sx
*/
{
int i;
double ssa = (double)sa;
#ifdef alliant
void saxpy_();
double ssaa = (double)sa;
saxpy_( &n, &ssaa, sx, &incx, sy, &incy );
return;
#else
if( n<=0 || ssa==0.0 ) return;
if( incx == incy ) {
if( incx == 1 ) {
/* Both increments = 1 */
for( i=0; i<n; i++ )
sy[i] += ssa*sx[i];
return;
}
if( incx>0 ) {
/* Equal, positive, non-unit increments. */
for( i=0; i<n; i++,sx+=incx,sy+=incx )
*sy += ssa*(*sx);
return;
}
}
/* Unequal or negative increments. */
if( incx < 0 ) sx += ((-n+1)*incx + 1);
if( incy < 0 ) sy += ((-n+1)*incy + 1);
for( i=0; i<n; i++,sx+=incx,sy+=incy )
*sy += ssa*(*sx);
#endif
}
void saxpyx( int n, double sa, double *sx,int incx,double * sy,int incy )
/*
PURPOSE
Vector times a scalar plus a vector. sx = sy + sa*sx.
INPUT
n Number of elements to multiply.
sa Scalar to multiply by (note that this is a double).
sx Pointer to double vector to scale.
incx Storage incrament for sx.
sy Pointer to double vector to add.
incy Storage incrament for sy.
OUTPUT
sx sx = sy + sa*sx
*/
{
int i;
double ssa = (double)sa;
if( n<=0 || ssa==0.0 ) return;
if( incx == incy ) {
if( incx == 1 ) {
/* Both increments = 1 */
for( i=0; i<n; i++ )
sx[i] = sy[i] + ssa*sx[i];
return;
}
if( incx>0 ) {
/* Equal, positive, non-unit increments. */
for( i=0; i<n; i++, sx+=incx, sy+=incx)
*sx = *sy + ssa*(*sx);
return;
}
}
/* Unequal or negative increments. */
if( incx < 0 ) sx += ((-n+1)*incx + 1);
if( incy < 0 ) sy += ((-n+1)*incy + 1);
for( i=0; i<n; i++,sx+=incx,sy+=incy )
*sx = *sy + ssa*(*sx);
}
void scopy(int n,double * sx,int incx, double *sy,int incy )
/*
PURPOSE
Copies vector sx into vector sy.
INPUT
n Number of components to copy.
sx Source vector
incx Index increment for sx.
incy Index increment for sy.
OUTPUT
sy Destination vector.
*/
{
int i;
#ifdef alliant
void scopy_();
scopy_( &n, sx, &incx, sy, &incy );
return;
#else
if( n<1 ) return;
if( incx == incy ) {
if( incx == 1 ) {
/* Both increments = 1 */
for( i=0; i<n; i++ )
sy[i] = sx[i];
return;
}
if( incx > 0 ) {
/* Equal, positive, non-unit increments. */
for( i=0; i<n; i++, sx+=incx, sy+=incx)
*sy = *sx;
return;
}
}
/* Non-equal or negative increments. */
if( incx < 0 ) sx += ((-n+1)*incx + 1);
if( incy < 0 ) sy += ((-n+1)*incy + 1);
for( i=0; i<n; i++,sx+=incx,sy+=incy )
(*sx) = (*sy);
return;
#endif
}
double sdot(int n,double * sx,int incx,double * sy, int incy )
/*
PURPOSE
Forms the dot product of a vector.
INPUT
n Number of elements to sum.
sx Address of first element of x vector.
incx Incrament for the x vector.
sy Address of first element of y vector.
incy incrament for the y vector.
OUPUT
sdot Dot product x and y. Double returned
due to `C' language features.
*/
{
int i;
double stemp = 0.0e0;
if( n<1 ) return( (double)stemp );
if( incx == incy ) {
if( incx == 1 ) {
/* Both increments = 1 */
for( i=0; i<n; i++ )
stemp += sx[i]*sy[i];
return( (double)stemp );
}
if( incx>0 ) {
/* Equal, positive, non-unit increments. */
for( i=0; i<n; i++, sx+=incx, sy+=incx)
stemp += (*sx)*(*sy);
return( (double)stemp );
}
}
/* Unequal or negative increments. */
if( incx < 0 ) sx += ((-n+1)*incx + 1);
if( incy < 0 ) sy += ((-n+1)*incy + 1);
for( i=0; i<n; i++,sx+=incx,sy+=incy )
stemp += (*sx)*(*sy);
return( (double)stemp );
} /* End of ---SDOT--- */
double r1mach(void);
double snrm2( int n,double * sx,int incx )
/*
PURPOSE
Computes the Euclidean norm of sx while being
very careful of distructive underflow and overflow.
INPUT
n Number of elements to use.
sx Address of first element of x vector.
incx Incrament for the x vector (>0).
OUPUT
snrm2 Euclidean norm of sx. Returns double
due to `C' language features.
REMARKS
This algorithm proceeds in four steps.
1) scan zero components.
2) do phase 2 when component is near underflow.
*/
{
int i;
static double cutlo, cuthi;
double sum = 0.0e0, hitst;
double xmax;
if( n<1 || incx<1 ) return( sum );
/* Calculate near underflow */
if( cutlo == 0.0 ) cutlo = sqrt( SMALLsp/r1mach() );
/* Calculate near overflow */
if( cuthi == 0.0 ) cuthi = sqrt( HUGEsp );
hitst = cuthi/(double) n;
i = 0;
/* Zero Sum. */
while( *sx == 0.0 && i<n ) {
i++;
sx += incx;
}
if( i>=n ) return( sum );
START:
if( abs( *sx ) > cutlo ) {
for( ; i<n; i++, sx+=incx ) { /* Loop over elements. */
if( abs( *sx ) > hitst ) goto GOT_LARGE;
sum += (*sx) * (*sx);
}
sum = sqrt( sum );
return( sum ); /* Sum completed
normaly. */
}
else { /* Small sum prepare
for phase 2. */
xmax = abs( *sx );
sx += incx;
i++;
sum += 1.0;
for( ; i<n; i++, sx+=incx ) {
if( abs( *sx ) > cutlo ) { /* Got normal elem.
Rescale and process. */
sum = (sum*xmax)*xmax;
goto START;
}
if( abs( *sx ) > xmax ) {
sum = 1.0 + sum*(xmax /(*sx))*(xmax /(*sx));
xmax = abs( *sx );
continue;
}
sum += ((*sx)/xmax)*((*sx)/xmax);
}
return( (double)xmax*sqrt( sum ) );
} /* End of small sum. */
GOT_LARGE:
sum = 1.0 + (sum/(*sx))/(*sx); /* Rescale and process. */
xmax = abs( *sx );
sx += incx;
i++;
for( ; i<n; i++, sx+=incx ) {
if( abs( *sx ) > xmax ) {
sum = 1.0 + sum*(xmax /(*sx))*(xmax /(*sx));
xmax = abs( *sx );
continue;
}
sum += ((*sx)/xmax)*((*sx)/xmax);
}
return( (double)xmax*sqrt( sum ) ); /* End of small sum. */
} /* End of ---SDOT--- */
double r1mach()
/***********************************************************************
**** This routine computes the unit roundoff for single precision
**** of the machine. This is defined as the smallest positive
**** machine number u such that 1.0 + u .ne. 1.0
**** Returns a double due to `C' language features.
**********************************************************************/
{
double u = 1.0e0, comp;
do {
u *= 0.5e0;
comp = 1.0e0 + u;
}
while( comp != 1.0e0 );
return( (double)u*2.0e0 );
} /*-------------------- end of function r1mach ------------------------*/
int min0(int n,int a,int b,int c,int d,int e,int f,int g,int h,int i,int
j,int k,int l,int m,int o,int p )
/*
PURPOSE
Determine the minimum of the arguments a-p.
INPUT
n Number of arguments to check 1 <= n <= 15.
a-p Integer arguments of which the minumum is desired.
RETURNS
min0 Minimum of a thru p.
*/
{
int mt;
if( n < 1 || n > 15 ) return( -1 );
mt = a;
if( n == 1 ) return( mt );
if( mt > b ) mt = b;
if( n == 2 ) return( mt );
if( mt > c ) mt = c;
if( n == 3 ) return( mt );
if( mt > d ) mt = d;
if( n == 4 ) return( mt );
if( mt > e ) mt = e;
if( n == 5 ) return( mt );
if( mt > f ) mt = f;
if( n == 6 ) return( mt );
if( mt > g ) mt = g;
if( n == 7 ) return( mt );
if( mt > h ) mt = h;
if( n == 8 ) return( mt );
if( mt > i ) mt = i;
if( n == 9 ) return( mt );
if( mt > j ) mt = j;
if( n == 10 ) return( mt );
if( mt > k ) mt = k;
if( n == 11 ) return( mt );
if( mt > l ) mt = l;
if( n == 12 ) return( mt );
if( mt > m ) mt = m;
if( n == 13 ) return( mt );
if( mt > o ) mt = o;
if( n == 14 ) return( mt );
if( mt > p ) mt = p;
return( mt );
}
void sscal(int n,double sa,double * sx,int incx )
/*
PURPOSE
Scales a vector by a constant.
INPUT
n Number of components to scale.
sa Scale value (note that this is a double).
sx Vector to scale.
incx Every incx-th element of sx will be scaled.
OUTPUT
sx Scaled vector.
*/
{
double ssa = (double)sa;
int i;
#ifdef alliant
void sscal_();
double ssaa = (double)sa;
sscal_( &n, &ssaa, sx, &incx );
return;
#else
if( n < 1 ) return;
/* Code for increment not equal to 1.*/
if( incx != 1 ) {
if( incx < 0 ) sx += (-n+1)*incx;
for( i=0; i<n; i++, sx+=incx )
*sx *= ssa;
return;
}
/* Code for unit increment. */
for( i=0; i<n; i++ )
sx[i] *= ssa;
return;
#endif
}
void vexopy(int n,double * v,double * x,double * y,int itype )
/*
Purpose:
To operate on the vectors x and y.
Input:
n Number of elements to scale.
x First operand vector.
y Second operand vector.
itype Type of operation to perform:
itype = 1 => '+'
itype = 2 => '-'
Output:
v Result vector of x op y.
*/
{
int i;
if( n<1 ) return;
if( itype == 1 ) /* ADDITION. */
for( i=0; i<n; i++ )
v[i] = x[i] + y[i];
else /* SUBTRACTION. */
for( i=0; i<n; i++ )
v[i] = x[i] - y[i];
}
void vfill(int n,double * v,double val )
/*
Purpose
To fill the FLOAT vector v with the value val.
Make sure that if you pass a value for val that you cast
it to double, viz.,
vfill( 100, vector, (double)0.0 );
*/
{
int i;
double vval = (double)val;
if( n<1 ) return;
for( i=0; i<n; i++ )
v[i] = vval;
}
#ifdef NEEDSCOPYSIGN
double copysign(double x,double y )
/*
PURPOSE
This routine is recomended by the IEEE standard 754. Most C
3M libraries contain this function. If yours does not then
compile this file with the -DCOPYSIGN option and the following
code will be generated. This routine copies the sign from y
onto x.
INPUT
x Thing to have it's sign changed.
y Variable to supply the sign.
RETURNS
copysign Returns x with the sign of y (the fortran intrinsic
sign(x,y)).
*/
{
/* Registers are used for reduced memory traffic. */
double xx = x;
double yy = y;
if( xx*yy < 0.0 ) return( -xx );
else return( xx );
}
#endif
[toc] | [prev] | [next] | [standalone]
| From | Melzzzzz <Melzzzzz@zzzzz.com> |
|---|---|
| Date | 2019-03-24 13:24 +0000 |
| Message-ID | <GyLlE.163277$pP5.161588@fx01.am4> |
| In reply to | #142340 |
On 2019-03-24, jacobnavia <jacob@jacob.remcomp.fr> wrote: > Le 24/03/2019 à 13:56, Melzzzzz a écrit : >> On 2019-03-24, jacobnavia <jacob@jacob.remcomp.fr> wrote: >>> What are your experiences with clang? >>> >>> I have recently installed that compiler in an ARM64/Linux system, and it >>> seems very good (much better than gcc) when it works. >>> >>> For instance, in a benchmark of floating point operations (matrix >>> operations) the results were: >>> >>> 1 clang -O2: 12.22 >>> 2 gcc -O2: 18.6 >>> 3 lcc -O : 21.4 >> >> Without code it is meaningless to say such figures. In my experience gcc >> is slightly faster. >> > > Joined the code of matrix.c Indeed clang is slightly faster in this benchmark: ./matrix_gcc 0.94s user 0.00s system 118% cpu 0.790 total ./matrix_clang 0.61s user 0.00s system 116% cpu 0.529 total ~/News >>> gcc -O2 -march=native matrix.c -o matrix_gcc -lm ~/News >>> clang -O2 -march=native matrix.c -o matrix_clang -lm clang version 7.0.1 (tags/RELEASE_701/final) gcc version 8.2.1 20181127 (GCC) -- press any key to continue or any other to quit...
[toc] | [prev] | [next] | [standalone]
| From | David Brown <david.brown@hesbynett.no> |
|---|---|
| Date | 2019-03-24 15:47 +0100 |
| Message-ID | <q785ae$9gi$1@dont-email.me> |
| In reply to | #142342 |
On 24/03/2019 14:24, Melzzzzz wrote: > On 2019-03-24, jacobnavia <jacob@jacob.remcomp.fr> wrote: >> Le 24/03/2019 à 13:56, Melzzzzz a écrit : >>> On 2019-03-24, jacobnavia <jacob@jacob.remcomp.fr> wrote: >>>> What are your experiences with clang? >>>> >>>> I have recently installed that compiler in an ARM64/Linux system, and it >>>> seems very good (much better than gcc) when it works. >>>> >>>> For instance, in a benchmark of floating point operations (matrix >>>> operations) the results were: >>>> >>>> 1 clang -O2: 12.22 >>>> 2 gcc -O2: 18.6 >>>> 3 lcc -O : 21.4 >>> >>> Without code it is meaningless to say such figures. In my experience gcc >>> is slightly faster. >>> >> >> Joined the code of matrix.c > Indeed clang is slightly faster in this benchmark: > ./matrix_gcc 0.94s user 0.00s system 118% cpu 0.790 total > ./matrix_clang 0.61s user 0.00s system 116% cpu 0.529 total > ~/News >>> gcc -O2 -march=native matrix.c -o matrix_gcc -lm > ~/News >>> clang -O2 -march=native matrix.c -o matrix_clang -lm > clang version 7.0.1 (tags/RELEASE_701/final) > gcc version 8.2.1 20181127 (GCC) > clang tends to be very good at automatic vectorisation and using SIMD units. If it is code where that is a benefit (and a matrix benchmark sounds like a likely candidate), then it stands a good chance of giving fast results. On other code, it can lead to slower results. It is, as far as I have seen in comparisons, usual for clang to compile a little faster than gcc, but for gcc's output to run a little faster than clang's. The difference between the two has dropped significantly in recent years - the rivalry between the compilers has paid off for everyone.
[toc] | [prev] | [next] | [standalone]
| From | Bart <bc@freeuk.com> |
|---|---|
| Date | 2019-03-24 13:42 +0000 |
| Message-ID | <BPLlE.231261$2t3.220857@fx10.am4> |
| In reply to | #142340 |
On 24/03/2019 13:11, jacobnavia wrote: > Le 24/03/2019 à 13:56, Melzzzzz a écrit : >> On 2019-03-24, jacobnavia <jacob@jacob.remcomp.fr> wrote: >>> What are your experiences with clang? >>> >>> I have recently installed that compiler in an ARM64/Linux system, and it >>> seems very good (much better than gcc) when it works. >>> >>> For instance, in a benchmark of floating point operations (matrix >>> operations) the results were: >>> >>> 1 clang -O2: 12.22 >>> 2 gcc -O2: 18.6 >>> 3 lcc -O : 21.4 >> >> Without code it is meaningless to say such figures. In my experience gcc >> is slightly faster. >> > > Joined the code of matrix.c I tried this, but with tgmath.h commented out. (I don't know what it does, but it seemed to still work without it. Some compilers don't have tgmath.h). Results on my AMD (Athlon II 215 2.7GHz) processor are: gcc 8.1.0 3.8 seconds clang 7.0.0 3.9 MSVC (CL) 3.9 DMC 4.3 (32-bit) Pelles C 4.6 lccwin64 5.7 bcc 9.9 (these two unoptimised) tcc 11.1 All 64-bit target and optimised except where stated.
[toc] | [prev] | [next] | [standalone]
| From | Noob <root@127.0.0.1> |
|---|---|
| Date | 2019-04-10 21:07 +0200 |
| Message-ID | <q8leta$53v$1@dont-email.me> |
| In reply to | #142344 |
On 24/03/2019 14:42, Bart wrote: > I don't know what [tgmath.h] does [...] FWIW, "tgmath" stands for "type-generic math". https://en.cppreference.com/w/c/numeric/tgmath > The header <tgmath.h> includes the headers <math.h> and <complex.h> > and defines several type-generic macros that determine which real or, > when applicable, complex function to call based on the types of the > arguments. Regards.
[toc] | [prev] | [next] | [standalone]
| From | already5chosen@yahoo.com |
|---|---|
| Date | 2019-03-24 06:24 -0700 |
| Message-ID | <67a29cb1-8e5f-41a0-9d8a-60b9e5679d4e@googlegroups.com> |
| In reply to | #142334 |
When you compare clag vs gcc, please keep in mind that in gcc they have -O2 and -O3 that are non-trivially different. Formally, clang also has -O2 and -O3, but in practice they are approximately the same. As to which is faster and which produces faster code, you really should try bigger corpus of the samples before jumping to any conclusion. My non-scientific feeling right now is that I don't know which of them is faster. As to faster code, clang wins about 70% of the time, but there are still 30% where gcc wins and sometimes it wins by non-trivial margin. For me, personally, one thing that makes clang less interesting is a fact that it supports too few targets. Also, the state of clang documentation for all targets except a few most popular is close to non-existing (or hard to find, which in effect is the same). gcc, on the other hand, is quite good in that regard.
[toc] | [prev] | [next] | [standalone]
| From | Melzzzzz <Melzzzzz@zzzzz.com> |
|---|---|
| Date | 2019-03-24 13:38 +0000 |
| Message-ID | <pLLlE.217226$Qp2.193589@fx11.am4> |
| In reply to | #142341 |
On 2019-03-24, already5chosen@yahoo.com <already5chosen@yahoo.com> wrote: > When you compare clag vs gcc, please keep in mind that in gcc they > have -O2 and -O3 that are non-trivially different. Formally, clang > also has -O2 and -O3, but in practice they are approximately the same. > Indeed when using -Ofast both are around same time. ./matrix_gcc 0.60s user 0.00s system 113% cpu 0.526 total ./matrix_clang 0.53s user 0.00s system 108% cpu 0.490 total -- press any key to continue or any other to quit...
[toc] | [prev] | [next] | [standalone]
| From | jacobnavia <jacob@jacob.remcomp.fr> |
|---|---|
| Date | 2019-03-26 21:06 +0100 |
| Message-ID | <q7e0o7$ukb$1@dont-email.me> |
| In reply to | #142334 |
Le 24/03/2019 à 12:15, jacobnavia a écrit :
> It is the slowest compiler known
>
> For instance, to compile the source code of lcc (around 2.5MB of C)
> we have compilation times of:
> 1 lcc 8.7 sec (with optimizations on)
> 2 gcc 38 sec (without optimization)
> 3 clang 5 minutes (without any optimizations).
>
> WITH optimizations the landscape looks the same:
> 1 lcc: 8.7 sec
> 2 gcc 2minutes 48s
> 3 clang: 26 minutes
That was version 5
I upgraded to version 9.0, and waited 32 hours and 41 minutes for the
build of clang to finish. CPU Quad core ARM64, 4GB RAM, SSD of 1 TB,
linux OS.
The executable of clang is 2.3GB with debug information. Stripped it
shrinks to "just" 194MB.
It compiles the same code used for the benchmark above even slower:
compilation time increases by 6 minutes. The figures are (with
optimizations ON):
1 lcc: 8.7 sec
2 gcc 2minutes 48s
3 clang: 32 minutes
This is progress: always fatter , always bigger, always more features, etc.
The generated code is WRONG and crashes immediately. I have sent a bug
report to clang on monday, after receiving the authorization from them
to do so.
So far no answer.
jacob
[toc] | [prev] | [next] | [standalone]
| From | Melzzzzz <Melzzzzz@zzzzz.com> |
|---|---|
| Date | 2019-03-26 20:48 +0000 |
| Message-ID | <7ewmE.616366$ao.567848@fx32.am4> |
| In reply to | #142488 |
On 2019-03-26, jacobnavia <jacob@jacob.remcomp.fr> wrote: > Le 24/03/2019 à 12:15, jacobnavia a écrit : >> It is the slowest compiler known >> >> For instance, to compile the source code of lcc (around 2.5MB of C) >> we have compilation times of: >> 1 lcc 8.7 sec (with optimizations on) >> 2 gcc 38 sec (without optimization) >> 3 clang 5 minutes (without any optimizations). >> >> WITH optimizations the landscape looks the same: >> 1 lcc: 8.7 sec >> 2 gcc 2minutes 48s >> 3 clang: 26 minutes > > That was version 5 > > I upgraded to version 9.0, and waited 32 hours and 41 minutes for the > build of clang to finish. CPU Quad core ARM64, 4GB RAM, SSD of 1 TB, > linux OS. Hm, on my Ryzen 2700X it compiles in half of hour? > > The executable of clang is 2.3GB with debug information. Stripped it > shrinks to "just" 194MB. Perhaps you should try release build? -- press any key to continue or any other to quit...
[toc] | [prev] | [next] | [standalone]
| From | jacobnavia <jacob@jacob.remcomp.fr> |
|---|---|
| Date | 2019-03-26 21:50 +0100 |
| Message-ID | <q7e3b8$lao$1@dont-email.me> |
| In reply to | #142491 |
Le 26/03/2019 à 21:48, Melzzzzz a écrit : > Hm, on my Ryzen 2700X it compiles in half of hour? My Intel i7 takes 2 hours. But I need it under ARM64, not under Intel!
[toc] | [prev] | [next] | [standalone]
| From | Ian Collins <ian-news@hotmail.com> |
|---|---|
| Date | 2019-03-27 09:52 +1300 |
| Message-ID | <gfvhnnFar11U7@mid.individual.net> |
| In reply to | #142492 |
On 27/03/2019 09:50, jacobnavia wrote: > Le 26/03/2019 à 21:48, Melzzzzz a écrit : >> Hm, on my Ryzen 2700X it compiles in half of hour? > > My Intel i7 takes 2 hours. > > But I need it under ARM64, not under Intel! https://llvm.org/docs/HowToCrossCompileLLVM.html -- Ian.
[toc] | [prev] | [next] | [standalone]
| From | jacobnavia <jacob@jacob.remcomp.fr> |
|---|---|
| Date | 2019-03-26 21:58 +0100 |
| Message-ID | <q7e3qf$u5b$1@dont-email.me> |
| In reply to | #142493 |
Le 26/03/2019 à 21:52, Ian Collins a écrit : > On 27/03/2019 09:50, jacobnavia wrote: >> Le 26/03/2019 à 21:48, Melzzzzz a écrit : >>> Hm, on my Ryzen 2700X it compiles in half of hour? >> >> My Intel i7 takes 2 hours. >> >> But I need it under ARM64, not under Intel! > > https://llvm.org/docs/HowToCrossCompileLLVM.html > Yes, I know I tried the emulators of ARM64 under linux/intel and decided... to buy that machine because I just refuse to spend hours figuring out how to debug remotely a program, or trying to figure out why a simple command will not work etc. I just prefer waiting 32 hours (just a day) doing something else and be done with it than spending a week trying to configure stuff!
[toc] | [prev] | [next] | [standalone]
| From | already5chosen@yahoo.com |
|---|---|
| Date | 2019-03-27 06:40 -0700 |
| Message-ID | <39afbdc4-34da-4d0e-94f3-e41324f25b74@googlegroups.com> |
| In reply to | #142497 |
On Tuesday, March 26, 2019 at 10:59:01 PM UTC+2, jacobnavia wrote: > Le 26/03/2019 à 21:52, Ian Collins a écrit : > > On 27/03/2019 09:50, jacobnavia wrote: > >> Le 26/03/2019 à 21:48, Melzzzzz a écrit : > >>> Hm, on my Ryzen 2700X it compiles in half of hour? > >> > >> My Intel i7 takes 2 hours. > >> > >> But I need it under ARM64, not under Intel! > > > > https://llvm.org/docs/HowToCrossCompileLLVM.html > > > > Yes, I know > Are you sure that you know? The rest of you comments suggest that you probably don't know. The link above describes the procedure of building clang compiler that will run on ARM Linux machine and generate ARM Linux executables where the build itself is done on x86-64 machine. In theory, any popular x86-64 machines will do, but I would suspect that in practice anything but Debian Linux would be too hard to handle for non-llvm-hacker. > I tried the emulators of ARM64 under linux/intel and decided... to buy > that machine because I just refuse to spend hours figuring out how to > debug remotely a program, or trying to figure out why a simple command > will not work etc. > > I just prefer waiting 32 hours (just a day) doing something else and be > done with it than spending a week trying to configure stuff!
[toc] | [prev] | [next] | [standalone]
| From | jacobnavia <jacob@jacob.remcomp.fr> |
|---|---|
| Date | 2019-03-27 17:31 +0100 |
| Message-ID | <q7g8g5$6uk$1@dont-email.me> |
| In reply to | #142510 |
Le 27/03/2019 à 14:40, already5chosen@yahoo.com a écrit : > On Tuesday, March 26, 2019 at 10:59:01 PM UTC+2, jacobnavia wrote: >> Le 26/03/2019 à 21:52, Ian Collins a écrit : >>> On 27/03/2019 09:50, jacobnavia wrote: >>>> Le 26/03/2019 à 21:48, Melzzzzz a écrit : >>>>> Hm, on my Ryzen 2700X it compiles in half of hour? >>>> >>>> My Intel i7 takes 2 hours. >>>> >>>> But I need it under ARM64, not under Intel! >>> >>> https://llvm.org/docs/HowToCrossCompileLLVM.html >>> >> >> Yes, I know >> > > Are you sure that you know? > The rest of you comments suggest that you probably don't know. > > The link above describes the procedure of building clang compiler that will run on ARM Linux machine and generate ARM Linux executables where the build itself is done on x86-64 machine. In theory, any popular x86-64 machines will do, but I would suspect that in practice anything but Debian Linux would be too hard to handle for non-llvm-hacker. > >> I tried the emulators of ARM64 under linux/intel and decided... to buy >> that machine because I just refuse to spend hours figuring out how to >> debug remotely a program, or trying to figure out why a simple command >> will not work etc. >> >> I just prefer waiting 32 hours (just a day) doing something else and be >> done with it than spending a week trying to configure stuff! >
[toc] | [prev] | [next] | [standalone]
| From | already5chosen@yahoo.com |
|---|---|
| Date | 2019-03-27 06:29 -0700 |
| Message-ID | <6ff05b81-8635-4b54-9792-126aec4214a3@googlegroups.com> |
| In reply to | #142493 |
On Tuesday, March 26, 2019 at 10:52:15 PM UTC+2, Ian Collins wrote: > On 27/03/2019 09:50, jacobnavia wrote: > > Le 26/03/2019 à 21:48, Melzzzzz a écrit : > >> Hm, on my Ryzen 2700X it compiles in half of hour? > > > > My Intel i7 takes 2 hours. > > > > But I need it under ARM64, not under Intel! > > https://llvm.org/docs/HowToCrossCompileLLVM.html > > -- > Ian. Looks pretty messy and amateurish when one considers that we are talking about best funded compiler development project in the history of digital computing,
[toc] | [prev] | [next] | [standalone]
| From | Ben Bacarisse <ben.usenet@bsb.me.uk> |
|---|---|
| Date | 2019-03-27 14:57 +0000 |
| Message-ID | <87h8bol5zh.fsf@bsb.me.uk> |
| In reply to | #142509 |
already5chosen@yahoo.com writes: <of clang> > Looks pretty messy and amateurish when one considers that we are > talking about best funded compiler development project in the history > of digital computing, Do you have a citation for that? It would be interesting to see a few compiler projects compared by funding and effort. -- Ben.
[toc] | [prev] | [next] | [standalone]
| From | already5chosen@yahoo.com |
|---|---|
| Date | 2019-03-27 08:16 -0700 |
| Message-ID | <8f38f898-30b5-4e46-91ed-6f9b65efe0a3@googlegroups.com> |
| In reply to | #142513 |
On Wednesday, March 27, 2019 at 4:58:01 PM UTC+2, Ben Bacarisse wrote: > already5chosen@yahoo.com writes: > <of clang> > > Looks pretty messy and amateurish when one considers that we are > > talking about best funded compiler development project in the history > > of digital computing, > > Do you have a citation for that? It would be interesting to see a few > compiler projects compared by funding and effort. > > -- > Ben. No I have no citation. But it's common knowledge that LLVM is funded by Apple, which is by far the richest computer company in the history and that ALOT of people are working on it. Google, which is not exactly poor company either, also paying salaries to many LLVM developers. I would think that any other compiler with the only possible exception of gcc, was developed by few persons, at most few dozens persons. Now, if one takes compilers with environment/IDE, libraries etc, I can believe that there were cases when hundreds of people were working on all that stuff, but here we are talking about large number of people working on compiler itself.
[toc] | [prev] | [next] | [standalone]
| From | scott@slp53.sl.home (Scott Lurndal) |
|---|---|
| Date | 2019-03-27 15:47 +0000 |
| Message-ID | <lWMmE.246066$%55.215500@fx40.iad> |
| In reply to | #142514 |
already5chosen@yahoo.com writes: >On Wednesday, March 27, 2019 at 4:58:01 PM UTC+2, Ben Bacarisse wrote: >> already5chosen@yahoo.com writes: >> <of clang> >> > Looks pretty messy and amateurish when one considers that we are >> > talking about best funded compiler development project in the history >> > of digital computing, >> >> Do you have a citation for that? It would be interesting to see a few >> compiler projects compared by funding and effort. >> >> -- >> Ben. > >No I have no citation. >But it's common knowledge that LLVM is funded by Apple, which is by far the richest computer company in the history and that ALOT of people are working on it. Google, which is not exactly poor company either, also paying salaries to many LLVM developers. >I would think that any other compiler with the only possible exception of gcc, was developed by few persons, at most few dozens persons. >Now, if one takes compilers with environment/IDE, libraries etc, I can believe that there were cases when hundreds of people were working on all that stuff, but here we are talking about large number of people working on compiler itself. Define "a lot". Full-time? Part-Time? I know Burroughs spent a lot on compilers in the day, and so did IBM. Whole groups with first and second level managers.
[toc] | [prev] | [next] | [standalone]
Page 1 of 2 [1] 2 Next page →
Back to top | Article view | comp.lang.c
csiph-web