Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: main.cpp
- Revision:
- 4:557ad9613c6e
- Parent:
- 3:da1132c65314
- Child:
- 5:2b929fbd5c69
diff -r da1132c65314 -r 557ad9613c6e main.cpp
--- a/main.cpp Tue Jan 03 03:29:16 2017 +0000
+++ b/main.cpp Tue Jan 03 14:24:52 2017 +0000
@@ -16,7 +16,7 @@
Timer timer;
int do_benchmark( void );
-double cpu_time( void );
+//double cpu_time( void );
void daxpy( int n, double da, double dx[], int incx, double dy[], int incy );
double ddot( int n, double dx[], int incx, double dy[], int incy );
int dgefa( double a[], int lda, int n, int ipvt[] );
@@ -45,16 +45,15 @@
int main()
{
- //pc.baud(115200);
- //pc.baud(19200);
- pc.baud(9600);
+ pc.baud(115200);
+ //pc.baud(9600);
while(1) {
pc.printf("Starting benchmark...\n");
do_benchmark();
-
+
pc.printf(" kraj \n\n");
}
}
@@ -82,7 +81,7 @@
N is the problem size.
*/
{
-# define N 8
+# define N 2
# define LDA ( N + 1 )
//static double a[90];
@@ -120,7 +119,7 @@
pc.printf ( " Matrix order N = %d\n", N );
pc.printf ( " Leading matrix dimension LDA = %d\n", LDA );
- ops = ( double ) ( 2L * N * N * N ) / 3.0 + 2.0 * ( double ) ( N * N );
+ ops = ( double ) ( 2L * N * N * N ) / 3 + 2 * ( N * N );
/*
Allocate space for arrays.
@@ -147,14 +146,14 @@
}
timer.start();
-
+
//*****************
t1 = ( double ) timer.read_us() / 1000000.0;
-
+
info = dgefa ( a, LDA, N, ipvt );
t2 = ( double ) timer.read_us() / 1000000.0;
-
+
if ( info != 0 ) {
pc.printf ( "\n" );
pc.printf ( "LINPACK_BENCH - Fatal error!\n" );
@@ -163,12 +162,12 @@
return 1;
}
time[0] = ( double ) t2 - t1;
-
- timer.stop();
+
+
timer.reset();
//*********
- timer.start();
+
t1 = ( double ) timer.read_us() / 1000000.0;
job = 0;
@@ -179,7 +178,8 @@
total = time[0] + time[1];
- timer.reset();
+ timer.stop();
+
//*********
/*
@@ -222,40 +222,40 @@
time[2] = total;
+ time[3] = ( double ) ops / ( 1000000.0 * total );
+ /*
if ( 0.0 < total)
{
time[3] = ( double ) ops / ( 1000000.0 * total );
- }
- else
+ }
+ else
{
time[3] = -1.0;
}
-
+ */
+
time[4] = 2.0 / time[3];
time[5] = total / cray;
- pc.printf( "\n" );
- pc.printf( " Norm. Resid Resid MACHEP X[1] X[N]\n" );
-
+ //pc.printf( " \n\n ");
+ //pc.printf( "\n Norm. Resid Resid MACHEP X[1] X[N]\n" );
+ pc.printf( "\n MACHEP X[1] X[N]\n" );
//pc.printf(" %14f", residn);
//pc.printf(" %14f", resid_max);
- //pc.printf(" %14e", eps);
- //pc.printf(" %14f", b[0]);
- //pc.printf(" %14f ",b[N-1]);
- //pc.printf("\n\n");
+ pc.printf(" %14e", eps);
+ pc.printf(" %14f", b[0]);
+ pc.printf(" %14f ",b[N-1]);
+ pc.printf("\n\n");
+ //pc.printf( " %14f %14f %14e %14f %14f \n", residn, resid_max, eps, b[0], b[N-1] );
- // */
- //pc.printf( " %14f %14f %14e %14f %14f \n", residn, resid_max, eps, b[0], b[N-1] );
-
pc.printf( " \n\n ");
-
- pc.printf( " Factor Solve Total MFLOPS Unit Cray-Ratio \n\n" );
- /*
+ pc.printf( " Factor Solve Total MFLOPS Unit Cray-Ratio \n\n" );
+
for(int ii=0; ii<6; ii++) {
- pc.printf("\t %9f", time[ii]);
+ pc.printf(" %9f", time[ii]);
}
- */
- pc.printf( " %9f %9f %9f %9f %9f %9f\n", time[0], time[1], time[2], time[3], time[4], time[5] );
+
+ //pc.printf( " %9f %9f %9f %9f %9f %9f\n", time[0], time[1], time[2], time[3], time[4], time[5] );
/*
Terminate.
@@ -266,15 +266,14 @@
pc.printf( "\n" );
- timer.stop();
-
return 0;
# undef LDA
# undef N
}
+
/******************************************************************************/
-double cpu_time ( void )
+//double cpu_time ( void )
/******************************************************************************/
/*
@@ -291,14 +290,15 @@
koristi mbed.Timer
*/
-{
- double vreme;
+//{
+// double vreme;
+
+// vreme = timer.read_ms() / 1000;
- vreme = timer.read_ms() / 1000;
+// return vreme;
+//}
+/******************************************************************************/
- return vreme;
-}
-/******************************************************************************/
void daxpy ( int n, double da, double dx[], int incx, double dy[], int incy )