diff options
author | Marcin Juszkiewicz <marcin.juszkiewicz@linaro.org> | 2012-05-21 16:54:27 +0200 |
---|---|---|
committer | Marcin Juszkiewicz <marcin.juszkiewicz@linaro.org> | 2012-05-21 16:56:32 +0200 |
commit | 669cc04bfc572cfa8c7c1fbdbc83bb4f2428b060 (patch) | |
tree | 487467ecbff69285e77dc55db6b74a0847e93c95 |
initial testing of gcc-linaro/cross/armhf - scimark and nbenchprecise-gcc-linaro-4.7-cross-armhfgcc-linaro-4.7-cross-armhf
-rw-r--r-- | Makefile | 52 | ||||
-rw-r--r-- | tarballs/gexpr.c | 359 | ||||
-rw-r--r-- | tarballs/gmpbench-0.2.tar.bz2 | bin | 0 -> 19992 bytes | |||
-rw-r--r-- | tarballs/nbench-byte-2.2.3.tar.gz | bin | 0 -> 111791 bytes | |||
-rw-r--r-- | tarballs/patches/nbench/01-use-clock_gettime.patch | 107 | ||||
-rw-r--r-- | tarballs/patches/nbench/series | 1 | ||||
-rw-r--r-- | tarballs/patches/scimark/01-use-clock_gettime.patch | 37 | ||||
-rw-r--r-- | tarballs/patches/scimark/series | 1 | ||||
-rw-r--r-- | tarballs/scimark2_1c.zip | bin | 0 -> 13792 bytes |
9 files changed, 557 insertions, 0 deletions
diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..ba5a9dc --- /dev/null +++ b/Makefile @@ -0,0 +1,52 @@ +#!/usr/bin/make -f + +stampdir = stamps/ + +info: + echo "run make all" + +all: $(stampdir)scimark $(stampdir)nbench + +$(stampdir)init: + install -d $(stampdir) + # first add required PPA + echo "deb http://ppa.launchpad.net/linaro-maintainers/staging-overlay/ubuntu precise main" >>/etc/apt/sources.list + + # then enable armhf support + echo "foreign-architecture armhf" >>/etc/dpkg/dpkg.cfg.d/multiarch + echo "deb [arch=armhf] http://ports.ubuntu.com/ precise main universe" >>/etc/apt/sources.list + + # then enable sources + echo "deb-src http://archive.ubuntu.com/ubuntu/ precise main universe" >>/etc/apt/sources.list + + apt-get install -y --force-yes unzip quilt + touch $@ + +$(stampdir)install-cross-compiler: $(stampdir)init + # update APT cache + apt-get update || true + + # then install cross compiler + apt-get install gcc-linaro-arm-linux-gnueabihf libgmp-dev:armhf -y --force-yes + touch $@ + +$(stampdir)nbench: $(stampdir)install-cross-compiler + tar xf tarballs/nbench-byte-2.2.3.tar.gz + cd nbench-byte-2.2.3/; \ + QUILT_PATCHES=../tarballs/patches/nbench quilt push -a; \ + PATH=/usr/lib/gcc-linaro-cross/bin/:$$PATH make CC=arm-linux-gnueabihf-gcc && \ + touch ../$@ + +$(stampdir)gmpbench: $(stampdir)install-cross-compiler + tar xf tarballs/gmpbench-0.2.tar.bz2 + pushd gmpbench-0.2/ + CC=arm-linux-gnueabihf-gcc sh compile.sh + touch ../$@ + + +$(stampdir)scimark: $(stampdir)install-cross-compiler + install -d scimark + cd scimark && unzip ../tarballs/scimark2_1c.zip ;\ + QUILT_PATCHES=../tarballs/patches/scimark quilt push -a; \ + PATH=/usr/lib/gcc-linaro-cross/bin/:$$PATH make CC=arm-linux-gnueabihf-gcc && \ + touch ../$@ diff --git a/tarballs/gexpr.c b/tarballs/gexpr.c new file mode 100644 index 0000000..1218bc1 --- /dev/null +++ b/tarballs/gexpr.c @@ -0,0 +1,359 @@ +/* Expression evaluation using plain floating-point arithmetic. + Copyright 1999, 2000, 2001, 2002, 2003, 2006 Free Software Foundation, Inc. + +This program is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free Software +Foundation; either version 2, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +PARTICULAR PURPOSE. See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along with +this program; see the file COPYING. If not, write to the Free Software +Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ + +#include <math.h> +#include <ctype.h> +#include <setjmp.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + +jmp_buf top; + +static char *bp, *expr_start_p, *expr_end_p; +static int ch; +static int previous_result_valid_flag; +double previous_result; + +double term (void), expo (void), factor (void), number (void); + +#define next skip () + +void +skip (void) +{ + do + ch = *bp++; + while (ch == ' ' || ch == '\n'); +} + +void +error (void) +{ + fprintf (stderr, "%s\n", expr_start_p); + fprintf (stderr, "%*s^ syntax error\n", (int) (bp - expr_start_p) - 1, ""); + longjmp (top, 1); +} + +double +expr (void) +{ + double e; + if (ch == '+') + { + next; + e = term (); + } + else if (ch == '-') + { + next; + e = - term (); + } + else + e = term (); + while (ch == '+' || ch == '-') + { char op; + op = ch; + next; + if (op == '-') + e -= term (); + else + e += term (); + } + return e; +} + +double +term (void) +{ + double t; + t = expo (); + for (;;) + switch (ch) + { + case '*': + next; + t *= expo (); + break; + case '/': + next; + t /= expo (); + break; + case '%': + next; + t = fmod (t, expo ()); + break; + default: + return t; + } +} + +double +expo (void) +{ + double e; + e = factor (); + if (ch == '^') + { + next; + e = pow (e, expo ()); + } + return e; +} + +struct functions +{ + char *spelling; + double (* evalfn) (); +}; + +double +my_log2 (double x) +{ + return log (x) * 1.4426950408889634073599246810019; +} + +struct functions fns[] = +{ + {"log2", my_log2}, + {"log10", log10}, + {"log", log}, + {"exp", exp}, + {"sqrt", sqrt}, + {"floor", floor}, + {"ceil", ceil}, + {"sin", sin}, + {"cos", cos}, + {"tan", tan}, + {"asin", asin}, + {"acos", acos}, + {"atan", atan}, + {"sinh", sinh}, + {"cosh", cosh}, + {"tanh", tanh}, + {"asinh", asinh}, + {"acosh", acosh}, + {"atanh", atanh}, + {0, 0} +}; + + +double +factor (void) +{ + double f; + int i; + + for (i = 0; fns[i].spelling != 0; i++) + { + char *spelling = fns[i].spelling; + int len = strlen (spelling); + if (strncmp (spelling, bp - 1, len) == 0 && ! isalnum (bp[-1 + len])) + { + bp += len - 1; + next; + if (ch != '(') + error (); + next; + f = expr (); + if (ch != ')') + error (); + next; + return (fns[i].evalfn) (f); + } + } + + if (ch == '(') + { + next; + f = expr (); + if (ch == ')') + next; + else + error (); + } + else + f = number (); + if (ch == '!') + { + unsigned long n; + if (floor (f) != f) + error (); + for (n = f, f = 1; n > 1; n--) + f *= n; + next; + } + return f; +} + +double +number (void) +{ + double n; + char *endp; + + if (strncmp ("pi", bp - 1, 2) == 0 && ! isalnum (bp[1])) + { + bp += 2 - 1; + next; + return 3.1415926535897932384626433832795; + } + if (ch == '$') + { + if (! previous_result_valid_flag) + error (); + next; + return previous_result; + } + if (ch != '.' && (ch < '0' || ch > '9')) + error (); + n = strtod (bp - 1, &endp); + if (endp == bp - 1) + error (); + bp = endp; + next; + return n; +} + +int nl_flag = 1; +int hhmm_flag = 0; +int dhhmm_flag = 0; +int round_flag = 0; +int prec = 5; + +void +output (double exp) +{ + int h, m; + if (hhmm_flag) + { + m = exp * 60; + h = m / 60; + m -= h * 60; + printf ("%02d:%02d", h, m); + } + else if (dhhmm_flag) + { + int d; + m = exp * (24 * 60); + d = m / (24 * 60); + m -= d * (24 * 60); + h = m / 60; + m -= h * 60; + printf ("%dd %02d:%02d", d, h, m); + } + else + printf ("%.*g", prec, exp); + if (nl_flag) + puts (""); + previous_result = exp; + previous_result_valid_flag = 1; +} + +int +main (int argc, char **argv) +{ + while (argc >= 2) + { + if (!strcmp (argv[1], "-n")) + { + nl_flag = 0; + argv++; + argc--; + } + else if (!strcmp (argv[1], "-hhmm")) + { + hhmm_flag = 1; + argv++; + argc--; + } + else if (!strcmp (argv[1], "-dhhmm")) + { + dhhmm_flag = 1; + argv++; + argc--; + } + else if (!strcmp (argv[1], "-round")) + { + round_flag = 1; + argv++; + argc--; + } + else if (!strcmp (argv[1], "-prec")) + { + prec = atoi (argv[2]); + argv += 2; + argc -= 2; + } + else if (!strcmp (argv[1], "-help") || !strcmp (argv[1], "-h")) + { + printf ("usage: %s [options] expr [expr ... ]\n", argv[0]); + printf (" options: -n -- suppress newline\n"); + printf (" -prec n -- print n digits\n"); + printf (" -round -- round to nearest integer\n"); + printf (" -hhmm -- print in base 60 (time format)\n"); + printf (" -dhhmm -- print in base 24,60,60 (time format)\n"); + printf (" -help -- you've figured out that one\n"); + exit (0); + } + else + break; + } + + if (argc >= 2) + { + int i; + double exp; + + for (i = 1; i < argc; i++) + { + expr_start_p = argv[i]; + expr_end_p = expr_end_p + strlen (expr_start_p); + bp = expr_start_p; + next; + if (setjmp (top) == 0) + { + exp = expr (); + if (round_flag) + exp = floor (exp + 0.5); + output (exp); + } + } + } + else + { +#define BUFSIZE 1024 + char buf[BUFSIZE]; + double exp; + + for (;;) + { + fputs ("eval> ", stdout); + bp = fgets (buf, BUFSIZE, stdin); + if (bp == NULL) + break; + next; + if (setjmp (top) == 0) + { + exp = expr (); + if (round_flag) + exp = floor (exp + 0.5); + output (exp); + } + } + } + + exit (0); +} diff --git a/tarballs/gmpbench-0.2.tar.bz2 b/tarballs/gmpbench-0.2.tar.bz2 Binary files differnew file mode 100644 index 0000000..f3e7d01 --- /dev/null +++ b/tarballs/gmpbench-0.2.tar.bz2 diff --git a/tarballs/nbench-byte-2.2.3.tar.gz b/tarballs/nbench-byte-2.2.3.tar.gz Binary files differnew file mode 100644 index 0000000..5d99959 --- /dev/null +++ b/tarballs/nbench-byte-2.2.3.tar.gz diff --git a/tarballs/patches/nbench/01-use-clock_gettime.patch b/tarballs/patches/nbench/01-use-clock_gettime.patch new file mode 100644 index 0000000..91a38e9 --- /dev/null +++ b/tarballs/patches/nbench/01-use-clock_gettime.patch @@ -0,0 +1,107 @@ +Only in nbench-byte-2.2.3: emfloat.o +Only in nbench-byte-2.2.3: hardware.o +--- + Makefile | 2 +- + sysspec.c | 17 +++++++++++++---- + 2 files changed, 14 insertions(+), 5 deletions(-) + +--- nbench-byte-2.2.3.orig/Makefile ++++ nbench-byte-2.2.3/Makefile +@@ -139,11 +139,11 @@ sysspec.o: sysspec.h sysspec.c nmglobal. + -c sysspec.c + + nbench: emfloat.o misc.o nbench0.o nbench1.o sysspec.o hardware.o + $(CC) $(MACHINE) $(DEFINES) $(CFLAGS) $(LINKFLAGS)\ + emfloat.o misc.o nbench0.o nbench1.o sysspec.o hardware.o\ +- -o nbench -lm ++ -o nbench -lm -lrt + + ########################################################################## + + clean: + - /bin/rm -f *.o *~ \#* core a.out hello sysinfo.c sysinfoc.c \ +--- nbench-byte-2.2.3.orig/sysspec.c ++++ nbench-byte-2.2.3/sysspec.c +@@ -33,10 +33,11 @@ + ** system-specific. If the benchmarks are to be ported + ** to new hardware/new O.S., this is the first place to + ** start. + */ + #include "sysspec.h" ++#include <time.h> + + #ifdef DOS16 + #include <io.h> + #include <fcntl.h> + #include <sys\stat.h> +@@ -772,10 +773,18 @@ exit(1); + + /***************************** + ** STOPWATCH ROUTINES ** + *****************************/ + ++static unsigned long now() ++{ ++ struct timespec time; ++ clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &time); ++ ++ return time.tv_sec*1000000 + time.tv_nsec/1000; ++} ++ + /**************************** + ** StartStopwatch + ** Starts a software stopwatch. Returns the first value of + ** the stopwatch in ticks. + */ +@@ -795,11 +804,11 @@ return((unsigned long)1); + ** Win 3.x timer returns a DWORD, which we coax into a long. + */ + _Call16(lpfn,"p",&win31tinfo); + return((unsigned long)win31tinfo.dwmsSinceStart); + #else +-return((unsigned long)clock()); ++return now(); + #endif + #endif + } + + /**************************** +@@ -819,11 +828,11 @@ return((unsigned long)(MacHSTdelay+myTMT + #else + #ifdef WIN31TIMER + _Call16(lpfn,"p",&win31tinfo); + return((unsigned long)win31tinfo.dwmsSinceStart-startticks); + #else +-return((unsigned long)clock()-startticks); ++return(now()-startticks); + #endif + #endif + } + + /**************************** +@@ -842,11 +851,11 @@ return((unsigned long)(tickamount/CLK_TC + return((unsigned long)(tickamount/1000000)); + #endif + + #ifdef CLOCKWCPS + /* Everybody else */ +-return((unsigned long)(tickamount/CLOCKS_PER_SEC)); ++return(tickamount/1000000); + #endif + + #ifdef WIN31TIMER + /* Each tick is 840 nanoseconds */ + return((unsigned long)(tickamount/1000L)); +@@ -871,11 +880,11 @@ return((double)tickamount/(double)CLK_TC + return((double)tickamount/(double)1000000); + #endif + + #ifdef CLOCKWCPS + /* Everybody else */ +-return((double)tickamount/(double)CLOCKS_PER_SEC); ++return((double)tickamount*1e-6); + #endif + + #ifdef WIN31TIMER + /* Using 840 nanosecond ticks */ + return((double)tickamount/(double)1000); diff --git a/tarballs/patches/nbench/series b/tarballs/patches/nbench/series new file mode 100644 index 0000000..a29bd27 --- /dev/null +++ b/tarballs/patches/nbench/series @@ -0,0 +1 @@ +01-use-clock_gettime.patch diff --git a/tarballs/patches/scimark/01-use-clock_gettime.patch b/tarballs/patches/scimark/01-use-clock_gettime.patch new file mode 100644 index 0000000..4dfdc72 --- /dev/null +++ b/tarballs/patches/scimark/01-use-clock_gettime.patch @@ -0,0 +1,37 @@ +--- + Makefile | 2 +- + Stopwatch.c | 6 +++++- + 2 files changed, 6 insertions(+), 2 deletions(-) + +--- scimark.orig/Makefile ++++ scimark/Makefile +@@ -10,9 +10,9 @@ LDFLAGS = + + OBJS = FFT.o kernel.o Stopwatch.o Random.o SOR.o SparseCompRow.o \ + array.o MonteCarlo.o LU.o + + scimark2 : scimark2.o $(OBJS) +- $(CC) $(CFLAGS) -o scimark2 scimark2.o $(OBJS) $(LDFLAGS) -lm ++ $(CC) $(CFLAGS) -o scimark2 scimark2.o $(OBJS) $(LDFLAGS) -lm -lrt + + clean: + rm $(OBJS) scimark2 +--- scimark.orig/Stopwatch.c ++++ scimark/Stopwatch.c +@@ -1,11 +1,15 @@ + #include <stdlib.h> ++#include <time.h> + #include "Stopwatch.h" + + double seconds() + { +- return ((double) clock()) / (double) CLOCKS_PER_SEC; ++ struct timespec now; ++ clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &now); ++ ++ return now.tv_sec + now.tv_nsec*1e-9; + } + + void Stopwtach_reset(Stopwatch Q) + { + Q->running = 0; /* false */ diff --git a/tarballs/patches/scimark/series b/tarballs/patches/scimark/series new file mode 100644 index 0000000..a29bd27 --- /dev/null +++ b/tarballs/patches/scimark/series @@ -0,0 +1 @@ +01-use-clock_gettime.patch diff --git a/tarballs/scimark2_1c.zip b/tarballs/scimark2_1c.zip Binary files differnew file mode 100644 index 0000000..6097d53 --- /dev/null +++ b/tarballs/scimark2_1c.zip |