* Minor changes.

git-svn-id: trunk@7580 -
This commit is contained in:
daniel 2007-06-05 07:53:55 +00:00
parent 023be72367
commit d6e6e39d16

View File

@ -1,6 +1,12 @@
program stream; program stream;
{$ifdef unix}
uses baseunix,unix; uses baseunix,unix;
{$endif}
{$ifdef windows}
uses windows;
{$endif}
{-----------------------------------------------------------------------} {-----------------------------------------------------------------------}
{ Original code developed by John D. McCalpin } { Original code developed by John D. McCalpin }
@ -79,11 +85,11 @@ const N = 2000000;
const HLINE = '-------------------------------------------------------------'; const HLINE = '-------------------------------------------------------------';
const inf = 1/0; inf = 1/0;
var a,b,c:array[0..N+OFFSET-1] of double; var a,b,c:array[0..N+OFFSET-1] of double;
var avgtime:array[0..3] of double = (0,0,0,0); avgtime:array[0..3] of double = (0,0,0,0);
maxtime:array[0..3] of double = (0,0,0,0); maxtime:array[0..3] of double = (0,0,0,0);
mintime:array[0..3] of double = (inf,inf,inf,inf); mintime:array[0..3] of double = (inf,inf,inf,inf);
@ -99,13 +105,6 @@ var avgtime:array[0..3] of double = (0,0,0,0);
3 * sizeof(double) * N 3 * sizeof(double) * N
); );
{$ifdef TUNED}
procedure tuned_STREAM_Copy;external;
procedure tuned_STREAM_Scale(double scalar);external
procedure void tuned_STREAM_Add();external;
procedure tuned_STREAM_Triad(double scalar);external;
{$endif}
const M=20; const M=20;
function min(a,b:longint):longint;inline; function min(a,b:longint):longint;inline;
@ -144,6 +143,44 @@ begin
max:=b; max:=b;
end; end;
procedure tuned_STREAM_Copy;
var j:longint;
begin
for j:=0 to N-1 do
c[j]:=a[j];
end;
procedure tuned_STREAM_Scale(scalar:double);
var j:longint;
begin
for j:=0 to N-1 do
b[j]:=scalar*c[j];
end;
procedure tuned_STREAM_Add;
var j:longint;
begin
for j:=0 to N-1 do
c[j]:=a[j]+b[j];
end;
procedure tuned_STREAM_Triad(scalar:double);
var j:longint;
begin
for j:=0 to N-1 do
a[j]:=b[j]+scalar*c[j];
end;
{$ifdef unix}
{$define have_mysecond}
function mysecond:double; function mysecond:double;
var tp:timeval; var tp:timeval;
@ -153,6 +190,20 @@ begin
fpgettimeofday(@tp,@tzp); fpgettimeofday(@tp,@tzp);
mysecond:=double(tp.tv_sec)+double(tp.tv_usec)*1e-6; mysecond:=double(tp.tv_sec)+double(tp.tv_usec)*1e-6;
end; end;
{$endif}
{$ifdef windows}
{$define have_mysecond}
function mysecond:double;
begin
mysecond:=gettickcount*1e-3;
end;
{$endif}
{$ifndef have_mysecond}
{$error Please implement a mysecond for your platform.}
{$endif}
function checktick:longint; function checktick:longint;
@ -263,7 +314,7 @@ var quantum:longint;
begin begin
{ --- SETUP --- determine precision and check timing --- } { --- SETUP --- determine precision and check timing --- }
writeln(HLINE); writeln(HLINE);
writeln('STREAM version $Revision: 5.6 $\n'); writeln('STREAM version Revision: 5.6');
writeln(HLINE); writeln(HLINE);
BytesPerWord:=sizeof(double); BytesPerWord:=sizeof(double);
writeln('This system uses ',BytesPerWord,' bytes per DOUBLE PRECISION word.'); writeln('This system uses ',BytesPerWord,' bytes per DOUBLE PRECISION word.');
@ -272,7 +323,7 @@ begin
writeln('Array size = ',N,', Offset = ',OFFSET); writeln('Array size = ',N,', Offset = ',OFFSET);
writeln('Total memory required = ',3*BytesPerWord*(N/1048576),' MB.'); writeln('Total memory required = ',3*BytesPerWord*(N/1048576),' MB.');
writeln('Each test is run ',NTIMES,' times, but only'); writeln('Each test is run ',NTIMES,' times, but only');
writeln('the *best* time for each is used.\n'); writeln('the *best* time for each is used.');
writeln(HLINE); writeln(HLINE);
writeln('writelning one line per active thread....'); writeln('writelning one line per active thread....');
@ -366,7 +417,7 @@ begin
for j:=0 to 3 do for j:=0 to 3 do
begin begin
avgtime[j]:=avgtime[j]/(NTIMES-1); avgtime[j]:=avgtime[j]/(NTIMES-1);
writeln(labels[j], writeln(labels[j]:11,
1E-6*bytes[j]/mintime[j]:11:4, 1E-6*bytes[j]/mintime[j]:11:4,
avgtime[j]:11:4, avgtime[j]:11:4,
mintime[j]:11:4, mintime[j]:11:4,
@ -375,6 +426,6 @@ begin
writeln(HLINE); writeln(HLINE);
{ --- Check Results --- } { --- Check Results --- }
checkSTREAMresults(); checkSTREAMresults;
writeln(HLINE); writeln(HLINE);
end. end.