Skip to main content

A tool for automating benchmarks of programming assignments.

Project description

benchie

Release Build status codecov Commit activity License

A tool for automating benchmarks of programming assignments.

Installation

Install uv.

You can run the tool without installation using the following command:

uvx benchie --help

To install the tool in an environment, you can run:

uv venv
uv pip install benchie

Current support

Fetching assignments works for Dodona and subgit submissions.

Currently supported benchmarking:

  • execution time (hyperfine with or without a Docker container)
  • peak memory usage (memray)
    • (with_imports) uses python -m memray and includes the memory usage of the imports
    • (with_tracker) uses a median of 3 executions with memray.Tracker, which would not show the memory usage of the imports

Planned support

  • Docker support for memray
  • Support for GitHub Classroom

Run as a student

Example data

With the example data in this repository at solutions/ and data/ you can run the following command:

benchie run -S -e "example_sleep" -b hyperfine -b memray_tracker

The output will be stored in output/example_sleep/.

Run within a Docker container

First build and tag a local image with a specific name. Here we use the Dockerfile in the repository root:

docker build -t local_combio_project .

Then we can run a container from this image with the following command:

benchie run -S -e "example_sleep" -b hyperfine --docker_image local_combio_project

Memray is currently not yet supported in Docker containers.

Custom data

Put different implementations at solutions/{exercise_1}/{implementation_1}.py. Note that it's best to use double quotes '""' instead of single quotes "''" because of some current string parsing limitations.

Run the benchmark with disabled fetching of Dodona submissions and only the first 3 datasets:

benchie run -S -e "{exercise_1}" --subset_data 3

Output will be stored in output/{exercise_1}.

Run as a teacher

Fetch token from Dodona user profile and store as token file.

Setup recurrent job

  • Use deploy keys
  • Use git instead of https as git origin remote URL
  • setup cron job
  • copy conda init lines from ~/.bashrc to ~/.bashrc_conda

Use crontab -e to add a cron job (edit the repo path):

SHELL=/bin/bash
BASH_ENV=~/.bashrc_conda
0 * * * * conda activate combio_benchmark_2024; timeout --signal=KILL 1h benchie run -e "global_alignment" -fC >> ~/combio_benchmark_job.log 2>&1

Repository initiated with fpgmaas/cookiecutter-uv.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

benchie-0.0.3.tar.gz (16.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

benchie-0.0.3-py3-none-any.whl (17.1 kB view details)

Uploaded Python 3

File details

Details for the file benchie-0.0.3.tar.gz.

File metadata

  • Download URL: benchie-0.0.3.tar.gz
  • Upload date:
  • Size: 16.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for benchie-0.0.3.tar.gz
Algorithm Hash digest
SHA256 343641aab6eb85a4318527b84c11766b4f61f3c11296d5b7c4466506052a9c07
MD5 f73aad6c93a1670dc8040ef40d8406f9
BLAKE2b-256 deeebb5908a32c3f000a498b1d6713a819e613f6af2d6e8ef660192f28727423

See more details on using hashes here.

File details

Details for the file benchie-0.0.3-py3-none-any.whl.

File metadata

  • Download URL: benchie-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 17.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for benchie-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 9ffc9f1fa2989c3d4ec90b9928b9e328201f835a48902d626401fd627f640101
MD5 3e92ca1840f4bfd5fd8ceacbe400ec4e
BLAKE2b-256 14b2a624b75559095f683e9e3b53d81905ab3668faa9c6fa81c9b8bb6c802813

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page