From bad569a3f83e5870f1274d62e0980a360853c321 Mon Sep 17 00:00:00 2001 From: Harshil Patel Date: Sun, 3 Dec 2023 13:23:46 -0800 Subject: [PATCH] misc: update x86-npb-benchmarks.py to use suites (#587) - updated the x86-npb-benchmarks.py to use npb workloads and suites. The suites and workloads are not in the database are also waiting feedback. I am attaching the JSON file here. [npb_workloads_suite.json](https://github.com/gem5/gem5/files/13431116/npb_workloads_suite.json) To run the x86-npb-benchmarks.py script use the GEM5_RESOURCE_JSON_APPEND env variable. The full command is: ``` GEM5_RESOURCE_JSON_APPEND=[path to npb_workloads_suite.json] ./build/X86/gem5.opt configs/example/gem5_library/x86-npb-benchmarks.py --benchmark [benchmark] ``` Change-Id: I248e6452ea4122e9260e34e4368847660edae577 --- .../gem5_library/x86-npb-benchmarks.py | 40 ++++--------------- 1 file changed, 7 insertions(+), 33 deletions(-) diff --git a/configs/example/gem5_library/x86-npb-benchmarks.py b/configs/example/gem5_library/x86-npb-benchmarks.py index c78c6102aa..6e6d501c37 100644 --- a/configs/example/gem5_library/x86-npb-benchmarks.py +++ b/configs/example/gem5_library/x86-npb-benchmarks.py @@ -76,8 +76,6 @@ requires( # Following are the list of benchmark programs for npb. -benchmark_choices = ["bt", "cg", "ep", "ft", "is", "lu", "mg", "sp"] - # We are restricting classes of NPB to A, B and C as the other classes (D and # F) require main memory size of more than 3 GB. The X86Board is currently # limited to 3 GB of memory. This limitation is explained later in line 136. @@ -86,12 +84,11 @@ benchmark_choices = ["bt", "cg", "ep", "ft", "is", "lu", "mg", "sp"] # works with class D in the current configuration. More information on the # memory footprint for NPB is available at https://arxiv.org/abs/2010.13216 -size_choices = ["A", "B", "C"] - parser = argparse.ArgumentParser( description="An example configuration script to run the npb benchmarks." ) +npb_suite = obtain_resource("npb-benchmark-suite") # The only positional argument accepted is the benchmark name in this script. parser.add_argument( @@ -99,15 +96,7 @@ parser.add_argument( type=str, required=True, help="Input the benchmark program to execute.", - choices=benchmark_choices, -) - -parser.add_argument( - "--size", - type=str, - required=True, - help="Input the class of the program to simulate.", - choices=size_choices, + choices=[workload.get_id() for workload in npb_suite], ) parser.add_argument( @@ -119,11 +108,12 @@ parser.add_argument( args = parser.parse_args() + # The simulation may fail in the case of `mg` with class C as it uses 3.3 GB -# of memory (more information is availabe at https://arxiv.org/abs/2010.13216). +# of memory (more information is available at https://arxiv.org/abs/2010.13216). # We warn the user here. -if args.benchmark == "mg" and args.size == "C": +if args.benchmark == "npb-mg-c": warn( "mg.C uses 3.3 GB of memory. Currently we are simulating 3 GB\ of main memory in the system." @@ -131,7 +121,7 @@ if args.benchmark == "mg" and args.size == "C": # The simulation will fail in the case of `ft` with class C. We warn the user # here. -elif args.benchmark == "ft" and args.size == "C": +elif args.benchmark == "npb-ft-c": warn( "There is not enough memory for ft.C. Currently we are\ simulating 3 GB of main memory in the system." @@ -194,23 +184,7 @@ board = X86Board( # Also, we sleep the system for some time so that the output is printed # properly. - -command = ( - f"/home/gem5/NPB3.3-OMP/bin/{args.benchmark}.{args.size}.x;" - + "sleep 5;" - + "m5 exit;" -) - -board.set_kernel_disk_workload( - # The x86 linux kernel will be automatically downloaded to the - # `~/.cache/gem5` directory if not already present. - # npb benchamarks was tested with kernel version 4.19.83 - kernel=obtain_resource("x86-linux-kernel-4.19.83"), - # The x86-npb image will be automatically downloaded to the - # `~/.cache/gem5` directory if not already present. - disk_image=obtain_resource("x86-npb"), - readfile_contents=command, -) +board.set_workload(obtain_resource(args.benchmark)) # The first exit_event ends with a `workbegin` cause. This means that the