gem5.resources.resource module

class gem5.resources.resource.AbstractResource(id: str | None = None, resource_version: str | None = None, local_path: str | None = None, description: str | None = None, source: str | None = None, downloader: partial | None = None)

Bases: object

An abstract class which all Resource classes inherit from.

get_category_name() str
get_description() str | None

Returns description associated with this resource.

get_id() str

Returns the ID of the resource.

get_local_path() str | None

Returns the local path of the resource.

If specified the downloader partial function is called to download the resource if it is not present or up-to-date at the specified local_path.

get_resource_version() str

Returns the version of the resource.

get_source() str | None

Returns information as to where the source for this resource may be found.

class gem5.resources.resource.BinaryResource(local_path: str, id: str | None = None, resource_version: str | None = None, description: str | None = None, source: str | None = None, downloader: partial | None = None, architecture: ISA | str | None = None, **kwargs)

Bases: FileResource

A binary resource.

get_architecture() ISA | None

Returns the ISA this binary is compiled to.

get_category_name() str
class gem5.resources.resource.BootloaderResource(local_path: str, id: str | None = None, resource_version: str | None = None, description: str | None = None, source: str | None = None, downloader: partial | None = None, architecture: ISA | str | None = None, **kwargs)

Bases: BinaryResource

A bootloader resource.

get_category_name() str
class gem5.resources.resource.CheckpointResource(local_path: str, id: str | None = None, resource_version: str | None = None, description: str | None = None, source: str | None = None, downloader: partial | None = None, **kwargs)

Bases: DirectoryResource

A checkpoint resource. The following directory structure is expected:

<local_path>:
  • board.physmem.store0.pmem

  • m5.cpt

get_category_name() str
class gem5.resources.resource.CustomDiskImageResource(local_path: str, resource_version: str | None = None, root_partition: str | None = None, metadata: Dict = {})

Bases: DiskImageResource

A custom disk image gem5 resource. It can be used to specify a custom, local disk image.

Warning

This class is deprecated and will be removed in future releases of gem5. Please use the DiskImageResource class instead. This class is merely a wrapper for it.

class gem5.resources.resource.CustomResource(local_path: str, metadata: Dict = {})

Bases: AbstractResource

A custom gem5 resource. This can be used to encapsulate a resource provided by a gem5 user as opposed to one available within the gem5 resources repository.

Warning

This class is deprecated and will be removed in future releases of gem5. Please use the correct AbstractResource subclass instead.

class gem5.resources.resource.DirectoryResource(local_path: str, id: str | None = None, resource_version: str | None = None, description: str | None = None, source: str | None = None, downloader: partial | None = None, **kwargs)

Bases: AbstractResource

A resource consisting of a directory.

get_category_name() str
get_local_path() str | None

Returns the local path of the resource.

If specified the downloader partial function is called to download the resource if it is not present or up-to-date at the specified local_path.

class gem5.resources.resource.DiskImageResource(local_path: str, id: str | None = None, resource_version: str | None = None, description: str | None = None, source: str | None = None, downloader: partial | None = None, root_partition: str | None = None, **kwargs)

Bases: FileResource

A Disk Image resource.

get_category_name() str
get_root_partition() str | None

Returns, if applicable, the Root Partition of the disk image.

class gem5.resources.resource.FileResource(local_path: str, id: str | None = None, resource_version: str | None = None, description: str | None = None, source: str | None = None, downloader: partial | None = None, **kwargs)

Bases: AbstractResource

A resource consisting of a single file.

get_category_name() str
get_local_path() str | None

Returns the local path of the resource.

If specified the downloader partial function is called to download the resource if it is not present or up-to-date at the specified local_path.

class gem5.resources.resource.GitResource(local_path: str, id: str | None = None, resource_version: str | None = None, description: str | None = None, source: str | None = None, downloader: partial | None = None, **kwargs)

Bases: DirectoryResource

A git resource.

get_category_name() str
class gem5.resources.resource.KernelResource(local_path: str, id: str | None = None, resource_version: str | None = None, description: str | None = None, source: str | None = None, downloader: partial | None = None, architecture: ISA | str | None = None, **kwargs)

Bases: BinaryResource

A kernel resource.

get_category_name() str
class gem5.resources.resource.LooppointCsvResource(local_path: str, id: str | None = None, resource_version: str | None = None, description: str | None = None, source: str | None = None, downloader: partial | None = None, **kwargs)

Bases: FileResource, LooppointCsvLoader

This LoopPoint resource used to create a LoopPoint resource from a pinpoints CSV file.

get_category_name() str
class gem5.resources.resource.LooppointJsonResource(local_path: str, id: str | None = None, resource_version: str | None = None, region_id: str | int | None = None, description: str | None = None, source: str | None = None, downloader: partial | None = None, **kwargs)

Bases: FileResource, LooppointJsonLoader

get_category_name() str
gem5.resources.resource.Resource(resource_id: str, resource_directory: str | None = None, download_md5_mismatch: bool = True, resource_version: str | None = None, clients: List[str] | None = None) AbstractResource

This function was created to maintain backwards compatibility for v21.1.0 and prior releases of gem5 where Resource was a class.

In the interests of gem5-resource specialization, the Resource class has been dropped. Instead users are advised to use the obtain_resource function which will return the correct AbstractResource implementation. This function (disguised as a class) wraps this function.

class gem5.resources.resource.SimpointDirectoryResource(local_path: str, simpoint_file: str, weight_file: str, simpoint_interval: int, warmup_interval: int, id: str | None = None, resource_version: str | None = None, workload_name: str | None = None, description: str | None = None, source: str | None = None, downloader: partial | None = None, **kwargs)

Bases: SimpointResource

A SimPoint diretory resource. This SimPoint Resource assumes the existance of a directory containing a SimPoint file and a weight file.

get_category_name() str
get_simpoint_file() Path

Return the SimPoint File path.

get_weight_file() Path

Returns the Weight File path.

class gem5.resources.resource.SimpointResource(resource_version: str | None = None, simpoint_interval: int = None, simpoint_list: List[int] = None, weight_list: List[float] = None, warmup_interval: int = 0, id: str | None = None, workload_name: str | None = None, description: str | None = None, source: str | None = None, downloader: partial | None = None, local_path: str | None = None, **kwargs)

Bases: AbstractResource

A SimPoint resource. This resource stores all information required to perform a SimPoint creation and restore. It contains the SimPoint, the SimPoint interval, the weight for each SimPoint, the full warmup length, and the warmup length for each SimPoint.

get_category_name() str
get_simpoint_interval() int

Returns the SimPoint interval value.

get_simpoint_list() List[int]

Returns the a list containing all the SimPoints for the workload.

get_simpoint_start_insts() List[int]

Returns a lst containing all the SimPoint starting instrunction points for the workload. This was calculated by multiplying the SimPoint with the SimPoint interval when it was generated.

get_warmup_interval() int

Returns the instruction length of the warmup interval.

get_warmup_list() List[int]

Returns the a list containing the warmup length for each SimPoint. Each warmup length in this list corresponds to the SimPoint at the same index in get_simpoint_list(). I.e., get_warmup_list()[4] is the warmup length for SimPoint get_simpoint_list()[4].

get_weight_list() List[float]

Returns the list that contains the weight for each SimPoint. The order of the weights matches that of the list returned by get_simpoint_list(). I.e. get_weight_list()[3] is the weight for SimPoint get_simpoint_list()[3].

get_workload_name() str | None

Return the workload name this SimPoint is associated with.

class gem5.resources.resource.SuiteResource(workloads: Dict[WorkloadResource, Set[str]] = {}, resource_version: str | None = None, description: str | None = None, source: str | None = None, id: str | None = None, **kwargs)

Bases: AbstractResource

A suite resource. This resource is used to specify a suite of workloads to run on a board. It contains a list of workloads to run, along with their IDs and versions.

Each workload in a suite is used to create a WorkloadResource object. These objects are stored in a list and can be iterated over.

get_category_name() str
get_input_groups() Set[str]
Returns:

A set of all input groups used by the workloads in a suite.

with_input_group(input_group: str) SuiteResource
Parameters:

input_group – The input group to filter the workloads by.

Returns:

A new SuiteResource object with only the workloads that use the specified input group.

class gem5.resources.resource.WorkloadResource(function: str = None, id: str | None = None, resource_version: str | None = None, description: str | None = None, source: str | None = None, local_path: str | None = None, parameters: Dict[str, Any] | None = {}, **kwargs)

Bases: AbstractResource

A workload resource. This resource is used to specify a workload to run on a board. It contains the function to call and the parameters to pass to that function.

get_category_name() str
get_function_str() str

Returns the name of the workload function to be run.

This function is called via the AbstractBoard’s set_workload function. The parameters from the get_parameters function are passed to this function.

get_id() str

Returns the ID of the workload.

get_parameters() Dict[str, Any]

Returns a dictionary mapping the workload parameters to their values.

These parameters are passed to the function specified by get_function_str via the AbstractBoard’s set_workload function.

set_parameter(parameter: str, value: Any) None

Used to set or override a workload parameter

Parameters:
  • parameter – The parameter of the function to set.

  • value – The value to set to the parameter.

gem5.resources.resource.obtain_resource(resource_id: str, resource_directory: str | None = None, download_md5_mismatch: bool = True, resource_version: str | None = None, clients: List | None = None, gem5_version='24.1.0.1', to_path: str | None = None, quiet: bool = False) AbstractResource

This function primarily serves as a factory for resources. It will return the correct AbstractResource implementation based on the resource requested.

Parameters:
  • resource_name – The name of the gem5 resource as it appears under the “id” field in the resource.json file.

  • resource_directory – The location of the directory in which the resource is to be stored. If this parameter is not set, it will set to the environment variable GEM5_RESOURCE_DIR. If the environment is not set it will default to ~/.cache/gem5 if available, otherwise the CWD. Note: This argument is ignored if the to_path parameter is specified.

  • download_md5_mismatch – If the resource is present, but does not have the correct md5 value, the resource will be deleted and re-downloaded if this value is True. Otherwise an exception will be thrown. True by default.

  • resource_version – Version of the resource itself. Not a required parameter. None by default.

  • clients – A list of clients to search for the resource. If this parameter is not set, it will default search all clients.

  • gem5_version – The gem5 version to use to filter incompatible resource versions. By default set to the current gem5 version. If None, this filtering is not performed.

  • to_path – The path to which the resource is to be downloaded. If None, the resource will be downloaded to the resource directory with the file/directory name equal to the ID of the resource. Note: Usage of this parameter will override the resource_directory parameter.

  • quiet – If True, suppress output. False by default.