{"id":19297161,"url":"https://github.com/pnnl/qasmtrans","last_synced_at":"2026-01-03T17:48:27.801Z","repository":{"id":186580588,"uuid":"674721190","full_name":"pnnl/qasmtrans","owner":"pnnl","description":"A C++ based quantum transpiler for NISQ devices","archived":false,"fork":false,"pushed_at":"2025-01-20T08:48:32.000Z","size":2391,"stargazers_count":23,"open_issues_count":0,"forks_count":8,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-01-20T09:36:09.688Z","etag":null,"topics":["compiler-design","qasm","qasm-compiler","quantum","quantum-computing","transpiler"],"latest_commit_sha":null,"homepage":"","language":"OpenQASM","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pnnl.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-08-04T15:50:51.000Z","updated_at":"2025-01-20T08:48:34.000Z","dependencies_parsed_at":null,"dependency_job_id":"9d10d420-8d90-4c64-95a4-562f4483f39a","html_url":"https://github.com/pnnl/qasmtrans","commit_stats":null,"previous_names":["pnnl/qasmtrans"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pnnl%2Fqasmtrans","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pnnl%2Fqasmtrans/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pnnl%2Fqasmtrans/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pnnl%2Fqasmtrans/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pnnl","download_url":"https://codeload.github.com/pnnl/qasmtrans/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244591477,"owners_count":20477707,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["compiler-design","qasm","qasm-compiler","quantum","quantum-computing","transpiler"],"created_at":"2024-11-09T23:01:24.408Z","updated_at":"2026-01-03T17:48:27.795Z","avatar_url":"https://github.com/pnnl.png","language":"OpenQASM","funding_links":[],"categories":["OpenQASM"],"sub_categories":[],"readme":"# QASMTrans\nQASMTrans is a quantum transpiler for effectively parsing and translating general OpenQASM[1] circuits to\ncircuits compiled for a particular NISQ device (e.g., from IBMQ, Rigetti, IonQ, Quantinuum), addressing\nthe contraints of basis gates and qubit topology. QASMTrans is purely developed in C++ without external\nlibrary dependency, facilitate deployment across platforms. It is specially designed for emerging deep\ncircuits, such as those from HHL, QPE, quantum simulation, etc. QASMTrans is easy to extend for adding \nnew optimization passes and backend devices (see [extension](passes/README.md)). For some examplar \nQASM circuits, please check our [QASMBench](https://github.com/pnnl/qasmbench).\n\nPlease check our paper for details and performance: https://arxiv.org/pdf/2308.07581.pdf\n\n\n## Installation\nTo install the software, follow the steps below:\n\n```bash\ngit clone https://github.com/pnnl/qasmtrans.git\ncd qasmtrans\nmkdir build\ncd build\ncmake ..\nmake \n```\n\n## Execution\nTo run the transpiler, use the command below:\n\n```bash\n./qasmtrans -i ../data/test_benchmark/bv10.qasm -m ibmq -c ../data/devices/ibmq_toronto.json -v 1\n```\n\n## Testing\nThe correctness testing is through the comparision of the Qiskit-Aer simulation results from QASMTrans generated circuits, and Qiskit generated circuits for the list of input circuits. The test is passed with differences less than 0.5%. \n```bash\ncd test\nsh validation_test.sh\n```\n\nThe detailed result will be stored in compare_summary.txt.\n## Options\nQASMTrans command-line options:\n\n- `-i`: Input qasm file, e.g.  `data/test_benchmark/bv10.qasm`    \n\n- `-o`: Specify the output file location, the default path is `data/output_qasm_file/{circuit}_{mode}.qasm`.\n\n- `-b`: Sepcify basis gate set {x, y, z} (Future support) \n\n- `-q`: Take a qasm circuit string as input (Future support)\n\n- `-m`: Set the mode that determines the specific basis gate set for a vendor:\n  - `ibmq`: The basis gates for IBMQ here is [rz,sx,x,cx] (default)\n  - `ionq`:  The basis gates for IonQ here is [rx(gpi),ry(gpi2),rz(gz),rxx(ms)] \n  - `quantinuum`: The basis gates for Quantinuum here is [rx,rz,zz]\n  - `rigetti`: The basis gates for Rigetti here is [rx,ry,cz] \n  - `quafu`: The basis gates for Quafu here is [cz,rx,ry,rz,h]\n\n- `-c`: Specify the backend device with certain topology. The path is \"data/devices/\"\n\n    IBMQ Machines (Heavy-hexagon):\n    \n    - `ibmq_toronto (27 qubits)` (default option)\n    - `ibmq_jakarta (7 qubits)`\n    - `ibmq_guadalupe (16 qubits)`\n    - `ibm_cairo (27 qubits)`\n    - `ibm_brisbane (127 qubits)`\n\n    Rigetti Machine (Ring):\n    - `aspen_m3 (80 qubits)`\n\n    Quantinuum Machine (All-to-all connected):\n    - `h1_2 (12 qubits)`\n    - `h1_1 (20 qubits)` \n    \n    Dummy Machines (All-to-all connected):\n    \n    - `dummy_ibmq12 (12 qubits)`\n    - `dummy_ibmq14 (14 qubits)`\n    - `dummy_ibmq15 (15 qubits)`\n    - `dummy_ibmq16 (16 qubits)`\n    - `dummy_ibmq30 (30 qubits)` \n\n- `-limited`: Limit the number of qubits used (i.e., avoid using all physical qubits of the device). Due to more limited topology, more gates can be introduced. This option is\nparticularly useful for numerical simulation on a classical system, given less qubits.\n\n- `-v`: Set the verbose level for debugging:\n  - 0 : No output (default)\n  - 1 : Output device_name, gate_ops, transpilation time, output file location\n  - 2 : Detailed information, including initial_mapping, transpilation time for different steps during the routing/mapping pass\n\n## Data Structure\nThe central data structure are:\n\n`Circuit`: each transpilation pass takes in a circuit object and applies the logic of the pass to the circuit:\n- `n_qubits`: The total number of qubits in the circuit.\n- `gates`: A vector storing the gates (or quantum operations) applied within the circuit.\n\n`Gate`: basic data structure for a gate:\n- `op_name`: This attribute specifies the type of gate. Examples include 'CX' (CNOT gate), 'Rz' (Pauli-Z rotation gate), etc.\n- `ctrl`: This defines the control qubit for controlled operations.\n- `qubit`: This represents the target qubit upon which the gate operation is applied.\n- `theta/lambda/phi/gama`: These are parameters representing the rotation angle (where applicable) for the gate operation.\n\n## External Files:\nQASMTrans includes two external source header files:\n- [lexer.hpp](https://github.com/ArashPartow/lexertk): Lexertk, a simple to use, easy to integrate and extremely fast lexicographical generator.\n- [json.hpp](https://github.com/nlohmann/json): a C++ json operation library.\n\n## Developers:\n- Fei Hua, Pacific Northwest National Laboratory \n- Meng Wang, Pacific Northwest National Laboratory\n- Muqing Zheng, Pacific Northwest National Laboratory\n- Ang Li, Pacific Northwest National Laboratory\n\nThanks to Gushu Li (University of Pennsylvania) for sharing the Python source code of Sabre[2]).\n\n\n## Citation format:\n\n- Fei Hua, Meng Wang, Gushu Li, Bo Peng, Chenxu Liu, Muqing Zheng, Samuel Stein, Yufei Ding, Eddy Z. Zhang, Travis S. Humble, Ang Li. \"QASMTrans: A QASM based Quantum Transpiler Framework for NISQ Devices.\" arXiv preprint arXiv:2308.07581 (2023)\n\nBibtex:\n```text\n@misc{hua2023qasmtrans,\n      title={QASMTrans: A QASM based Quantum Transpiler Framework for NISQ Devices}, \n      author={Fei Hua and Meng Wang and Gushu Li and Bo Peng and Chenxu Liu and Muqing Zheng and Samuel Stein and Yufei Ding and Eddy Z. Zhang and Travis S. Humble and Ang Li},\n      year={2023},\n      eprint={2308.07581},\n      archivePrefix={arXiv},\n      primaryClass={quant-ph}\n}\n```\n\n## References\n- [1] Cross, A.W., Bishop, L.S., Smolin, J.A., \u0026 Gambetta, J.M. (2017). Open quantum assembly language. arXiv preprint [arXiv:1707.03429](https://arxiv.org/abs/1707.03429).\n- [2] Li, G., Ding, Y., \u0026 Xie, Y. (2019). Tackling the qubit mapping problem for NISQ-era quantum devices. In Proceedings of the Twenty-Fourth International Conference on Architectural Support for Programming Languages and Operating Systems (pp. 1001-1014).(https://dl.acm.org/doi/abs/10.1145/3297858.3304023)\n\n## Acknowledgments\nPNNL IPID: 32821-E, IR: PNNL-SA-188499, Export Control: EAR99, Software DOI: 10.11578/dc.20230814.4\n\nThe develoopment of this software is currently supported by the U.S. Department of Energy, Office of Science, National Quantum Information Science Research Centers, Quantum Science Center (QSC). Part of the original development was also supported by the U.S. Department of Energy, Office of Science, National Quantum Information Science Research Centers, Co-design Center for Quantum Advantage (C2QA) under contract number DE-SC0012704. This research used resources of the Oak Ridge Leadership Computing Facility, which is a DOE Office of Science User Facility supported under Contract DE-AC05-00OR22725. This research used resources of the National Energy Research Scientific Computing Center (NERSC), a U.S. Department of Energy Office of Science User Facility located at Lawrence Berkeley National Laboratory, operated under Contract No. DE-AC02-05CH11231. The Pacific Northwest National Laboratory is operated by Battelle for the U.S. Department of Energy under Contract DE-AC05-76RL01830.\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpnnl%2Fqasmtrans","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpnnl%2Fqasmtrans","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpnnl%2Fqasmtrans/lists"}