File tree Expand file tree Collapse file tree 6 files changed +15
-37
lines changed
Expand file tree Collapse file tree 6 files changed +15
-37
lines changed Original file line number Diff line number Diff line change 7171 name : cargo clippy
7272 language : system
7373 pass_filenames : false
74- entry : bash -c 'LIBTORCH_USE_PYTORCH=1 LIBTORCH_BYPASS_VERSION_CHECK=1 cargo clippy "$@"' --
74+ entry : bash -c 'LIBTORCH_USE_PYTORCH=1 cargo clippy "$@"' --
7575 args :
7676 - --manifest-path
7777 - qdp/Cargo.toml
Original file line number Diff line number Diff line change 1818"""
1919Data-to-State latency benchmark: CPU RAM -> GPU VRAM.
2020
21- Run:
22- python qdp/qdp- python/ benchmark/benchmark_latency.py --qubits 16 \
21+ Run from qdp-python directory (qumat_qdp must be importable, e.g. via uv) :
22+ uv run python benchmark/benchmark_latency.py --qubits 16 \ \
2323 --batches 200 --batch-size 64 --prefetch 16
2424"""
2525
2626from __future__ import annotations
2727
2828import argparse
29- import sys
3029import time
31- from pathlib import Path
3230
3331import torch
3432
35- # Add project root to path so qumat_qdp is importable when run as script
36- _script_dir = Path (__file__ ).resolve ().parent
37- _project_root = _script_dir .parent
38- if str (_project_root ) not in sys .path :
39- sys .path .insert (0 , str (_project_root ))
40-
41- from benchmark .utils import normalize_batch , prefetched_batches # noqa: E402
42- from qumat_qdp import QdpBenchmark # noqa: E402
33+ from benchmark .utils import normalize_batch , prefetched_batches
34+ from qumat_qdp import QdpBenchmark
4335
4436BAR = "=" * 70
4537SEP = "-" * 70
Original file line number Diff line number Diff line change 2121Compares iterator-based throughput with run_throughput_pipeline_py.
2222Expectation: loader version slightly slower due to Python boundary per batch.
2323
24- Usage ( from qdp-python):
24+ Run from qdp-python directory (qumat_qdp must be importable, e.g. via uv ):
2525 uv run python benchmark/benchmark_loader_throughput.py --qubits 16 --batches 200 --batch-size 64
2626"""
2727
2828from __future__ import annotations
2929
3030import argparse
31- import sys
3231import time
33- from pathlib import Path
3432
35- # Add project root to path so qumat_qdp is importable when run as script
36- _script_dir = Path (__file__ ).resolve ().parent
37- _project_root = _script_dir .parent
38- if str (_project_root ) not in sys .path :
39- sys .path .insert (0 , str (_project_root ))
40-
41- from qumat_qdp import QuantumDataLoader , QdpBenchmark # noqa: E402
33+ from qumat_qdp import QuantumDataLoader , QdpBenchmark
4234
4335
4436def run_loader_throughput (
Original file line number Diff line number Diff line change 2323- Prefetch on the CPU side to keep the GPU fed.
2424- Encode vectors into amplitude states on GPU and run a tiny consumer op.
2525
26- Run:
27- python qdp/ benchmark/benchmark_throughput.py --qubits 16 --batches 200 --batch-size 64
26+ Run from qdp-python directory (qumat_qdp must be importable, e.g. via uv) :
27+ uv run python benchmark/benchmark_throughput.py --qubits 16 --batches 200 --batch-size 64
2828"""
2929
3030import argparse
31- import sys
3231import time
33- from pathlib import Path
3432
3533import numpy as np
3634import torch
3735
38- # Add project root to path so qumat_qdp is importable when run as script
39- _script_dir = Path (__file__ ).resolve ().parent
40- _project_root = _script_dir .parent
41- if str (_project_root ) not in sys .path :
42- sys .path .insert (0 , str (_project_root ))
43-
44- from benchmark .utils import normalize_batch , prefetched_batches # noqa: E402
45- from qumat_qdp import QdpBenchmark # noqa: E402
36+ from benchmark .utils import normalize_batch , prefetched_batches
37+ from qumat_qdp import QdpBenchmark
4638
4739BAR = "=" * 70
4840SEP = "-" * 70
Original file line number Diff line number Diff line change 2929
3030from __future__ import annotations
3131
32- # Rust extension (built by maturin)
32+ # Rust extension (built by maturin). QdpEngine/QuantumTensor are public for
33+ # advanced use; QdpBenchmark and QuantumDataLoader are the recommended high-level API.
3334import _qdp
3435
3536from qumat_qdp .api import (
Original file line number Diff line number Diff line change 3131
3232from typing import Iterator , Optional
3333
34- # Lazy import _qdp until __iter__ is used
34+ # Lazy import _qdp until __iter__ is used: avoids import-time load when only
35+ # importing QuantumDataLoader, and defers extension/CUDA requirement until first use.
3536_qdp : Optional [object ] = None
3637
3738
You can’t perform that action at this time.
0 commit comments