text
stringlengths
0
234
Set_Memory(bp.all, mem);
end loop;
loop
for i in reverse first .. last loop
bp := runner.benchmarks.Element(i);
Reset(bp.all, i);
begin
Run(bp.all);
exception
when Prune_Error =>
null;
Function Definition: procedure MemSim is
Function Body: mem : Memory_Pointer := null;
runner : Runner_Type;
arg : Positive := 1;
type Benchmark_Constructor_Type is
access function return Benchmark.Benchmark_Pointer;
type Benchmark_Info_Type is record
name : Unbounded_String;
usage : Unbounded_String;
constructor : Benchmark_Constructor_Type;
end record;
type Benchmark_Info_Array is array(Natural range <>) of Benchmark_Info_Type;
function BM_Entry(name : String;
usage : String;
constructor : Benchmark_Constructor_Type)
return Benchmark_Info_Type is
begin
return Benchmark_Info_Type'(To_Unbounded_String(name),
To_Unbounded_String(usage),
constructor);
end BM_Entry;
benchmark_map : constant Benchmark_Info_Array := (
BM_Entry("cholesky",
"[size=256][iterations=1][spacing=0]",
Benchmark.Matrix.Cholesky.Create_Cholesky'Access),
BM_Entry("hash",
"[size=1024][iterations=1000][spacing=0][seed=15]",
Benchmark.Hash.Create_Hash'Access),
BM_Entry("heap",
"[size=1024][spacing=0][seed=15]",
Benchmark.Heap.Create_Heap'Access),
BM_Entry("lu",
"[size=256][iterations=1][spacing=0]",
Benchmark.Matrix.LU.Create_LU'Access),
BM_Entry("mm",
"[size=256][iterations=1][spacing=0][seed=15]",
Benchmark.Matrix.MM.Create_MM'Access),
BM_Entry("qsort",
"[size=1024][iterations=1][spacing=0][seed=15]",
Benchmark.QSort.Create_QSort'Access),
BM_Entry("stride",
"[size=1024][iterations=1000][stride=1][spacing=0]",
Benchmark.Stride.Create_Stride'Access),
BM_Entry("trace",
"[file=trace.txt][spacing=0]",
Benchmark.Trace.Create_Trace'Access),
BM_Entry("tree",
"[size=1024][iterations=10000][spacing=0]",
Benchmark.Tree.Create_Tree'Access)
);
procedure Show_Usage is
begin
Put_Line("usage: " & Command_Name & " [options] " &
"<memory> {<benchmark> [<options>]}");
Put_Line("options:");
Put_Line(" -addr_bits <n> Number of address bits");
Put_Line(" -device <d> Device type (asic, virtex6, ...)");
Put_Line("benchmarks:");
for i in benchmark_map'First .. benchmark_map'Last loop
Put_Line(" " & To_String(benchmark_map(i).name & " " &
To_String(benchmark_map(i).usage)));
end loop;
Put_Line(" show");
end Show_Usage;
begin
-- Run the tests if requested.
if Argument_Count = 1 and then Argument(1) = "test" then
Test.Run_Tests;
return;
end if;
-- Parse options.
Parse_Options: while arg < Argument_Count loop
begin
if Argument(arg) = "-addr_bits" then
Device.Set_Address_Bits(Positive'Value(Argument(arg + 1)));
arg := arg + 2;
elsif Argument(arg) = "-device" then
Device.Set_Device(Argument(arg + 1));
arg := arg + 2;