CN115952868B - Quantum circuit task processing method and device, electronic equipment and readable storage medium - Google Patents
Quantum circuit task processing method and device, electronic equipment and readable storage medium Download PDFInfo
- Publication number
- CN115952868B CN115952868B CN202211708228.7A CN202211708228A CN115952868B CN 115952868 B CN115952868 B CN 115952868B CN 202211708228 A CN202211708228 A CN 202211708228A CN 115952868 B CN115952868 B CN 115952868B
- Authority
- CN
- China
- Prior art keywords
- quantum circuit
- task
- quantum
- circuit
- tasks
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
Classifications
-
- Y—GENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02D—CLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
- Y02D10/00—Energy efficient computing, e.g. low power processors, power management or thermal management
Landscapes
- Machine Translation (AREA)
Abstract
本公开提供了一种量子电路任务处理方法、装置、电子设备及可读存储介质,涉及量子计算机、量子处理器、量子电路任务、多进程技术领域。该方法包括:响应于任务队列中存在至少两个待处理的目标量子电路任务,将不同的目标量子电路任务分配至不同的量子电路转译进程;控制各量子电路转译进程对接收到的目标量子电路任务进行电路转译操作,得到转译后量子电路;控制各量子电路转译进程将相应的转译后量子电路提交给量子计算机进行运行,并得到量子计算机返回的电路运行结果;根据各量子电路转译进程返回的电路运行结果,更新相应的目标量子电路任务的处理状态。该方法通过将多进程并发技术应用至量子设备对量子电路任务的处理方面,提升了处理效率。
The present disclosure provides a quantum circuit task processing method, device, electronic equipment and readable storage medium, and relates to the technical fields of quantum computers, quantum processors, quantum circuit tasks, and multi-processes. The method includes: responding to the presence of at least two target quantum circuit tasks to be processed in the task queue, allocating different target quantum circuit tasks to different quantum circuit translation processes; controlling each quantum circuit translation process to respond to the received target quantum circuit The task performs circuit translation operations to obtain translated quantum circuits; controls each quantum circuit translation process to submit the corresponding translated quantum circuits to the quantum computer for operation, and obtains the circuit operation results returned by the quantum computer; according to the results returned by each quantum circuit translation process The circuit operation results update the processing status of the corresponding target quantum circuit task. This method improves processing efficiency by applying multi-process concurrency technology to the processing of quantum circuit tasks by quantum devices.
Description
技术领域Technical field
本公开涉及量子任务处理技术领域,具体涉及量子计算机、量子处理器、量子电路任务、多进程技术领域,尤其涉及一种量子电路任务处理方法、装置、电子设备、计算机可读存储介质及计算机程序产品。The present disclosure relates to the field of quantum task processing technology, specifically to the technical field of quantum computers, quantum processors, quantum circuit tasks, and multi-process technology, and in particular to a quantum circuit task processing method, device, electronic equipment, computer-readable storage media, and computer programs. product.
背景技术Background technique
由于当前量子设备还处于发展阶段,一台量子计算机往往只能集成一张单核心量子芯片,底层系统对电路任务采用串行的执行方式是无法改变的。在量子应用的用户端和服务端,原有设计上都提供了Nowait(不等待)的提交模式和支持高并发的任务创建机制。Since the current quantum equipment is still in the development stage, a quantum computer can often only integrate a single-core quantum chip, and the underlying system's serial execution method of circuit tasks cannot be changed. On the client side and server side of quantum applications, the original design provides the Nowait (no waiting) submission mode and a task creation mechanism that supports high concurrency.
当前的量子电路任务通常采取串行的方式处理任务,即仅在上一个量子电路任务处理完毕后,才能够继续处理下一个量子电路任务,而每一个量子电路任务的处理过程可以主要分为三阶段:拉取待处理任务、电路任务转译及提交等待结果、将接收到的运行结果返回给用户端。第二阶段的电路任务转译及提交等待结果通常需要耗费较长时间,因此串行设计将明显限制任务处理效率。Current quantum circuit tasks usually process tasks in a serial manner, that is, only after the previous quantum circuit task is processed, the next quantum circuit task can be continued. The processing process of each quantum circuit task can be mainly divided into three Stage: Pull the pending tasks, translate the circuit tasks and submit the waiting results, and return the received running results to the user. The second-stage circuit task translation and submission of waiting results usually take a long time, so serial design will significantly limit task processing efficiency.
发明内容Contents of the invention
本公开实施例提出了一种量子电路任务处理方法、装置、电子设备、计算机可读存储介质及计算机程序产品。Embodiments of the present disclosure provide a quantum circuit task processing method, device, electronic equipment, computer-readable storage medium, and computer program product.
第一方面,本公开实施例提出了一种量子电路任务处理方法,包括:响应于任务队列中存在至少两个待处理的目标量子电路任务,将不同的目标量子电路任务分配至不同的量子电路转译进程;其中,基于量子计算机的量子处理单元的核心数预先创建有多个量子电路转译进程;控制各量子电路转译进程对接收到的目标量子电路任务进行电路转译操作,得到转译后量子电路;控制各量子电路转译进程将相应的转译后量子电路提交给量子计算机进行运行,并得到量子计算机返回的电路运行结果;根据各量子电路转译进程返回的电路运行结果,更新相应的目标量子电路任务的处理状态。In a first aspect, an embodiment of the present disclosure proposes a quantum circuit task processing method, including: in response to the presence of at least two target quantum circuit tasks to be processed in the task queue, allocating different target quantum circuit tasks to different quantum circuits. Translation process; wherein multiple quantum circuit translation processes are pre-created based on the number of cores of the quantum processing unit of the quantum computer; each quantum circuit translation process is controlled to perform circuit translation operations on the received target quantum circuit tasks to obtain the translated quantum circuit; Control each quantum circuit translation process, submit the corresponding translated quantum circuit to the quantum computer for operation, and obtain the circuit operation results returned by the quantum computer; update the corresponding target quantum circuit task based on the circuit operation results returned by each quantum circuit translation process. Processing status.
第二方面,本公开实施例提出了一种量子电路任务处理装置,包括:任务分配单元,被配置成响应于任务队列中存在至少两个待处理的目标量子电路任务,将不同的目标量子电路任务分配至不同的量子电路转译进程;其中,基于量子计算机的量子处理单元的核心数预先创建有多个量子电路转译进程;转译单元,被配置成控制各量子电路转译进程对接收到的目标量子电路任务进行电路转译操作,得到转译后量子电路;提交量子设备运行单元,被配置成控制各量子电路转译进程将相应的转译后量子电路提交给量子计算机进行运行,并得到量子计算机返回的电路运行结果;处理状态更新单元,被配置成根据各量子电路转译进程返回的电路运行结果,更新相应的目标量子电路任务的处理状态。In a second aspect, an embodiment of the present disclosure proposes a quantum circuit task processing device, including: a task allocation unit configured to respond to the presence of at least two target quantum circuit tasks to be processed in the task queue, assigning different target quantum circuits to Tasks are assigned to different quantum circuit translation processes; among them, multiple quantum circuit translation processes are pre-created based on the core number of the quantum processing unit of the quantum computer; the translation unit is configured to control each quantum circuit translation process to respond to the received target quantum The circuit task performs a circuit translation operation and obtains the translated quantum circuit; the submission quantum device operation unit is configured to control the translation process of each quantum circuit, submit the corresponding translated quantum circuit to the quantum computer for operation, and obtain the circuit operation returned by the quantum computer. Result; the processing status update unit is configured to update the processing status of the corresponding target quantum circuit task based on the circuit operation results returned by each quantum circuit translation process.
第三方面,本公开实施例提供了一种电子设备,该电子设备包括:至少一个处理器;以及与至少一个处理器通信连接的存储器;其中,存储器存储有可被至少一个处理器执行的指令,该指令被至少一个处理器执行,以使至少一个处理器执行时能够实现如第一方面描述的量子电路任务处理方法。In a third aspect, embodiments of the present disclosure provide an electronic device, which includes: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions that can be executed by the at least one processor. , the instruction is executed by at least one processor, so that when executed by at least one processor, the quantum circuit task processing method described in the first aspect can be implemented.
第四方面,本公开实施例提供了一种存储有计算机指令的非瞬时计算机可读存储介质,该计算机指令用于使计算机执行时能够实现如第一方面描述的量子电路任务处理方法。In a fourth aspect, embodiments of the present disclosure provide a non-transitory computer-readable storage medium storing computer instructions. The computer instructions are used to enable the computer to implement the quantum circuit task processing method as described in the first aspect when executed.
第五方面,本公开实施例提供了一种包括计算机程序的计算机程序产品,该计算机程序在被处理器执行时能够实现如第一方面描述的量子电路任务处理方法的步骤。In a fifth aspect, embodiments of the present disclosure provide a computer program product including a computer program, which, when executed by a processor, can implement the steps of the quantum circuit task processing method described in the first aspect.
本公开提供的量子电路任务处理方案,将任务队列中多个量子电路任务分配至预先创建的多个量子电路转译进程,以借助不同的量子电路转译进程来同时处理不同的量子电路任务,以同时对多个量子电路任务执行转译操作和提交等待,从而避免持续传入的量子电路任务在任务队列中不断堆积,提升量子设备对量子电路任务的处理效率。The quantum circuit task processing solution provided by the present disclosure allocates multiple quantum circuit tasks in the task queue to multiple pre-created quantum circuit translation processes, so as to process different quantum circuit tasks at the same time with the help of different quantum circuit translation processes. Perform translation operations and submit waiting for multiple quantum circuit tasks, thereby avoiding the continuous accumulation of incoming quantum circuit tasks in the task queue and improving the processing efficiency of quantum circuit tasks by quantum devices.
应当理解,本部分所描述的内容并非旨在标识本公开的实施例的关键或重要特征,也不用于限制本公开的范围。本公开的其它特征将通过以下的说明书而变得容易理解。It should be understood that what is described in this section is not intended to identify key or important features of the embodiments of the disclosure, nor is it intended to limit the scope of the disclosure. Other features of the present disclosure will become readily understood from the following description.
附图说明Description of the drawings
通过阅读参照以下附图所作的对非限制性实施例所作的详细描述,本公开的其它特征、目的和优点将会变得更明显:Other features, objects and advantages of the present disclosure will become more apparent upon reading the detailed description of the non-limiting embodiments with reference to the following drawings:
图1是本公开可以应用于其中的示例性系统架构;Figure 1 is an exemplary system architecture in which the present disclosure may be applied;
图2为本公开实施例提供的一种量子电路任务处理方法的流程图;Figure 2 is a flow chart of a quantum circuit task processing method provided by an embodiment of the present disclosure;
图3为本公开实施例提供的一种创建进程池的方法的流程图;Figure 3 is a flow chart of a method for creating a process pool provided by an embodiment of the present disclosure;
图4为本公开实施例提供的一种基于任务类型分配不同的目标量子电路任务至不同的量子转译进程的方法的流程图;Figure 4 is a flow chart of a method for allocating different target quantum circuit tasks to different quantum translation processes based on task types provided by an embodiment of the present disclosure;
图5为本公开实施例提供的一种基于性能需求分配不同的目标量子电路任务至不同的量子转译进程的方法的流程图;Figure 5 is a flow chart of a method for allocating different target quantum circuit tasks to different quantum translation processes based on performance requirements according to an embodiment of the present disclosure;
图6为本公开实施例提供的一种基于重要程度分配不同的目标量子电路按任务至不同的量子转译进程的方法的流程图;Figure 6 is a flow chart of a method for assigning different target quantum circuits to different quantum translation processes based on tasks based on importance according to an embodiment of the present disclosure;
图7为本公开实施例提供的在一应用场景下的对量子电路任务进行分配及多进程处理的流程示意图;Figure 7 is a schematic flowchart of quantum circuit task allocation and multi-process processing in an application scenario provided by an embodiment of the present disclosure;
图8为本公开实施例提供的不同任务阶段处理量子电路任务的流程示意图;Figure 8 is a schematic flowchart of processing quantum circuit tasks in different task stages provided by an embodiment of the present disclosure;
图9为本公开实施例提供的一种量子电路任务处理装置的结构框图;Figure 9 is a structural block diagram of a quantum circuit task processing device provided by an embodiment of the present disclosure;
图10为本公开实施例提供的一种适用于执行量子电路任务处理方法的电子设备的结构示意图。FIG. 10 is a schematic structural diagram of an electronic device suitable for performing a quantum circuit task processing method provided by an embodiment of the present disclosure.
具体实施方式Detailed ways
以下结合附图对本公开的示范性实施例做出说明,其中包括本公开实施例的各种细节以助于理解,应当将它们认为仅仅是示范性的。因此,本领域普通技术人员应当认识到,可以对这里描述的实施例做出各种改变和修改,而不会背离本公开的范围和精神。同样,为了清楚和简明,以下的描述中省略了对公知功能和结构的描述。需要说明的是,在不冲突的情况下,本公开中的实施例及实施例中的特征可以相互组合。Exemplary embodiments of the present disclosure are described below with reference to the accompanying drawings, in which various details of the embodiments of the present disclosure are included to facilitate understanding and should be considered to be exemplary only. Accordingly, those of ordinary skill in the art will recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of the disclosure. Also, descriptions of well-known functions and constructions are omitted from the following description for clarity and conciseness. It should be noted that, as long as there is no conflict, the embodiments and features in the embodiments of the present disclosure can be combined with each other.
本公开的技术方案中,所涉及的用户个人信息的收集、存储、使用、加工、传输、提供和公开等处理,均符合相关法律法规的规定,且不违背公序良俗。In the technical solution of this disclosure, the collection, storage, use, processing, transmission, provision and disclosure of user personal information are in compliance with relevant laws and regulations and do not violate public order and good customs.
图1示出了可以应用本公开的量子电路任务处理方法、装置、电子设备及计算机可读存储介质的实施例的示例性系统架构100。FIG. 1 shows an exemplary system architecture 100 to which embodiments of quantum circuit task processing methods, apparatuses, electronic devices, and computer-readable storage media of the present disclosure may be applied.
如图1所示,系统架构100可以包括终端设备101、102、103,网络104和量子服务端105。网络104用以在终端设备101、102、103和量子服务端105之间提供通信链路的介质。网络104可以包括各种连接类型,例如有线、无线通信链路或者光纤电缆等等。As shown in Figure 1, the system architecture 100 may include terminal devices 101, 102, 103, a network 104 and a quantum server 105. The network 104 is used as a medium for providing communication links between the terminal devices 101, 102, 103 and the quantum server 105. Network 104 may include various connection types, such as wired, wireless communication links, or fiber optic cables, among others.
用户可以使用终端设备101、102、103通过网络104与量子服务端105交互,以下发量子电路任务或接收返回的任务运行结果等。终端设备101、102、103和量子服务端105上可以安装有各种用于实现两者之间进行信息通讯的应用,例如量子电路绘制类应用、量子电路任务传输类应用、量子电路任务处理类应用等。Users can use terminal devices 101, 102, and 103 to interact with the quantum server 105 through the network 104 to issue quantum circuit tasks or receive returned task running results, etc. Various applications for information communication between the terminal devices 101, 102, 103 and the quantum server 105 can be installed, such as quantum circuit drawing applications, quantum circuit task transmission applications, and quantum circuit task processing applications. Applications etc.
终端设备101、102、103和量子服务端105可以是硬件,也可以是软件。当终端设备101、102、103为硬件时,可以是具有显示屏的各种电子设备,包括但不限于智能手机、平板电脑、膝上型便携计算机和台式计算机等等;当终端设备101、102、103为软件时,可以安装在上述所列举的电子设备中,其可以实现成多个软件或软件模块,也可以实现成单个软件或软件模块,在此不做具体限定。当量子服务端105为硬件时,可以实现成前置服务器与量子计算机的组合;当量子服务端为软件时,可以实现成多个仿真软件或仿真软件模块,也可以实现成单个仿真软件或仿真软件模块,在此不做具体限定。The terminal devices 101, 102, 103 and the quantum server 105 can be hardware or software. When the terminal devices 101, 102, and 103 are hardware, they can be various electronic devices with display screens, including but not limited to smartphones, tablet computers, laptop computers, desktop computers, etc.; when the terminal devices 101, 102 When 103 is software, it can be installed in the electronic equipment listed above. It can be implemented as multiple software or software modules, or as a single software or software module, and is not specifically limited here. When the quantum server 105 is hardware, it can be implemented as a combination of a front-end server and a quantum computer; when the quantum server 105 is software, it can be implemented as multiple simulation software or simulation software modules, or as a single simulation software or simulation Software modules are not specifically limited here.
量子服务端105通过内置的各种应用可以提供各种服务,以可以处理量子电路任务的量子电路任务处理类应用为例,量子服务端105在运行该量子电路任务处理类应用时可实现如下效果:首先,通过网络104接收终端设备101、102、103陆续分别传入的量子电路任务;然后,在任务队列中存在至少两个待处理的目标量子电路任务时,将不同的目标量子电路任务分配至不同的量子电路转译进程;其中,基于量子计算机的量子处理单元的核心数预先创建有多个该量子电路转译进程;接着,控制各量子电路转译进程对接收到的目标量子电路任务进行电路转译操作,得到转译后量子电路;下一步,控制各量子电路转译进程将相应的转译后量子电路提交给量子计算机进行运行,并得到量子计算机返回的电路运行结果;最后,根据各量子电路转译进程返回的电路运行结果,更新相应的目标量子电路任务的处理状态。The quantum server 105 can provide various services through various built-in applications. Taking the quantum circuit task processing application that can handle quantum circuit tasks as an example, the quantum server 105 can achieve the following effects when running the quantum circuit task processing application. : First, receive the quantum circuit tasks incoming from the terminal devices 101, 102, and 103 through the network 104; then, when there are at least two target quantum circuit tasks to be processed in the task queue, assign different target quantum circuit tasks. to different quantum circuit translation processes; among them, multiple quantum circuit translation processes are pre-created based on the core number of the quantum processing unit of the quantum computer; then, each quantum circuit translation process is controlled to perform circuit translation on the received target quantum circuit task Operation to obtain the translated quantum circuit; in the next step, control the translation process of each quantum circuit to submit the corresponding translated quantum circuit to the quantum computer for operation, and obtain the circuit operation result returned by the quantum computer; finally, return the result according to the translation process of each quantum circuit The circuit operation result is updated to update the processing status of the corresponding target quantum circuit task.
需要指出的是,待处理的量子电路任务除可以从终端设备101、102、103通过网络104获取到之外,也可以通过各种方式预先存储在量子服务端105本地。因此,当量子服务端105检测到本地已经存储有这些数据时(例如开始处理之前留存的待处理量子电路任务),可选择直接从本地获取这些数据,在此种情况下,示例性系统架构100也可以不包括终端设备101、102、103和网络104。It should be pointed out that in addition to obtaining the quantum circuit tasks to be processed from the terminal devices 101, 102, and 103 through the network 104, they can also be pre-stored locally on the quantum server 105 through various methods. Therefore, when the quantum server 105 detects that the data has been stored locally (for example, before starting to process a pending quantum circuit task that was left before processing), it can choose to obtain the data directly from the local. In this case, the exemplary system architecture 100 Terminal devices 101, 102, 103 and network 104 may not be included.
本公开后续各实施例所提供的量子电路任务处理方法一般由对接量子计算机或量子设备的量子服务端105来执行,相应地,量子电路任务处理装置一般也设置于量子服务端105中。The quantum circuit task processing methods provided in subsequent embodiments of the present disclosure are generally executed by the quantum server 105 connected to a quantum computer or quantum device. Correspondingly, the quantum circuit task processing device is generally also provided in the quantum server 105.
应该理解,图1中的终端设备、网络和量子服务端的数目仅仅是示意性的。根据实现需要,可以具有任意数目的终端设备、网络和量子服务端。It should be understood that the numbers of terminal devices, networks and quantum servers in Figure 1 are only illustrative. Depending on implementation needs, there can be any number of end devices, networks, and quantum servers.
请参考图2,图2为本公开实施例提供的一种量子电路任务处理方法的流程图,其中流程200包括以下步骤:Please refer to Figure 2, which is a flow chart of a quantum circuit task processing method provided by an embodiment of the present disclosure. The process 200 includes the following steps:
步骤201:响应于任务队列中存在至少两个待处理的目标量子电路任务,将不同的目标量子电路任务分配至不同的量子电路转译进程;Step 201: In response to the presence of at least two target quantum circuit tasks to be processed in the task queue, allocate different target quantum circuit tasks to different quantum circuit translation processes;
本步骤旨在由量子电路任务处理方法的执行主体(例如图1所示的量子服务端105)在确认任务队列中存在多个(即至少两个)待处理的目标量子电路任务时,将不同的目标量子电路任务分配至不同的量子电路转译进程。This step is intended for the execution subject of the quantum circuit task processing method (such as the quantum server 105 shown in Figure 1) to confirm that there are multiple (that is, at least two) target quantum circuit tasks to be processed in the task queue. The target quantum circuit tasks are assigned to different quantum circuit translation processes.
其中,基于量子计算机的量子处理单元的核心数预先创建有多个量子电路转译进程,例如在量子计算机的量子处理单元(Quantum Processing Unit,QPU)的核心数为4时,可以预先创建4个量子电路转译进程,即每个核心对应一个量子电路转译进程,即每个核心负责一个量子电路转译进程,当然,在单个核心可以负责更多的量子电路转译进程时,还可以预先创建数量更多的量子电路转译进程,此处不做具体限定。Among them, multiple quantum circuit translation processes are pre-created based on the core number of the quantum processing unit of the quantum computer. For example, when the core number of the quantum processing unit (Quantum Processing Unit, QPU) of the quantum computer is 4, 4 quantum circuit translation processes can be pre-created. Circuit translation process, that is, each core corresponds to a quantum circuit translation process, that is, each core is responsible for one quantum circuit translation process. Of course, when a single core can be responsible for more quantum circuit translation processes, a larger number can be created in advance. The quantum circuit translation process is not specifically limited here.
具体的,在将各目标量子电路任务分配至各量子电路转译进程时,还可以结合各种分配标准来进行,例如结合任务类型、任务性能需求、任务重要程度、任务所需最短耗时等要求,将其分配至能够满足其要求的量子电路转译进程,即也需要预先为创建出的不同量子电路转译进程进行区分。Specifically, when allocating each target quantum circuit task to each quantum circuit translation process, various allocation criteria can also be combined, such as combining task type, task performance requirements, task importance, minimum time required for the task, etc. , assign it to the quantum circuit translation process that can meet its requirements, that is, it is also necessary to distinguish the different quantum circuit translation processes created in advance.
步骤202:控制各量子电路转译进程对接收到的目标量子电路任务进行电路转译操作,得到转译后量子电路;Step 202: Control each quantum circuit translation process to perform a circuit translation operation on the received target quantum circuit task to obtain the translated quantum circuit;
在步骤201的基础上,本步骤旨在由上述执行主体控制各量子电路转译进程对接收到的目标量子电路任务进行电路转译操作,得到转译后量子电路。On the basis of step 201, this step aims to have the above-mentioned execution subject control each quantum circuit translation process to perform a circuit translation operation on the received target quantum circuit task to obtain a translated quantum circuit.
即每个量子电路转译进程首先将对分配至自身的目标量子电路任务中包含的原始量子电路模型进行转译,得到转译后量子电路。That is, each quantum circuit translation process will first translate the original quantum circuit model contained in the target quantum circuit task assigned to itself, and obtain the translated quantum circuit.
步骤203:控制各量子电路转译进程将相应的转译后量子电路提交给量子计算机进行运行,并得到量子计算机返回的电路运行结果;Step 203: Control the translation process of each quantum circuit, submit the corresponding translated quantum circuit to the quantum computer for operation, and obtain the circuit operation result returned by the quantum computer;
在步骤202的基础上,本步骤旨在由上述执行主体控制各量子电路转译进程将相应的转译后量子电路提交给量子计算机来运行,并得到量子计算机运行完成后所返回的电路运行结果。On the basis of step 202, this step aims to have the above-mentioned execution subject control each quantum circuit translation process, submit the corresponding translated quantum circuit to the quantum computer for operation, and obtain the circuit operation result returned by the quantum computer after the operation is completed.
基于上述两步骤可知,量子电路转译进程所负责的操作包括:对接收到的原始量子电路模型转译为底层的量子设备可识别、可执行的量子电路,以及将转译后的量子电路下发给量子设备来运行,最终接收到量子设备返回的运行结果。Based on the above two steps, it can be seen that the operations responsible for the quantum circuit translation process include: translating the received original quantum circuit model into a quantum circuit that is identifiable and executable by the underlying quantum device, and sending the translated quantum circuit to the quantum circuit. device to run, and finally receive the operating results returned by the quantum device.
步骤204:根据各量子电路转译进程返回的电路运行结果,更新相应的目标量子电路任务的处理状态。Step 204: Update the processing status of the corresponding target quantum circuit task according to the circuit operation results returned by each quantum circuit translation process.
在步骤203的基础上,本步骤旨在由上述执行主体根据各量子电路转译进程返回的电路运行结果,更新相应的目标量子电路任务的处理状态。Based on step 203, this step aims to update the processing status of the corresponding target quantum circuit task based on the circuit operation results returned by each quantum circuit translation process by the above execution subject.
即处理状态的更新可以具体为:将目标量子电路任务的处理状态由之前的待处理状态更新为处理完成状态。另外,若电路运行结果为空或异常结果,还可以将目标量子电路任务的处理状态由之前的待处理状态更新为处理异常状态。That is, the update of the processing status can be specifically: updating the processing status of the target quantum circuit task from the previous pending status to the processing completed status. In addition, if the circuit operation result is empty or an abnormal result, the processing status of the target quantum circuit task can also be updated from the previous pending status to the processing exception status.
本公开实施例提供的量子电路任务处理方法,将任务队列中多个量子电路任务分配至预先创建的多个量子电路转译进程,以借助不同的量子电路转译进程来同时处理不同的量子电路任务,以同时对多个量子电路任务执行转译操作和提交等待,从而避免持续传入的量子电路任务在任务队列中不断堆积,提升量子设备对量子电路任务的处理效率。The quantum circuit task processing method provided by the embodiment of the present disclosure allocates multiple quantum circuit tasks in the task queue to multiple pre-created quantum circuit translation processes, so as to process different quantum circuit tasks simultaneously with the help of different quantum circuit translation processes. It can perform translation operations and submit waiting for multiple quantum circuit tasks at the same time, thereby avoiding the continuous accumulation of incoming quantum circuit tasks in the task queue and improving the processing efficiency of quantum circuit tasks by quantum devices.
请参考图3,图3为本公开实施例提供的一种创建进程池的方法的流程图,其中流程300包括以下步骤:Please refer to Figure 3, which is a flow chart of a method for creating a process pool provided by an embodiment of the present disclosure. The process 300 includes the following steps:
步骤301:确定量子计算机的量子处理单元的核心数;Step 301: Determine the number of cores of the quantum processing unit of the quantum computer;
步骤302:创建与核心数数量一致的量子电路转译进程;Step 302: Create a quantum circuit translation process consistent with the number of cores;
步骤303:创建存储各量子电路转译进程的进程池。Step 303: Create a process pool to store the translation processes of each quantum circuit.
本实施例通过步骤301-步骤303所提供的方案中,选择在确定量子处理单元的核心数的基础上,按一个处理核心负责一个量子电路转译进程的方式,创建数量与核心数一致的量子电路转译进程,并创建一个用于存储各量子电路转译进程的进程池,以便于后续直接基于进程池对量子电路转译进程进行调用和管理。In this embodiment, among the solutions provided in steps 301 to 303, on the basis of determining the number of cores of the quantum processing unit, one processing core is responsible for one quantum circuit translation process, and a number of quantum computers consistent with the number of cores are created. Circuit translation process, and create a process pool for storing each quantum circuit translation process, so that the quantum circuit translation process can be called and managed directly based on the process pool.
例如在本实例所提供方案的基础上,上述实施例中的步骤201的任务分配步骤,就可以具体表现为:将不同的目标量子电路任务分配至进程池中的不同量子电路转译进程。For example, based on the solution provided in this example, the task allocation step of step 201 in the above embodiment can be embodied as: allocating different target quantum circuit tasks to different quantum circuit translation processes in the process pool.
具体的,在目标量子电路任务的数量少于进程池中的空闲量子电路转译进程数时,可以基于预设的进程选取策略挑选出对应数量的空闲量子电路转译进程来一一处理目标量子电路任务,进一步的,进程选取策略可以多种多样,例如随机选取、按空闲时长选取、按进程健康状态选取、按进程历史执行过的任务数来选取等等;而在目标量子电路任务的数量大于进程池中的空闲量子电路转译进程数时,则可以先调用所有的空闲量子电路转译进程先处理一批目标量子电路任务,然后再激活一部分之前处理休眠状态的量子电路转译进程继续处理剩下的目标量子电路任务,或者等待之前处在任务处理中的量子电路转译进程恢复至空闲状态以继续为其分配新的目标量子电路任务。Specifically, when the number of target quantum circuit tasks is less than the number of idle quantum circuit translation processes in the process pool, a corresponding number of idle quantum circuit translation processes can be selected based on the preset process selection strategy to process the target quantum circuit tasks one by one. , Furthermore, process selection strategies can be diverse, such as random selection, selection based on idle time, selection based on process health status, selection based on the number of tasks executed in the history of the process, etc.; while the number of tasks in the target quantum circuit is greater than the number of processes When there are many idle quantum circuit translation processes in the pool, you can first call all idle quantum circuit translation processes to process a batch of target quantum circuit tasks, and then activate some of the quantum circuit translation processes that previously processed the dormant state to continue processing the remaining targets. Quantum circuit task, or wait for the quantum circuit translation process that was previously processing the task to return to the idle state to continue assigning it a new target quantum circuit task.
进一步的,还可以控制进程池中仅有预设数量的量子电路转译进程常态化的处于空闲等待状态,而剩余数量的量子电路转译进程则被控制处于休眠状态,以避免过多的量子电路转译进程均处于空闲等待状态对有限内存资源的过多占用和过长占用,即处于休眠状态下可以最小化该进程对内存资源的占用,也有利于在确实需要更多的量子电路转译进程时快速将其激活使其恢复至空闲等待状态,快于重新构建新的量子电路转译进程。其中,该预设数量根据任务队列中目标量子电路任务的平均数量确定,以尽可能的使空闲等待状态的量子电路转译进程满足大多数时候的任务使用需求,以提供效果最大化的多进程并发效果。Furthermore, it is also possible to control only a preset number of quantum circuit translation processes in the process pool to be in a normal idle waiting state, while the remaining number of quantum circuit translation processes are controlled to be in a dormant state to avoid excessive quantum circuit translation. Processes are all in the idle waiting state, which occupies too much and too long a limited memory resource. That is, being in a dormant state can minimize the process's occupancy of memory resources, and is also conducive to rapid translation of quantum circuits when more processes are really needed. Activating it returns it to an idle waiting state faster than rebuilding a new quantum circuit translation process. Among them, the preset number is determined based on the average number of target quantum circuit tasks in the task queue, so that the quantum circuit translation process in the idle waiting state can meet the task usage requirements most of the time as much as possible to provide multi-process concurrency with maximum effect. Effect.
更进一步的,还可以销毁休眠状态持续超过预设时长的量子电路转译进程。即若一个量子电路转译进程持续处于休眠状态超过预设时长,则可以说明其已经长期未被激活使用过,因此为了进一步减少其对有限内存资源的占用,将销毁这类量子电路转译进程,以将用于构成进程的内存资源释放出去。Furthermore, quantum circuit translation processes that have been in dormant state for longer than the preset time can also be destroyed. That is, if a quantum circuit translation process continues to be dormant for more than the preset time, it means that it has not been activated for a long time. Therefore, in order to further reduce its occupation of limited memory resources, such quantum circuit translation processes will be destroyed. Release the memory resources used to form the process.
为加强对具体如何将不同的量子电路任务分配至不同的量子电路转译进程的理解,本公开还通过下述多个实施例,以不同的任务分配方式介绍分配过程。In order to enhance the understanding of how to allocate different quantum circuit tasks to different quantum circuit translation processes, this disclosure also introduces the allocation process in different task allocation methods through the following multiple embodiments.
首先请参考图4,图4为本公开实施例提供的一种基于任务类型分配不同的目标量子电路任务至不同的量子转译进程的方法的流程图,其中流程400包括以下步骤:First, please refer to Figure 4. Figure 4 is a flow chart of a method for allocating different target quantum circuit tasks to different quantum translation processes based on task types provided by an embodiment of the present disclosure. The process 400 includes the following steps:
步骤401:为预先创建出的不同量子电路转译进程分别附加不同的任务类型标签;Step 401: Attach different task type labels to different pre-created quantum circuit translation processes;
即本步骤旨在由上述执行主体为预先创建出的不同量子电路转译进程分别附加不同的任务类型标签,即不同的任务类型标签可意味着标签所在的量子电路转译进程专用于处理某个任务类型的量子电路任务。That is, this step is intended for the above execution subject to attach different task type labels to different pre-created quantum circuit translation processes. That is, different task type labels can mean that the quantum circuit translation process where the label is located is dedicated to processing a certain task type. of quantum circuit tasks.
任务类型的分类标准可根据实际情况和实际需求自行确定,例如可根据量子电路任务对应原始量子电路模型的规模、所包含的量子门电路的数量、复杂程度,以及任务目的等具有区分的参数,此处不做具体限定。The classification criteria of task types can be determined by oneself according to the actual situation and actual needs. For example, the scale of the original quantum circuit model corresponding to the quantum circuit task, the number and complexity of the quantum gate circuits included, and the purpose of the task can be distinguished. There are no specific limitations here.
步骤402:确定各目标量子电路任务各自的任务类型;Step 402: Determine the respective task types of each target quantum circuit task;
步骤403:将同一任务类型的目标量子电路任务分配至用于具有相应的任务类型标签的量子电路转译进程。Step 403: Assign the target quantum circuit tasks of the same task type to the quantum circuit translation process with the corresponding task type label.
步骤402-步骤403则首先确定各目标量子电路任务所分别对应的任务类型,然后按照任务类型的一致性,将同一任务类型的目标量子电路任务分配至用于具有相应的任务类型标签的量子电路转译进程,以期通过使适用于处理某类型的量子电路任务的量子电路转译进程处理到相应类型的量子电路任务,使得每个量子电路转译进程最大化发挥其处理效率。Steps 402 to 403 first determine the task types corresponding to each target quantum circuit task, and then allocate the target quantum circuit tasks of the same task type to quantum circuits with corresponding task type labels according to the consistency of the task types. The translation process aims to maximize the processing efficiency of each quantum circuit translation process by making the quantum circuit translation process suitable for processing a certain type of quantum circuit task process the corresponding type of quantum circuit task.
请参考图5,图5为本公开实施例提供的一种基于性能需求分配不同的目标量子电路任务至不同的量子转译进程的方法的流程图,其中流程500包括以下步骤:Please refer to Figure 5. Figure 5 is a flow chart of a method for allocating different target quantum circuit tasks to different quantum translation processes based on performance requirements according to an embodiment of the present disclosure. The process 500 includes the following steps:
步骤501:为不同的量子电路转译进程在创建时分配不同量的性能资源;Step 501: Allocate different amounts of performance resources to different quantum circuit translation processes when they are created;
步骤502:根据分配的性能资源的多少,为相应的量子电路转译进程附加区分性能高低的性能标签;Step 502: According to the amount of allocated performance resources, attach a performance label that distinguishes high and low performance to the corresponding quantum circuit translation process;
步骤501-步骤502旨在由上述执行主体为预先创建出的不同量子电路转译进程分配不同量的性能资源(例如处理资源占用上限、内存资源占用上限、显存资源占用上限等),即不同的性能标签可意味着标签所在的量子电路转译进程拥有不同量级的性能资源,也就代表着其性能的强弱不同。Steps 501 to 502 aim to allocate different amounts of performance resources (such as the upper limit of processing resource occupancy, the upper limit of memory resource occupancy, the upper limit of video memory resource occupancy, etc.) to the different pre-created quantum circuit translation processes by the above-mentioned execution subject, that is, different performance Tags can mean that the quantum circuit translation process where the tag is located has different levels of performance resources, which means that its performance is different.
性能标签可以简单分为:弱性能标签和强性能标签,也可以按性能强弱分为多个等级,例如按照性能从弱到强依次分为:一级性能标签、二级性能标签、三级性能标签、四级性能标签。Performance tags can be simply divided into: weak performance tags and strong performance tags. They can also be divided into multiple levels according to the strength of their performance. For example, according to performance from weak to strong, they can be divided into: first-level performance tags, second-level performance tags, and third-level performance tags. Performance label, level four performance label.
步骤503:确定各目标量子电路任务各自的任务性能需求;Step 503: Determine the respective task performance requirements of each target quantum circuit task;
步骤504:将各目标量子电路任务分配至附加有表征具有相应性能的性能标签的量子电路转译进程。Step 504: Assign each target quantum circuit task to a quantum circuit translation process attached with a performance tag indicating corresponding performance.
步骤503-步骤504则首先确定各目标量子电路任务所分别对应的任务性能需求,然后将各目标量子电路任务分配至附加有表征具有相应性能的性能标签的量子电路转译进程,以期通过使具有所要求的性能的量子电路转译进程来处理存在相应性能需求的量子电路任务,使得每个量子电路转译进程确能够处理相应的量子电路任务,而不至于因性能不足无法处理某个量子电路任务导致处理失败、浪费处理资源。Steps 503 to 504 first determine the task performance requirements corresponding to each target quantum circuit task, and then allocate each target quantum circuit task to the quantum circuit translation process with a performance tag indicating the corresponding performance, in order to achieve the goal of achieving the target quantum circuit task by The quantum circuit translation process with the required performance is used to process the quantum circuit tasks with corresponding performance requirements, so that each quantum circuit translation process can indeed handle the corresponding quantum circuit task, rather than being unable to process a certain quantum circuit task due to insufficient performance. Failure, waste of processing resources.
请参考图6,图6为本公开实施例提供的一种基于重要程度分配不同的目标量子电路按任务至不同的量子转译进程的方法的流程图,其中流程600包括以下步骤:Please refer to Figure 6. Figure 6 is a flow chart of a method for allocating different target quantum circuits to different quantum translation processes based on importance based on an embodiment of the present disclosure. The process 600 includes the following steps:
步骤601:为预先创建出的不同量子电路转译进程分别附加不同的重要程度标签;Step 601: Attach different importance labels to different pre-created quantum circuit translation processes;
即本步骤旨在由上述执行主体为预先创建出的不同量子电路转译进程分别附加不同的重要程度标签,即不同的重要程度标签可意味着标签所在的量子电路转译进程专用于处理要求相应重要程度的量子电路任务。That is, this step is intended for the above execution subject to attach different importance labels to different pre-created quantum circuit translation processes. That is, different importance labels can mean that the quantum circuit translation process where the label is located is dedicated to processing requirements with corresponding importance levels. of quantum circuit tasks.
重要程度的划分标准可根据实际情况和实际需求自行确定,例如可根据量子电路任务对应原始量子电路模型的规模、所包含的量子门电路的数量、复杂程度,以及任务目的、任务提交用户的权限等级等具有区分的参数,此处不做具体限定。The criteria for classifying the degree of importance can be determined by oneself based on the actual situation and actual needs. For example, the scale of the original quantum circuit model corresponding to the quantum circuit task, the number and complexity of the quantum gate circuits included, as well as the purpose of the task and the permissions of the user submitting the task. Levels and other parameters have differentiating parameters and are not specifically limited here.
步骤602:确定各目标量子电路任务各自的重要程度;Step 602: Determine the importance of each target quantum circuit task;
步骤603:将各目标量子电路任务分配至附加有相应重要程度标签的量子电路转译进程。Step 603: Allocate each target quantum circuit task to a quantum circuit translation process attached with a corresponding importance label.
步骤602-步骤603则首先确定各目标量子电路任务所分别对应的重要程度,然后按照重要程度就高不就低的分配原则(即需要将要求某个重要程度的量子电路任务分配给至少能够处理具有该重要程度的量子电路任务的量子电路转译进程),将各目标量子电路任务分配至附加有相应重要程度标签的量子电路转译进程,以期通过使用合适的量子电路转译进程处理到相应的量子电路任务,使得每个量子电路转译进程满足任务所要求的重要程度,以为要求相应重要程度的任务提供相应的重要性保障。Steps 602 to 603 first determine the corresponding importance of each target quantum circuit task, and then assign the higher importance rather than the lower importance (that is, the quantum circuit tasks requiring a certain degree of importance need to be assigned to tasks that can at least handle the tasks). The quantum circuit translation process of the quantum circuit task with the importance level), allocate each target quantum circuit task to the quantum circuit translation process with the corresponding importance level label, in order to process the corresponding quantum circuit by using the appropriate quantum circuit translation process Task, so that each quantum circuit translation process meets the importance required by the task, and provides corresponding importance guarantee for tasks requiring corresponding importance.
进一步的,若发现目标量子电路任务中还存在高重要性任务(即具有超过预设重要程度的重要程度的目标量子电路任务),还可以将高重要性任务同时分配给至少两个不同的量子电路转译进程,并同时根据至少两个不同的量子电路转译进程各自返回的电路运行结果,更新高重要性任务的处理状态。以尽可能的避免单一量子电路转译进程来处理该高重要性任务导致出现的处理错误现象,保障得到的电路运行结果的准确性,即仅当至少两个不同的量子电路转译进程各自返回的电路运行结果一致(即结果存在误差时应保证误差处在允许范围内)时,才认为所得到的电路运行结果是准确性,进而才更新该高重要性任务的处理状态。Furthermore, if it is found that there are also high-importance tasks in the target quantum circuit task (that is, the target quantum circuit task has an importance that exceeds the preset importance level), the high-importance task can also be assigned to at least two different quantum tasks at the same time. The circuit translation process, and simultaneously updates the processing status of high-importance tasks based on the circuit operation results returned by at least two different quantum circuit translation processes. To avoid as much as possible the processing errors caused by a single quantum circuit translation process to handle this high-importance task, and to ensure the accuracy of the circuit operation results obtained, that is, only when at least two different quantum circuit translation processes each return a circuit Only when the running results are consistent (that is, when there is an error in the result, the error should be ensured to be within the allowable range), the obtained circuit running result is considered to be accurate, and then the processing status of the high-importance task is updated.
为加深理解,本公开还结合一个具体应用场景,给出了一种具体的实现方案:In order to deepen understanding, this disclosure also provides a specific implementation plan combined with a specific application scenario:
为了使当前稀有的量子资源可以供尽可能多的用户使用到,因此在该场景下将本地化的量子设备资源封装上云,使其不仅可满足本地用户传入的使用需求,也可以接收远端访问用户基于对云服务的使用传入其使用需求,为更好的满足对使用需求的处理,本场景下还创建有用于管理使用需求的代理(Agent),而Agent中负责主要业务可拆分为TaskPuller、TaskRunner和TaskPusher三个子进程,且子进程间依靠数据库协同。In order to make the currently rare quantum resources available to as many users as possible, localized quantum device resources are encapsulated on the cloud in this scenario, so that they can not only meet the incoming usage needs of local users, but also receive remote End-access users pass in their usage requirements based on the use of cloud services. In order to better meet the usage requirements, an agent (Agent) is also created for managing usage requirements in this scenario, and the main business in the Agent can be detached. It is divided into three sub-processes: TaskPuller, TaskRunner and TaskPusher, and the sub-processes rely on database collaboration.
其中,TaskPuller子进程负责收集服务端真机任务队列中的待执行任务,进程内是同步执行的,每次只会拉取一个任务处理。即TaskPuller进程对任务完成基本信息提取和初始化后将任务写入本地数据库;Among them, the TaskPuller sub-process is responsible for collecting the tasks to be executed in the real machine task queue on the server side. The process is executed synchronously, and only one task is pulled for processing at a time. That is, the TaskPuller process completes basic information extraction and initialization of the task and then writes the task into the local database;
TaskRunner子进程负责将电路与目标底层设备(即量子计算机或称量子设备)进行配适并提交运行,可以具体分为预处理(PRE)、运行(RUN)、后处理(POST)三个部分,即预处理部分负责将接收到的原始量子电路模型转译为量子计算机或量子设备可识别、可运行的电路模型或操作执行;运行部分负责将处理后能被量子计算机或量子设备可识别、可运行的转译后量子电路提交给量子计算机或量子设备,可使用量子计算机或量子设备提供的提交函数同步选项,提交后等待该函数将计算结果返回,因此运行阶段实际包含提交和等待底层返回结果;后处理部分负责对量子计算机或量子设备返回的结果做处理,处理过程根据底层系统而有所不同,有时会包含一些计算,有时也可以将结果转译到接受的格式直接返回;The TaskRunner sub-process is responsible for adapting the circuit to the target underlying device (i.e., quantum computer or quantum device) and submitting it for operation. It can be divided into three parts: preprocessing (PRE), operation (RUN), and post-processing (POST). That is, the preprocessing part is responsible for translating the received original quantum circuit model into a circuit model or operation execution that can be recognized and runnable by a quantum computer or quantum device; the operation part is responsible for converting the processed into a circuit model or operation execution that can be recognized and runnable by a quantum computer or quantum device. After the translated quantum circuit is submitted to a quantum computer or quantum device, you can use the submission function synchronization option provided by the quantum computer or quantum device. After submission, wait for the function to return the calculation result, so the running phase actually includes submitting and waiting for the bottom layer to return the result; The processing part is responsible for processing the results returned by quantum computers or quantum devices. The processing process varies according to the underlying system. Sometimes it includes some calculations, and sometimes it can also translate the results into an accepted format and return them directly;
TaskPusher子进程携带结果数据上传服务端,进程内同步执行,每次只会从数据库中取一个任务上传。The TaskPusher sub-process carries the result data and uploads it to the server. It is executed synchronously within the process. Only one task is uploaded from the database at a time.
由于每个进程都要将处理后的任务写入本地数据库,并将任务状态修改到下一阶段,每个进程从数据库中拉取任务时会根据任务状态从而找到对应要处理的任务,每个进程一次只能处理一个任务。常规技术架构下,电路任务在Agent中被各个进程依序传递执行,每个进程中都是同步的执行,效率较低。Since each process has to write the processed tasks into the local database and modify the task status to the next stage, when each process pulls tasks from the database, it will find the corresponding task to be processed based on the task status. Each process A process can only handle one task at a time. Under the conventional technical architecture, circuit tasks are sequentially transferred and executed by each process in the Agent. Each process is executed synchronously, which is inefficient.
针对现有串行技术架构方案的缺点,本实施例针对QPU Agent提供了一种将任务处理过程并行化的多进程优化方案,通过并行化提升执行效率并且为支持与多核QPU适配。即该方案在现有Agent的基础上,设计出支持TaskRunner子进程扩充的结构。In view of the shortcomings of the existing serial technology architecture solution, this embodiment provides a multi-process optimization solution for QPU Agent that parallelizes the task processing process. It improves execution efficiency through parallelization and supports adaptation to multi-core QPU. That is, this solution designs a structure that supports the expansion of TaskRunner sub-processes based on the existing Agent.
下述将针对多进程优化部分,详细的从整体架构设计和设计思路两方面进行展开介绍:The following will introduce the multi-process optimization part in detail from the overall architecture design and design ideas:
架构设计Architecture design
从上述对TaskPuller、TaskRunner和TaskPusher三个子进程的功能介绍不难看出,其中的TaskPuller和TaskPusher主要应用于收集任务,进程中并没有复杂的功能逻辑且都与服务端对接,因此对这两个进程运行中所消耗的时间不是需要主要关注和需要优化的目标。Agent中对于电路的处理基本都包含在了TaskRunner中,而且该进程负责与底层硬件系统对接并等待结果返回。当平台收到大量任务时,这些任务会堆积的就是在TaskPuller和TaskRunner之间这一步的数据库表中。因此,本实施例将需要进行优化设计的目标瞄准TaskRunner进程。From the above introduction to the functions of the three sub-processes of TaskPuller, TaskRunner and TaskPusher, it is not difficult to see that TaskPuller and TaskPusher are mainly used to collect tasks. There is no complex functional logic in the process and they are all connected to the server. Therefore, for these two processes The time consumed in operation is not the main goal that needs to be paid attention to and needs to be optimized. The circuit processing in Agent is basically included in TaskRunner, and this process is responsible for connecting with the underlying hardware system and waiting for the results to be returned. When the platform receives a large number of tasks, these tasks will accumulate in the database table between TaskPuller and TaskRunner. Therefore, this embodiment aims at the TaskRunner process as the target that needs to be optimized and designed.
设计思路Design ideas
Agent的瓶颈在于TaskRunner执行时间过长。由于Agent处理的每个电路任务间没有依赖关系,所以是可以对TaskRunner做并行化处理的。设计思路是在TaskRunner运行的数目上做扩充。将Agent由原本单个TaskRunner子进程框架改为支持运行多个TaskRunner。The bottleneck of Agent is that TaskRunner takes too long to execute. Since there is no dependency between each circuit task processed by the Agent, TaskRunner can be parallelized. The design idea is to expand the number of TaskRunner runs. Change the Agent from the original single TaskRunner sub-process framework to support running multiple TaskRunners.
另外,考虑到Agent是帮助云平台对接底层各种不同设备系统的工具,是否采取TaskRunner多进程的对接方式也要根据所对接系统来决定,可能不一定支持多进程的提交方式。因此设计中Agent要同时具备运行单个进程和多进程的兼容,并且在TaskRunner的数目上,需要能够灵活调整。In addition, considering that Agent is a tool that helps the cloud platform connect to various underlying device systems, whether to adopt TaskRunner's multi-process docking method also depends on the docking system, which may not necessarily support multi-process submission. Therefore, in the design, the Agent must be compatible with running a single process and multiple processes at the same time, and the number of TaskRunners needs to be flexibly adjusted.
在单进程模式下,TaskRunner可根据数据库中任务的state(状态)属性,按序将状态为pulled(待处理状态)的任务取出运行。在运行结束后将任务结果更新到数据库的同时将状态更新为executed(处理完成)状态。Agent中通过更新state来让任务继续往下流转。In single-process mode, TaskRunner can take out and run tasks with a status of pulled (to be processed) in order according to the state attribute of the tasks in the database. After the operation is completed, the task results are updated to the database and the status is updated to executed (processing completed) status. The Agent updates the state to allow tasks to continue flowing downwards.
在多进程模式下,请参见图7和图8所示的示意图,每个TaskRunner进程读取数据库时都对数据库上锁,保证同一时刻下只有一个进程来访问。为了防止多个TaskRunner取到相同任务,还加入中间状态occupied(已被占用状态),该状态用于描述当前任务已经被一个TaskRunner进程取走运行了。TaskRunner在拿到一个状态为pulled的任务后要在一次上锁中完成将任务状态更新为occupied的操作,从而保证锁释放后不会有其它进程取到相同任务。In multi-process mode, please refer to the schematic diagrams shown in Figure 7 and Figure 8. Each TaskRunner process locks the database when reading the database to ensure that only one process can access it at the same time. In order to prevent multiple TaskRunners from taking the same task, an intermediate state occupied (occupied state) is also added, which is used to describe that the current task has been taken away and run by a TaskRunner process. After TaskRunner obtains a task with a status of pulled, it must complete the operation of updating the task status to occupied in one lock, thereby ensuring that no other process will obtain the same task after the lock is released.
除此之外还需要考虑到Agent细粒度的问题。已有方案下Agent无论在哪一时刻被关闭,重启后都不会丢失任务。依靠的是对任务在数据库中落盘和状态管理。当为支持多进程模式加入一个新的状态occupied后,在任务处于该状态下Agent被关闭,那么下次重启时,这个状态为occupied的任务便不会再被任何TaskRunner读取并重新运行。这样也就破坏了当前Agent的细粒度。针对这点,方案还需要在Agent的守护进程中加入每次启动时将数据库中occupied状态回退到pulled状态的逻辑。In addition, the fine-grained issues of Agent need to be considered. Under the existing solution, no matter when the Agent is shut down, the task will not be lost after restarting. It relies on placing tasks in the database and managing their status. When a new state occupied is added to support multi-process mode, the Agent is shut down while the task is in this state. Then the next time it is restarted, the task in the occupied state will no longer be read and re-run by any TaskRunner. This also destroys the fine-grainedness of the current Agent. In response to this, the solution also needs to add logic to the Agent's daemon process to roll back the occupied state in the database to the pulled state every time it is started.
对于TaskRunner进程数的调控,采取配置环境变量的方法。由守护进程每次运行时根据给出的数目开启相应的进程。进程数可配置为1至N。需要注意,在多进程模式下任务按创建顺序从服务端获取,但无法保证底层执行时也遵循该顺序。每个任务根据电路规模不同在预处理中所用时间不同,有可能后创建的任务在TaskRunner2中很快处理完并超过还在TaskRunner1进程中进行预处理的任务,被先提交给底层系统。这时就会出现后创建任务比先创建任务执行的情况。但这种情况对用户是无感的,况且当两个任务以前后差距极小间隔被提交后,优先执行电路规模小的电路也是从整体上优化等待时间一种策略。To control the number of TaskRunner processes, configure environment variables. The daemon starts the corresponding process according to the given number each time it runs. The number of processes can be configured from 1 to N. It should be noted that in multi-process mode, tasks are obtained from the server in the order of creation, but there is no guarantee that the underlying execution will also follow this order. Each task takes different time in preprocessing depending on the size of the circuit. It is possible that the tasks created later will be processed quickly in TaskRunner2 and exceed the tasks that are still being preprocessed in the TaskRunner1 process, and will be submitted to the underlying system first. At this time, there will be a situation where the task created later is executed than the task created first. However, this situation is insensitive to the user. Moreover, when two tasks are submitted with a very small gap between them, prioritizing the execution of smaller circuits is also a strategy to optimize the waiting time as a whole.
通过上述多进程优化方案,为QPU Agent提供了并行化处理任务的实现途径。这种并行化带来的好处体现在Agent处理并发任务时效率的提升和Agent在对底层系统接口的调用上。从云平台的角度看,Agent作为运行真机任务链条上的一环,提升其内部对任务的处理效率会直接反馈到用户的使用上。从底层硬件系统的角度看,Agent提供多进程往底层提交任务的服务,也是提升硬件使用率,充分利用硬件资源的必要支持。进而得以从优化用户使用体验和提升底层资源利用两方面,帮助平台更具竞争力。Through the above multi-process optimization scheme, QPU Agent is provided with a way to implement parallel processing tasks. The benefits brought by this parallelization are reflected in the improvement in efficiency when the Agent handles concurrent tasks and the Agent's call to the underlying system interface. From the perspective of the cloud platform, Agent is a link in the chain of running real machine tasks. Improving its internal task processing efficiency will directly feed back to the user's use. From the perspective of the underlying hardware system, Agent provides a service for multiple processes to submit tasks to the underlying layer, which is also a necessary support for improving hardware utilization and making full use of hardware resources. This can help the platform become more competitive by optimizing the user experience and improving the utilization of underlying resources.
进一步参考图9,作为对上述各图所示方法的实现,本公开提供了一种量子电路任务处理装置的一个实施例,该装置实施例与图2所示的方法实施例相对应,该装置具体可以应用于各种电子设备中。With further reference to Figure 9, as an implementation of the methods shown in the above figures, the present disclosure provides an embodiment of a quantum circuit task processing device. The device embodiment corresponds to the method embodiment shown in Figure 2. The device Specifically, it can be applied to various electronic devices.
如图9所示,本实施例的量子电路任务处理装置900可以包括:任务分配单元901、转译单元902、提交量子设备运行单元903、处理状态更新单元904。其中,任务分配单元901,被配置成响应于任务队列中存在至少两个待处理的目标量子电路任务,将不同的目标量子电路任务分配至不同的量子电路转译进程;其中,基于量子计算机的中央处理器的核心数预先创建有多个量子电路转译进程;转译单元902,被配置成控制各量子电路转译进程对接收到的目标量子电路任务进行电路转译操作,得到转译后量子电路;提交量子设备运行单元903,被配置成控制各量子电路转译进程将相应的转译后量子电路提交给量子计算机进行运行,并得到量子计算机返回的电路运行结果;处理状态更新单元904,被配置成根据各量子电路转译进程返回的电路运行结果,更新相应的目标量子电路任务的处理状态。As shown in Figure 9, the quantum circuit task processing device 900 of this embodiment may include: a task allocation unit 901, a translation unit 902, a quantum device operation submission unit 903, and a processing status update unit 904. Among them, the task allocation unit 901 is configured to respond to the existence of at least two target quantum circuit tasks to be processed in the task queue, and allocate different target quantum circuit tasks to different quantum circuit translation processes; wherein, based on the central processing unit of the quantum computer The core number of the processor is pre-created with multiple quantum circuit translation processes; the translation unit 902 is configured to control each quantum circuit translation process to perform a circuit translation operation on the received target quantum circuit task to obtain the translated quantum circuit; submit the quantum device The operation unit 903 is configured to control the translation process of each quantum circuit, submit the corresponding translated quantum circuit to the quantum computer for operation, and obtain the circuit operation results returned by the quantum computer; the processing status update unit 904 is configured to control the translation process of each quantum circuit according to the The circuit operation result returned by the translation process updates the processing status of the corresponding target quantum circuit task.
在本实施例中,量子电路任务处理装置900中:任务分配单元901、转译单元902、提交量子设备运行单元903、处理状态更新单元904的具体处理及其所带来的技术效果可分别参考图2对应实施例中的步骤201-204的相关说明,在此不再赘述。In this embodiment, in the quantum circuit task processing device 900: the task allocation unit 901, the translation unit 902, the submission quantum device operation unit 903, and the processing status update unit 904. The specific processing and the technical effects thereof can be referred to Fig. 2 corresponds to the relevant descriptions of steps 201-204 in the embodiment, which will not be described again here.
在本实施例的一些可选的实现方式中,量子电路任务处理装置900中还可以包括:In some optional implementations of this embodiment, the quantum circuit task processing device 900 may also include:
核心数确定单元,被配置成确定量子计算机的中央处理器的核心数;a core number determination unit configured to determine the number of cores of the central processor of the quantum computer;
量子电路转译进程创建单元,被配置成创建与核心数数量一致的量子电路转译进程;The quantum circuit translation process creation unit is configured to create a quantum circuit translation process consistent with the number of cores;
进程池创建单元,被配置成创建存储各量子电路转译进程的进程池;The process pool creation unit is configured to create a process pool that stores the translation processes of each quantum circuit;
对应的,任务分配单元901可以被进一步配置成:Correspondingly, the task allocation unit 901 can be further configured to:
将不同的目标量子电路任务分配至进程池中的不同的量子电路转译进程。Allocate different target quantum circuit tasks to different quantum circuit translation processes in the process pool.
在本实施例的一些可选的实现方式中,量子电路任务处理装置900中还可以包括:In some optional implementations of this embodiment, the quantum circuit task processing device 900 may also include:
进程状态控制单元,被配置成控制进程池中预设数量的量子电路转译进程处于空闲等待状态、剩余数量的量子电路转译进程处于休眠状态;其中,预设数量根据任务队列中目标量子电路任务的平均数量确定。The process state control unit is configured to control a preset number of quantum circuit translation processes in the process pool to be in an idle waiting state, and the remaining number of quantum circuit translation processes to be in a dormant state; wherein, the preset number is based on the number of target quantum circuit tasks in the task queue. The average quantity is determined.
在本实施例的一些可选的实现方式中,量子电路任务处理装置900中还可以包括:In some optional implementations of this embodiment, the quantum circuit task processing device 900 may also include:
进程销毁单元,被配置成销毁休眠状态持续超过预设时长的量子电路转译进程。The process destruction unit is configured to destroy the quantum circuit translation process whose dormant state lasts for more than a preset period of time.
在本实施例的一些可选的实现方式中,量子电路任务处理装置900中还可以包括:In some optional implementations of this embodiment, the quantum circuit task processing device 900 may also include:
任务类型标签附加单元,被配置成为预先创建出的不同量子电路转译进程分别附加不同的任务类型标签;The task type label attaching unit is configured to attach different task type labels to different pre-created quantum circuit translation processes;
对应的,任务分配单元901可以被进一步配置成:Correspondingly, the task allocation unit 901 can be further configured to:
确定各目标量子电路任务各自的任务类型;Determine the respective task types of each target quantum circuit task;
将同一任务类型的目标量子电路任务分配至用于具有相应的任务类型标签的量子电路转译进程;Assign target quantum circuit tasks of the same task type to quantum circuit translation processes with corresponding task type labels;
在本实施例的一些可选的实现方式中,量子电路任务处理装置900中还可以包括:In some optional implementations of this embodiment, the quantum circuit task processing device 900 may also include:
性能资源分配单元,被配置成为不同的量子电路转译进程在创建时分配不同量的性能资源;The performance resource allocation unit is configured to allocate different amounts of performance resources to different quantum circuit translation processes when they are created;
性能标签附加单元,被配置成根据分配的性能资源的多少,为相应的量子电路转译进程附加区分性能高低的性能标签;The performance label attachment unit is configured to attach a performance label that distinguishes high and low performance to the corresponding quantum circuit translation process according to the amount of allocated performance resources;
对应的,任务分配单元901可以被进一步配置成:Correspondingly, the task allocation unit 901 can be further configured to:
确定各目标量子电路任务各自的任务性能需求;Determine the respective task performance requirements for each target quantum circuit task;
将各目标量子电路任务分配至附加有表征具有相应性能的性能标签的量子电路转译进程。Each target quantum circuit task is assigned to a quantum circuit translation process appended with a performance tag characterizing the corresponding performance.
在本实施例的一些可选的实现方式中,量子电路任务处理装置900中还可以包括:In some optional implementations of this embodiment, the quantum circuit task processing device 900 may also include:
重要程度标签附加单元,被配置成为预先创建出的不同量子电路转译进程分别附加不同的重要程度标签;The importance label attaching unit is configured to attach different importance labels to different pre-created quantum circuit translation processes;
对应的,任务分配单元901可以被进一步配置成:Correspondingly, the task allocation unit 901 can be further configured to:
确定各目标量子电路任务各自的重要程度;Determine the importance of each target quantum circuit task;
将各目标量子电路任务分配至附加有相应重要程度标签的量子电路转译进程。Allocate each target quantum circuit task to a quantum circuit translation process attached with a corresponding importance label.
在本实施例的一些可选的实现方式中,量子电路任务处理装置900中还可以包括:In some optional implementations of this embodiment, the quantum circuit task processing device 900 may also include:
高重要性任务分配单元,被配置成响应于目标量子电路任务中存在高重要性任务,将高重要性任务同时分配给至少两个不同的量子电路转译进程;其中,高重要性任务为具有超过预设重要程度的重要程度的目标量子电路任务;The high-importance task allocation unit is configured to respond to the existence of a high-importance task in the target quantum circuit task and allocate the high-importance task to at least two different quantum circuit translation processes at the same time; wherein the high-importance task is a task with more than Target quantum circuit tasks with preset levels of importance;
高重要性任务处理状态更新单元,被配置成同时根据至少两个不同的量子电路转译进程各自返回的电路运行结果,更新高重要性任务的处理状态。The high-importance task processing status update unit is configured to simultaneously update the processing status of the high-importance task based on the circuit operation results returned by at least two different quantum circuit translation processes.
本实施例作为对应于上述方法实施例的装置实施例存在,本实施例提供的量子电路任务处理装置,将任务队列中多个量子电路任务分配至预先创建的多个量子电路转译进程,以借助不同的量子电路转译进程来同时处理不同的量子电路任务,以同时对多个量子电路任务执行转译操作和提交等待,从而避免持续传入的量子电路任务在任务队列中不断堆积,提升量子设备对量子电路任务的处理效率。This embodiment exists as a device embodiment corresponding to the above method embodiment. The quantum circuit task processing device provided by this embodiment allocates multiple quantum circuit tasks in the task queue to multiple pre-created quantum circuit translation processes. Different quantum circuit translation processes are used to process different quantum circuit tasks at the same time to perform translation operations and submit waiting for multiple quantum circuit tasks at the same time, thereby avoiding the continuous accumulation of incoming quantum circuit tasks in the task queue and improving the efficiency of quantum devices. Processing efficiency of quantum circuit tasks.
根据本公开的实施例,本公开还提供了一种电子设备,该电子设备包括:至少一个处理器;以及与至少一个处理器通信连接的存储器;其中,存储器存储有可被至少一个处理器执行的指令,该指令被至少一个处理器执行,以使至少一个处理器执行时能够实现上述任意实施例所描述的量子电路任务处理方法。According to an embodiment of the present disclosure, the present disclosure also provides an electronic device, which includes: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores information that can be executed by the at least one processor. instructions, which are executed by at least one processor, so that when executed by at least one processor, the quantum circuit task processing method described in any of the above embodiments can be implemented.
根据本公开的实施例,本公开还提供了一种可读存储介质,该可读存储介质存储有计算机指令,该计算机指令用于使计算机执行时能够实现上述任意实施例所描述的量子电路任务处理方法。According to an embodiment of the present disclosure, the present disclosure also provides a readable storage medium that stores computer instructions. The computer instructions are used to enable the computer to implement the quantum circuit tasks described in any of the above embodiments when executed. Approach.
根据本公开的实施例,本公开还提供了一种计算机程序产品,该计算机程序在被处理器执行时能够实现上述任意实施例所描述的量子电路任务处理方法。According to an embodiment of the present disclosure, the present disclosure also provides a computer program product, which when executed by a processor can implement the quantum circuit task processing method described in any of the above embodiments.
图10示出了可以用来实施本公开的实施例的示例电子设备1000的示意性框图。电子设备旨在表示各种形式的数字计算机,诸如,膝上型计算机、台式计算机、工作台、个人数字助理、服务器、刀片式服务器、大型计算机、和其它适合的计算机。电子设备还可以表示各种形式的移动装置,诸如,个人数字处理、蜂窝电话、智能电话、可穿戴设备和其它类似的计算装置。本文所示的部件、它们的连接和关系、以及它们的功能仅仅作为示例,并且不意在限制本文中描述的和/或者要求的本公开的实现。Figure 10 shows a schematic block diagram of an example electronic device 1000 that may be used to implement embodiments of the present disclosure. Electronic devices are intended to refer to various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. Electronic devices may also represent various forms of mobile devices, such as personal digital assistants, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are examples only and are not intended to limit implementations of the disclosure described and/or claimed herein.
如图10所示,设备1000包括计算单元1001,其可以根据存储在只读存储器(ROM)1002中的计算机程序或者从存储单元1008加载到随机访问存储器(RAM)1003中的计算机程序,来执行各种适当的动作和处理。在RAM 1003中,还可存储设备1000操作所需的各种程序和数据。计算单元1001、ROM 1002以及RAM 1003通过总线1004彼此相连。输入/输出(I/O)接口1005也连接至总线1004。As shown in FIG. 10 , the device 1000 includes a computing unit 1001 that can execute according to a computer program stored in a read-only memory (ROM) 1002 or loaded from a storage unit 1008 into a random access memory (RAM) 1003 Various appropriate actions and treatments. In the RAM 1003, various programs and data required for the operation of the device 1000 can also be stored. Computing unit 1001, ROM 1002 and RAM 1003 are connected to each other via bus 1004. An input/output (I/O) interface 1005 is also connected to bus 1004.
设备1000中的多个部件连接至I/O接口1005,包括:输入单元1006,例如键盘、鼠标等;输出单元1007,例如各种类型的显示器、扬声器等;存储单元1008,例如磁盘、光盘等;以及通信单元1009,例如网卡、调制解调器、无线通信收发机等。通信单元1009允许设备1000通过诸如因特网的计算机网络和/或各种电信网络与其他设备交换信息/数据。Multiple components in the device 1000 are connected to the I/O interface 1005, including: input unit 1006, such as a keyboard, mouse, etc.; output unit 1007, such as various types of displays, speakers, etc.; storage unit 1008, such as a magnetic disk, optical disk, etc. ; and communication unit 1009, such as a network card, modem, wireless communication transceiver, etc. The communication unit 1009 allows the device 1000 to exchange information/data with other devices through computer networks such as the Internet and/or various telecommunications networks.
计算单元1001可以是各种具有处理和计算能力的通用和/或专用处理组件。计算单元1001的一些示例包括但不限于中央处理单元(CPU)、图形处理单元(GPU)、各种专用的人工智能(AI)计算芯片、各种运行机器学习模型算法的计算单元、数字信号处理器(DSP)、以及任何适当的处理器、控制器、微控制器等。计算单元1001执行上文所描述的各个方法和处理,例如量子电路任务处理方法。例如,在一些实施例中,量子电路任务处理方法可被实现为计算机软件程序,其被有形地包含于机器可读介质,例如存储单元1008。在一些实施例中,计算机程序的部分或者全部可以经由ROM 1002和/或通信单元1009而被载入和/或安装到设备1000上。当计算机程序加载到RAM 1003并由计算单元1001执行时,可以执行上文描述的量子电路任务处理方法的一个或多个步骤。备选地,在其他实施例中,计算单元1001可以通过其他任何适当的方式(例如,借助于固件)而被配置为执行量子电路任务处理方法。Computing unit 1001 may be a variety of general and/or special purpose processing components having processing and computing capabilities. Some examples of the computing unit 1001 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, digital signal processing processor (DSP), and any appropriate processor, controller, microcontroller, etc. The computing unit 1001 performs various methods and processes described above, such as quantum circuit task processing methods. For example, in some embodiments, the quantum circuit task processing method may be implemented as a computer software program that is tangibly embodied in a machine-readable medium, such as storage unit 1008. In some embodiments, part or all of the computer program may be loaded and/or installed onto device 1000 via ROM 1002 and/or communication unit 1009 . When the computer program is loaded into RAM 1003 and executed by computing unit 1001, one or more steps of the quantum circuit task processing method described above may be performed. Alternatively, in other embodiments, the computing unit 1001 may be configured to perform the quantum circuit task processing method in any other suitable manner (eg, by means of firmware).
本文中以上描述的系统和技术的各种实施方式可以在数字电子电路系统、集成电路系统、场可编程门阵列(FPGA)、专用集成电路(ASIC)、专用标准产品(ASSP)、芯片上系统的系统(SOC)、负载可编程逻辑设备(CPLD)、计算机硬件、固件、软件、和/或它们的组合中实现。这些各种实施方式可以包括:实施在一个或者多个计算机程序中,该一个或者多个计算机程序可在包括至少一个可编程处理器的可编程系统上执行和/或解释,该可编程处理器可以是专用或者通用可编程处理器,可以从存储系统、至少一个输入装置、和至少一个输出装置接收数据和指令,并且将数据和指令传输至该存储系统、该至少一个输入装置、和该至少一个输出装置。Various implementations of the systems and techniques described above may be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on a chip implemented in a system (SOC), load programmable logic device (CPLD), computer hardware, firmware, software, and/or a combination thereof. These various embodiments may include implementation in one or more computer programs executable and/or interpreted on a programmable system including at least one programmable processor, the programmable processor The processor, which may be a special purpose or general purpose programmable processor, may receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device. An output device.
用于实施本公开的方法的程序代码可以采用一个或多个编程语言的任何组合来编写。这些程序代码可以提供给通用计算机、专用计算机或其他可编程数据处理装置的处理器或控制器,使得程序代码当由处理器或控制器执行时使流程图和/或框图中所规定的功能/操作被实施。程序代码可以完全在机器上执行、部分地在机器上执行,作为独立软件包部分地在机器上执行且部分地在远程机器上执行或完全在远程机器或服务器上执行。Program code for implementing the methods of the present disclosure may be written in any combination of one or more programming languages. These program codes may be provided to a processor or controller of a general-purpose computer, special-purpose computer, or other programmable data processing device, such that the program codes, when executed by the processor or controller, cause the functions specified in the flowcharts and/or block diagrams/ The operation is implemented. The program code may execute entirely on the machine, partly on the machine, as a stand-alone software package, partly on the machine and partly on a remote machine or entirely on the remote machine or server.
在本公开的上下文中,机器可读介质可以是有形的介质,其可以包含或存储以供指令执行系统、装置或设备使用或与指令执行系统、装置或设备结合地使用的程序。机器可读介质可以是机器可读信号介质或机器可读储存介质。机器可读介质可以包括但不限于电子的、磁性的、光学的、电磁的、红外的、或半导体系统、装置或设备,或者上述内容的任何合适组合。机器可读存储介质的更具体示例会包括基于一个或多个线的电气连接、便携式计算机盘、硬盘、随机存取存储器(RAM)、只读存储器(ROM)、可擦除可编程只读存储器(EPROM或快闪存储器)、光纤、便捷式紧凑盘只读存储器(CD-ROM)、光学储存设备、磁储存设备、或上述内容的任何合适组合。In the context of this disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in connection with an instruction execution system, apparatus, or device. The machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. Machine-readable media may include, but are not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media would include one or more wire-based electrical connections, laptop disks, hard drives, random access memory (RAM), read only memory (ROM), erasable programmable read only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination of the above.
为了提供与用户的交互,可以在计算机上实施此处描述的系统和技术,该计算机具有:用于向用户显示信息的显示装置(例如,CRT(阴极射线管)或者LCD(液晶显示器)监视器);以及键盘和指向装置(例如,鼠标或者轨迹球),用户可以通过该键盘和该指向装置来将输入提供给计算机。其它种类的装置还可以用于提供与用户的交互;例如,提供给用户的反馈可以是任何形式的传感反馈(例如,视觉反馈、听觉反馈、或者触觉反馈);并且可以用任何形式(包括声输入、语音输入或者、触觉输入)来接收来自用户的输入。To provide interaction with a user, the systems and techniques described herein may be implemented on a computer having a display device (eg, a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user ); and a keyboard and pointing device (eg, a mouse or a trackball) through which a user can provide input to the computer. Other kinds of devices may also be used to provide interaction with the user; for example, the feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and may be provided in any form, including Acoustic input, voice input or tactile input) to receive input from the user.
可以将此处描述的系统和技术实施在包括后台部件的计算系统(例如,作为数据服务器)、或者包括中间件部件的计算系统(例如,应用服务器)、或者包括前端部件的计算系统(例如,具有图形用户界面或者网络浏览器的用户计算机,用户可以通过该图形用户界面或者该网络浏览器来与此处描述的系统和技术的实施方式交互)、或者包括这种后台部件、中间件部件、或者前端部件的任何组合的计算系统中。可以通过任何形式或者介质的数字数据通信(例如,通信网络)来将系统的部件相互连接。通信网络的示例包括:局域网(LAN)、广域网(WAN)和互联网。The systems and techniques described herein may be implemented in a computing system that includes back-end components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes front-end components (e.g., A user's computer having a graphical user interface or web browser through which the user can interact with implementations of the systems and technologies described herein), or including such backend components, middleware components, or any combination of front-end components in a computing system. The components of the system may be interconnected by any form or medium of digital data communication (eg, a communications network). Examples of communication networks include: local area network (LAN), wide area network (WAN), and the Internet.
计算机系统可以包括客户端和服务器。客户端和服务器一般远离彼此并且通常通过通信网络进行交互。通过在相应的计算机上运行并且彼此具有客户端-服务器关系的计算机程序来产生客户端和服务器的关系。服务器可以是云服务器,又称为云计算服务器或云主机,是云计算服务体系中的一项主机产品,以解决传统物理主机与虚拟专用服务器(VPS,Virtual Private Server)服务中存在的管理难度大,业务扩展性弱的缺陷。Computer systems may include clients and servers. Clients and servers are generally remote from each other and typically interact over a communications network. The relationship of client and server is created by computer programs running on corresponding computers and having a client-server relationship with each other. The server can be a cloud server, also known as cloud computing server or cloud host. It is a host product in the cloud computing service system to solve the management difficulties existing in traditional physical host and virtual private server (VPS) services. Large, weak business scalability.
根据本公开实施例的技术方案,将任务队列中多个量子电路任务分配至预先创建的多个量子电路转译进程,以借助不同的量子电路转译进程来同时处理不同的量子电路任务,以同时对多个量子电路任务执行转译操作和提交等待,从而避免持续传入的量子电路任务在任务队列中不断堆积,提升量子设备对量子电路任务的处理效率。According to the technical solution of the embodiment of the present disclosure, multiple quantum circuit tasks in the task queue are assigned to multiple pre-created quantum circuit translation processes, so that different quantum circuit tasks can be processed simultaneously with the help of different quantum circuit translation processes to simultaneously process Multiple quantum circuit tasks perform translation operations and submit waiting, thereby avoiding the continuous accumulation of incoming quantum circuit tasks in the task queue and improving the processing efficiency of quantum circuit tasks by quantum devices.
应该理解,可以使用上面所示的各种形式的流程,重新排序、增加或删除步骤。例如,本发公开中记载的各步骤可以并行地执行也可以顺序地执行也可以不同的次序执行,只要能够实现本公开公开的技术方案所期望的结果,本文在此不进行限制。It should be understood that various forms of the process shown above may be used, with steps reordered, added or deleted. For example, each step described in the present disclosure can be executed in parallel, sequentially, or in a different order. As long as the desired results of the technical solution disclosed in the present disclosure can be achieved, there is no limitation here.
上述具体实施方式,并不构成对本公开保护范围的限制。本领域技术人员应该明白的是,根据设计要求和其他因素,可以进行各种修改、组合、子组合和替代。任何在本公开的精神和原则之内所作的修改、等同替换和改进等,均应包含在本公开保护范围之内。The above-mentioned specific embodiments do not constitute a limitation on the scope of the present disclosure. It will be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions are possible depending on design requirements and other factors. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of this disclosure shall be included in the protection scope of this disclosure.
Claims (18)
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202211708228.7A CN115952868B (en) | 2022-12-29 | 2022-12-29 | Quantum circuit task processing method and device, electronic equipment and readable storage medium |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202211708228.7A CN115952868B (en) | 2022-12-29 | 2022-12-29 | Quantum circuit task processing method and device, electronic equipment and readable storage medium |
Publications (2)
| Publication Number | Publication Date |
|---|---|
| CN115952868A CN115952868A (en) | 2023-04-11 |
| CN115952868B true CN115952868B (en) | 2024-01-12 |
Family
ID=87296775
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN202211708228.7A Active CN115952868B (en) | 2022-12-29 | 2022-12-29 | Quantum circuit task processing method and device, electronic equipment and readable storage medium |
Country Status (1)
| Country | Link |
|---|---|
| CN (1) | CN115952868B (en) |
Citations (7)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US9141741B1 (en) * | 2013-10-29 | 2015-09-22 | Cadence Design Systems, Inc. | Methods, systems, and articles of manufacture for implementing mixed-signal electronic circuit designs with power data in standardized power formats |
| CN109858628A (en) * | 2019-02-28 | 2019-06-07 | 北京百度网讯科技有限公司 | Compile method, apparatus, equipment and the computer readable storage medium of quantum circuit |
| CN112926741A (en) * | 2019-12-06 | 2021-06-08 | 英特尔公司 | Parallel stream apparatus and method for fault tolerant quantum computer |
| CN113985780A (en) * | 2021-10-28 | 2022-01-28 | 中国人民解放军战略支援部队信息工程大学 | Multi-channel remote control device and method, storage medium and electronic device |
| CN114139712A (en) * | 2021-12-01 | 2022-03-04 | 北京百度网讯科技有限公司 | Quantum circuit processing method, processing device, electronic device and storage medium |
| CN114528995A (en) * | 2022-01-04 | 2022-05-24 | 上海交通大学 | Light-weight and quick quantum circuit simulation implementation system based on PyTorch |
| EP4006788A1 (en) * | 2020-10-14 | 2022-06-01 | Tencent Technology (Shenzhen) Company Limited | Quantum circuit determining method and apparatus, device, and storage medium |
Family Cites Families (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US12248847B2 (en) * | 2021-05-04 | 2025-03-11 | International Business Machines Corporation | Communication coordination and node synchronization for enhanced quantum circuit operation employing a hybrid classical/quantum system |
| US20220383179A1 (en) * | 2021-05-20 | 2022-12-01 | IonQ, Inc. | Debugging of quantum circuits |
-
2022
- 2022-12-29 CN CN202211708228.7A patent/CN115952868B/en active Active
Patent Citations (7)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US9141741B1 (en) * | 2013-10-29 | 2015-09-22 | Cadence Design Systems, Inc. | Methods, systems, and articles of manufacture for implementing mixed-signal electronic circuit designs with power data in standardized power formats |
| CN109858628A (en) * | 2019-02-28 | 2019-06-07 | 北京百度网讯科技有限公司 | Compile method, apparatus, equipment and the computer readable storage medium of quantum circuit |
| CN112926741A (en) * | 2019-12-06 | 2021-06-08 | 英特尔公司 | Parallel stream apparatus and method for fault tolerant quantum computer |
| EP4006788A1 (en) * | 2020-10-14 | 2022-06-01 | Tencent Technology (Shenzhen) Company Limited | Quantum circuit determining method and apparatus, device, and storage medium |
| CN113985780A (en) * | 2021-10-28 | 2022-01-28 | 中国人民解放军战略支援部队信息工程大学 | Multi-channel remote control device and method, storage medium and electronic device |
| CN114139712A (en) * | 2021-12-01 | 2022-03-04 | 北京百度网讯科技有限公司 | Quantum circuit processing method, processing device, electronic device and storage medium |
| CN114528995A (en) * | 2022-01-04 | 2022-05-24 | 上海交通大学 | Light-weight and quick quantum circuit simulation implementation system based on PyTorch |
Non-Patent Citations (2)
| Title |
|---|
| Parallelizing quantum circuits;Anne Broadbent et al.;Theoretical Computer Science;全文 * |
| Separation of gates in quantum parallel programming;Kan He et al.;arxiv.org * |
Also Published As
| Publication number | Publication date |
|---|---|
| CN115952868A (en) | 2023-04-11 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| CN113835887B (en) | Video memory allocation method, device, electronic device and readable storage medium | |
| CN110851237A (en) | Container cross heterogeneous cluster reconstruction method for domestic platform | |
| CN114185641B (en) | Virtual machine cold migration method and device, electronic equipment and storage medium | |
| CN113590329A (en) | Resource processing method and device | |
| CN113986580A (en) | Task processing method and device | |
| CN114968567A (en) | Method, apparatus and medium for allocating computing resources of a compute node | |
| CN114968286A (en) | Microservice publishing method, device, storage medium and electronic device | |
| CN117130571A (en) | Display method, device, chip and storage medium based on multi-core heterogeneous system | |
| CN115061947B (en) | Resource management method, device, equipment and storage medium | |
| CN114697398B (en) | Data processing methods, devices, electronic equipment, storage media and products | |
| CN102929619A (en) | Process automation software development system across hardware platform | |
| CN115390992A (en) | Virtual machine creating method, device, equipment and storage medium | |
| CN115421855A (en) | Application management system, method and device based on cloud-edge collaboration | |
| CN115952868B (en) | Quantum circuit task processing method and device, electronic equipment and readable storage medium | |
| CN118626275A (en) | Heterogeneous computing resource virtualization processing method, electronic device and storage medium | |
| CN118467113A (en) | A container-aware scheduling method, product, device and medium | |
| CN114048030B (en) | Method and device for scheduling operator | |
| CN114816758B (en) | Resource allocation method and device | |
| CN117009000A (en) | Component, method, device, apparatus and medium for operating open source buddha system | |
| CN117056022A (en) | RPA task execution method and device, electronic equipment and storage medium | |
| CN115309558A (en) | A resource scheduling management system, method, computer equipment and storage medium | |
| CN114860455A (en) | Request processing method, device, equipment and storage medium | |
| CN114490000A (en) | Task processing method, device, equipment and storage medium | |
| CN112965836A (en) | Service control method and device, electronic equipment and readable storage medium | |
| CN114792186A (en) | Production scheduling simulation method and device |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| PB01 | Publication | ||
| PB01 | Publication | ||
| SE01 | Entry into force of request for substantive examination | ||
| SE01 | Entry into force of request for substantive examination | ||
| GR01 | Patent grant | ||
| GR01 | Patent grant |