This is an automated email from the ASF dual-hosted git repository.
guanmingchiu pushed a commit to branch dev-qdp
in repository https://gitbox.apache.org/repos/asf/mahout.git
The following commit(s) were added to refs/heads/dev-qdp by this push:
new 8f20ddfbf [QDP] Add colab benchmark example (#755)
8f20ddfbf is described below
commit 8f20ddfbf73b7dc090e934c2e92771b6bf701d3a
Author: Ryan Huang <[email protected]>
AuthorDate: Fri Dec 26 10:12:29 2025 +0800
[QDP] Add colab benchmark example (#755)
* colab benchmark
* add link
* add link
* update with colab badge
* precommit
* renamed folder name to notebooks
* update link
---
qdp/benchmark/README.md | 6 +
qdp/benchmark/notebooks/mahout_benchmark.ipynb | 207 +++++++++++++++++++++++++
2 files changed, 213 insertions(+)
diff --git a/qdp/benchmark/README.md b/qdp/benchmark/README.md
new file mode 100644
index 000000000..e338d2545
--- /dev/null
+++ b/qdp/benchmark/README.md
@@ -0,0 +1,6 @@
+<!-- TODO: benchmark docs -->
+
+
+### We can also run benchmarks on colab notebooks(without owning a GPU)
+
+[](https://colab.research.google.com/github/apache/mahout/blob/colab-benchmark/qdp/benchmark/notebooks/mahout_benchmark.ipynb)
diff --git a/qdp/benchmark/notebooks/mahout_benchmark.ipynb
b/qdp/benchmark/notebooks/mahout_benchmark.ipynb
new file mode 100644
index 000000000..81fd746fd
--- /dev/null
+++ b/qdp/benchmark/notebooks/mahout_benchmark.ipynb
@@ -0,0 +1,207 @@
+{
+ "cells": [
+ {
+ "cell_type": "markdown",
+ "metadata": {
+ "id": "pjstUzDHQHad"
+ },
+ "source": [
+ "## Install environments"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "colab": {
+ "base_uri": "https://localhost:8080/"
+ },
+ "collapsed": true,
+ "id": "-hkLubLFXs_8",
+ "outputId": "95dda2d2-2cff-4b99-8a19-ce47e6f67fa6"
+ },
+ "outputs": [],
+ "source": [
+ "!sudo apt-get update -y > /dev/null\n",
+ "!sudo apt-get install python3.11 python3.11-dev python3.11-distutils
libpython3.11-dev > /dev/null\n",
+ "!sudo apt-get install python3.11-venv binfmt-support > /dev/null\n",
+ "!sudo apt-get install python3-pip > /dev/null\n",
+ "!python3 -m pip install --upgrade pip > /dev/null\n",
+ "!python3 -m pip install ipykernel\n"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "colab": {
+ "base_uri": "https://localhost:8080/"
+ },
+ "collapsed": true,
+ "id": "_HEpQ4F3C4gV",
+ "outputId": "2f9969f4-313b-4652-ddf8-e538598532db"
+ },
+ "outputs": [],
+ "source": [
+ "# 1. Install Rust Toolchain\n",
+ "!curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s --
-y\n",
+ "import os\n",
+ "os.environ['PATH'] += \":/root/.cargo/bin\"\n",
+ "\n",
+ "# 2. Verify Installation\n",
+ "!rustc --version\n",
+ "!cargo --version\n",
+ "\n",
+ "# 3. Install Maturin (Build Backend for qdp-python)\n",
+ "!pip install maturin"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "colab": {
+ "base_uri": "https://localhost:8080/"
+ },
+ "collapsed": true,
+ "id": "ljkluVL5ES4S",
+ "outputId": "73b1d5c1-6580-4633-e774-f58a138e94b8"
+ },
+ "outputs": [],
+ "source": [
+ "!curl -LsSf https://astral.sh/uv/install.sh | sh"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "colab": {
+ "base_uri": "https://localhost:8080/"
+ },
+ "id": "9cgMNKOoEgYm",
+ "outputId": "24cec148-17c9-4dea-c47f-18d05e6b1911"
+ },
+ "outputs": [],
+ "source": [
+ "!nvcc --version\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {
+ "id": "rOja7HAaQL1h"
+ },
+ "source": [
+ "## Install Mahout"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "colab": {
+ "base_uri": "https://localhost:8080/"
+ },
+ "collapsed": true,
+ "id": "u7Skxs7lDBlq",
+ "outputId": "ff876484-54a0-4f92-ca9b-ff7003997ee6"
+ },
+ "outputs": [],
+ "source": [
+ "# 1. Clone the repository\n",
+ "!git clone -b dev-qdp https://github.com/apache/mahout.git\n",
+ "\n",
+ "# 2. Install Python Dependencies\n",
+ "# We use the requirements file provided in the benchmark folder\n",
+ "%cd /content/mahout/qdp/qdp-python\n",
+ "!uv venv -p python3.11\n",
+ "# Activate the virtual environment and run uv sync and maturin
develop\n",
+ "!source .venv/bin/activate && uv sync --group dev\n",
+ "# !source .venv/bin/activate && uv run --python 3.11 maturin develop"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "id": "XX7w2efnD9np"
+ },
+ "outputs": [],
+ "source": [
+ "%cd /content/mahout/qdp/qdp-python\n",
+ "\n",
+ "# 1. Remove all old wheels to prevent future conflicts\n",
+ "!rm -rf /content/mahout/qdp/target/wheels/*\n",
+ "\n",
+ "# 2. Re-run build (so we have exactly one fresh wheel)\n",
+ "!uv run maturin build --interpreter .venv/bin/python\n",
+ "\n",
+ "# 3. Install the single new wheel found\n",
+ "!uv pip install /content/mahout/qdp/target/wheels/*.whl --python
.venv/bin/python --force-reinstall\n",
+ "\n",
+ "!./.venv/bin/python -c \"import mahout_qdp;
print(mahout_qdp.__file__)\""
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true,
+ "id": "eYLNNzRQFNQ_"
+ },
+ "outputs": [],
+ "source": [
+ "!uv pip install -r /content/mahout/qdp/benchmark/requirements.txt
--python .venv/bin/python"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true,
+ "id": "qqmfUHGsGm8m"
+ },
+ "outputs": [],
+ "source": [
+ "!uv pip install matplotlib-inline --python .venv/bin/python"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {
+ "id": "hj7sU3yJQeMj"
+ },
+ "source": [
+ "## Run Benchmarks"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "id": "iuP5BdI3E-oR"
+ },
+ "outputs": [],
+ "source": [
+ "!./.venv/bin/python /content/mahout/qdp/benchmark/benchmark_e2e.py
--frameworks mahout-parquet mahout-arrow pennylane --qubits 18 --samples 500"
+ ]
+ }
+ ],
+ "metadata": {
+ "accelerator": "GPU",
+ "colab": {
+ "gpuType": "T4",
+ "provenance": []
+ },
+ "kernelspec": {
+ "display_name": "Python 3",
+ "name": "python3"
+ },
+ "language_info": {
+ "name": "python"
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 0
+}