dd4bench 0.0.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,7 @@
1
+ [codespell]
2
+ builtin = clear,rare,en-GB_to_en-US,names,informal,code
3
+ check-filenames =
4
+ check-hidden =
5
+ skip = */.git,*/build,*/prefix,*tests/data,*/.vscode,*/playground,*/py-venv,CODE_OF_CONDUCT.md
6
+ quiet-level = 2
7
+ ignore-words-list = jupyter
@@ -0,0 +1,37 @@
1
+ // Devcontainer for local development
2
+ // See https://github.com/key4hep/key4hep-images/ for available images
3
+ // Requires the host have
4
+ // a) CernVM-FS installed (see https://cvmfs.readthedocs.io/en/stable/cpt-quickstart.html for instructions)
5
+ // b) The necessary repositories mounted on the host machine; sudo mount -t cvmfs sw.hsf.org /cvmfs/sw.hsf.org
6
+ {
7
+ "name": "Key4HEP Dev",
8
+ "image": "ghcr.io/key4hep/key4hep-images/alma9-cvmfs:latest",
9
+
10
+ // Make sure CVMFS is mounted on the host (and bind-mounted):
11
+ "mounts": [
12
+ "source=/cvmfs,target=/cvmfs,type=bind"
13
+ ],
14
+
15
+ // "postCreateCommand" runs once after the container is created.
16
+ // Here, we append the source line to ~/.bashrc so new terminals pick it up.
17
+ "postCreateCommand": [
18
+ "bash",
19
+ "-c",
20
+ "echo 'source setup.sh' >> ~/.bashrc"
21
+ ],
22
+ // Install and activate vs code extensions for environment
23
+ "customizations": {
24
+ "vscode": {
25
+ "extensions": [
26
+ "ms-python.python",
27
+ "ms-toolsai.jupyter",
28
+ "ms-vscode.cpptools",
29
+ "llvm-vs-code-extensions.vscode-clangd",
30
+ "ms-vscode.cmake-tools",
31
+ "ibm.output-colorizer",
32
+ "charliermarsh.ruff",
33
+ "eamodio.gitlens"
34
+ ]
35
+ }
36
+ }
37
+ }
@@ -0,0 +1,47 @@
1
+ name: Pipeline
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - main
7
+ pull_request:
8
+ branches:
9
+ - main
10
+
11
+ env:
12
+ CONTAINER_IMAGE: ghcr.io/key4hep/key4hep-images/alma9
13
+
14
+ jobs:
15
+ run:
16
+ runs-on: ubuntu-latest
17
+ steps:
18
+ # Checkout code
19
+ - uses: actions/checkout@v4
20
+
21
+ # Set up CVMFS
22
+ - uses: cvmfs-contrib/github-action-cvmfs@v4
23
+
24
+ # Cache Matplotlib font cache directory
25
+ # to speed up the tests
26
+ - name: Cache Matplotlib font cache
27
+ uses: actions/cache@v4
28
+ with:
29
+ path: .cache/matplotlib
30
+ key: ${{ runner.os }}-matplotlib-cache
31
+
32
+ # Build and test in the container
33
+ - name: Build and test
34
+ run: |
35
+ docker run --rm \
36
+ --device /dev/fuse \
37
+ --cap-add SYS_ADMIN \
38
+ --volume /cvmfs:/cvmfs:shared \
39
+ --volume ${{ github.workspace }}:/workspace \
40
+ --workdir /workspace \
41
+ -e MPLCONFIGDIR=/workspace/.cache/matplotlib \
42
+ ${{ env.CONTAINER_IMAGE }} bash -c "
43
+
44
+ echo '::group::Set-up key4hep'
45
+ source setup.sh
46
+ echo "Hello World"
47
+ "
@@ -0,0 +1,31 @@
1
+ name: Publish to PyPI
2
+
3
+ on:
4
+ release:
5
+ types: [published]
6
+
7
+ jobs:
8
+ publish:
9
+ runs-on: ubuntu-latest
10
+ environment: pypi
11
+ permissions:
12
+ id-token: write
13
+
14
+ steps:
15
+ - uses: actions/checkout@v6
16
+ with:
17
+ fetch-depth: 0
18
+
19
+ - name: Set up Python
20
+ uses: actions/setup-python@v6
21
+ with:
22
+ python-version: "3.13"
23
+
24
+ - name: Install build tools
25
+ run: pip install build
26
+
27
+ - name: Build
28
+ run: python -m build
29
+
30
+ - name: Publish to PyPI
31
+ uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,21 @@
1
+ **/.DS_Store
2
+ .idea/
3
+ .vs/
4
+ .vscode/
5
+ build/
6
+ cmake-build-*/
7
+ prefix/
8
+ CMakeLists.txt.user
9
+ compile_commands.json
10
+ env.bat
11
+ env.ps1
12
+ Testing
13
+ test/output
14
+ __pycache__/
15
+ *.py[cod]
16
+ *$py.class
17
+ *.egg-info
18
+ playground/
19
+ tests/output
20
+ py-venv/
21
+ .env
@@ -0,0 +1,23 @@
1
+ - repo: https://github.com/charliermarsh/ruff-pre-commit
2
+ rev: "v0.15.12"
3
+ hooks:
4
+ # Run the linter.
5
+ - id: ruff
6
+ args: [ --fix ]
7
+ # Run the formatter.
8
+ - id: ruff-format
9
+
10
+ - repo: https://github.com/pre-commit/pre-commit-hooks
11
+ rev: "v6.0.0"
12
+ hooks:
13
+ - id: check-case-conflict
14
+ - id: check-merge-conflict
15
+ - id: check-toml
16
+ - id: check-yaml
17
+ - id: end-of-file-fixer
18
+ - id: trailing-whitespace
19
+
20
+ - repo: https://github.com/psf/black
21
+ rev: "26.3.1"
22
+ hooks:
23
+ - id: black
@@ -0,0 +1,133 @@
1
+
2
+ # Contributor Covenant Code of Conduct
3
+
4
+ ## Our Pledge
5
+
6
+ We as members, contributors, and leaders pledge to make participation in our
7
+ community a harassment-free experience for everyone, regardless of age, body
8
+ size, visible or invisible disability, ethnicity, sex characteristics, gender
9
+ identity and expression, level of experience, education, socio-economic status,
10
+ nationality, personal appearance, race, caste, color, religion, or sexual
11
+ identity and orientation.
12
+
13
+ We pledge to act and interact in ways that contribute to an open, welcoming,
14
+ diverse, inclusive, and healthy community.
15
+
16
+ ## Our Standards
17
+
18
+ Examples of behavior that contributes to a positive environment for our
19
+ community include:
20
+
21
+ * Demonstrating empathy and kindness toward other people
22
+ * Being respectful of differing opinions, viewpoints, and experiences
23
+ * Giving and gracefully accepting constructive feedback
24
+ * Accepting responsibility and apologizing to those affected by our mistakes,
25
+ and learning from the experience
26
+ * Focusing on what is best not just for us as individuals, but for the overall
27
+ community
28
+
29
+ Examples of unacceptable behavior include:
30
+
31
+ * The use of sexualized language or imagery, and sexual attention or advances of
32
+ any kind
33
+ * Trolling, insulting or derogatory comments, and personal or political attacks
34
+ * Public or private harassment
35
+ * Publishing others' private information, such as a physical or email address,
36
+ without their explicit permission
37
+ * Other conduct which could reasonably be considered inappropriate in a
38
+ professional setting
39
+
40
+ ## Enforcement Responsibilities
41
+
42
+ Community leaders are responsible for clarifying and enforcing our standards of
43
+ acceptable behavior and will take appropriate and fair corrective action in
44
+ response to any behavior that they deem inappropriate, threatening, offensive,
45
+ or harmful.
46
+
47
+ Community leaders have the right and responsibility to remove, edit, or reject
48
+ comments, commits, code, wiki edits, issues, and other contributions that are
49
+ not aligned to this Code of Conduct, and will communicate reasons for moderation
50
+ decisions when appropriate.
51
+
52
+ ## Scope
53
+
54
+ This Code of Conduct applies within all community spaces, and also applies when
55
+ an individual is officially representing the community in public spaces.
56
+ Examples of representing our community include using an official email address,
57
+ posting via an official social media account, or acting as an appointed
58
+ representative at an online or offline event.
59
+
60
+ ## Enforcement
61
+
62
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
63
+ reported to the community leaders responsible for enforcement.
64
+
65
+ All complaints will be reviewed and investigated promptly and fairly.
66
+
67
+ All community leaders are obligated to respect the privacy and security of the
68
+ reporter of any incident.
69
+
70
+ ## Enforcement Guidelines
71
+
72
+ Community leaders will follow these Community Impact Guidelines in determining
73
+ the consequences for any action they deem in violation of this Code of Conduct:
74
+
75
+ ### 1. Correction
76
+
77
+ **Community Impact**: Use of inappropriate language or other behavior deemed
78
+ unprofessional or unwelcome in the community.
79
+
80
+ **Consequence**: A private, written warning from community leaders, providing
81
+ clarity around the nature of the violation and an explanation of why the
82
+ behavior was inappropriate. A public apology may be requested.
83
+
84
+ ### 2. Warning
85
+
86
+ **Community Impact**: A violation through a single incident or series of
87
+ actions.
88
+
89
+ **Consequence**: A warning with consequences for continued behavior. No
90
+ interaction with the people involved, including unsolicited interaction with
91
+ those enforcing the Code of Conduct, for a specified period of time. This
92
+ includes avoiding interactions in community spaces as well as external channels
93
+ like social media. Violating these terms may lead to a temporary or permanent
94
+ ban.
95
+
96
+ ### 3. Temporary Ban
97
+
98
+ **Community Impact**: A serious violation of community standards, including
99
+ sustained inappropriate behavior.
100
+
101
+ **Consequence**: A temporary ban from any sort of interaction or public
102
+ communication with the community for a specified period of time. No public or
103
+ private interaction with the people involved, including unsolicited interaction
104
+ with those enforcing the Code of Conduct, is allowed during this period.
105
+ Violating these terms may lead to a permanent ban.
106
+
107
+ ### 4. Permanent Ban
108
+
109
+ **Community Impact**: Demonstrating a pattern of violation of community
110
+ standards, including sustained inappropriate behavior, harassment of an
111
+ individual, or aggression toward or disparagement of classes of individuals.
112
+
113
+ **Consequence**: A permanent ban from any sort of public interaction within the
114
+ community.
115
+
116
+ ## Attribution
117
+
118
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage],
119
+ version 2.1, available at
120
+ [https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].
121
+
122
+ Community Impact Guidelines were inspired by
123
+ [Mozilla's code of conduct enforcement ladder][Mozilla CoC].
124
+
125
+ For answers to common questions about this code of conduct, see the FAQ at
126
+ [https://www.contributor-covenant.org/faq][FAQ]. Translations are available at
127
+ [https://www.contributor-covenant.org/translations][translations].
128
+
129
+ [homepage]: https://www.contributor-covenant.org
130
+ [v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
131
+ [Mozilla CoC]: https://github.com/mozilla/diversity
132
+ [FAQ]: https://www.contributor-covenant.org/faq
133
+ [translations]: https://www.contributor-covenant.org/translations
dd4bench-0.0.1/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026, Joshua Falco Beirer
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,38 @@
1
+ Metadata-Version: 2.4
2
+ Name: dd4bench
3
+ Version: 0.0.1
4
+ Summary: Performance benchmarking for DD4hep-based simulations and reconstruction in Key4hep
5
+ Author-email: Joshua Falco Beirer <jbeirer@cern.ch>
6
+ Project-URL: Repository, https://github.com/jbeirer/DD4bench
7
+ Requires-Python: >=3.13
8
+ Description-Content-Type: text/markdown
9
+ License-File: LICENSE
10
+ Requires-Dist: pandas
11
+ Requires-Dist: matplotlib
12
+ Dynamic: license-file
13
+
14
+ # DD4bench
15
+
16
+ Performance benchmarking for DD4hep-based simulations and reconstruction in Key4hep.
17
+
18
+ ## Installation
19
+
20
+ ```bash
21
+ pip install dd4bench
22
+ ```
23
+
24
+ ## Basic Usage
25
+
26
+ ```python
27
+ from dd4bench import benchmark
28
+
29
+ result = benchmark.ddsim(
30
+ compact_file="ALLEGRO_o1_v03.xml",
31
+ ddsim_args={
32
+ "numberOfEvents": 100,
33
+ "gun.particle": "e-",
34
+ "gun.distribution": "uniform",
35
+ },
36
+ scan=True,
37
+ )
38
+ ```
@@ -0,0 +1,25 @@
1
+ # DD4bench
2
+
3
+ Performance benchmarking for DD4hep-based simulations and reconstruction in Key4hep.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ pip install dd4bench
9
+ ```
10
+
11
+ ## Basic Usage
12
+
13
+ ```python
14
+ from dd4bench import benchmark
15
+
16
+ result = benchmark.ddsim(
17
+ compact_file="ALLEGRO_o1_v03.xml",
18
+ ddsim_args={
19
+ "numberOfEvents": 100,
20
+ "gun.particle": "e-",
21
+ "gun.distribution": "uniform",
22
+ },
23
+ scan=True,
24
+ )
25
+ ```
@@ -0,0 +1,8 @@
1
+ """DD4bench — performance benchmarking for DD4hep-based simulations and reconstruction in Key4hep."""
2
+
3
+ from importlib.metadata import version, PackageNotFoundError
4
+
5
+ try:
6
+ __version__ = version("dd4bench")
7
+ except PackageNotFoundError:
8
+ __version__ = "unknown"
@@ -0,0 +1,38 @@
1
+ Metadata-Version: 2.4
2
+ Name: dd4bench
3
+ Version: 0.0.1
4
+ Summary: Performance benchmarking for DD4hep-based simulations and reconstruction in Key4hep
5
+ Author-email: Joshua Falco Beirer <jbeirer@cern.ch>
6
+ Project-URL: Repository, https://github.com/jbeirer/DD4bench
7
+ Requires-Python: >=3.13
8
+ Description-Content-Type: text/markdown
9
+ License-File: LICENSE
10
+ Requires-Dist: pandas
11
+ Requires-Dist: matplotlib
12
+ Dynamic: license-file
13
+
14
+ # DD4bench
15
+
16
+ Performance benchmarking for DD4hep-based simulations and reconstruction in Key4hep.
17
+
18
+ ## Installation
19
+
20
+ ```bash
21
+ pip install dd4bench
22
+ ```
23
+
24
+ ## Basic Usage
25
+
26
+ ```python
27
+ from dd4bench import benchmark
28
+
29
+ result = benchmark.ddsim(
30
+ compact_file="ALLEGRO_o1_v03.xml",
31
+ ddsim_args={
32
+ "numberOfEvents": 100,
33
+ "gun.particle": "e-",
34
+ "gun.distribution": "uniform",
35
+ },
36
+ scan=True,
37
+ )
38
+ ```
@@ -0,0 +1,19 @@
1
+ .codespellrc
2
+ .gitignore
3
+ .pre-commit-config.yaml
4
+ CODE_OF_CONDUCT.md
5
+ LICENSE
6
+ README.md
7
+ pyproject.toml
8
+ requirements.txt
9
+ setup.sh
10
+ .devcontainer/devcontainer.json
11
+ .github/workflows/ci.yml
12
+ .github/workflows/on-release-main.yml
13
+ dd4bench/__init__.py
14
+ dd4bench.egg-info/PKG-INFO
15
+ dd4bench.egg-info/SOURCES.txt
16
+ dd4bench.egg-info/dependency_links.txt
17
+ dd4bench.egg-info/entry_points.txt
18
+ dd4bench.egg-info/requires.txt
19
+ dd4bench.egg-info/top_level.txt
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ dd4bench = dd4bench.cli:main
@@ -0,0 +1,2 @@
1
+ pandas
2
+ matplotlib
@@ -0,0 +1 @@
1
+ dd4bench
@@ -0,0 +1,38 @@
1
+ [project]
2
+ name = "dd4bench"
3
+ dynamic = ["version"]
4
+ description = "Performance benchmarking for DD4hep-based simulations and reconstruction in Key4hep"
5
+ authors = [{name = "Joshua Falco Beirer", email = "jbeirer@cern.ch"}]
6
+ readme = "README.md"
7
+ requires-python = ">=3.13"
8
+ # Intended to run inside the Key4hep environment; dependency versions
9
+ # are determined by the Key4hep stack, so no version constraints are set.
10
+ dependencies = [
11
+ "pandas",
12
+ "matplotlib",
13
+ ]
14
+
15
+ [project.urls]
16
+ Repository = "https://github.com/jbeirer/DD4bench"
17
+
18
+ [project.scripts]
19
+ dd4bench = "dd4bench.cli:main"
20
+
21
+ [build-system]
22
+ requires = ["setuptools>=64", "setuptools-scm>=8"]
23
+ build-backend = "setuptools.build_meta"
24
+
25
+ [tool.setuptools.packages.find]
26
+ include = ["dd4bench*"]
27
+
28
+ [tool.setuptools_scm]
29
+ # version is derived automatically from git tags
30
+
31
+ [tool.pytest.ini_options]
32
+ markers = [
33
+ "integration: requires full Key4hep environment with ddsim",
34
+ ]
35
+
36
+ [tool.ruff]
37
+ line-length = 100
38
+ target-version = "py313"
@@ -0,0 +1,2 @@
1
+ codespell==2.4.2
2
+ pre-commit==4.6.0
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,74 @@
1
+ #!/bin/bash
2
+
3
+ # Use environment variable if set, otherwise use default version
4
+ KEY4HEP_VERSION=${KEY4HEP_VERSION:-"2026-04-08"}
5
+
6
+ # Setup Key4HEP environment only if not already set
7
+ if [ -z "$KEY4HEP_STACK" ]; then
8
+ source /cvmfs/sw.hsf.org/key4hep/setup.sh -r "${KEY4HEP_VERSION}"
9
+ else
10
+ echo "✅ KEY4HEP_STACK is already set. Skipping Key4HEP environment setup."
11
+ fi
12
+
13
+ # Set up python virtual environment only if it doesn't exist
14
+ mkdir -p ~/.local/bin
15
+ export PATH=~/.local/bin:"${PATH}"
16
+
17
+ # Download cvmfs-venv script if not already present
18
+ if [ ! -f ~/.local/bin/cvmfs-venv ]; then
19
+ curl -sL https://raw.githubusercontent.com/jbeirer/cvmfs-venv/main/cvmfs-venv.sh -o ~/.local/bin/cvmfs-venv
20
+ chmod +x ~/.local/bin/cvmfs-venv
21
+ fi
22
+
23
+ # Check if the virtual environment already exists
24
+ if [ ! -d "py-venv" ]; then
25
+ cvmfs-venv py-venv
26
+ else
27
+ echo "✅ Virtual environment 'py-venv' already exists. Skipping creation."
28
+ fi
29
+
30
+ # Check if the virtual environment is already activated
31
+ if [ -z "$VIRTUAL_ENV" ]; then
32
+ echo "🔄 Activating virtual environment..."
33
+ . py-venv/bin/activate
34
+ else
35
+ echo "✅ Virtual environment is already active."
36
+ fi
37
+
38
+ # Check if all required Python dependencies are installed
39
+ pip install --quiet --no-dependencies -r requirements.txt
40
+
41
+ # Check if pre-commit is already installed
42
+ if ! pre-commit --version &>/dev/null; then
43
+ echo "🔄 Installing pre-commit hooks..."
44
+ pre-commit install
45
+ else
46
+ echo "✅ Pre-commit hooks are already installed."
47
+ fi
48
+
49
+ # Capture all environment variables for the current session
50
+ # This allows us to use jupyter notebooks in the key4hep environment
51
+ ENV_FILE=".env"
52
+ echo "🔄 Saving all environment variables to .env file..."
53
+
54
+ # Use printenv to retrieve all environment variables and format them for a .env file.
55
+ #
56
+ # Exclusions:
57
+ # 1) Exclude PKG_CONFIG_PATH to prevent "execvp(3) failed: Argument list too long."
58
+ # - There is nothing special about PKG_CONFIG_PATH, but it is long and unnecessary.
59
+ # 2) Exclude all SINGULARITY and APPTAINER-related variables.
60
+ # - This helps avoid potential conflicts or issues with Singularity/Apptainer.
61
+
62
+ EXCLUDE_PATTERNS=(
63
+ PKG_CONFIG_PATH
64
+ ".*SINGULARITY.*"
65
+ ".*APPTAINER.*"
66
+ ALRB_CONT_IMAGE
67
+ )
68
+ # Convert patterns into a grep-compatible regex
69
+ EXCLUDE_REGEX="$(printf "|%s" "${EXCLUDE_PATTERNS[@]}" | cut -c2-)"
70
+
71
+ printenv | grep -vE "^(${EXCLUDE_REGEX})=" \
72
+ | awk -F= '{print $1"=\"" $2 "\""}' > "$ENV_FILE"
73
+
74
+ echo "✅ .env file created successfully."