Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .flake8
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ per-file-ignores =
# We should aim is to address all of these in the future
src/signaloid/distributional_information_plotting/*: C901
src/signaloid/distributional/*: C901
src/signaloid/benchmarking/*: C901
6 changes: 5 additions & 1 deletion .github/workflows/signaloid-python.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,18 @@ jobs:
ref: ${{ github.head_ref }}
fetch-depth: 0
fetch-tags: true
# The benchmarking build-template assets are a submodule, and
# `pyproject.toml` includes them in the built distributions.
submodules: recursive
token: ${{ secrets.CI_HELPER_PAT || github.token }}

- name: Debug
run: |
echo "github.event_name:" ${{ github.event_name }}
echo "github.event.pull_request.head.sha:" ${{ github.event.pull_request.head.sha }}
echo "github.sha:" ${{ github.sha }}
echo "github.event.release.tag_name:" ${{ github.event.release.tag_name }}
echo "contains(github.event.pull_request.labels, 'ci:upload-binaries'):" ${{ contains(github.event.pull_request.labels, 'ci:"upload-binaries') }}
echo "contains(github.event.pull_request.labels.*.name, 'ci:upload-binaries'):" ${{ contains(github.event.pull_request.labels.*.name, 'ci:upload-binaries') }}

- name: Set up Python
uses: actions/setup-python@v6
Expand Down
4 changes: 4 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[submodule "src/signaloid/benchmarking/assets"]
path = src/signaloid/benchmarking/assets
url = ../../signaloid/Signaloid-Demo-TemplateBuildAssets
branch = main
30 changes: 30 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ The Signaloid Python Library and SDK provides tools for interacting with
applications that utilize Signaloid's UxHw® technology for distributional
arithmetic. Use the library to analyze Ux Data values from the application.

Also, run benchmarking of applications to compare the performance with
equivalent Monte Carlo methods.

![signaloid-python diagram](images/signaloid-external-illustration-signaloid-python-diagram-flat-light-withCR.png#gh-light-mode-only)
![signaloid-python diagram](images/signaloid-external-illustration-signaloid-python-diagram-flat-dark-withCR.png#gh-dark-mode-only)

## Requirements

Expand All @@ -29,6 +34,31 @@ python -m pip install .

## Usage

### Benchmarking UxHw applications

Use the `signaloid-benchmarking` command-line tool to benchmark an application
running with UxHw against a Monte Carlo baseline. The following example
benchmarks for UxHw Core microarchitectures Athens and Jupiter for precisions 8,
16, and 32, for both types of correlation tracking.

```bash
python -m signaloid.benchmarking.automation \
--path-to-application ./my-uxhw-app \
--path-to-uxhw-sdk ~/project-uxhw-sdk \
--path-to-pin ~/pin-external-4.2 \
-u Athens Jupiter \
-s 8 16 32 \
-c Disabled Autocorrelation \
-r Mean
```

The tool needs access to the Signaloid UxHw SDK to build the applications for
UxHw, and access to the Intel Pin tool for accurate benchmarking. Arguments
`-u/--representation-types`, `-s/--representation-sizes`,
`-c/--uncertainty-correlation_types`, `-r/--reporting-methods` can also be
supplied using a YAML file with `--config <file>`.

For details, see the package [README.md](src/signaloid/benchmarking/automation/README.md).

### Parsing Ux Data
Construct `DistributionalValue` Python objects by parsing
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
32 changes: 30 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@ packages = [
{ include = "signaloid", from = "src" }
]

# The build-template assets are a submodule, so they must be listed explicitly
# to ship in the built distributions. Requires the submodule to be checked out
# at build time.
include = [
{ path = "src/signaloid/benchmarking/assets/**/*", format = ["sdist", "wheel"] },
]

[tool.poetry-dynamic-versioning]
enable = true
Expand Down Expand Up @@ -46,19 +52,41 @@ matplotlib = [
{ version = ">=3.10.0", python = ">=3.10,<3.14" },
{ version = ">=3.10.5", python = ">=3.10,<3.15" },
]
pillow = ">=12.2.0"
pillow = ">=12.3.0"
pyyaml = ">=6.0.0"
scipy = [
{ version = ">=1.13.0,<1.16.0", python = ">=3.10,<3.11" },
{ version = ">=1.14.0", python = ">=3.11" },
]

# Benchmarking sub-package application dependencies. These ship as plain
# (non-optional) dependencies so the benchmarking timing harness works on a
# straight install. Only the Google-Sheets reporting backend below remains an
# optional extra (see [tool.poetry.extras]).
pandas = "^2.0"
tabulate = "^0.9.0"
tqdm = "^4.66.2"
POT = ">=0.9.3"
gspread = { version = "^6.2.1", optional = true }
google-api-python-client = { version = "^2.171.0", optional = true }
oauth2client = { version = "^4.1.3", optional = true }
# These packages are transitive dependencies (coming via the Google-Sheets
# backend above). Here we pin them to their minimum secure versions.
# They are installed with the ``sheets`` extra.
pyasn1 = { version = ">=0.6.4", optional = true }
# rsa >=4.3 caps Python at <4, so the floor is scoped to python <4. For
# python >=4 it falls back to rsa's older unbounded release
# transitively, matching the existing resolution split.
rsa = { version = ">=4.7", optional = true, python = "<4" }
cryptography = { version = ">=50.0.0", optional = true }
httplib2 = { version = ">=0.32.0", optional = true }

[tool.poetry.extras]
sheets = ["gspread", "google-api-python-client", "oauth2client"]
sheets = ["gspread", "google-api-python-client", "oauth2client", "pyasn1", "rsa", "cryptography", "httplib2"]

[tool.poetry.scripts]
signaloid-uxdata-toolkit = "signaloid.uxdata_toolkit:main"
signaloid-benchmarking = "signaloid.benchmarking.automation.benchmark_application:main"

[tool.mypy]
warn_unused_configs = true
Expand Down
59 changes: 59 additions & 0 deletions src/signaloid/benchmarking/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# Copyright (c) 2026, Signaloid.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
# sell copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
# DEALINGS IN THE SOFTWARE.

"""Benchmarking tooling for distributional workloads.

Provides the timing harness and the equivalent-Monte-Carlo analysis that compares
Signaloid (UxHw) computations against Monte-Carlo references. The application-level
dependencies (``pandas``, ``tabulate``, ``tqdm``, ``POT``) install with the package.
The optional Google Sheets reporting backend is the ``sheets`` extra (install
``signaloid[sheets]`` to enable it).

The public API is the ``signaloid-benchmarking`` console script plus the symbols
re-exported here (the equivalent-Monte-Carlo analysis is also available as a library
API). Modules under ``automation`` are internal orchestration and not part of
the API.
"""

from signaloid.benchmarking.config import (
Correlations,
DistanceMetrics,
ReportingMethods,
RepresentationTypes,
VariableTypes,
)
from signaloid.benchmarking.equivalent_mc import (
LoadDataComputeEquivalentMCArgs,
anderson_darling_test,
load_data_and_compute_equivalent_mc,
)
from signaloid.benchmarking.types import BenchmarkingVariable

__all__ = [
"load_data_and_compute_equivalent_mc",
"LoadDataComputeEquivalentMCArgs",
"BenchmarkingVariable",
"DistanceMetrics",
"RepresentationTypes",
"Correlations",
"ReportingMethods",
"VariableTypes",
"anderson_darling_test",
]
1 change: 1 addition & 0 deletions src/signaloid/benchmarking/assets
Submodule assets added at e59a56
Loading
Loading