From 69d9d39d138478381c670565e5091c9a17ad98be Mon Sep 17 00:00:00 2001 From: Jana Hozzova Date: Tue, 10 Mar 2026 09:36:39 +0100 Subject: [PATCH 1/9] Add new objects to T4 results schema Add objects describing metadata and compilation data to T4 results json schema --- src/autotuning_methodology/schemas/T4.json | 148 ++++++++++++++++++++- 1 file changed, 145 insertions(+), 3 deletions(-) diff --git a/src/autotuning_methodology/schemas/T4.json b/src/autotuning_methodology/schemas/T4.json index 82db64e..4e3368c 100644 --- a/src/autotuning_methodology/schemas/T4.json +++ b/src/autotuning_methodology/schemas/T4.json @@ -1,6 +1,6 @@ { "$schema": "https://json-schema.org/draft/2020-12/schema", - "$id": "https://github.com/odgaard/TuningSchema/blob/T4/results-schema.json", + "$id": "https://github.com/AutoTuningAssociation/autotuning_methodology/blob/main/src/autotuning_methodology/schemas/T4.json", "description": "Open Autotuning Results Schema", "type": "object", "properties": { @@ -8,7 +8,44 @@ "description": "The version number of the schema in major.minor.patch format.", "type": "string", "pattern": "^[0-9]{1,}.[0-9]{1,}.[0-9]{1,}$", - "example": "1.0.0" + "examples": ["1.1.0"] + }, + "metadata": { + "description": "Metadata about the tuning environment and execution context", + "type": "object", + "properties": { + "compute_api": { + "description": "The compute API used for kernel execution", + "type": "string", + "enum": ["OpenCL", "CUDA", "Vulkan"] + }, + "platform": { + "description": "The compute platform name (e.g., vendor SDK)", + "type": "string" + }, + "device": { + "description": "The compute device name", + "type": "string" + }, + "autotuner": { + "description": "The name of the autotuning framework", + "type": "string", + "examples": ["KTT","KernelTuner"] + }, + "autotuner_version": { + "description": "The version of the autotuning framework", + "type": "string" + }, + "timestamp": { + "description": "Timestamp when the tuning session started", + "type": "string" + }, + "timeunit": { + "description": "The time unit used for all time measurements in the results", + "type": "string", + "enum": ["nanoseconds", "microseconds", "milliseconds", "seconds"] + } + } }, "results": { "type": "array", @@ -41,6 +78,22 @@ }, "validation": { "type": "number" + }, + "data": { + "description": "Time spent on data movement (host-device transfers)", + "type": "number" + }, + "kernel_overhead": { + "description": "Kernel launch overhead", + "type": "number" + }, + "profiling_runs": { + "description": "Time spent on profiling runs", + "type": "number" + }, + "profiling_overhead": { + "description": "Overhead from profiling instrumentation", + "type": "number" } } }, @@ -74,9 +127,98 @@ }, "unit": { "type": "string" + }, + "type": { + "description": "Data type of the profiling counter (used in KTT autotuner)", + "type": "string", + "enum": ["Int", "UnsignedInt", "Double", "Percent", "Throughput", "UtilizationLevel"] } } } + }, + "compilation_data": { + "description": "Kernel compilation metadata and thread dimensions (optional, used by KTT's profile-based searcher)", + "type": "object", + "properties": { + "max_work_group_size": { + "description": "Maximum work-group size (thread block size) for this kernel on this device", + "type": "integer", + "minimum": 0 + }, + "local_memory_size": { + "description": "Statically-allocated local memory (shared memory in CUDA) in bytes", + "type": "integer", + "minimum": 0 + }, + "private_memory_size": { + "description": "Private memory (local memory in CUDA) per work-item in bytes", + "type": "integer", + "minimum": 0 + }, + "constant_memory_size": { + "description": "User-allocated constant memory in bytes (CUDA only, 0 for OpenCL)", + "type": "integer", + "minimum": 0 + }, + "registers": { + "description": "Number of registers per work-item (CUDA only, 0 for OpenCL)", + "type": "integer", + "minimum": 0 + }, + "global_size": { + "description": "Global thread dimensions (NDRange in OpenCL, grid dimensions in CUDA)", + "type": "object", + "properties": { + "x": { + "description": "Size in X dimension", + "type": "integer", + "minimum": 1 + }, + "y": { + "description": "Size in Y dimension", + "type": "integer", + "minimum": 1 + }, + "z": { + "description": "Size in Z dimension", + "type": "integer", + "minimum": 1 + } + }, + "required": ["x", "y", "z"] + }, + "local_size": { + "description": "Local work-group dimensions (work-group size in OpenCL, thread block size in CUDA)", + "type": "object", + "properties": { + "x": { + "description": "Size in X dimension", + "type": "integer", + "minimum": 1 + }, + "y": { + "description": "Size in Y dimension", + "type": "integer", + "minimum": 1 + }, + "z": { + "description": "Size in Z dimension", + "type": "integer", + "minimum": 1 + } + }, + "required": ["x", "y", "z"] + } + }, + "required": [ + "max_work_group_size", + "local_memory_size", + "private_memory_size", + "constant_memory_size", + "registers", + "global_size", + "local_size" + ] } }, "required": [ @@ -88,4 +230,4 @@ } } } -} \ No newline at end of file +} From bce5a096ae2c36c51a7c131c99f942ebe040c625 Mon Sep 17 00:00:00 2001 From: Jana Hozzova Date: Tue, 10 Mar 2026 09:46:11 +0100 Subject: [PATCH 2/9] Add descriptions and examples to T4 results schema Also fix the bug in pattern for version, dots need to be escaped --- src/autotuning_methodology/schemas/T4.json | 41 ++++++++++++++++------ 1 file changed, 31 insertions(+), 10 deletions(-) diff --git a/src/autotuning_methodology/schemas/T4.json b/src/autotuning_methodology/schemas/T4.json index 4e3368c..04af118 100644 --- a/src/autotuning_methodology/schemas/T4.json +++ b/src/autotuning_methodology/schemas/T4.json @@ -7,7 +7,7 @@ "schema_version": { "description": "The version number of the schema in major.minor.patch format.", "type": "string", - "pattern": "^[0-9]{1,}.[0-9]{1,}.[0-9]{1,}$", + "pattern": "^[0-9]{1,}\\.[0-9]{1,}\\.[0-9]{1,}$", "examples": ["1.1.0"] }, "metadata": { @@ -48,35 +48,52 @@ } }, "results": { + "description": "Array of tuning results, one per tested configuration", "type": "array", "items": { "type": "object", "properties": { "timestamp": { + "description": "ISO 8601 timestamp when this configuration was evaluated", "type": "string" }, "configuration": { + "description": "The parameter configuration tested. Keys are parameter names, values are parameter values.", "type": "object" }, "objectives": { - "type": "array" + "description": "List of optimization objectives for this result", + "type": "array", + "items": { + "type": "string" + }, + "examples": ["time"] }, "times": { + "description": "Breakdown of time measurements for this configuration", "type": "object", "properties": { "compilation_time": { + "description": "Time spent compiling the kernel function", "type": "number" }, "runtimes": { - "type": "array" + "description": "Array of kernel runtime measurements", + "type": "array", + "items": { + "type": "number" + } }, "framework": { + "description": "Total framework overhead (sum of data, profiling, and kernel overhead)", "type": "number" }, "search_algorithm": { + "description": "Time spent by the search algorithm selecting this configuration", "type": "number" }, "validation": { + "description": "Time spent validating correctness of results", "type": "number" }, "data": { @@ -98,6 +115,7 @@ } }, "invalidity": { + "description": "Status indicating whether the configuration is valid or the reason for invalidity", "enum": [ "timeout", "compile", @@ -108,24 +126,27 @@ ] }, "correctness": { - "type": "number" + "description": "Binary indicator of correctness (1 = correct, 0 = incorrect)", + "type": "number", + "enum": [0, 1] }, "measurements": { + "description": "Array of measurements including runtime and optional profiling counters", "type": "array", "items": { "type": "object", "properties": { "name": { - "type": "string" + "description": "Name of the measurement or profiling counter", + "type": "string", + "example": "time" }, "value": { - "type": [ - "number", - "string", - "array" - ] + "description": "The measured value", + "type": ["number", "string", "array"] }, "unit": { + "description": "Unit of measurement (empty string if dimensionless or in metadata timeunit)", "type": "string" }, "type": { From 6f5bd03d6bfbcae24f6c0186962d1b4555382e20 Mon Sep 17 00:00:00 2001 From: Jana Hozzova Date: Thu, 15 Oct 2026 13:37:46 +0200 Subject: [PATCH 3/9] Reorganize metadata in T4.json Restructure existing metadata fields into three semantic categories: - compute: API, platform, device (compute_api renamed to api) - framework: autotuner, version, backend (shortened field names) - session: timestamp, timeunit (explicit ISO 8601 format) Group by purpose instead of keeping one flat bag of keys, so a reader can tell at a glance which part of a run a field describes. The flat layout was already getting hard to follow and we are about to add a lot more metadata on top of it. Note that metadata.timeunit moves to metadata.session.timeunit, and that key is read in production. The readers are updated later in this branch. All fields remain optional. No functional changes, just cleaner organization. --- src/autotuning_methodology/schemas/T4.json | 83 ++++++++++++++-------- 1 file changed, 55 insertions(+), 28 deletions(-) diff --git a/src/autotuning_methodology/schemas/T4.json b/src/autotuning_methodology/schemas/T4.json index 04af118..f8758fd 100644 --- a/src/autotuning_methodology/schemas/T4.json +++ b/src/autotuning_methodology/schemas/T4.json @@ -14,36 +14,63 @@ "description": "Metadata about the tuning environment and execution context", "type": "object", "properties": { - "compute_api": { - "description": "The compute API used for kernel execution", - "type": "string", - "enum": ["OpenCL", "CUDA", "Vulkan"] - }, - "platform": { - "description": "The compute platform name (e.g., vendor SDK)", - "type": "string" - }, - "device": { - "description": "The compute device name", - "type": "string" - }, - "autotuner": { - "description": "The name of the autotuning framework", - "type": "string", - "examples": ["KTT","KernelTuner"] - }, - "autotuner_version": { - "description": "The version of the autotuning framework", - "type": "string" + "compute": { + "description": "Compute API and device configuration used for kernel execution", + "type": "object", + "properties": { + "api": { + "description": "The compute API used for kernel execution", + "type": "string", + "examples": ["OpenCL", "CUDA", "Vulkan", "HIP", "SYCL"] + }, + "platform": { + "description": "The compute platform name (e.g., vendor SDK version)", + "type": "string", + "examples": ["NVIDIA CUDA 12.1", "AMD ROCm 5.6.0"] + }, + "device": { + "description": "The compute device name as reported by the API", + "type": "string", + "examples": ["NVIDIA A100-SXM4-40GB", "AMD Instinct MI250X"] + } + } }, - "timestamp": { - "description": "Timestamp when the tuning session started", - "type": "string" + "framework": { + "description": "Autotuning framework identification and configuration", + "type": "object", + "properties": { + "autotuner": { + "description": "The name of the autotuning framework", + "type": "string", + "examples": ["KernelTuner", "KTT", "CLTune", "ATF"] + }, + "version": { + "description": "The version of the autotuning framework", + "type": "string", + "examples": ["1.0.0", "2.3.1"] + }, + "backend": { + "description": "The backend used by the autotuning framework (when applicable)", + "type": "string", + "examples": ["PyCUDA", "CuPy", "HIP", "cupy"] + } + } }, - "timeunit": { - "description": "The time unit used for all time measurements in the results", - "type": "string", - "enum": ["nanoseconds", "microseconds", "milliseconds", "seconds"] + "session": { + "description": "Tuning session timing and measurement configuration", + "type": "object", + "properties": { + "timestamp": { + "description": "ISO 8601 UTC timestamp when the tuning session started", + "type": "string", + "examples": ["2024-03-15T14:30:00Z"] + }, + "timeunit": { + "description": "The default time unit used for runtime measurements in the results", + "type": "string", + "enum": ["nanoseconds", "microseconds", "milliseconds", "seconds"] + } + } } } }, From 28d1a80899685d54c57ba64a33918bcbbfd1eb09 Mon Sep 17 00:00:00 2001 From: Jana Hozzova Date: Thu, 15 Oct 2026 13:37:46 +0200 Subject: [PATCH 4/9] Add hardware.accelerators to metadata in T4.json Add vendor-neutral accelerators array supporting NVIDIA, AMD, Intel, and future GPU vendors without schema updates. Each entry contains: - vendor: string identifier (nvidia, amd, intel, etc.) - tool: optional query tool name (nvidia-smi, rocm-smi, etc.) - data: raw tool output as JSON object Model this as an array rather than vendor-named fields so a host with two different accelerators, or a vendor we have not heard of yet, needs no schema change. Keep data unconstrained: every query tool prints a different shape and the shape moves between tool versions, and we would rather keep the whole output than normalise it away. Handles multi-GPU and heterogeneous systems. Required fields: vendor and data. --- src/autotuning_methodology/schemas/T4.json | 30 ++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/src/autotuning_methodology/schemas/T4.json b/src/autotuning_methodology/schemas/T4.json index f8758fd..cede01b 100644 --- a/src/autotuning_methodology/schemas/T4.json +++ b/src/autotuning_methodology/schemas/T4.json @@ -71,6 +71,36 @@ "enum": ["nanoseconds", "microseconds", "milliseconds", "seconds"] } } + }, + "hardware": { + "description": "Hardware inventory collected via system introspection tools", + "type": "object", + "properties": { + "accelerators": { + "description": "Array of GPU/accelerator devices. Each entry represents one device or device query tool output. Supports heterogeneous systems with multiple vendor accelerators.", + "type": "array", + "items": { + "type": "object", + "properties": { + "vendor": { + "description": "Accelerator vendor identifier. Use consistent naming: 'nvidia', 'amd', 'intel' for common vendors.", + "type": "string", + "examples": ["nvidia", "amd", "intel", "apple"] + }, + "tool": { + "description": "The tool used to query device information", + "type": "string", + "examples": ["nvidia-smi", "rocm-smi", "clinfo", "system_profiler"] + }, + "data": { + "description": "Raw tool output converted to JSON. Structure varies by tool and version. For nvidia-smi: XML output converted to JSON with processes removed for privacy.", + "type": "object" + } + }, + "required": ["vendor", "data"] + } + } + } } } }, From fed35ffdde10ebd9a4a4a10b9c3b273ab870b73d Mon Sep 17 00:00:00 2001 From: Jana Hozzova Date: Thu, 15 Oct 2026 13:37:46 +0200 Subject: [PATCH 5/9] Add cpu, memory, storage, system to hardware in T4.json Add remaining hardware inventory fields to metadata.hardware: - cpu: lscpu JSON output (architecture, cores, cache) - memory: /proc/meminfo parsed (total, free, swap) - storage: lsblk array (devices, sizes, mounts) - system: lshw hardware tree (motherboard, buses, peripherals) Constrain only the container type of each field and leave the keys inside alone. Writing a normalised schema per tool would mean chasing every tool's output format forever, and the point of these fields is to keep what the tool said so a result can be reproduced later. All fields accept raw tool output as JSON. Privacy note: lshw should use -sanitize flag to remove serial numbers. --- src/autotuning_methodology/schemas/T4.json | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/autotuning_methodology/schemas/T4.json b/src/autotuning_methodology/schemas/T4.json index cede01b..3f970f4 100644 --- a/src/autotuning_methodology/schemas/T4.json +++ b/src/autotuning_methodology/schemas/T4.json @@ -99,6 +99,25 @@ }, "required": ["vendor", "data"] } + }, + "cpu": { + "description": "CPU information from lscpu --json output. Contains processor architecture, model, cores, threads, cache sizes, and capabilities.", + "type": "object" + }, + "memory": { + "description": "Memory information from /proc/meminfo parsed to JSON. Includes total/free/available memory, swap, buffers, and cache statistics.", + "type": "object" + }, + "storage": { + "description": "Block device information from lsblk output parsed to JSON. Array of storage devices with name, size, type, and mount points.", + "type": "array", + "items": { + "type": "object" + } + }, + "system": { + "description": "General hardware information from lshw -json -sanitize. Complete system hardware tree including motherboard, buses, and peripherals. The -sanitize flag removes serial numbers for privacy.", + "type": "object" } } } From 89b048d4fef4b86c3adb091aca4a112b170f301c Mon Sep 17 00:00:00 2001 From: Jana Hozzova Date: Thu, 15 Oct 2026 13:37:46 +0200 Subject: [PATCH 6/9] Add environment metadata section in T4.json Add metadata.environment with software environment fields: - os_info: lsb_release output (distro, version, codename) - hostname: system identifier for multi-node tracking - python_requirements: dependency list from requirements.txt - software: key-value object for compiler/library versions Keep software as a plain name-to-version map: the common case is exactly that, and a value can still be an object when a tool needs to record a path or flags. All fields optional. Software uses additionalProperties for flexibility with tool-specific metadata. --- src/autotuning_methodology/schemas/T4.json | 46 ++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/src/autotuning_methodology/schemas/T4.json b/src/autotuning_methodology/schemas/T4.json index 3f970f4..fec3c80 100644 --- a/src/autotuning_methodology/schemas/T4.json +++ b/src/autotuning_methodology/schemas/T4.json @@ -120,6 +120,52 @@ "type": "object" } } + }, + "environment": { + "description": "Software environment metadata including OS, hostname, dependencies, and toolchain", + "type": "object", + "properties": { + "os_info": { + "description": "Operating system information from lsb_release -a output parsed to JSON. Contains distribution name, version, codename, and description.", + "type": "object", + "examples": [ + { + "Distributor ID": "Ubuntu", + "Description": "Ubuntu 22.04.3 LTS", + "Release": "22.04", + "Codename": "jammy" + } + ] + }, + "hostname": { + "description": "System hostname from the hostname command. Useful for distinguishing results from different machines or cluster nodes.", + "type": "string", + "examples": ["gpu-node-01", "workstation.example.com"] + }, + "python_requirements": { + "description": "Python package dependencies from requirements.txt. Array of requirement specifier strings.", + "type": "array", + "items": { + "type": "string" + }, + "examples": [["numpy>=1.24.0", "kernel_tuner==1.0.0", "cuda-python==12.1.0"]] + }, + "software": { + "description": "Compilers, libraries, and toolkits used for kernel compilation and execution. Keys are tool/library names, values are typically version strings but can be objects with additional metadata.", + "type": "object", + "additionalProperties": true, + "examples": [ + { + "gcc": "11.4.0", + "nvcc": "12.1.105", + "cuda-toolkit": "12.1", + "rocm": "5.6.0", + "openblas": "0.3.21", + "cmake": "3.27.0" + } + ] + } + } } } }, From 6c5c178e12e52427612cea1d03523125a2642c38 Mon Sep 17 00:00:00 2001 From: Jana Hozzova Date: Thu, 15 Oct 2026 13:37:46 +0200 Subject: [PATCH 7/9] Add metadata.doi field to T4.json Add DOI field for archival identifiers. Pattern validates standard DOI format (10.{registrant}/{suffix}). Examples included for common repositories: Zenodo, Figshare, OSF. Validate the format so a resolver URL or a half-copied identifier gets caught on write instead of on someone else's read. Optional field typically added post-publication. Provides permanent citable link to complete dataset. --- src/autotuning_methodology/schemas/T4.json | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/autotuning_methodology/schemas/T4.json b/src/autotuning_methodology/schemas/T4.json index fec3c80..0bbedad 100644 --- a/src/autotuning_methodology/schemas/T4.json +++ b/src/autotuning_methodology/schemas/T4.json @@ -166,6 +166,12 @@ ] } } + }, + "doi": { + "description": "Digital Object Identifier (DOI) for archived results. Added after publishing to a repository like Zenodo, Figshare, or institutional archives. The DOI provides a permanent, citable link to the complete dataset.", + "type": "string", + "pattern": "^10\\.\\d{4,9}/[-._;()/:A-Za-z0-9]+$", + "examples": ["10.5281/zenodo.1234567", "10.6084/m9.figshare.9876543", "10.17605/OSF.IO/ABC123"] } } }, From 2df6085ce10b314ad33f97d7a8202c3bfb42d38f Mon Sep 17 00:00:00 2001 From: Jana Hozzova Date: Thu, 15 Oct 2026 13:43:56 +0200 Subject: [PATCH 8/9] Update description and doc of T4 schema changes Update schema description to reflect comprehensive metadata support. Add a README describing the six metadata categories and their purpose. --- src/autotuning_methodology/schemas/README.md | 178 +++++++++++++++++++ src/autotuning_methodology/schemas/T4.json | 2 +- 2 files changed, 179 insertions(+), 1 deletion(-) create mode 100644 src/autotuning_methodology/schemas/README.md diff --git a/src/autotuning_methodology/schemas/README.md b/src/autotuning_methodology/schemas/README.md new file mode 100644 index 0000000..210112a --- /dev/null +++ b/src/autotuning_methodology/schemas/README.md @@ -0,0 +1,178 @@ +# T4: Open Autotuning Results Schema + +`T4.json` is a [JSON Schema](https://json-schema.org/draft/2020-12/schema) (Draft 2020-12) +describing the output format autotuning frameworks write their results in. A T4 document has +three top-level members: + +| Member | Purpose | +| --- | --- | +| `schema_version` | Version of this schema the document follows, in `major.minor.patch` form. | +| `metadata` | Everything about the environment the tuning session ran in. | +| `results` | One entry per tested configuration: its parameters, timings and validity. | + +## Metadata structure + +The `metadata` object captures comprehensive reproducibility information organized into six +categories. **Every category, and every field within a category, is optional** — collect what +the machine can tell you and leave the rest out. + +### Compute + +What the kernels ran on, as the compute API reports it. + +- `api` — compute API (`CUDA`, `OpenCL`, `HIP`, `SYCL`, `Vulkan`) +- `platform` — SDK/platform version, e.g. `NVIDIA CUDA 12.1` +- `device` — device name as reported by the API + +### Framework + +Which autotuner orchestrated the session. + +- `autotuner` — framework name (`KernelTuner`, `KTT`, `CLTune`, `ATF`) +- `version` — framework version +- `backend` — backend implementation (`PyCUDA`, `CuPy`, `HIP`), if the framework has one + +### Session + +When the session ran and how its numbers should be read. + +- `timestamp` — ISO 8601 UTC start time, e.g. `2024-03-15T14:30:00Z` +- `timeunit` — unit for the runtime measurements in `results`, one of `nanoseconds`, + `microseconds`, `milliseconds`, `seconds` + +### Hardware + +Hardware inventory, stored as the raw JSON the introspection tools produce. The schema fixes +only each field's container type; the keys inside are whatever the tool printed, so a newer +tool version does not need a schema change. + +- `accelerators` — array of GPU/accelerator entries, vendor-neutral so heterogeneous and + multi-GPU hosts both fit. Each entry needs a `vendor` (`nvidia`, `amd`, `intel`, `apple`) + and its `data`; `tool` names the query tool (`nvidia-smi`, `rocm-smi`, `clinfo`, + `system_profiler`) that produced it. +- `cpu` — `lscpu --json` output (architecture, cores, cache) +- `memory` — `/proc/meminfo` parsed to JSON (total, free, swap) +- `storage` — `lsblk` array (devices, sizes, mount points) +- `system` — `lshw` hardware tree (motherboard, buses, peripherals) + +### Environment + +The software side of the same question. + +- `os_info` — `lsb_release -a` output parsed to JSON (distribution, version, codename) +- `hostname` — system identifier, useful for multi-node runs +- `python_requirements` — array of requirement specifier strings, as `requirements.txt` holds + them +- `software` — map of tool name to version (`gcc`, `nvcc`, `cuda-toolkit`, `cmake`, …). A value + is normally a version string, but may be an object when a path or build flags are worth + recording. + +### DOI + +- `doi` — Digital Object Identifier of the archived dataset, validated against the standard + `10.{registrant}/{suffix}` form. Added after publishing to Zenodo, Figshare, OSF or an + institutional archive, so whoever holds the file can find the archive it came from. + +## Metadata collection workflow + +### System metadata collection + +A collector script (the reference implementation is `metadata.py` from +[odgaard/TuningSchema](https://github.com/odgaard/TuningSchema)) gathers the hardware and +environment data and emits JSON shaped like the two matching metadata categories: + +```json +{ + "hardware": { + "accelerators": [], + "cpu": {}, + "memory": {}, + "storage": [], + "system": {} + }, + "environment": { + "os_info": {}, + "hostname": "gpu-node-01", + "python_requirements": [], + "software": {} + } +} +``` + +The collection commands behind those fields: + +| Field | Command | +| --- | --- | +| `hardware.accelerators` | `nvidia-smi --query -x`, `rocm-smi`, `clinfo` → JSON | +| `hardware.cpu` | `lscpu --json` | +| `hardware.memory` | `cat /proc/meminfo` → JSON | +| `hardware.storage` | `lsblk -a` → JSON | +| `hardware.system` | `lshw -json -sanitize` | +| `environment.os_info` | `lsb_release -a` → JSON | +| `environment.hostname` | `hostname` | +| `environment.python_requirements` | `requirements.txt` | +| `environment.software` | `gcc --version`, `nvcc --version`, … | + +**Privacy.** Strip the `` section from `nvidia-smi` output and always pass +`-sanitize` to `lshw` so serial numbers stay out of the file. Note that `hostname` can reveal +internal network topology, and absolute paths can reveal directory structure; document +whatever measures you took. + +### Merging into T4 results + +The autotuning framework merges the collected system metadata with the metadata it knows +itself (compute, framework, session): + +**Python** + +```python +import json + +with open("system-metadata.json") as system_metadata_file: + system_metadata = json.load(system_metadata_file) + +output = { + "schema_version": "1.1.0", + "metadata": { + "compute": {"api": "CUDA", "platform": "NVIDIA CUDA 12.1", "device": "NVIDIA A100-SXM4-40GB"}, + "framework": {"autotuner": "KernelTuner", "version": "1.0.0", "backend": "PyCUDA"}, + "session": {"timestamp": "2024-03-15T14:30:00Z", "timeunit": "milliseconds"}, + **system_metadata, # adds hardware and environment + }, + "results": [], +} +``` + +**C++ (nlohmann/json)** + +```cpp +#include +using json = nlohmann::json; + +json system_metadata = /* load from file */; +json output = { + {"schema_version", "1.1.0"}, + {"metadata", { + {"compute", {{"api", "CUDA"}, {"platform", "NVIDIA CUDA 12.1"}, {"device", "NVIDIA A100-SXM4-40GB"}}}, + {"framework", {{"autotuner", "KTT"}, {"version", "1.0.0"}}}, + {"session", {{"timestamp", "2024-03-15T14:30:00Z"}, {"timeunit", "milliseconds"}}}, + {"hardware", system_metadata["hardware"]}, + {"environment", system_metadata["environment"]} + }}, + {"results", json::array()} +}; +``` + +## Validating a results file + +```python +import json +from jsonschema import validate + +with open("T4.json") as schema_file: + schema = json.load(schema_file) +with open("my-results.json") as results_file: + validate(instance=json.load(results_file), schema=schema) +``` + +`ajv` (JavaScript) and [jsonschemavalidator.net](https://www.jsonschemavalidator.net) work too. diff --git a/src/autotuning_methodology/schemas/T4.json b/src/autotuning_methodology/schemas/T4.json index 0bbedad..3af754d 100644 --- a/src/autotuning_methodology/schemas/T4.json +++ b/src/autotuning_methodology/schemas/T4.json @@ -1,7 +1,7 @@ { "$schema": "https://json-schema.org/draft/2020-12/schema", "$id": "https://github.com/AutoTuningAssociation/autotuning_methodology/blob/main/src/autotuning_methodology/schemas/T4.json", - "description": "Open Autotuning Results Schema", + "description": "Open Autotuning Results Schema with comprehensive hardware and environment metadata", "type": "object", "properties": { "schema_version": { From 80b3590b7cb245913fe440c3b0e4b1e63e02f578 Mon Sep 17 00:00:00 2001 From: Jana Hozzova Date: Thu, 15 Oct 2026 13:43:56 +0200 Subject: [PATCH 9/9] Read the time unit from the reorganized metadata Fix a silent 1000x error the metadata reorganization introduced. Both readers of the time unit still looked for the flat metadata.timeunit key that moved to metadata.session.timeunit, and metadata does not forbid unknown keys, so a file written the way the new README says validated cleanly and then fell through to the "seconds" default. Every objective time, time budget and curve came out 1000x too large for a file in milliseconds, 10^9x for nanoseconds, with no warning and entirely plausible-looking plots. Add get_T4_timeunit to the formats interface and call it from both sites. It prefers metadata.session.timeunit and falls back to the flat key, so files written before the reorganization -- including this repo's own integration fixture -- keep working. --- .../formats_interface.py | 18 ++++++++++++++++++ src/autotuning_methodology/runner.py | 3 ++- .../searchspace_statistics.py | 4 ++-- 3 files changed, 22 insertions(+), 3 deletions(-) diff --git a/src/autotuning_methodology/formats_interface.py b/src/autotuning_methodology/formats_interface.py index 4d6fa58..f2b2538 100644 --- a/src/autotuning_methodology/formats_interface.py +++ b/src/autotuning_methodology/formats_interface.py @@ -5,6 +5,24 @@ from autotuning_methodology.validators import validate_T4 +def get_T4_timeunit(metadata: dict) -> str: + """Get the time unit the runtime measurements of a T4 file are expressed in. + + Reads ``metadata.session.timeunit``, falling back to the flat ``metadata.timeunit`` key used + before the metadata reorganization, and to seconds when the file names no unit at all. + + Args: + metadata: the ``metadata`` object of a T4 document. + + Returns: + the name of the time unit. + """ + session_timeunit = metadata.get("session", {}).get("timeunit") + if session_timeunit is not None: + return session_timeunit + return metadata.get("timeunit", "seconds") + + def load_T4_format(filepath: Path, validate: True) -> dict: """Load and optionally validate a T4 format file.""" with open(filepath, "r", encoding="utf-8") as fh: diff --git a/src/autotuning_methodology/runner.py b/src/autotuning_methodology/runner.py index 6035a97..2ce27e8 100755 --- a/src/autotuning_methodology/runner.py +++ b/src/autotuning_methodology/runner.py @@ -18,6 +18,7 @@ import yappi from autotuning_methodology.caching import ResultsDescription +from autotuning_methodology.formats_interface import get_T4_timeunit from autotuning_methodology.searchspace_statistics import SearchspaceStatistics, convert_from_time_unit from autotuning_methodology.validators import ( is_invalid_objective_performance, @@ -200,7 +201,7 @@ def tune_with_KTT(): raise ValueError(f"Invalid autotuning framework '{group['autotuner']}'") # convert time units - timeunit: str = results.get("metadata", {}).get("timeunit", "seconds") + timeunit: str = get_T4_timeunit(results.get("metadata", {})) for result in results["results"]: for k, v in result["times"].items(): result["times"][k] = convert_from_time_unit(v, timeunit) diff --git a/src/autotuning_methodology/searchspace_statistics.py b/src/autotuning_methodology/searchspace_statistics.py index 43d46c7..f5ca53f 100644 --- a/src/autotuning_methodology/searchspace_statistics.py +++ b/src/autotuning_methodology/searchspace_statistics.py @@ -9,7 +9,7 @@ import matplotlib.pyplot as plt import numpy as np -from autotuning_methodology.formats_interface import load_T4_format +from autotuning_methodology.formats_interface import get_T4_timeunit, load_T4_format from autotuning_methodology.validators import is_invalid_objective_performance, is_invalid_objective_time @@ -428,7 +428,7 @@ def _load(self, validate=True) -> bool: filepath = self.get_valid_filepath() data = load_T4_format(filepath, validate=validate) metadata: dict = data.get("metadata", {}) - timeunit = metadata.get("timeunit", "seconds") + timeunit = get_T4_timeunit(metadata) results: dict = data["results"] self.results = results