summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2017-03-28 14:38:07 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2017-03-29 07:42:46 +0200
commit0a16d5f4a007d71dd667ae3751b8dfee2c30f16b (patch)
tree9d05cf81658702331c9c2f37f63b8ba95c003349
parentbenchmarks/linpack: Import (diff)
downloadrtems-0a16d5f4a007d71dd667ae3751b8dfee2c30f16b.tar.bz2
benchmarks/linpack: Port to RTEMS
Close #2958.
-rw-r--r--testsuites/benchmarks/linpack/Makefile.am6
-rw-r--r--testsuites/benchmarks/linpack/init.c14
-rw-r--r--testsuites/benchmarks/linpack/linpack-pc.c211
-rw-r--r--testsuites/benchmarks/linpack/linpack.doc6
-rw-r--r--testsuites/benchmarks/linpack/linpack.scn52
5 files changed, 109 insertions, 180 deletions
diff --git a/testsuites/benchmarks/linpack/Makefile.am b/testsuites/benchmarks/linpack/Makefile.am
index d947cd626b..2f5c25cf57 100644
--- a/testsuites/benchmarks/linpack/Makefile.am
+++ b/testsuites/benchmarks/linpack/Makefile.am
@@ -1,5 +1,6 @@
rtems_tests_PROGRAMS = linpack
-linpack_SOURCES = init.c
+linpack_SOURCES = init.c linpack-pc.c
+linpack_LDADD = -lm
dist_rtems_tests_DATA = linpack.scn linpack.doc
@@ -8,8 +9,9 @@ include $(top_srcdir)/../automake/compile.am
include $(top_srcdir)/../automake/leaf.am
AM_CPPFLAGS += -I$(top_srcdir)/../support/include
+AM_CFLAGS += -fno-inline -fno-builtin
-LINK_OBJS = $(linpack_OBJECTS)
+LINK_OBJS = $(linpack_OBJECTS) $(linpack_LDADD)
LINK_LIBS = $(linpack_LDLIBS)
linpack$(EXEEXT): $(linpack_OBJECTS) $(linpack_DEPENDENCIES)
diff --git a/testsuites/benchmarks/linpack/init.c b/testsuites/benchmarks/linpack/init.c
index 8b67e52360..c94314b41d 100644
--- a/testsuites/benchmarks/linpack/init.c
+++ b/testsuites/benchmarks/linpack/init.c
@@ -20,15 +20,19 @@
const char rtems_test_name[] = "LINPACK";
-static void test(void)
-{
-}
+int main(int argc, char **argv);
static void Init(rtems_task_argument arg)
{
+ char *argv[] = {
+ "linpack",
+ "10",
+ NULL
+ };
+
TEST_BEGIN();
- test();
+ main(2, argv);
TEST_END();
rtems_test_exit(0);
@@ -41,6 +45,8 @@ static void Init(rtems_task_argument arg)
#define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION
+#define CONFIGURE_INIT_TASK_ATTRIBUTES RTEMS_FLOATING_POINT
+
#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
#define CONFIGURE_INIT
diff --git a/testsuites/benchmarks/linpack/linpack-pc.c b/testsuites/benchmarks/linpack/linpack-pc.c
index a5e68696f1..5b8bc1c378 100644
--- a/testsuites/benchmarks/linpack/linpack-pc.c
+++ b/testsuites/benchmarks/linpack/linpack-pc.c
@@ -193,6 +193,8 @@
***************************************************************************
*/
+#define DP
+#define ROLL
#ifdef SP
#define REAL float
@@ -216,17 +218,14 @@
#endif
-#define NTIMES 10
+#define NTIMES atoi(argv[1])
#include <stdio.h>
#include <math.h>
-#include <conio.h>
#include <stdlib.h>
static REAL atime[9][15];
-static char this_month;
-static int this_year;
void print_time (int row);
void matgen (REAL a[], int lda, int n, REAL b[], REAL *norma);
@@ -240,56 +239,25 @@ void dscal (int n, REAL da, REAL dx[], int incx);
REAL ddot (int n, REAL dx[], int incx, REAL dy[], int incy);
/* TIME TIME TIME TIME TIME TIME TIME TIME TIME TIME TIME TIME TIME */
- #include <time.h> /* for following time functions only */
- REAL second()
+ #include <sys/time.h> /* for following time functions only */
+ static REAL second(void)
{
- REAL secs;
- clock_t Time;
- Time = clock();
- secs = (REAL)Time / (REAL)CLOCKS_PER_SEC;
- return secs ;
- }
+ struct timeval tv;
-/* DATE DATE DATE DATE DATE DATE DATE DATE DATE DATE DATE DATE DATE */
- #include <dos.h> /* for following date functions only */
- void what_date()
- {
- /* Watcom */
- struct dosdate_t adate;
- _dos_getdate( &adate );
- this_month = adate.month;
- this_year = adate.year;
-
- /* Borland
- struct date adate;
- getdate( &adate );
- this_month = adate.da_mon;
- this_year = adate.da_year;
- */
- return;
+ gettimeofday(&tv, NULL);
+ return (double)tv.tv_sec + (double)tv.tv_usec * 1e-6;
}
-
-main ()
+int main (int argc, char **argv)
{
static REAL aa[200*200],a[200*201],b[200],x[200];
REAL cray,ops,total,norma,normx;
REAL resid,residn,eps,t1,tm2,epsn,x1,x2;
REAL mflops;
static int ipvt[200],n,i,j,ntimes,info,lda,ldaa;
- int Endit, pass, loop;
+ int pass, loop;
REAL overhead1, overhead2, time1, time2;
- FILE *outfile;
- char *compiler, *options, general[9][80] = {" "};
-
- outfile = fopen("Linpack.txt","a+");
- if (outfile == NULL)
- {
- printf ("Cannot open results file \n\n");
- printf("Press any key\n");
- Endit = getch();
- exit (0);
- }
+ char *compiler, *options;
/************************************************************************
* Enter details of compiler and options used *
@@ -350,10 +318,10 @@ main ()
(double)residn, (double)resid, (double)epsn,
(double)x1, (double)x2);
- fprintf(stderr,"Times are reported for matrices of order %5d\n",n);
- fprintf(stderr,"1 pass times for array with leading dimension of%5d\n\n",lda);
- fprintf(stderr," dgefa dgesl total Mflops unit");
- fprintf(stderr," ratio\n");
+ fprintf(stdout,"Times are reported for matrices of order %5d\n",n);
+ fprintf(stdout,"1 pass times for array with leading dimension of%5d\n\n",lda);
+ fprintf(stdout," dgefa dgesl total Mflops unit");
+ fprintf(stdout," ratio\n");
atime[2][0] = total;
if (total > 0.0)
@@ -374,7 +342,7 @@ main ()
* Calculate overhead of executing matgen procedure *
************************************************************************/
- fprintf (stderr,"\nCalculating matgen overhead\n");
+ fprintf (stdout,"\nCalculating matgen overhead\n");
pass = -20;
loop = NTIMES;
do
@@ -387,7 +355,7 @@ main ()
}
time2 = second();
overhead1 = (time2 - time1);
- fprintf (stderr,"%10d times %6.2f seconds\n", loop, overhead1);
+ fprintf (stdout,"%10d times %6.2f seconds\n", loop, overhead1);
if (overhead1 > 5.0)
{
pass = 0;
@@ -408,13 +376,13 @@ main ()
overhead1 = overhead1 / (double)loop;
- fprintf (stderr,"Overhead for 1 matgen %12.5f seconds\n\n", overhead1);
+ fprintf (stdout,"Overhead for 1 matgen %12.5f seconds\n\n", overhead1);
/************************************************************************
* Calculate matgen/dgefa passes for 5 seconds *
************************************************************************/
- fprintf (stderr,"Calculating matgen/dgefa passes for 5 seconds\n");
+ fprintf (stdout,"Calculating matgen/dgefa passes for 5 seconds\n");
pass = -20;
ntimes = NTIMES;
do
@@ -427,7 +395,7 @@ main ()
dgefa(a,lda,n,ipvt,&info );
}
time2 = second() - time1;
- fprintf (stderr,"%10d times %6.2f seconds\n", ntimes, time2);
+ fprintf (stdout,"%10d times %6.2f seconds\n", ntimes, time2);
if (time2 > 5.0)
{
pass = 0;
@@ -449,10 +417,10 @@ main ()
ntimes = 5.0 * (double)ntimes / time2;
if (ntimes == 0) ntimes = 1;
- fprintf (stderr,"Passes used %10d \n\n", ntimes);
- fprintf(stderr,"Times for array with leading dimension of%4d\n\n",lda);
- fprintf(stderr," dgefa dgesl total Mflops unit");
- fprintf(stderr," ratio\n");
+ fprintf (stdout,"Passes used %10d \n\n", ntimes);
+ fprintf(stdout,"Times for array with leading dimension of%4d\n\n",lda);
+ fprintf(stdout," dgefa dgesl total Mflops unit");
+ fprintf(stdout," ratio\n");
/************************************************************************
* Execute 5 passes *
@@ -492,10 +460,10 @@ main ()
print_time(j);
}
atime[3][6] = atime[3][6] / 5.0;
- fprintf (stderr,"Average %11.2f\n",
+ fprintf (stdout,"Average %11.2f\n",
(double)atime[3][6]);
- fprintf (stderr,"\nCalculating matgen2 overhead\n");
+ fprintf (stdout,"\nCalculating matgen2 overhead\n");
/************************************************************************
* Calculate overhead of executing matgen procedure *
@@ -510,10 +478,10 @@ main ()
overhead2 = (time2 - time1);
overhead2 = overhead2 / (double)loop;
- fprintf (stderr,"Overhead for 1 matgen %12.5f seconds\n\n", overhead2);
- fprintf(stderr,"Times for array with leading dimension of%4d\n\n",ldaa);
- fprintf(stderr," dgefa dgesl total Mflops unit");
- fprintf(stderr," ratio\n");
+ fprintf (stdout,"Overhead for 1 matgen %12.5f seconds\n\n", overhead2);
+ fprintf(stdout,"Times for array with leading dimension of%4d\n\n",ldaa);
+ fprintf(stdout," dgefa dgesl total Mflops unit");
+ fprintf(stdout," ratio\n");
/************************************************************************
* Execute 5 passes *
@@ -553,7 +521,7 @@ main ()
print_time(j);
}
atime[3][12] = atime[3][12] / 5.0;
- fprintf (stderr,"Average %11.2f\n",
+ fprintf (stdout,"Average %11.2f\n",
(double)atime[3][12]);
/************************************************************************
@@ -563,109 +531,16 @@ main ()
mflops = atime[3][6];
if (atime[3][12] < mflops) mflops = atime[3][12];
- fprintf(stderr,"\n");
- fprintf(stderr,ROLLING);fprintf(stderr,PREC);
- fprintf(stderr," Precision %11.2f Mflops \n\n",mflops);
-
- what_date();
-
-/************************************************************************
- * Type details of hardware, software etc. *
- ************************************************************************/
-
- printf ("Enter the following data which will be "
- "appended to file Linpack.txt \n\n");
- printf ("PC Supplier/model ?\n ");
- scanf ("%[^\n]", general[1]);
- fflush (stdin);
- printf ("CPU ?\n ");
- scanf ("%[^\n]", general[2]);
- fflush (stdin);
- printf ("Clock MHz ?\n ");
- scanf ("%[^\n]", general[3]);
- fflush (stdin);
- printf ("Cache ?\n ");
- scanf ("%[^\n]", general[4]);
- fflush (stdin);
- printf ("Chipset/options ?\n ");
- scanf ("%[^\n]", general[5]);
- fflush (stdin);
- printf ("OS/DOS version ?\n ");
- scanf ("%[^\n]", general[6]);
- fflush (stdin);
- printf ("Your name ?\n ");
- scanf ("%[^\n]", general[7]);
- fflush (stdin);
- printf ("Where from ?\n ");
- scanf ("%[^\n]", general[8]);
- fflush (stdin);
- printf ("Mail address ?\n ");
- scanf ("%[^\n]", general[0]);
- fflush (stdin);
-
-/************************************************************************
- * Add results to output file LLloops.txt *
- ************************************************************************/
-
- fprintf (outfile, "----------------- ----------------- --------- "
- "--------- ---------\n");
- fprintf (outfile, "LINPACK BENCHMARK FOR PCs 'C/C++' n @ 100\n\n");
- fprintf (outfile, "Month run %d/%d\n", this_month, this_year);
- fprintf (outfile, "PC model %s\n", general[1]);
- fprintf (outfile, "CPU %s\n", general[2]);
- fprintf (outfile, "Clock MHz %s\n", general[3]);
- fprintf (outfile, "Cache %s\n", general[4]);
- fprintf (outfile, "Options %s\n", general[5]);
- fprintf (outfile, "OS/DOS %s\n", general[6]);
- fprintf (outfile, "Compiler %s\n", compiler);
- fprintf (outfile, "OptLevel %s\n", options);
- fprintf (outfile, "Run by %s\n", general[7]);
- fprintf (outfile, "From %s\n", general[8]);
- fprintf (outfile, "Mail %s\n\n", general[0]);
-
- fprintf(outfile, "Rolling %s\n",ROLLING);
- fprintf(outfile, "Precision %s\n",PREC);
- fprintf(outfile, "norm. resid %16.1f\n",(double)residn);
- fprintf(outfile, "resid %16.8e\n",(double)resid);
- fprintf(outfile, "machep %16.8e\n",(double)epsn);
- fprintf(outfile, "x[0]-1 %16.8e\n",(double)x1);
- fprintf(outfile, "x[n-1]-1 %16.8e\n",(double)x2);
- fprintf(outfile, "matgen 1 seconds %16.5f\n",overhead1);
- fprintf(outfile, "matgen 2 seconds %16.5f\n",overhead2);
- fprintf(outfile, "Repetitions %16d\n",ntimes);
- fprintf(outfile, "Leading dimension %16d\n",lda);
- fprintf(outfile, " dgefa dgesl "
- " total Mflops\n");
- fprintf(outfile, "1 pass seconds %16.5f %9.5f %9.5f\n",
- atime[0][0], atime[1][0], atime[2][0]);
-
- for (i=1 ; i<6 ; i++)
- {
- fprintf(outfile, "Repeat seconds %16.5f %9.5f %9.5f %9.2f\n",
- atime[0][i], atime[1][i], atime[2][i], atime[3][i]);
- }
- fprintf(outfile, "Average %46.2f\n",atime[3][6]);
-
- fprintf(outfile, "Leading dimension %16d\n",ldaa);
-
- for (i=7 ; i<12 ; i++)
- {
- fprintf(outfile, "Repeat seconds %16.5f %9.5f %9.5f %9.2f\n",
- atime[0][i], atime[1][i], atime[2][i], atime[3][i]);
- }
- fprintf(outfile, "Average %46.2f\n\n",atime[3][12]);
-
- fclose (outfile);
-
- printf("\nPress any key\n");
- Endit = getch();
+ fprintf(stdout,"\n");
+ fprintf(stdout,ROLLING);fprintf(stdout,PREC);
+ fprintf(stdout," Precision %11.2f Mflops \n\n",mflops);
}
/*----------------------*/
void print_time (int row)
{
-fprintf(stderr,"%11.5f%11.5f%11.5f%11.2f%11.4f%11.4f\n", (double)atime[0][row],
+fprintf(stdout,"%11.5f%11.5f%11.5f%11.2f%11.4f%11.4f\n", (double)atime[0][row],
(double)atime[1][row], (double)atime[2][row], (double)atime[3][row],
(double)atime[4][row], (double)atime[5][row]);
return;
@@ -950,10 +825,7 @@ void daxpy(int n, REAL da, REAL dx[], int incx, REAL dy[], int incy)
*/
{
- int i,ix,iy,m,mp1;
-
- mp1 = 0;
- m = 0;
+ int i,ix,iy;
if(n <= 0) return;
if (da == ZERO) return;
@@ -1019,10 +891,7 @@ REAL ddot(int n, REAL dx[], int incx, REAL dy[], int incy)
{
REAL dtemp;
- int i,ix,iy,m,mp1;
-
- mp1 = 0;
- m = 0;
+ int i,ix,iy;
dtemp = ZERO;
@@ -1086,10 +955,7 @@ void dscal(int n, REAL da, REAL dx[], int incx)
*/
{
- int i,m,mp1,nincx;
-
- mp1 = 0;
- m = 0;
+ int i,nincx;
if(n <= 0)return;
if(incx != 1) {
@@ -1150,6 +1016,7 @@ int idamax(int n, REAL dx[], int incx)
if( n < 1 ) return(-1);
if(n ==1 ) return(0);
+ itemp = -1;
if(incx != 1) {
/* code for increment not equal to 1 */
diff --git a/testsuites/benchmarks/linpack/linpack.doc b/testsuites/benchmarks/linpack/linpack.doc
index af3805855e..35044a1d9c 100644
--- a/testsuites/benchmarks/linpack/linpack.doc
+++ b/testsuites/benchmarks/linpack/linpack.doc
@@ -4,8 +4,10 @@ test set name: linpack
directives:
- TBD
+ None, this benchmark program depends on the compiler, standard libraries, the
+ processor and the memory system. It is more or less independent of the
+ operating system, except some disturbance from the system clock service.
concepts:
- TBD
+ This is the linpack benchmark ported to RTEMS.
diff --git a/testsuites/benchmarks/linpack/linpack.scn b/testsuites/benchmarks/linpack/linpack.scn
index e69de29bb2..6d2b3fec97 100644
--- a/testsuites/benchmarks/linpack/linpack.scn
+++ b/testsuites/benchmarks/linpack/linpack.scn
@@ -0,0 +1,52 @@
+*** BEGIN OF TEST LINPACK ***
+Rolled Double Precision Linpack Benchmark - PC Version in 'C/C++'
+
+Compiler INSERT COMPILER NAME HERE
+Optimisation INSERT OPTIMISATION OPTIONS HERE
+
+norm resid resid machep x[0]-1 x[n-1]-1
+ 1.7 7.41628980e-14 2.22044605e-16 -1.49880108e-14 -1.89848137e-14
+
+Times are reported for matrices of order 100
+1 pass times for array with leading dimension of 201
+
+ dgefa dgesl total Mflops unit ratio
+ 0.93482 0.02799 0.96281 0.71 2.8043 17.1930
+
+Calculating matgen overhead
+ 10 times 0.78 seconds
+ 20 times 1.56 seconds
+ 40 times 3.13 seconds
+ 80 times 6.26 seconds
+Overhead for 1 matgen 0.07824 seconds
+
+Calculating matgen/dgefa passes for 5 seconds
+ 10 times 10.13 seconds
+Passes used 4
+
+Times for array with leading dimension of 201
+
+ dgefa dgesl total Mflops unit ratio
+ 0.93483 0.02794 0.96278 0.71 2.8042 17.1924
+ 0.93483 0.02791 0.96274 0.71 2.8041 17.1918
+ 0.93483 0.02791 0.96274 0.71 2.8041 17.1919
+ 0.93483 0.02791 0.96274 0.71 2.8041 17.1918
+ 0.93483 0.02791 0.96274 0.71 2.8041 17.1918
+Average 0.71
+
+Calculating matgen2 overhead
+Overhead for 1 matgen 0.07824 seconds
+
+Times for array with leading dimension of 200
+
+ dgefa dgesl total Mflops unit ratio
+ 0.93487 0.02791 0.96278 0.71 2.8042 17.1924
+ 0.93483 0.02791 0.96274 0.71 2.8041 17.1918
+ 0.93484 0.02791 0.96275 0.71 2.8041 17.1919
+ 0.93487 0.02791 0.96278 0.71 2.8042 17.1924
+ 0.93484 0.02791 0.96275 0.71 2.8041 17.1919
+Average 0.71
+
+Rolled Double Precision 0.71 Mflops
+
+*** END OF TEST LINPACK ***