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:
@@ -36,7 +36,7 @@ Characteristics
|
||||
from gem5.isas import ISA
|
||||
from m5.objects import ArmDefaultRelease
|
||||
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
|
||||
from m5.objects import VExpress_GEM5_Foundation
|
||||
from gem5.coherence_protocol import CoherenceProtocol
|
||||
@@ -199,15 +199,15 @@ board = ArmBoard(
|
||||
|
||||
# Set the Full System workload.
|
||||
board.set_kernel_disk_workload(
|
||||
kernel=Resource(
|
||||
kernel=obtain_resource(
|
||||
"arm64-linux-kernel-5.4.49",
|
||||
resource_directory=args.resource_directory,
|
||||
),
|
||||
bootloader=Resource(
|
||||
bootloader=obtain_resource(
|
||||
"arm64-bootloader-foundation",
|
||||
resource_directory=args.resource_directory,
|
||||
),
|
||||
disk_image=Resource(
|
||||
disk_image=obtain_resource(
|
||||
"arm64-ubuntu-20.04-img",
|
||||
resource_directory=args.resource_directory,
|
||||
),
|
||||
|
||||
@@ -55,7 +55,7 @@ from gem5.components.processors.cpu_types import (
|
||||
from gem5.components.processors.simple_switchable_processor import (
|
||||
SimpleSwitchableProcessor,
|
||||
)
|
||||
from gem5.resources.resource import Resource
|
||||
from gem5.resources.resource import obtain_resource
|
||||
from gem5.runtime import get_runtime_coherence_protocol
|
||||
from gem5.utils.requires import requires
|
||||
|
||||
@@ -179,10 +179,10 @@ kernel_args = motherboard.get_default_kernel_args() + [args.kernel_args]
|
||||
|
||||
# Set the Full System workload.
|
||||
motherboard.set_kernel_disk_workload(
|
||||
kernel=Resource(
|
||||
kernel=obtain_resource(
|
||||
"x86-linux-kernel-5.4.49", resource_directory=args.resource_directory
|
||||
),
|
||||
disk_image=Resource(
|
||||
disk_image=obtain_resource(
|
||||
"x86-ubuntu-18.04-img", resource_directory=args.resource_directory
|
||||
),
|
||||
readfile_contents=dedent(
|
||||
|
||||
@@ -45,7 +45,7 @@ from gem5.components.processors.cpu_types import (
|
||||
from gem5.components.processors.simple_switchable_processor import (
|
||||
SimpleSwitchableProcessor,
|
||||
)
|
||||
from gem5.resources.resource import Resource
|
||||
from gem5.resources.resource import obtain_resource
|
||||
from gem5.runtime import get_runtime_coherence_protocol
|
||||
from gem5.simulate.simulator import Simulator
|
||||
from gem5.simulate.exit_event import ExitEvent
|
||||
@@ -165,10 +165,10 @@ kernal_args = motherboard.get_default_kernel_args() + [args.kernel_args]
|
||||
|
||||
# Set the Full System workload.
|
||||
motherboard.set_kernel_disk_workload(
|
||||
kernel=Resource(
|
||||
kernel=obtain_resource(
|
||||
"x86-linux-kernel-5.4.49", resource_directory=args.resource_directory
|
||||
),
|
||||
disk_image=Resource(
|
||||
disk_image=obtain_resource(
|
||||
"x86-ubuntu-18.04-img", resource_directory=args.resource_directory
|
||||
),
|
||||
# The first exit signals to switch processors.
|
||||
|
||||
@@ -37,7 +37,7 @@ Notes
|
||||
|
||||
import m5.stats
|
||||
|
||||
from gem5.resources.resource import Resource
|
||||
from gem5.resources.resource import obtain_resource
|
||||
from gem5.components.boards.x86_board import X86Board
|
||||
from gem5.components.memory import SingleChannelDDR3_1600
|
||||
from gem5.components.processors.simple_switchable_processor import (
|
||||
@@ -205,10 +205,10 @@ command = (
|
||||
)
|
||||
|
||||
board.set_kernel_disk_workload(
|
||||
kernel=Resource(
|
||||
kernel=obtain_resource(
|
||||
"x86-linux-kernel-5.4.49", resource_directory=args.resource_directory
|
||||
),
|
||||
disk_image=Resource(
|
||||
disk_image=obtain_resource(
|
||||
"x86-parsec", resource_directory=args.resource_directory
|
||||
),
|
||||
readfile_contents=command,
|
||||
|
||||
@@ -30,7 +30,7 @@ The system has no cache heirarchy and is as "bare-bones" as you can get in
|
||||
gem5 while still being functinal.
|
||||
"""
|
||||
|
||||
from gem5.resources.resource import Resource
|
||||
from gem5.resources.resource import obtain_resource
|
||||
from gem5.components.processors.cpu_types import (
|
||||
get_cpu_types_str_set,
|
||||
get_cpu_type_from_str,
|
||||
@@ -135,7 +135,9 @@ motherboard = SimpleBoard(
|
||||
)
|
||||
|
||||
# Set the workload
|
||||
binary = Resource(args.resource, resource_directory=args.resource_directory)
|
||||
binary = obtain_resource(
|
||||
args.resource, resource_directory=args.resource_directory
|
||||
)
|
||||
motherboard.set_se_binary_workload(binary, arguments=args.arguments)
|
||||
|
||||
# Run the simulation
|
||||
|
||||
@@ -45,7 +45,7 @@ By default a generator is passed to define the evit_event. A list of functions
|
||||
can also be passed. This is enabled by passing the `--list-format` flag.
|
||||
"""
|
||||
|
||||
from gem5.resources.resource import Resource
|
||||
from gem5.resources.resource import obtain_resource
|
||||
from gem5.components.memory import SingleChannelDDR3_1600
|
||||
from gem5.components.boards.simple_board import SimpleBoard
|
||||
from gem5.components.cachehierarchies.classic.no_cache import NoCache
|
||||
@@ -101,7 +101,7 @@ motherboard = SimpleBoard(
|
||||
# Set the workload
|
||||
# Note: Here we're using the "x86-m5-exit-repeat" resource. This calls an
|
||||
# `m5_exit(0)` command in an infinite while-loop.
|
||||
binary = Resource(
|
||||
binary = obtain_resource(
|
||||
"x86-m5-exit-repeat", resource_directory=args.resource_directory
|
||||
)
|
||||
motherboard.set_se_binary_workload(binary)
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
|
||||
"""
|
||||
|
||||
from gem5.resources.resource import Resource
|
||||
from gem5.resources.resource import obtain_resource
|
||||
from gem5.isas import ISA
|
||||
from gem5.components.memory import SingleChannelDDR3_1600
|
||||
from gem5.components.boards.simple_board import SimpleBoard
|
||||
@@ -76,7 +76,7 @@ motherboard = SimpleBoard(
|
||||
)
|
||||
|
||||
# Set the workload
|
||||
binary = Resource(
|
||||
binary = obtain_resource(
|
||||
"x86-hello64-static", resource_directory=args.resource_directory
|
||||
)
|
||||
motherboard.set_se_binary_workload(binary)
|
||||
|
||||
@@ -33,7 +33,7 @@ run before, at, or after the running of `simulator.run`.
|
||||
time.
|
||||
"""
|
||||
|
||||
from gem5.resources.resource import Resource
|
||||
from gem5.resources.resource import obtain_resource
|
||||
from gem5.isas import ISA
|
||||
from gem5.components.memory import SingleChannelDDR3_1600
|
||||
from gem5.components.boards.simple_board import SimpleBoard
|
||||
@@ -97,7 +97,7 @@ motherboard = SimpleBoard(
|
||||
)
|
||||
|
||||
# Set the workload
|
||||
binary = Resource(
|
||||
binary = obtain_resource(
|
||||
"x86-hello64-static", resource_directory=args.resource_directory
|
||||
)
|
||||
motherboard.set_se_binary_workload(binary)
|
||||
|
||||
@@ -72,14 +72,14 @@ class CustomWorkloadTestSuite(unittest.TestCase):
|
||||
)
|
||||
|
||||
def test_get_function_str(self) -> None:
|
||||
# Tests `CustomResource.get_function_str`
|
||||
# Tests `CustomWorkload.get_function_str`
|
||||
|
||||
self.assertEqual(
|
||||
"set_se_binary_workload", self.custom_workload.get_function_str()
|
||||
)
|
||||
|
||||
def test_get_parameters(self) -> None:
|
||||
# Tests `CustomResource.get_parameter`
|
||||
# Tests `CustomWorkload.get_parameter`
|
||||
|
||||
parameters = self.custom_workload.get_parameters()
|
||||
self.assertTrue(isinstance(parameters, Dict))
|
||||
@@ -95,7 +95,7 @@ class CustomWorkloadTestSuite(unittest.TestCase):
|
||||
self.assertEquals(6, parameters["arguments"][1])
|
||||
|
||||
def test_add_parameters(self) -> None:
|
||||
# Tests `CustomResource.set_parameter` for the case where we add a new
|
||||
# Tests `CustomWorkload.set_parameter` for the case where we add a new
|
||||
# parameter value.
|
||||
|
||||
self.custom_workload.set_parameter("test_param", 10)
|
||||
@@ -109,7 +109,7 @@ class CustomWorkloadTestSuite(unittest.TestCase):
|
||||
del self.custom_workload.get_parameters()["test_param"]
|
||||
|
||||
def test_override_parameter(self) -> None:
|
||||
# Tests `CustomResource.set_parameter` for the case where we override
|
||||
# Tests `CustomWorkload.set_parameter` for the case where we override
|
||||
# a parameter's value.
|
||||
|
||||
old_value = self.custom_workload.get_parameters()["binary"]
|
||||
|
||||
Reference in New Issue
Block a user