From b8c8a1b0e6b839933b62a1464fdd97c572fee0cb Mon Sep 17 00:00:00 2001 From: Guillaume Raffy Date: Fri, 21 Jun 2024 14:48:00 +0200 Subject: [PATCH] turned starbench into an installable package work related to [https://bugzilla.ipr.univ-rennes.fr/show_bug.cgi?id=3878] --- .gitignore | 3 +++ README.md | 23 +++++++++++++++++++++- pyproject.toml | 28 +++++++++++++++++++++++++++ setup.py | 6 ++++++ src/starbench/__init__.py | 0 starbench.py => src/starbench/main.py | 1 + 6 files changed, 60 insertions(+), 1 deletion(-) create mode 100644 .gitignore create mode 100644 pyproject.toml create mode 100644 setup.py create mode 100644 src/starbench/__init__.py rename starbench.py => src/starbench/main.py (99%) diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..c15e89f --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +src/starbench/__pycache__/ +dist/ +src/starbench.egg-info/ diff --git a/README.md b/README.md index 9655f37..32afe9a 100644 --- a/README.md +++ b/README.md @@ -22,5 +22,26 @@ then `starbench` will do the rest: ## example ```sh -starbench.py --git-repos-url https://github.com/hibridon/hibridon --code-version a3bed1c3ccfbca572003020d3e3d3b1ff3934fad --git-user g-raffy --git-pass-file "$HOME/.github/personal_access_tokens/bench.hibridon.cluster.ipr.univ-rennes1.fr.pat" --num-cores 2 --output-dir=/tmp/hibench --cmake-path=/opt/cmake/cmake-3.23.0/bin/cmake --cmake-option=-DCMAKE_BUILD_TYPE=Release --cmake-option=-DBUILD_TESTING=ON --benchmark-command='ctest --output-on-failure -L ^arch4_quick$' +bob@bob-ws2:~/work/starbench$ python3 -m venv ./starbench.venv +bob@bob-ws2:~/work/starbench$ source ./starbench.venv/bin/activate +bob@bob-ws2:~/work/starbench$ pip install wheel +Collecting wheel + Using cached wheel-0.43.0-py3-none-any.whl (65 kB) +Installing collected packages: wheel +Successfully installed wheel-0.43.0 +bob@bob-ws2:~/work/starbench$ pip install ./starbench.git +Processing ./starbench.git + Installing build dependencies ... done + WARNING: Missing build requirements in pyproject.toml for file:///home/bob/work/starbench/starbench.git. + WARNING: The project does not specify a build backend, and pip cannot fall back to setuptools without 'wheel'. + Getting requirements to build wheel ... done + Preparing wheel metadata ... done +Building wheels for collected packages: starbench + Building wheel for starbench (PEP 517) ... done + Created wheel for starbench: filename=starbench-1.0.0-py3-none-any.whl size=8011 sha256=a98c590fbc481722aed3512ae6345cce741615a17c24e67dc88070f85b616c4c + Stored in directory: /tmp/pip-ephem-wheel-cache-m_0xpm10/wheels/67/41/37/debf4c9251b719f84456398e144dffaa34d18ab336b529dc53 +Successfully built starbench +Installing collected packages: starbench +Successfully installed starbench-1.0.0 +bob@bob-ws2:~/work/starbench$ starbench --git-repos-url https://github.com/hibridon/hibridon --code-version a3bed1c3ccfbca572003020d3e3d3b1ff3934fad --git-user g-raffy --git-pass-file "$HOME/.github/personal_access_tokens/bench.hibridon.cluster.ipr.univ-rennes1.fr.pat" --num-cores 2 --output-dir=/tmp/hibench --cmake-path=/opt/cmake/cmake-3.23.0/bin/cmake --cmake-option=-DCMAKE_BUILD_TYPE=Release --cmake-option=-DBUILD_TESTING=ON --benchmark-command='ctest --output-on-failure -L ^arch4_quick$' ``` diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..2bff8c2 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,28 @@ +[build-system] +requires = ["setuptools"] +build-backup = "setuptools.build_meta" + +[project] +name = "starbench" +dynamic = ["version"] # the list of fields whose values are dicovered by the backend (eg __version__) +description = "a tool to benchmark a git cmake application using embarassingly parallel runs" +readme = "README.md" +keywords = ["benchmark", "hpc", "parallel", 'openmp'] +license = {text = "MIT License"} +dependencies = [ +# "cocluto >= 1.2" +# "cocluto@git+https://git.ipr.univ-rennes.fr/cellinfo/cocluto" +] +requires-python = ">= 3.8" +authors = [ + {name = "Guillaume Raffy", email = "guillaume.raffy@univ-rennes.fr"} +] + +[project.scripts] +starbench = "starbench.main:main" + +[project.urls] +Repository = "https://github.com/g-raffy/starbench" + +[tool.setuptools.dynamic] +version = {attr = "starbench.main.__version__"} diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..bac24a4 --- /dev/null +++ b/setup.py @@ -0,0 +1,6 @@ +#!/usr/bin/env python + +import setuptools + +if __name__ == "__main__": + setuptools.setup() diff --git a/src/starbench/__init__.py b/src/starbench/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/starbench.py b/src/starbench/main.py similarity index 99% rename from starbench.py rename to src/starbench/main.py index 5840db8..43f90d4 100755 --- a/starbench.py +++ b/src/starbench/main.py @@ -2,6 +2,7 @@ '''starbench is an application that is able to measure the execution time of a user software suite in various conditions (different build modes and different execution modes) ''' +__version__ = '1.0.0' import argparse import threading import subprocess