stdlib,configs,tests: Remove deprecated Resource classes usage (#102)
* stdlib,configs,tests: Remove `Resource` class use This class is deprecated, but was still used in various example configuration scriots and tests. This patch replaces it with the `obtain_resource` function. Change-Id: I0c89bf17783ccaaafc18072aaeefb5d1e207bc55 * configs: Remove `CustomDiskImageResource` use The class is deprecated but was still used in the SPEC example scripts. This patch replaces it with the `DiskImageResource` class. Change-Id: Ie0697fe59a3d737b05eb45ff3bc964f42b0387e0 * configs,tests: Remove `CustomResource` use This class is deprecated but was still used in example scripts and mentioned, incorrectly, in comments in the pyunit tests. This patch removes these. Change-Id: Icb6d02f47a5b72cd58551e5dcd59cc72d6a91a01 * stdlib: Remove '\' in Workload docstring example This example shows how to use the Workload. The backslash is not correct Python and would fail if used in this way. Co-authored-by: Jason Lowe-Power <jason@lowepower.com> --------- Co-authored-by: Jason Lowe-Power <jason@lowepower.com>
This commit is contained in:
@@ -43,7 +43,7 @@ scons build/ARM/gem5.opt
|
||||
|
||||
from gem5.isas import ISA
|
||||
from gem5.utils.requires import requires
|
||||
from gem5.resources.resource import Resource
|
||||
from gem5.resources.resource import obtain_resource
|
||||
from gem5.components.memory import SingleChannelDDR3_1600
|
||||
from gem5.components.processors.cpu_types import CPUTypes
|
||||
from gem5.components.boards.simple_board import SimpleBoard
|
||||
@@ -84,7 +84,7 @@ board.set_se_binary_workload(
|
||||
# Any resource specified in this file will be automatically retrieved.
|
||||
# At the time of writing, this file is a WIP and does not contain all
|
||||
# resources. Jira ticket: https://gem5.atlassian.net/browse/GEM5-1096
|
||||
Resource("arm-hello64-static")
|
||||
obtain_resource("arm-hello64-static")
|
||||
)
|
||||
|
||||
# Lastly we run the simulation.
|
||||
|
||||
@@ -48,7 +48,7 @@ scons build/RISCV/gem5.opt
|
||||
|
||||
from gem5.isas import ISA
|
||||
from gem5.utils.requires import requires
|
||||
from gem5.resources.resource import Resource
|
||||
from gem5.resources.resource import obtain_resource
|
||||
from gem5.components.memory import SingleChannelDDR3_1600
|
||||
from gem5.components.processors.cpu_types import CPUTypes
|
||||
from gem5.components.boards.simple_board import SimpleBoard
|
||||
@@ -89,8 +89,8 @@ board = SimpleBoard(
|
||||
# configs/example/gem5_library/checkpoints/riscv-hello-save-checkpoint.py
|
||||
board.set_se_binary_workload(
|
||||
# the workload should be the same as the save-checkpoint script
|
||||
Resource("riscv-hello"),
|
||||
checkpoint=Resource("riscv-hello-example-checkpoint-v23"),
|
||||
obtain_resource("riscv-hello"),
|
||||
checkpoint=obtain_resource("riscv-hello-example-checkpoint-v23"),
|
||||
)
|
||||
|
||||
simulator = Simulator(
|
||||
|
||||
@@ -46,7 +46,7 @@ scons build/RISCV/gem5.opt
|
||||
import argparse
|
||||
from gem5.isas import ISA
|
||||
from gem5.utils.requires import requires
|
||||
from gem5.resources.resource import Resource
|
||||
from gem5.resources.resource import obtain_resource
|
||||
from gem5.components.memory import SingleChannelDDR3_1600
|
||||
from gem5.components.processors.cpu_types import CPUTypes
|
||||
from gem5.components.boards.simple_board import SimpleBoard
|
||||
@@ -101,7 +101,7 @@ board.set_se_binary_workload(
|
||||
# Any resource specified in this file will be automatically retrieved.
|
||||
# At the time of writing, this file is a WIP and does not contain all
|
||||
# resources. Jira ticket: https://gem5.atlassian.net/browse/GEM5-1096
|
||||
Resource("riscv-hello")
|
||||
obtain_resource("riscv-hello")
|
||||
)
|
||||
|
||||
# Lastly we run the simulation.
|
||||
|
||||
@@ -35,7 +35,7 @@ correctly. If this is not done correctly this script will run with error.
|
||||
|
||||
from gem5.isas import ISA
|
||||
from gem5.utils.requires import requires
|
||||
from gem5.resources.resource import Resource
|
||||
from gem5.resources.resource import obtain_resource
|
||||
from gem5.components.memory import DRAMSysDDR3_1600
|
||||
from gem5.components.processors.cpu_types import CPUTypes
|
||||
from gem5.components.boards.simple_board import SimpleBoard
|
||||
@@ -78,7 +78,7 @@ board.set_se_binary_workload(
|
||||
# Any resource specified in this file will be automatically retrieved.
|
||||
# At the time of writing, this file is a WIP and does not contain all
|
||||
# resources. Jira ticket: https://gem5.atlassian.net/browse/GEM5-1096
|
||||
Resource("arm-hello64-static")
|
||||
obtain_resource("arm-hello64-static")
|
||||
)
|
||||
|
||||
# Lastly we run the simulation.
|
||||
|
||||
@@ -43,7 +43,7 @@ scons build/POWER/gem5.opt
|
||||
|
||||
from gem5.isas import ISA
|
||||
from gem5.utils.requires import requires
|
||||
from gem5.resources.resource import Resource
|
||||
from gem5.resources.resource import obtain_resource
|
||||
from gem5.components.memory import SingleChannelDDR4_2400
|
||||
from gem5.components.processors.cpu_types import CPUTypes
|
||||
from gem5.components.boards.simple_board import SimpleBoard
|
||||
@@ -75,7 +75,7 @@ board = SimpleBoard(
|
||||
cache_hierarchy=cache_hierarchy,
|
||||
)
|
||||
|
||||
board.set_se_binary_workload(Resource("power-hello"))
|
||||
board.set_se_binary_workload(obtain_resource("power-hello"))
|
||||
|
||||
# Lastly we run the simulation.
|
||||
simulator = Simulator(board=board)
|
||||
|
||||
@@ -48,7 +48,7 @@ from gem5.components.cachehierarchies.classic.private_l1_private_l2_cache_hierar
|
||||
from gem5.components.processors.cpu_types import CPUTypes
|
||||
from gem5.isas import ISA
|
||||
from gem5.utils.requires import requires
|
||||
from gem5.resources.resource import Resource
|
||||
from gem5.resources.resource import obtain_resource
|
||||
from gem5.simulate.simulator import Simulator
|
||||
|
||||
# Run a check to ensure the right version of gem5 is being used.
|
||||
@@ -79,8 +79,8 @@ board = RiscvBoard(
|
||||
|
||||
# Set the Full System workload.
|
||||
board.set_kernel_disk_workload(
|
||||
kernel=Resource("riscv-bootloader-vmlinux-5.10"),
|
||||
disk_image=Resource("riscv-disk-img"),
|
||||
kernel=obtain_resource("riscv-bootloader-vmlinux-5.10"),
|
||||
disk_image=obtain_resource("riscv-disk-img"),
|
||||
)
|
||||
|
||||
simulator = Simulator(board=board)
|
||||
|
||||
@@ -37,7 +37,7 @@ scons build/RISCV/gem5.opt
|
||||
```
|
||||
"""
|
||||
|
||||
from gem5.resources.resource import Resource
|
||||
from gem5.resources.resource import obtain_resource
|
||||
from gem5.simulate.simulator import Simulator
|
||||
from gem5.prebuilt.riscvmatched.riscvmatched_board import RISCVMatchedBoard
|
||||
from gem5.isas import ISA
|
||||
@@ -49,7 +49,7 @@ requires(isa_required=ISA.RISCV)
|
||||
board = RISCVMatchedBoard()
|
||||
|
||||
# set the hello world riscv binary as the board workload
|
||||
board.set_se_binary_workload(Resource("riscv-hello"))
|
||||
board.set_se_binary_workload(obtain_resource("riscv-hello"))
|
||||
|
||||
# run the simulation with the RISCV Matched board
|
||||
simulator = Simulator(board=board, full_system=False)
|
||||
|
||||
@@ -63,7 +63,7 @@ from gem5.components.processors.simple_switchable_processor import (
|
||||
from gem5.components.processors.cpu_types import CPUTypes
|
||||
from gem5.isas import ISA
|
||||
from gem5.coherence_protocol import CoherenceProtocol
|
||||
from gem5.resources.resource import Resource
|
||||
from gem5.resources.resource import obtain_resource
|
||||
from gem5.simulate.simulator import Simulator
|
||||
from gem5.simulate.exit_event import ExitEvent
|
||||
|
||||
@@ -203,10 +203,10 @@ board.set_kernel_disk_workload(
|
||||
# The x86 linux kernel will be automatically downloaded to the
|
||||
# `~/.cache/gem5` directory if not already present.
|
||||
# gapbs benchamarks was tested with kernel version 4.19.83
|
||||
kernel=Resource("x86-linux-kernel-4.19.83"),
|
||||
kernel=obtain_resource("x86-linux-kernel-4.19.83"),
|
||||
# The x86-gapbs image will be automatically downloaded to the
|
||||
# `~/.cache/gem5` directory if not already present.
|
||||
disk_image=Resource("x86-gapbs"),
|
||||
disk_image=obtain_resource("x86-gapbs"),
|
||||
readfile_contents=command,
|
||||
)
|
||||
|
||||
|
||||
@@ -60,7 +60,7 @@ from gem5.components.processors.simple_switchable_processor import (
|
||||
from gem5.components.processors.cpu_types import CPUTypes
|
||||
from gem5.isas import ISA
|
||||
from gem5.coherence_protocol import CoherenceProtocol
|
||||
from gem5.resources.resource import Resource
|
||||
from gem5.resources.resource import obtain_resource
|
||||
from gem5.simulate.simulator import Simulator
|
||||
from gem5.simulate.simulator import ExitEvent
|
||||
|
||||
@@ -204,10 +204,10 @@ 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=Resource("x86-linux-kernel-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=Resource("x86-npb"),
|
||||
disk_image=obtain_resource("x86-npb"),
|
||||
readfile_contents=command,
|
||||
)
|
||||
|
||||
|
||||
@@ -59,7 +59,7 @@ from gem5.components.processors.simple_switchable_processor import (
|
||||
from gem5.components.processors.cpu_types import CPUTypes
|
||||
from gem5.isas import ISA
|
||||
from gem5.coherence_protocol import CoherenceProtocol
|
||||
from gem5.resources.resource import Resource
|
||||
from gem5.resources.resource import obtain_resource
|
||||
from gem5.simulate.simulator import Simulator
|
||||
from gem5.simulate.exit_event import ExitEvent
|
||||
|
||||
@@ -185,10 +185,10 @@ board.set_kernel_disk_workload(
|
||||
# The x86 linux kernel will be automatically downloaded to the
|
||||
# `~/.cache/gem5` directory if not already present.
|
||||
# PARSEC benchamarks were tested with kernel version 4.19.83
|
||||
kernel=Resource("x86-linux-kernel-4.19.83"),
|
||||
kernel=obtain_resource("x86-linux-kernel-4.19.83"),
|
||||
# The x86-parsec image will be automatically downloaded to the
|
||||
# `~/.cache/gem5` directory if not already present.
|
||||
disk_image=Resource("x86-parsec"),
|
||||
disk_image=obtain_resource("x86-parsec"),
|
||||
readfile_contents=command,
|
||||
)
|
||||
|
||||
|
||||
@@ -65,7 +65,7 @@ from gem5.components.processors.simple_switchable_processor import (
|
||||
from gem5.components.processors.cpu_types import CPUTypes
|
||||
from gem5.isas import ISA
|
||||
from gem5.coherence_protocol import CoherenceProtocol
|
||||
from gem5.resources.resource import Resource, CustomDiskImageResource
|
||||
from gem5.resources.resource import Resource, DiskImageResource
|
||||
from gem5.simulate.simulator import Simulator
|
||||
from gem5.simulate.exit_event import ExitEvent
|
||||
|
||||
@@ -261,9 +261,7 @@ board.set_kernel_disk_workload(
|
||||
# 5.4.49
|
||||
kernel=Resource("x86-linux-kernel-4.19.83"),
|
||||
# The location of the x86 SPEC CPU 2017 image
|
||||
disk_image=CustomDiskImageResource(
|
||||
args.image, root_partition=args.partition
|
||||
),
|
||||
disk_image=DiskImageResource(args.image, root_partition=args.partition),
|
||||
readfile_contents=command,
|
||||
)
|
||||
|
||||
|
||||
@@ -63,7 +63,7 @@ from gem5.components.processors.simple_switchable_processor import (
|
||||
from gem5.components.processors.cpu_types import CPUTypes
|
||||
from gem5.isas import ISA
|
||||
from gem5.coherence_protocol import CoherenceProtocol
|
||||
from gem5.resources.resource import Resource, CustomDiskImageResource
|
||||
from gem5.resources.resource import obtain_resource, DiskImageResource
|
||||
from gem5.simulate.simulator import Simulator
|
||||
from gem5.simulate.exit_event import ExitEvent
|
||||
|
||||
@@ -268,18 +268,16 @@ except FileExistsError:
|
||||
|
||||
command = f"{args.benchmark} {args.size} {output_dir}"
|
||||
|
||||
# For enabling CustomResource, we pass an additional parameter to mount the
|
||||
# For enabling DiskImageResource, we pass an additional parameter to mount the
|
||||
# correct partition.
|
||||
|
||||
board.set_kernel_disk_workload(
|
||||
# The x86 linux kernel will be automatically downloaded to the
|
||||
# `~/.cache/gem5` directory if not already present.
|
||||
# SPEC CPU2017 benchamarks were tested with kernel version 4.19.83
|
||||
kernel=Resource("x86-linux-kernel-4.19.83"),
|
||||
kernel=obtain_resource("x86-linux-kernel-4.19.83"),
|
||||
# The location of the x86 SPEC CPU 2017 image
|
||||
disk_image=CustomDiskImageResource(
|
||||
args.image, root_partition=args.partition
|
||||
),
|
||||
disk_image=DiskImageResource(args.image, root_partition=args.partition),
|
||||
readfile_contents=command,
|
||||
)
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ from gem5.components.processors.simple_processor import SimpleProcessor
|
||||
from gem5.components.processors.cpu_types import CPUTypes
|
||||
from gem5.isas import ISA
|
||||
from gem5.utils.requires import requires
|
||||
from gem5.resources.resource import Resource, CustomResource
|
||||
from gem5.resources.resource import obtain_resource
|
||||
|
||||
import argparse
|
||||
|
||||
@@ -98,8 +98,8 @@ board = LupvBoard(
|
||||
# Set the Full System workload.
|
||||
|
||||
board.set_kernel_disk_workload(
|
||||
kernel=Resource("riscv-lupio-linux-kernel"),
|
||||
disk_image=Resource("riscv-lupio-busybox-img"),
|
||||
kernel=obtain_resource("riscv-lupio-linux-kernel"),
|
||||
disk_image=obtain_resource("riscv-lupio-busybox-img"),
|
||||
)
|
||||
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ from m5.objects import *
|
||||
from os import path
|
||||
|
||||
# For downloading the disk image
|
||||
from gem5.resources.resource import Resource
|
||||
from gem5.resources.resource import obtain_resource
|
||||
|
||||
import argparse
|
||||
|
||||
@@ -139,7 +139,7 @@ cpu_clock_rate = args.cpu_clock_rate
|
||||
memory_size = args.memory_size
|
||||
|
||||
# Try downloading the Resource
|
||||
bbl_resource = Resource("riscv-boot-exit-nodisk")
|
||||
bbl_resource = obtain_resource("riscv-boot-exit-nodisk")
|
||||
bbl_path = bbl_resource.get_local_path()
|
||||
|
||||
system = System()
|
||||
|
||||
Reference in New Issue
Block a user