From b26b6117b0bcdcb22cd8942de9ae7020fa3089ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E5=AE=9A=E4=B8=9C?= <3081545786@qq.com> Date: Tue, 23 Apr 2024 16:40:28 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=F0=9F=93=83=20docs:=20update=20docs=20Read?= =?UTF-8?q?me=20and=20fix=20qisa=5Ftype=20in=20quingo=5Ftask?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 45 +++++++++++++++----------------- README_ZH.md | 47 +++++++++++++++------------------- src/quingo/core/quingo_task.py | 2 +- 3 files changed, 42 insertions(+), 52 deletions(-) diff --git a/README.md b/README.md index 1a0ceb0..46b2df6 100755 --- a/README.md +++ b/README.md @@ -14,19 +14,12 @@ pip install -e . ```sh # for simulators used: +# The Tequila backend is not yet open source and needs to be installed separately. git clone https://gitee.com/hpcl_quanta/tequila.git -git checkout xbackend -pip install -e . - -git clone https://gitee.com/quingo/pyqcisim.git -git checkout bug-fix -pip install -e . - -git clone https://gitee.com/quingo/SymQC.git pip install -e . ``` -Upon success, it will automatically install the Quingo runtime system (this package), the PyQCAS simulator and the PyQCISim simulator. +Upon success, it will automatically install the Quingo runtime system (this package), the SymQC simulator, the PyQCISim simulator and the QuaLeSim simulator. ### Install the Quingo compiler @@ -61,22 +54,24 @@ For different simulation backend, please refer to `src/examples/sim_backend`, wh For different simulation modes, please refer to `src/examples/sim_exemode`, which displays the output of two different simulation results currently available. ## APIs of the Quingo runtime system -The `Quingo_interface` class expose the following methods: - - `set_log_level()`: `` can be one of `DEBUG`, `INFO`, `WARNING`, `ERROR`, or `CRITICAL`. - - `connect_backend()`: `` currently can be `'pyqcas_quantumsim'` or `'pyqcisim_quantumsim'`. -- `get_backend_name()`: return the name of the backend that is being used. An empty string will be returned if no backend has been set. -- `get_last_qasm()`: get the qasm code generated by the last execution. -- `config_execution(, )`: - - Configure the execution mode to `'one_shot'` or `'state_vector'`. - - When the execution mode is `'one_shot'`, the number of times to run the uploaded quantum circuit can be configured using the parameter `num_shots` at the same time. -- `call_quingo(, , *args)`: - - the main entry to call Quingo operation. - - `` : the name of the Qingo file which contains the quantum function called by the host program. - - `` : the name of the quantum function - - ``: a variable length of parameters used to call the Quingo operation in the form `qg_func_name()`. - - `read_result()`: read the computation result from the quantum kernel. - - For eQASM-based backend, the result is a binary block which encodes the quantum computation result. - - For QCIS-based backend, the result format is defined by PyQCISim. Please refer to the docstring of `quingo.if_backend.non_arch_backend.pyqcisim_quantumsim.PyQCISim_quantumsim::execute()` +1. `class Quingo_task`: + - 输入: + - `called_qu_fn`: `Path`,qu文件路径。 + - `called_func`: `str`,调用 quingo 函数名。 + - `debug_mode`(optional): `True` or `False`。 + - `qisa`(optional): 前端指令集类型。 + - `backend`(optional): 后端模拟器类型。 +2. `function compile()`: + - 输入: + - `Quingo_task`: 待编译 qu 任务 + - `params`: `Quingo_task` 中调用函数 `called_func` 所需参数 + - 输出:`qasm_fn`:输出对应指令集文件(.qcis / .qi) +3. `function execute()`: + - 输入: + - `qasm_fn`: `Path`,对应指令集文件(.qcis / .qi) + - `be_type`: `BackendType`,模拟器后端类型 + - `exe_config`: 执行模式,`ExeMode.SimShots`、`ExeMode.SimFinalResult`、`ExeMode.SimStateVector` + - 输出:`sim_result`:具体输出格式详见`src/quingo/backend/quingo_result_format_spec.md` ## Quingo programming tutorial At present, Qingguo runtime system has included sample programs such as `Bell_state`, `GHZ`, `VQE`, etc. Details can be found [here](https://gitee.com/quingo/quingo-runtime/tree/master/src/examples). \ No newline at end of file diff --git a/README_ZH.md b/README_ZH.md index 5e92c7b..d7f2367 100755 --- a/README_ZH.md +++ b/README_ZH.md @@ -8,22 +8,15 @@ ### 安装运行时系统以及模拟器 -依次执行以下命令便可以安装青果运行时系统、PyQCAS模拟器以及PyQCISim模拟器。 +依次执行以下命令便可以安装青果运行时系统、`SymQC` 模拟器、`PyQCISim` 模拟器以及 `QuaLeSim` 模拟器。 ```sh pip install -e . ``` ```sh # for simulators used: +# Tequila 后端尚未开源,需要单独安装。 git clone https://gitee.com/hpcl_quanta/tequila.git -git checkout xbackend -pip install -e . - -git clone https://gitee.com/quingo/pyqcisim.git -git checkout bug-fix -pip install -e . - -git clone https://gitee.com/quingo/SymQC.git pip install -e . ``` @@ -58,25 +51,27 @@ sim res: (['Q1', 'Q2'], [[0, 0], [0, 0], [1, 1], [1, 1], [0, 0], [0, 0], [0, 0] ``` 针对不同的模拟后端,详见`src/examples/sim_backend`,其中展示了目前稳定运行的SymQC、QuantumSim何Tequila后端的使用。 -针对不同的模拟模式,详见`src/examples/sim_exemode`,展示了对于目前的两种不同的模拟结果的输出。 +针对不同模式的输出格式,详见`src/quingo/backend/quingo_result_format_spec.md` ## 青果运行时系统提供的API -`Quingo_interface`类提供了以下方法: - - `set_log_level()`: 该方法中``的值可以是`DEBUG`, `INFO`, `WARNING`, `ERROR`, `CRITICAL`中的任意一个。 - - `connect_backend()`: 该方法中``的值目前可以是`'pyqcas_quantumsim'`或者`'pyqcisim_quantumsim'`。 -- `get_backend_name()`方法返回正在使用的后端名称。如果没有设置后端,将返回一个空字符串。 -- `get_last_qasm()`用来获取上次执行生成的qasm指令代码。 -- `config_execution(, )`: - - `config_execution`能够将执行模式配置为`'one_shot'`或`'state_vector'`. - - 当执行模式为`'one_shot'`时,可以同时使用参数`num_shots`来配置量子线路的运行次数。 -- `call_quingo(, , *args)`: - - `call_quingo`方法是调用Quingo操作的主要入口。 - - ``中的值为青果文件的名称,该青果文件中包含被宿主程序调用的量子操作。 - - ``中的值为量子操作的名称。 - - ``中的值为可变长度的参数,这些参数用来以 `qg_func_name()` 形式来调用青果操作。 -- `read_result()`方法负责从量子内核中读取计算结果。 - - 对于能够执行eQASM指令的后端,结果是对量子计算结果进行编码的二进制块。 - - 对于能够执行QCIS指令的后端,结果的格式由PyQCISim进行定义。详情请参考`quingo.if_backend.non_arch_backend.pyqcisim_quantumsim.PyQCISim_quantumsim::execute()`中的文档描述。 +1. `Quingo_task`类: + - 输入: + - `called_qu_fn`: `Path`,qu文件路径。 + - `called_func`: `str`,调用 quingo 函数名。 + - `debug_mode`(optional): `True` or `False`。 + - `qisa`(optional): 前端指令集类型。 + - `backend`(optional): 后端模拟器类型。 +2. `compile`: + - 输入: + - `Quingo_task`: 待编译 qu 任务 + - `params`: `Quingo_task` 中调用函数 `called_func` 所需参数 + - 输出:`qasm_fn`:输出对应指令集文件(.qcis / .qi) +3. `execute`: + - 输入: + - `qasm_fn`: `Path`,对应指令集文件(.qcis / .qi) + - `be_type`: `BackendType`,模拟器后端类型 + - `exe_config`: 执行模式,`ExeMode.SimShots`、`ExeMode.SimFinalResult`、`ExeMode.SimStateVector` + - 输出:`sim_result`:具体输出格式详见`src/quingo/backend/quingo_result_format_spec.md` ## 青果示例程序 目前青果运行时系统中已经包含了`Bell_state`、`GHZ`、`VQE`等示例程序,详情可见[此处](https://gitee.com/quingo/quingo-runtime/tree/master/src/examples)。 \ No newline at end of file diff --git a/src/quingo/core/quingo_task.py b/src/quingo/core/quingo_task.py index 01c9cc0..c662ae4 100644 --- a/src/quingo/core/quingo_task.py +++ b/src/quingo/core/quingo_task.py @@ -108,7 +108,7 @@ class Quingo_task: BackendType.SYMQC, BackendType.XIAOHONG, BackendType.QUALESIM_QUANTUMSIM, - # BackendType.QUALESIM_TEQUILA, + BackendType.QUALESIM_TEQUILA, ]: return Qisa.QCIS -- Gitee From 7797f920a53bb501c9cd6aa0d1bc28e6f750d3f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E5=AE=9A=E4=B8=9C?= <3081545786@qq.com> Date: Wed, 24 Apr 2024 10:02:29 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=F0=9F=90=B3=20chore:=20update=20install=5F?= =?UTF-8?q?requires's=20version=20number.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- setup.cfg | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/setup.cfg b/setup.cfg index 019e220..98cd1e7 100644 --- a/setup.cfg +++ b/setup.cfg @@ -22,13 +22,13 @@ packages =find: python_requires = >=3.7 install_requires = numpy - pyqcisim - symqc + pyqcisim >= 1.3.1 + symqc >= 1.1.1 colorama termcolor requests tqdm - qualesim >= 1.0.0 + qualesim >= 1.0.2 qualesim-tequila >= 1.0.2 pyquiet >= 0.0.4 -- Gitee From 09b8b8781c441f699ea6118bec72a4cc0ffa0355 Mon Sep 17 00:00:00 2001 From: Xiang Fu Date: Wed, 24 Apr 2024 11:52:12 +0800 Subject: [PATCH 3/3] update version number to 0.3.1 --- setup.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.cfg b/setup.cfg index 98cd1e7..cb1dc12 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = quingo -version = 0.3.0 +version = 0.3.1 author = Xiang Fu author_email = gtaifu@gmail.com use_2to3 = False -- Gitee