### Example HWBench Job Configuration Source: https://github.com/criteo/hwbench/blob/main/hwbench/config/README.md Demonstrates the configuration for two benchmark jobs: 'job_all_cores_once' and 'job_all_cores_twice'. These examples illustrate how to specify CPU core ranges and stressor counts to control the benchmark execution. ```config [job_all_cores_once] .... hosting_cpu_cores=0-63 stressor_range=1 [job_all_cores_twice] .... hosting_cpu_cores=0-63 stressor_range=1-2 ``` -------------------------------- ### PDU Configuration Example for hwbench Source: https://github.com/criteo/hwbench/blob/main/documentation/monitoring.md Example of a PDU configuration for hwbench monitoring. It requires a section name, credentials, type set to 'PDU', a driver, a URL, and an outlet number. ```ini [myPDU] username=admin password=admin type=PDU driver=generic url=http://mypdu/ outlet=21 ``` -------------------------------- ### Implement Hardware Monitoring in Python Source: https://context7.com/criteo/hwbench/llms.txt Shows how to integrate hardware monitoring into benchmark execution using the Monitoring class. It covers initializing hardware and monitoring components, starting and stopping monitoring, retrieving collected data, and dumping results to a file. ```python from hwbench.bench.monitoring import Monitoring from hwbench.environment.hardware import Hardware import pathlib # Initialize hardware and monitoring output_dir = pathlib.Path("/tmp/benchmark_output") hw = Hardware(output_dir, "monitoring.cfg") # Create monitoring instance monitoring = Monitoring(output_dir, "all", hw) # Start monitoring in background thread monitoring.start() # Run your benchmarks here... # Monitoring collects metrics in background # Stop monitoring and get results monitoring.stop() monitoring_data = monitoring.get() # Access specific metrics thermal_data = monitoring_data.contexts.Thermal fan_data = monitoring_data.contexts.Fans power_data = monitoring_data.contexts.PowerConsumption freq_data = monitoring_data.contexts.Freq # Dump monitoring results to file monitoring_output = monitoring.dump() ``` -------------------------------- ### PDU Outlet Group Configuration Example for hwbench Source: https://github.com/criteo/hwbench/blob/main/documentation/monitoring.md Example demonstrating the use of 'outletgroup' for PDU configuration in hwbench. This is an alternative to specifying a single 'outlet' and is used when PDUs group outlets. ```ini [PDU_with_grouped_outlets] username=admin password=admin type=PDU driver=raritan url=https://mypdu/ outletgroup=1 ``` -------------------------------- ### BMC Configuration Example for hwbench Source: https://github.com/criteo/hwbench/blob/main/documentation/monitoring.md Example of how to configure a BMC monitoring source in hwbench. The type must be 'BMC', and the section name can be a vendor name like 'HPE'. The URL is optional as it can be detected at runtime. ```ini [HPE] username=Administrator password=YOURPASSWORD type=BMC ``` -------------------------------- ### hwgraph: Adding Events to Graphs Source: https://context7.com/criteo/hwbench/llms.txt Enables annotating performance graphs with specific events by providing event name, start time, and duration. ```bash # Add event markers to graphs uv run hwgraph graph \ --traces results.json:MyServer:CPU.package \ --outdir ./graphs \ --events "Thermal_Throttle:120:30" \ "Power_Cap_Hit:300:15" \ "Fan_Speed_Increase:450:60" # Event syntax: event_name:start_time:duration # start_time: seconds from benchmark start # duration: event duration in seconds ``` -------------------------------- ### Orchestrate Benchmarks with Monitoring in Python Source: https://context7.com/criteo/hwbench/llms.txt Illustrates how to use the Benchmarks class to manage multiple benchmark executions, including hardware monitoring. This involves setting up configuration, hardware, checking requirements, parsing job configurations, running benchmarks, and dumping results. ```python from hwbench.bench.benchmarks import Benchmarks from hwbench.config.config import Config from hwbench.environment.hardware import Hardware import pathlib # Setup output_dir = pathlib.Path("/tmp/bench_results") output_dir.mkdir(exist_ok=True) # Load configuration and hardware config = Config("configs/simple.conf") hw = Hardware(output_dir, "monitoring.cfg") # Create benchmarks orchestrator benches = Benchmarks(output_dir, config) benches.set_hardware(hw) # Check requirements problems = benches.check_requirements() if problems: for problem in problems: print(f"Requirement not met: {problem}") exit(1) # Parse job configuration benches.parse_jobs_config() # Execute all benchmarks results = benches.run() # Dump results to JSON benches.dump() # Results structure: # { # "job_name": { # "performance_metric": value, # "effective_runtime": seconds, # "monitoring": {...} # } # } ``` -------------------------------- ### Configuration: Selecting CPU Cores and Scaling Source: https://context7.com/criteo/hwbench/llms.txt Defines how to select CPU cores for benchmarking, supporting NUMA nodes, specific physical cores, quadrants, mixed methods, and simple automatic scaling. ```configuration # Use cores from specific NUMA nodes hosting_cpu_cores=numa0,numa1 hosting_cpu_cores_scaling=iterate [test_physical_cores] # Use specific physical cores (includes hyperthreads) hosting_cpu_cores=core0,core1,core2,core3 hosting_cpu_cores_scaling=iterate [test_quadrants] # Use CPU quadrants for multi-die processors hosting_cpu_cores=quadrant0,quadrant1 hosting_cpu_cores_scaling=iterate [test_mixed] # Combine different selection methods hosting_cpu_cores=numa0,16-31 hosting_cpu_cores_scaling=none [test_simple_scaling] # Automatic power-of-2 scaling pattern hosting_cpu_cores=simple hosting_cpu_cores_scaling=iterate ``` -------------------------------- ### Define Custom Benchmark Engine in Python Source: https://context7.com/criteo/hwbench/llms.txt Demonstrates how to define a custom benchmark engine by subclassing EngineBase. This includes specifying the engine's name, binary, modules, custom parameters, and methods for retrieving the command-line version and parsing its output. ```python class Engine(EngineBase): def __init__(self): super().__init__("myengine", "mybinary") self.add_module(MyEngineModule(self, "module1")) self.custom_parameters_required = ["custom_param"] def run_cmd_version(self) -> list[str]: return [self.get_binary(), "--version"] def parse_version(self, stdout: bytes, stderr: bytes) -> str: self.version = stdout.decode().strip() return self.version class MyBenchmark(ExternalBench): def __init__(self, engine_module, parameters): super().__init__(engine_module, parameters) def run_cmd(self) -> list[str]: return [ self.engine_module.get_engine().get_binary(), "--test", self.parameters.get_engine_module_parameter(), "--runtime", str(self.parameters.get_runtime()) ] def parse_cmd(self, stdout: bytes, stderr: bytes): # Parse output and return results return { "performance": 1000.0, "effective_runtime": self.parameters.get_runtime() } # Use the engine engine = Engine() engine.init() print(f"Engine: {engine.get_name()}, Binary: {engine.get_binary()}") ``` -------------------------------- ### FIO Command-line Configuration Sample Source: https://github.com/criteo/hwbench/blob/main/documentation/fio.md This configuration defines FIO benchmarks using the 'cmdline' engine module. It specifies parameters like filename, direct I/O, read/write mode, block size, I/O engine, and I/O depth. The 'stressor_range' directive generates multiple benchmarks with varying 'numjobs'. ```ini [randread_cmdline] runtime=600 engine=fio engine_module=cmdline engine_module_parameter_base=--filename=/dev/nvme0n1 --direct=1 --rw=randread --bs=4k --ioengine=libaio --iodepth=256 --group_reporting --readonly hosting_cpu_cores=all hosting_cpu_cores_scaling=none stressor_range=4,6 ``` -------------------------------- ### hwgraph: List Available Power Metrics in Trace Source: https://context7.com/criteo/hwbench/llms.txt Command to query and list available power metrics from a benchmark results file, useful for selecting metrics for graph generation. ```bash # List all power metrics in a trace file uv run hwgraph list --trace results.json # Example output shows available metrics like: # - CPU.package # - CPU.Core # - BMC.ServerInChassis # - BMC.System # - PDU.Outlet21 ``` -------------------------------- ### hwgraph: Generating Performance and Environmental Graphs Source: https://context7.com/criteo/hwbench/llms.txt Command-line interface for generating graphs from benchmark results. Supports single traces, comparisons, custom settings, disabling graph types, and same-chassis/group comparisons. ```bash # Generate graphs from single trace uv run hwgraph graph \ --traces results.json:ServerA:CPU.package \ --outdir ./graphs # Compare multiple benchmark runs uv run hwgraph graph \ --traces results1.json:Intel_Xeon:CPU.package \ results2.json:AMD_EPYC:CPU.package \ --outdir ./comparison_graphs # Generate graphs with custom settings uv run hwgraph graph \ --traces baseline.json:Baseline:BMC.ServerInChassis \ optimized.json:Optimized:BMC.ServerInChassis \ --outdir ./output \ --dpi 150 \ --width 2560 \ --height 1440 \ --format png \ --engine cairo # Disable specific graph types uv run hwgraph graph \ --traces results.json:MyServer:CPU.package \ --outdir ./graphs \ --no-env \ --no-scaling \ --no-versus # Same chassis comparison (multiple servers in same physical chassis) uv run hwgraph graph \ --traces server1.json:Node1:BMC.ServerInChassis \ server2.json:Node2:BMC.ServerInChassis \ --outdir ./chassis_comparison \ --same-chassis # Same group comparison (multiple servers of same type) uv run hwgraph graph \ --traces host1.json:Host1:CPU.package \ host2.json:Host2:CPU.package \ host3.json:Host3:CPU.package \ --outdir ./group_comparison \ --same-group ``` -------------------------------- ### HWBench Configuration Directives Reference Source: https://context7.com/criteo/hwbench/llms.txt Provides a reference for configuration directives used in HWBench. This includes global and per-job settings for runtime, monitoring, engine selection, stressor configuration, CPU core allocation, thermal and fan thresholds, skip and sync methods, and FIO-specific disk selection. ```ini # Global or per-job directives # Benchmark duration in seconds runtime=120 # Enable monitoring: all, none, or specific components monitor=all # Benchmark engine: stressng, fio, sleep, spike engine=stressng # Engine module (subtype of engine) engine_module=cpu # Engine module parameters (comma-separated) engine_module_parameter=int128,float128,fft # Base parameters for engine (used with fio) engine_module_parameter_base=--direct=1 --rw=randread # Number of stressor instances: integer, range (1-8), list (1,4,8), or auto stressor_range=auto # How to scale stressors: plus_1, multiply_2, plus_2 stressor_range_scaling=plus_1 # CPU cores to use: integers, ranges, or keywords # Keywords: all, simple, numa, core, quadrant hosting_cpu_cores=simple # How to apply CPU cores: iterate (per value), none (all at once) hosting_cpu_cores_scaling=iterate # Thermal threshold to start benchmark (Celsius) thermal_start=40 # Fan speed threshold to start benchmark (RPM) fans_start=3000 # Skip method: bypass, wait skip_method=wait # Sync start method: none, filesystem sync_start=none # FIO-specific: disk selection disks=all # or specific disks disks=/dev/nvme0n1,/dev/sda ``` -------------------------------- ### Python API: Config Class for hwbench Configuration Source: https://context7.com/criteo/hwbench/llms.txt Programmatically parse and validate hwbench configuration files using the Config class. Allows setting hardware context, validating sections, and retrieving various configuration parameters. ```python from hwbench.config.config import Config from hwbench.environment.hardware import Hardware # Load configuration file config = Config("configs/simple.conf") # Set hardware context for core selection expansion hw = Hardware("/tmp/output", "monitoring.cfg") config.set_hardware(hw) # Validate all sections config.validate_sections() # Get sections and directives sections = config.get_sections() # ['wait', 'avx', 'cpu', 'stream', ...] runtime = config.get_runtime('cpu') # 120 engine = config.get_engine('cpu') # 'stressng' engine_module = config.get_engine_module('cpu') # 'cpu' # Parse hosting CPU cores with hardware context hcc = config.get_hosting_cpu_cores('cpu') # [0, 1, 2, 4, 8, 16, 32, ...] # Get stressor range stressor_range = config.get_stressor_range('cpu') # ['1'] or ['4', '6'] # Load engine dynamically engine_obj = config.load_engine('stressng') # Convert config to dictionary config_dict = config.to_dict() ``` -------------------------------- ### hwbench Configuration File Structure Source: https://github.com/criteo/hwbench/blob/main/documentation/monitoring.md This is a template for defining a monitoring source (like BMC or PDU) in the hwbench configuration file. It requires a section name, username, password, type, and URL. ```ini [section_name] username= password= type= url= ``` -------------------------------- ### Python API: Engine Base Class for Custom Benchmarks Source: https://context7.com/criteo/hwbench/llms.txt Provides the base classes (EngineBase, EngineModuleBase) for creating custom benchmark engines and modules within the hwbench framework. ```python from hwbench.bench.engine import EngineBase, EngineModuleBase from hwbench.bench.parameters import BenchmarkParameters from hwbench.bench.benchmark import ExternalBench # Define engine module class MyEngineModule(EngineModuleBase): def __init__(self, engine, name: str): super().__init__(engine, name) self.add_module_parameter("test1") self.add_module_parameter("test2") def run(self, params: BenchmarkParameters): bench = MyBenchmark(self, params) return bench.run() def fully_skipped_job(self, p) -> bool: return False ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.