Quantum resource management interface (QRMI)
Quantum resource management interface (QRMI) คือไลบรารีแบบ vendor-agnostic สำหรับระบบ high-performance compute (HPC) เพื่อเข้าถึง ควบคุม และตรวจสอบพฤติกรรมของ quantum computational resources ทำหน้าที่เป็นเลเยอร์ middleware บางๆ ที่ช่วยลดความซับซ้อนที่เกี่ยวข้องกับการควบคุม quantum resources ผ่านชุด APIs ที่เรียบง่าย เขียนด้วย Rust อินเทอร์เฟซนี้ยังเปิดเผย Python และ C APIs เพื่อให้ผสานรวมเข้ากับสภาพแวดล้อมการคำนวณใดก็ได้อย่างง่ายดาย
ดูซอร์สโค้ดสำหรับ build และ deploy QRMI ใน GitHub repository นี้
เครื่องมือ command line task_runner ทางเลือกสำหรับ execute quantum payloads กับ quantum hardware รวมอยู่ใน Python package ดู เอกสารฉบับเต็ม ใน GitHub repository
Build ไลบรารี QRMI
ส่วนนี้แสดงวิธี build QRMI สำหรับ C และ Python
Requirements
QRMI รองรับระบบปฏิบัติการ (OS) ต่อไปนี้:
AlmaLinux 9, Amazon Linux 2023, CentOS Stream 9, CentOS Stream 10,
RedHat Enterprise Linux 8, RedHat Enterprise Linux 9,
RedHat Enterprise Linux 10, Rocky Linux 8, Rocky Linux 9, SuSE 15,
Ubuntu 22.04, Ubuntu 24.04, MacOS Sequoia 15.1 or above
สภาพแวดล้อมการคอมไพล์
- Rust compiler 1.91 หรือสูงกว่า
- C compiler: เช่น GCC (
gcc) บน Linux และ Clang (clang-tools-extra) สำหรับ Rust unknown targets/cross compilations QRMI เข้ากันได้กับ compiler ที่สอดคล้องกับมาตรฐาน C11 make/cmake(make/cmake RPM สำหรับ RHEL-compatible OS)openssl(openssl-devel RPM สำหรับ RHEL-compatible OS)zlib(zlib-devel RPM สำหรับ RHEL-compatible OS)- Python 3.11, 3.12 หรือ 3.13 (สำหรับ Python API)
- ไลบรารีและ header files ที่จำเป็นสำหรับการพัฒนา Python (python3.1x-devel RPM สำหรับ RHEL-compatible OS):
- /usr/include/python3.1x
- /usr/lib64/libpython3.1x.so
- ไลบรารีและ header files ที่จำเป็นสำหรับการพัฒนา Python (python3.1x-devel RPM สำหรับ RHEL-compatible OS):
- Doxygen (สำหรับสร้างเอกสาร C API) ขึ้นอยู่กับ OS:
dnf install doxygenสำหรับ Linux (RHEL/CentOS/Rocky Linux และอื่นๆ)apt install doxygenสำหรับ Linux (Ubuntu และอื่นๆ)brew install doxygenสำหรับ MacOS
สภาพแวดล้อม runtime
- gcc (libgcc RPM สำหรับ RHEL-compatible OS)
- openssl (openssl-libs RPM สำหรับ RHEL-compatible OS)
- zlib (zlib RPM สำหรับ RHEL-compatible OS)
- Python 3.11, 3.12 หรือ 3.13 (สำหรับ Python API)
- ไลบรารีและ header files ที่จำเป็นสำหรับการพัฒนา Python (python3.1x-devel RPM สำหรับ RHEL-compatible OS)
Build ไลบรารี Rust/C API ด้วยคำสั่งต่อไปนี้ในตำแหน่งที่บันทึก QRMI repository ไว้
. ~/.cargo/env
cargo clean
cargo build --release
ในการ build Python package ให้ตั้งค่าสภาพแวดล้อม Python และติดตั้ง dependencies ที่จำเป็นก่อน
. ~/.cargo/env
cargo clean
python3.12 -m venv ~/py312_qrmi_venv
source ~/py312_qrmi_venv/bin/activate
pip install --upgrade pip
pip install -r requirements-dev.txt
สร้าง stub files สำหรับ Python code
. ~/.cargo/env
cargo run --bin stubgen --features=pyo3
สุดท้าย build Python wheels สำหรับแจกจ่ายให้กับ hosts
source ~/py312_qrmi_venv/bin/activate
CARGO_TARGET_DIR=./target/release/maturin maturin build --release
wheel ถูกสร้างในไดเรกทอรี ./target/release/maturin/wheels คุณสามารถแจกจ่ายและติดตั้งบน hosts ได้โดย pip install <wheel>
การบันทึก log
QRMI รองรับ log crate สำหรับการบันทึก log คุณสามารถดู QRMI runtime logs โดยละเอียดได้โดยระบุตัวแปรสภาพแวดล้อม RUST_LOG พร้อม log level ที่รองรับได้แก่ error, warn, info, debug และ trace ระดับเริ่มต้นคือ warn
หากระบุ trace คุณจะเห็น HTTP transaction logs ที่อยู่เบื้องหลัง
RUST_LOG=trace <your QRMI executable>
ตัวอย่าง logs:
[2025-08-16T03:47:38Z DEBUG request::connect] starting new connection: https://iam.cloud.ibm.com/
[2025-08-16T03:47:38Z DEBUG direct_access_api::middleware::auth] current token ...
Build เอกสาร API
สามารถสร้างเอกสาร Rust API ได้โดยรัน
. ~/.cargo/env
cargo doc --no-deps --open
สามารถสร้างเอกสาร C API ได้โดยใช้ doxygen:
doxygen Doxyfile
จะสร้าง HTML document ในไดเรกทอรี ./html ซึ่งสามารถเปิดในเว็บเบราว์เซอร์ได้
เอกสาร Python API สร้างด้วย pydoc หลังจากเข้าสู่ virtual environment ที่ติดตั้ง QRMI แล้ว รันคำสั่งต่อไปนี้:
python -m pydoc -p 8290
Server ready at http://localhost:8290/
Server commands: [b]rowser, [q]uit
server> b
จากนั้นเปิดหน้าต่อไปนี้ในเบราว์เซอร์:
http://localhost:8290/qrmi.html
หยุด server ด้วย:
server> q