root / synthbench / euroben-ports / base / C / mod2am / .svn / text-base / mod2am.c.svn-base @ 0:839f52ef7657
History | View | Annotate | Download (1.2 kB)
1 |
#include <stdio.h> |
---|---|
2 |
#include <stdlib.h> |
3 |
|
4 |
double cclock( void ); |
5 |
int check( int m, int l, int n, double *c ); |
6 |
void gendat( int, int, int, int, double *a, double *b ); |
7 |
void mvm( int, int, int, int, double *a, double *b, double *c ); |
8 |
void prthead( void ); |
9 |
void prtspeed( int, int, int, double, int, int ); |
10 |
void state( char * ); |
11 |
|
12 |
int main() |
13 |
{ |
14 |
int lda, m, l, n; |
15 |
int ok, nops, nrep; |
16 |
int i; |
17 |
double *a, *b, *c; |
18 |
double time; |
19 |
FILE *inl; |
20 |
// ------------------------------------------------------------------------ |
21 |
state( "mod2a" ); |
22 |
prthead(); |
23 |
inl = fopen( "mod2am.in", "r" ); |
24 |
while( ( fscanf( inl, "%d%d%d%d\n", &m, &l, &n, &nrep ) != EOF ) ){ |
25 |
lda = l + 1; |
26 |
a = calloc( m*lda, sizeof( double ) ); |
27 |
b = calloc( l*n, sizeof( double ) ); |
28 |
c = calloc( m*n, sizeof( double ) ); |
29 |
gendat( lda, m, l, n, a, b ); |
30 |
time = cclock(); |
31 |
for( i = 0; i < nrep; i++ ){ |
32 |
mxm( lda, m, l, n, a, b, c ); |
33 |
} |
34 |
time = cclock() - time; |
35 |
ok = check( m, l, n, c ); |
36 |
time = time/nrep; |
37 |
nops = 2*m*l*n; |
38 |
prtspeed( m, l, n, time, ok, nops ); |
39 |
free( a ); free( b ); free( c); |
40 |
} |
41 |
printf( "-------------------------------------------------\n" ); |
42 |
} |