WO2021147878A1 - 控制任务集中的任务并行的系统及其方法 - Google Patents

控制任务集中的任务并行的系统及其方法 Download PDF

Info

Publication number
WO2021147878A1
WO2021147878A1 PCT/CN2021/072788 CN2021072788W WO2021147878A1 WO 2021147878 A1 WO2021147878 A1 WO 2021147878A1 CN 2021072788 W CN2021072788 W CN 2021072788W WO 2021147878 A1 WO2021147878 A1 WO 2021147878A1
Authority
WO
WIPO (PCT)
Prior art keywords
critical
task
critical section
section
region
Prior art date
Application number
PCT/CN2021/072788
Other languages
English (en)
French (fr)
Inventor
李新奇
柳俊丞
袁进辉
Original Assignee
北京一流科技有限公司
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by 北京一流科技有限公司 filed Critical 北京一流科技有限公司
Publication of WO2021147878A1 publication Critical patent/WO2021147878A1/zh

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/48Program initiating; Program switching, e.g. by interrupt
    • G06F9/4806Task transfer initiation or dispatching
    • G06F9/4843Task transfer initiation or dispatching by program, e.g. task dispatcher, supervisor, operating system
    • G06F9/4881Scheduling strategies for dispatcher, e.g. round robin, multi-level priority queues

Definitions

  • the present disclosure relates to a data processing technology, and more specifically, the present disclosure relates to a system and method for controlling task parallelism in task concentration.
  • the processing intention of big data is complex data processing technology.
  • a data processing job is usually divided into multiple tasks, and in the integrated computing architecture, the CPU and the GPU connected to the CPU are responsible for the computing tasks. These computing tasks will be based on the timing relationship between each other. Perform parallel calculations. But sometimes, many tasks are dependent on each other. For example, some data required for the calculation of the first task will also be used for the calculation of the second task; or some data generated by the calculation of the first task will be used in the calculation of the second task. Used by the calculation of the second task. Therefore, in the process of data usage conflict between the two, it will inevitably lead to the failure of the second task when the first task is executed, resulting in a kind of downtime. vice versa.
  • the present disclosure provides a system for controlling task parallelism in a task set, including: a critical region analysis component for analyzing the relationship between any two tasks in a task set.
  • the critical section is assigned a predetermined critical section mark to the critical section obtained by analysis to form a critical section mark relationship graph in the task set.
  • the critical section is a memory sharing part between any two tasks.
  • the critical section mark relationship chart records the mutual exclusion relationship of any two critical sections; and the critical section monitoring component, which is located in the data processing path of each task instance, is used for multiple executed task instances, based on the critical section mark relationship chart , Allows execution of the first critical section of a pair of critical sections in a mutually exclusive relationship and makes the other critical section wait for execution.
  • the critical section monitoring component arranges the critical section markers of the first critical section that can be executed immediately or in the first task instance in the first critical section monitoring queue, and Arrange the critical section markers of the second critical section of the second task instance that cannot be executed simultaneously with the first critical section in the second critical section monitoring queue, and monitor whether the execution operation of the first critical section is completed, so that the first critical section After the execution of the zone is completed, the critical zone mark of the first critical zone is moved out of the first critical zone monitoring queue, and the critical zone mark of the second critical zone is moved from the second critical zone monitoring queue to the first critical zone monitoring queue .
  • the critical region tag includes a critical region ID and a source node and a sink node.
  • the critical-region monitoring component monitors the completion status of the operation performed in the first critical region by receiving a message from the sink node of the first critical region, and is After receiving the message, the sink node sends a message to the source node of the critical section of the second task instance.
  • the critical section is an input critical section, an output critical section, or a main critical section.
  • a method for controlling task parallelism in a task set which includes: a task analysis step, which analyzes the critical region between any two tasks in a task set through a critical region analysis component, and obtains The critical section is assigned a predetermined critical section mark to form a critical section mark relationship graph in the task set, the critical section is a memory sharing part between any two tasks, and the critical section mark relationship graph records any The mutual exclusion relationship between the two critical regions; and the critical region monitoring step, through the critical region monitoring component, for each task instance data processing path, for multiple executed task instances, based on the critical region marked relationship chart, allowing mutual execution In the exclusion relationship, the first critical section of a pair of critical sections arrives first, and the other critical section is in a state of waiting for execution.
  • the critical section monitoring step arranges the critical section markers of the first critical section that can be executed immediately or in the first task instance in the first critical section monitoring queue, and Arrange the critical section markers of the second critical section of the second task instance that cannot be executed simultaneously with the first critical section in the second critical section monitoring queue, and monitor whether the execution operation of the first critical section is completed, so that the first critical section After the execution of the zone is completed, the critical zone mark of the first critical zone is moved out of the first critical zone monitoring queue, and the critical zone mark of the second critical zone is moved from the second critical zone monitoring queue to the first critical zone monitoring queue .
  • the critical region tag includes a critical region ID and a source node and a sink node.
  • the critical section monitoring step monitors the critical section of the first task instance by receiving a message from the sink node of the first critical section to monitor the completion status of the critical section of the first task instance, and After receiving the message from the sink node, send a message to the source node of the critical section of the second task instance.
  • the critical region is an input critical region, an output critical region, or a main body critical region.
  • Figure 1 shows a schematic diagram of a first embodiment of a method for controlling task parallelism in task concentration according to the present disclosure.
  • FIG. 2 is a schematic diagram showing an example of a second embodiment of the method for controlling task parallelism in task concentration according to the present disclosure.
  • FIG. 3 is a schematic diagram showing a system for controlling tasks to be concentrated in parallel according to the present disclosure.
  • first, second, third, etc. may be used in this disclosure to describe various information, the information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other.
  • one of the two possible devices may be referred to as the first task instance or the second task instance, and similarly, the other of the two possible devices may be What is referred to as a second task instance can also be referred to as a first task instance.
  • the word "if” as used herein can be interpreted as "when” or "when” or "in response to determination”.
  • Figure 1 shows a schematic diagram of a first embodiment of a method for controlling task parallelism in task concentration according to the present disclosure.
  • three tasks J 0 , J 1 and J 2 are displayed, and the three constitute a task set.
  • a task set can include any number of tasks.
  • the first critical region will be referred to as the second critical region
  • the second critical region will be referred to as the first critical region
  • segments 2 J 0 J 0 is the first task and the first task belonging to a third task J J critical region between the C 2 0 2, and J 2.
  • Critical regions usually mainly include three types of critical regions, such as input (INPUT) critical regions, output (OUTPUT) critical regions, and body (BODY) critical regions.
  • INPUT input
  • OUTPUT output
  • BODY body
  • the first task J 0 and the second task J 1 can be performed in parallel in the non-critical region portion, between the first task when the J 0 C 0 is first performed to a critical region, having a second region corresponding to a critical task J C 1 to 1 at this time it may be other non-critical region
  • the first task J 0 continues to be executed in parallel until the second task J 1 is executed to the critical region C 1 .
  • Fig. 2 shows a schematic diagram of a second embodiment of a method for controlling task parallelism in task concentration according to the present disclosure.
  • the task set contains five tasks J 0 , J 1 and J 2 , which contains three tasks J 0 , which means that in this task set, the first task J 0 will iterate three times.
  • a verification task is usually performed after multiple training tasks are performed.
  • a streaming data processing system for the same iterative task, there is no conflict between each other, and there is no critical zone.
  • the two cannot be parallel.
  • the serial between the critical region C 0 and the critical region C 1 should be considered to ensure that the entire third iteration The correctness of the execution of the first task J 0 and the second task J 1.
  • the section M 02 that shares memory between the first task J 0 and the third task J 2 of the third iteration, that is, the section of the first task J 0 of the third iteration.
  • J 0 2 and the section J 2 1 of the third task J 2 therefore, the section J 0 2 is the first task of the third iteration between the first task J 0 and the third task J 2 of the third iteration.
  • mission critical region C 0 J 2, and J 2. 1 is a section of a third iteration of the first task a third task J 0 and J 2 belongs between a third task J critical region 2 C 3, which means that , The critical region C 2 and the critical region C 3 are in conflict during the execution process.
  • the two cannot be parallel. For this reason, try to implement the first task J 0 and the third task J 2 of the third iteration.
  • the serialization between the critical region C 2 and the critical region C 3 should be considered to ensure the correct execution of the first task J 0 and the third task J 2 of the entire third iteration. For this reason, it is necessary to control the switching between the critical region C 2 and the critical region C 3 to ensure that the execution of the first task J 0 and the third task J 2 of the third iteration can be implemented in parallel with the exception of the critical region. In this way, the maximum possible parallelism between multiple tasks in a task set is realized.
  • FIG. 3 is a schematic diagram showing a system 100 for controlling task concentration and task parallelism according to the present disclosure.
  • the task-concentrated task parallel control system 100 includes a critical section analysis component 110, a critical section analysis component, which is used to analyze the critical section between any two tasks in a task set, and is the result of the analysis.
  • the critical area is assigned a predetermined critical area mark to form a critical area mark relationship graph in the task set.
  • the critical area is a memory sharing part between any two tasks, and the critical area mark relationship graph records any two critical areas. The mutually exclusive relationship of the district.
  • each task contains multiple task nodes, such as tasks J 0 , J 1 , J 2 , J 3 ...J n , each containing task nodes N 0 , N 1 , N 2 , N 3 ..., as shown in Figure 3
  • the dotted line connects these task nodes in series to form a static data processing path.
  • the data processing path is not a single simple linear processing path, but has many various branch paths.
  • Each task node contains its own node attributes, which show the upstream and downstream relationship of the node in the current task and the output relationship or production relationship of the upstream node consumed by it. 1 and 2, the critical region analysis component 110 compares and analyzes all tasks in the task set, and analyzes the upstream and downstream consumption logic relationships of the task nodes that constitute each task and the memory resources of the task nodes. As mentioned above, between two tasks that are related to each other, they are related through task nodes. For example, some task nodes of the first task and some task nodes of the second task will share data in a certain memory. Or model data or some task nodes of the first task will consume some data or model data generated by some task nodes of the second task.
  • the task node section of each task with shared memory can be determined as the critical area between these two tasks, and These critical regions are numbered to give the critical region ID.
  • the numbers of these critical regions are expressed in this application as C 0 , C 1 , C 2 ... C n , in actual reference, they can be marked in other ways, such as the ID of the task and the source node of the critical region. ID and sink node ID are combined to mark.
  • Each critical area includes its start task node and end task node, which respectively represent the source node and sink node of the critical area. Therefore, each critical section number contains information about task ID, source node ID, and sink node ID.
  • the critical region analysis component 110 forms a critical region mark table recording the critical region between any two tasks according to the analysis results of any two tasks. As shown in Fig. 3, when there are mutually exclusive critical areas between any two tasks, the mutually exclusive critical areas between the two tasks are marked with a logical number "1", otherwise they are marked with a logical value "0". Therefore, the critical section mark table actually records the specific situations where there are critical sections that conflict with each other between any two tasks, or in other words, the specific conditions of critical sections that cannot be parallel to each other.
  • the critical section mark table shown here shows that there may be two sets of marks for marking critical sections between any two tasks, but in some cases, there may be multiple pairs of critical sections between a pair of tasks, so one
  • the mark table marks three or more critical regions for a pair of tasks.
  • the two pairs of critical regions between any two tasks can be merged into a pair of critical regions.
  • close distance means that there are no more than ten task nodes between the sink node of the previous critical section and the source node of the next critical section, or the difference between the sink node of the previous critical section and the source node of the next critical section
  • the total execution time between all task nodes does not exceed the predetermined length of time, for example, between 1% and 3% of the total execution time of a task.
  • a critical section monitoring component 120 is deployed in the data processing system.
  • the data processing system receives a specific task instance and executes a specific task instance, as the task instance progresses, it will pass through the critical region monitoring component 120 before entering the source node of the critical region of the task instance, that is, the critical region
  • the monitoring component 120 is located in the data processing path of each task instance. As shown in FIG. 3, the data processing paths of all tasks J 0 , J 1 , J 2 , J 3, ... J n having a critical section pass through the critical section monitoring component 120.
  • the critical section monitoring component 120 is connected to the source nodes of all critical sections in the task set, so it can know whether each task instance starts to perform critical section operations based on the critical section ID, and thereby arrange the critical section flags that are performing critical section operations in In the first critical section monitoring queue Q 0 , at the same time, based on the critical section mark relationship graph obtained by the critical section analysis component 110, the critical section mark of another task instance that conflicts with the critical section of the operation is arranged in the second monitoring queue critical section of Q 1.
  • the critical section monitoring component 120 monitors that the first task instance J 0 enters the source node of the critical section C 0 , it arranges the critical section C 1 in the second task instance J 2 that conflicts with the critical section to the second The critical section monitors the queue Q 1 and makes it in a state of waiting for execution.
  • the wait-for-execution state here does not mean that the second task instance J 2 must have been executed to the source node of the critical area C 1 , but only that when the second task instance J 2 is executed to the source node of the critical area C 1, if
  • the critical section monitoring component 120 has not received the message fed back by the sink node of the critical section C 0 of the first task instance J 0 , the execution of the critical section C 1 will be in a waiting state. vice versa. In this way, when the critical section of a pair of conflicting critical sections is in an operation execution state, the critical section monitoring component 120 notifies the conflicting critical section that the operation cannot be performed.
  • the sink nodes of all critical regions in the task set are connected to the critical region monitoring component 120.
  • the sink node of any critical section of any task instance When executed, it will return to the critical section monitoring component 120 a message indicating that the execution is complete.
  • the critical section monitoring component 120 receives a message fed back by the sink node of the critical section C 0 of the first task instance J 0 , the critical section monitoring component 120 will monitor the identification of the critical section C 0 from the first critical section.
  • the queue Q 0 is removed, and the critical region C 1 identifier in the second critical region monitoring queue Q 1 is moved to the first critical region monitoring queue Q 0 . In this way, the source node in the critical area C 1 in the second task instance J 2 is notified that it can immediately start operations on the critical area C 1 when its execution timing arrives.
  • the critical section monitoring component 120 enables serial operations between critical sections that conflict with each other, so that the non-critical section between any two tasks (also referred to as "overlapping sections") can be performed Parallel operation.
  • the critical section is synchronized and executed serially, while the other non-critical sections or overlapping sections of the tasks are executed asynchronously on their own data processing paths.
  • the critical section analysis component 110 pre-analyzes any task.
  • the purpose of the present disclosure can also be realized by running a program or a group of programs on any computing device.
  • the computing device may be a well-known general-purpose device. Therefore, the purpose of the present disclosure can also be achieved only by providing a program product containing program code for implementing the method or device. That is, such a program product also constitutes the present disclosure, and a storage medium storing such a program product also constitutes the present disclosure.
  • the storage medium may be any well-known storage medium or any storage medium developed in the future.
  • each component or each step can be decomposed and/or recombined.
  • These decomposition and/or recombination should be regarded as equivalent solutions of the present disclosure.
  • the steps of executing the above-mentioned series of processing can naturally be executed in chronological order in the order of description, but they do not necessarily need to be executed in chronological order. Some steps can be performed in parallel or independently of each other.

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Debugging And Monitoring (AREA)

Abstract

本发明公开了一种控制任务集中的任务并行的系统,包括:临界区分析组件,用于分析一个任务集中的任意两个任务之间临界区,并为分析获得的所述临界区赋予预定临界区标记,形成所述任务集中的临界区标记关系图表,所述临界区是所述任意两个任务之间的内存共享部分,所述临界区标记关系图表记载任意两个临界区的互斥关系;以及临界区监控组件,其位于每个任务实例数据处理路径中,用于对于多个被执行的任务实例,基于临界区标记关系图表,允许执行存在互斥关系中一对临界区中的先到达的一个临界区而使得另一个临界区处于等待执行状态。

Description

控制任务集中的任务并行的系统及其方法 技术领域
本公开涉及一种数据处理技术,更具体地说,本公开涉及一种用于控制任务集中的任务并行的系统及其方法。
背景技术
大数据的处理意向复杂的数据处理技术。为了提高数据处理的效率,通常将一个数据处理工作分成多项任务,并在集成计算架构中分别由CPU、与CPU相连的GPU来承担计算任务,这些计算任务会根据彼此之间的时序关系被进行并行计算。但是有时候,很多任务之间存在彼此的依赖关系,例如第一任务的计算所需的某些数据也会被第二任务的计算所使用;或者第一任务的计算所产生的某些数据会被第二任务的计算所使用。因此,在两者之间存在数据使用冲突过程中,必然导致第一任务执行时,第二任务不能执行,导致一种停机现象。反之亦然。因此,任务并行只能在不相关的任务执行,这将导致的不能并行的任务之间的切换以任务整体为单位进行,这在大数据处理或深度学习这种数据处理过程中,以任务整体为单位的这种切换,这种任务切换的成本就是所有计算设备的同步开销。当计算设备的数目达到1024甚至更高的时候,任务切换点会成为整个计算系统的巨大瓶颈,因为所有数据同步的时候,几乎所有的计算操作将无法进行,这个过程需要花费巨大的时间。因此,以任务为单位的这种同步以及任务的切换会不可避免的带来开销,而且这个开销随着集成的计算设备(例如CPU和GPU)的增多而开销会是指数级增长的,这将导致计算资源得不到充分地利用,也降低了数据处理的效率。
因此,人们期望获得一种控制任务集中的任务并行的系统,其能够消除上述现有技术中的一种或多种技术问题,提高任务并行程度。
技术解决方案
本发明的目的在于解决至少上述问题之一,具体而言,本公开提供一种控制任务集中的任务并行的系统,包括:临界区分析组件,用于分析一个任务集中的任意两个任务之间临界区,并为分析获得的所述临界区赋予预定临界区标记,形成所述任务集中的临界区标记关系图表,所述临界区是所述任意两个任务之间的内存共享部分,所述临界区标记关系图表记载任意两个临界区的互斥关系;以及临界区监控组件,其位于每个任务实例数据处理路径中,用于对于多个被执行的任务实例,基于临界区标记关系图表,允许执行存在互斥关系中一对临界区中的先到达的一个临界区而使得另一个临界区处于等待执行状态。
根据本公开的控制任务集中的任务并行的系统,其中所述临界区监控组件将第一任务实例中的可立即或正在执行的第一临界区的临界区标记排列第一临界区监控队列中以及将第二任务实例的不能与第一临界区同时执行的第二临界区的临界区标记排列在第二临界区监控队列中,以及监控第一临界区的执行操作是否完成,以便在第一临界区的执行操作完成后,将第一临界区的临界区标记移出第一临界区监控队列,并将第二临界区的临界区标记从第二临界区监控队列移动到第一临界区监控队列中。
根据本公开的控制任务集中的任务并行的系统,其中所述临界区标记包括临界区ID及源节点和汇节点。
根据本公开的控制任务集中的任务并行的系统,其中所述临界区监控组件通过从第一临界区的所述汇节点接收到消息来监控第一临界区被执行操作完成状态,并在从所述汇节点接收到消息后向第二任务实例的临界区的源节点发出消息。
根据本公开的控制任务集中的任务并行的系统,其中所述临界区为输入临界区、输出临界区或主体临界区。
根据本公开的另一个方面,提供了一种控制任务集中的任务并行的方法,包括:任务分析步骤,通过临界区分析组件分析一个任务集中的任意两个任务之间临界区,并为分析获得的所述临界区赋予预定临界区标记,形成所述任务集中的临界区标记关系图表,所述临界区是所述任意两个任务之间的内存共享部分,所述临界区标记关系图表记载任意两个临界区的互斥关系;以及临界区监控步骤,通过临界区监控组件,针对每个任务实例数据处理路径,对于多个被执行的任务实例,基于临界区标记关系图表,允许执行存在互斥关系中一对临界区中的先到达的一个临界区而使得另一个临界区处于等待执行状态。
根据本公开的控制任务集中的任务并行的方法,其中所述临界区监控步骤将第一任务实例中的可立即或正在执行的第一临界区的临界区标记排列第一临界区监控队列中以及将第二任务实例的不能与第一临界区同时执行的第二临界区的临界区标记排列在第二临界区监控队列中,以及监控第一临界区的执行操作是否完成,以便在第一临界区的执行操作完成后,将第一临界区的临界区标记移出第一临界区监控队列,并将第二临界区的临界区标记从第二临界区监控队列移动到第一临界区监控队列中。
根据本公开的控制任务集中的任务并行的方法,其中所述临界区标记包括临界区ID及源节点和汇节点。
根据本公开的控制任务集中的任务并行的方法,其中所述临界区监控步骤通过从第一临界区的所述汇节点接收到消息来监控第一任务实例的临界区被执行操作完成状态,并在从所述汇节点接收到消息后向第二任务实例的临界区的源节点发出消息。
根据本公开的控制任务集中的任务并行的方法,其中所述临界区为输入临界区、输出临界区或主体临界区。
本发明的其它优点、目标和特征将部分通过下面的说明体现,部分还将通过对本发明的研究和实践而为本领域的技术人员所理解。
附图说明
图1所示的是根据本公开的控制任务集中的任务并行的方法的第一实施例的示意图。
图2为所示的是根据本公开的控制任务集中的任务并行的方法的第二实施的例示意图。
图3为所示的是根据本公开的控制任务集中的任务并行的系统的示意图。
本发明的实施方式
下面结合实施例和附图对本发明做进一步的详细说明,以令本领域技术人员参照说明书文字能够据以实施。
这里将详细地对示例性实施例进行说明,其示例表示在附图中。下面的描述涉及附图时,除非另有表示,不同附图中的相同数字表示相同或相似的要素。以下示例性实施例中所描述的实施方式并不代表与本公开相一致的所有实施方式。相反,它们仅是与如所附权利要求书中所详述的、本公开的一些方面相一致的装置和方法的例子。
在本公开使用的术语是仅仅出于描述特定实施例的目的,而非旨在限制本开。在本公开和所附权利要求书中所使用的单数形式的“一种”、“所述”和“该”也旨在包括多数形式,除非上下文清楚地表示其他含义。还应当理解,本文中使用的术语“和/或”是指并包含一个或多个相关联的列出项目的任何或所有可能组合。
应当理解,尽管在本公开可能采用术语第一、第二、第三等来描述各种信息,但这些信息不应限于这些术语。这些术语仅用来将同一类型的信息彼此区分开。例如,在不脱离本公开范围的情况下,在下文中,两个可能设备之一可以被称为第一任务实例也可以被称为第二任务实例,类似地,两个可能设备的另一个可以被称为第二任务实例也可以被称为第一任务实例。取决于语境,如在此所使用的词语“如果”可以被解释成为“在……时”或“当……时”或“响应于确定”。
为了使本领域技术人员更好地理解本公开,下面结合附图和具体实施方式对本公开作进一步详细说明。
在多任务数据处理中,通常任务实例之间极有可能存在彼此共用的数据,这些数据会存储在计算系统的内存中,因此,两个任务之间会存在共用内存的情形,也就是在任务的某一执行阶段会存在共用内存中某些数据的情形。例如,在带规模的数据训练过程中,不同任务在执行过程中会使用同一训练模型的情形,或者在深度学习或大数据处理过程中,也会存在验证任务使用训练任务的生产数据的情形。在这种情形下,现有技术的数据处理系统会整体地切换任务,即,暂停其中一个任务,以保证被切换任务的执行,直到被切换任务被执行完成为止,因此,现有技术中,彼此存在数据使用互斥情形的任务之间不能进行并行执行,这在深度学习以及大数据计算存在数量繁多的互斥任务的情形下,任务之间并行将难以实现。
图1所示的是根据本公开的控制任务集中的任务并行的方法的第一实施例的示意图。如图1所示,显示了三个任务J 0、J 1以及J 2,三者构成了一个任务集。尽管为了描述方便,图1中仅仅显示了三个任务,但是一个任务集中可以包括任意数量任务。如图1所示,第一任务J 0和第二任务J 1之间存在彼此共享内存的区段M 01,即第一任务J 0的区段和第二任务J 1的区段,因此,区段是第一任务J 0和第二任务J 1之间属于第一任务J 0的第一临界区C 0,而区段是第一任务J 0和第二任务J 1之间属于第二任务J 1的第二临界区C 1,这也就是说,临界区C 0与临界区C 1在执行过程中存在冲突的情形,因此,两者不能并行,为此,在实现第一任务J 0和第二任务J 1之间尽可能并行的基础上,要考虑到临界区C 0与临界区C 1之间的串行,以便保证整个第一任务J 0和第二任务J 1执行的正确性。为此,需要控制临界区C 0与临界区C 1之间进行切换以保证第一任务J 0和第二任务J 1执行之间除了临界区之外的部分能够实现并行,从而实现了一个任务集中的多任务之间最大可能的并行。在任务集的任务实例循环执行过程中,第一临界区会被称为第二临界区,而第二临界区会称为第一临界区。
同样,如图1所示,第一任务J 0和第三任务J 2之间存在彼此共享内存的区段M 02,即第一任务J 0的区段J 0 2和第三任务J 2的区段J 2 1,因此,区段J 0 2是第一任务J 0和第三任务J 2之间属于第一任务J 0的临界区C 2,而区段J 2 1是第一任务J 0和第三任务J 2之间属于第三任务J 2的临界区C 3,这也就是说,临界区C 2与临界区C 3在执行过程中存在冲突的情形,因此,两者不能并行,为此,在实现第一任务J 0和第三任务J 2之间尽可能并行的基础上,要考虑到临界区C 2与临界区C 3之间的串行,以便保证整个第一任务J 0和第三任务J 2执行的正确性。为此,需要控制临界区C 2与临界区C 3之间进行切换以保证第一任务J 0和第三任务J 2执行之间除了临界区之外的部分能够实现并行,从而实现了一个任务集中的多任务之间最大可能的并行。
尽管上面仅仅列举了第一任务J 0和第二任务J 1之间仅仅存在一对临界区,但是在有些实际情况下,两个任务之间可能会存在多对临界区。为了简化描述过程,再次仅仅列出一对互斥的临界区。为了方便描述,在此仅仅按照顺序第临界区进行编号,作为临界区的ID。临界区通常主要包括三大类临界区,例如输入(INPUT)临界区、输出(OUTPUT)临界区以及主体(BODY)临界区。首先,每个人物都会有输入部分,输入部分都会有参数列表,参数列表部分通常会被其他任务所使用,因此参数列表部分通常是输入临界区。并且每个任务也都会输出相应的数据部分,因此输出数据通常会被其他任务所使用,因此输出数据部分在任务中通常为输出临界区。因此,作为一种实施方式,可以直接指定每个任务的输入部分以及输出部分为临界区。
举例而言,在任意两个任务之间,例如上述第一任务J 0和第二任务J 1之间,存在上述各种临界区时,第一任务J 0和第二任务J 1之间可以在非临界区部分并行执行,当第一任务J 0之间先被执行到临界区C 0时,与具有相对应临界区C 1的第二任务J 1可以此时在其其他非临界区与第一任务J 0并行持续执行,直到第二任务J 1被执行到对应临界区C 1的为止。当第二任务J 1被执行到对应临界区C 1时,如果第一任务J 0的临界区C 0时还为被执行完毕,则第二任务J 1的临界区C 1的执行将处于暂停状态直到第一任务J 0的临界区C 0被执行完毕为止。反之亦然。同样,对于第一任务J 0和第三任务J 2之间的并行情况也是如此,仅仅在第一任务J 0的临界区C 2和第三任务J 2的临界区C 3,之间进行错时进行,并不影响其他部分的并行。
图2所示的是根据本公开的控制任务集中的任务并行的方法的第二实施例的示意图。与图1所示不同的是,任务集中包含了五个任务J 0、J 1以及J 2,其中包含了三个任务J 0,这意味着在这个任务集中,第一任务J 0将会迭代三次。举例而言,在一种深度学习和大数据计算过程中,通常会每执行多次训练任务之后执行一次验证任务。在流式数据处理系统中,对于相同的迭代任务,彼此之间不存在冲突情形,也就不存在临界区。在第三次迭代的第一任务J 0才会与其他任务J 1或J 2存在临界区,例如第三次迭代的第一任务J 0和第二任务J 1之间存在彼此共享内存的区段M 01,即第三次迭代的第一任务J 0的区段J 0 1和第二任务J 1的区段J 1 0,因此,区段J 0 1是第三次迭代的第一任务J 0和第二任务J 1之间属于第三次迭代的第一任务J 0的临界区C 0,而区段J 1 0是第三次迭代的第一任务J 0和第二任务J 1之间属于第二任务J 1的临界区C 1,这也就是说,临界区C 0与临界区C 1在执行过程中存在冲突的情形,因此,两者不能并行,为此,在实现第三次迭代的第一任务J 0和第二任务J 1之间尽可能并行的基础上,要考虑到临界区C 0与临界区C 1之间的串行,以便保证整个第三次迭代的第一任务J 0和第二任务J 1执行的正确性。为此,需要控制临界区C 0与临界区C 1之间进行切换以保证第三次迭代的第一任务J 0和第二任务J 1执行之间除了临界区之外的部分能够实现并行,从而实现了一个任务集中的多任务之间最大可能的并行。
同样,如图1所示,第三次迭代的第一任务J 0和第三任务J 2之间存在彼此共享内存的区段M 02,即第三次迭代的第一任务J 0的区段J 0 2和第三任务J 2的区段J 2 1,因此,区段J 0 2是第三次迭代的第一任务J 0和第三任务J 2之间属于第三次迭代的第一任务J 0的临界区C 2,而区段J 2 1是第三次迭代的第一任务J 0和第三任务J 2之间属于第三任务J 2的临界区C 3,这也就是说,临界区C 2与临界区C 3在执行过程中存在冲突的情形,因此,两者不能并行,为此,在实现第三次迭代的第一任务J 0和第三任务J 2之间尽可能并行的基础上,要考虑到临界区C 2与临界区C 3之间的串行,以便保证整个第三次迭代的第一任务J 0和第三任务J 2执行的正确性。为此,需要控制临界区C 2与临界区C 3之间进行切换以保证第三次迭代的第一任务J 0和第三任务J 2执行之间除了临界区之外的部分能够实现并行,从而实现了一个任务集中的多任务之间最大可能的并行。
图3为所示的是根据本公开的控制任务集中的任务并行的系统100的示意图。如图3所示,任务集中的任务并行的控制系统100包括临界区分析组件110,临界区分析组件,用于分析一个任务集中的任意两个任务之间临界区,并为分析获得的所述临界区赋予预定临界区标记,形成所述任务集中的临界区标记关系图表,所述临界区是所述任意两个任务之间的内存共享部分,所述临界区标记关系图表记载任意两个临界区的互斥关系。通常每个任务包含多个任务节点,例如任务J 0、J 1、J 2、J 3…J n,每个包含任务节点N 0、N 1、N 2、N 3…,在图3中通过虚线将这些任务节点串联起来,形成一条静态数据处理路径。尽管在图3中仅仅显示为一条单一的串联路径,但是其实由于任意任务之间存在彼此的关联关系,彼此的任务节点之间也会存在连接部分,例如前面和后面都提到的临界区部分。而且数据处理路径也不是单一简单线条状处理路径,而是有很多各种分支路径。每个任务节点含有自身的节点属性,这些属性显示了节点的在当前任务中的上下游关系以及其所消费的上游节点输出关系或生产关系。结合图1和2所示,临界区分析组件110对任务集中的所有任务进行比较分析,分析构成每个任务的任务节点的上下游消费逻辑关系以及任务节点的内存资源。如上所述,在彼此相关的两个任务之间,两者之间通过任务节点产生关联,例如第一任务的某些任务节点与第二任务的某些任务节点会通用某一内存中的数据或模型数据或者第一任务的某些任务节点会消费第二任务的某些任务节点所生成的某些数据或模型数据。为此,这些共享的内存资源或所生产的被第一任务的某些节点所需要的数据在被第一任务使用之前,第二任务的某些任务节点不能执行任务改变这些共享内存资源中的数据,以防止出现错误。基于任意两个任务之间的某些任务节点之间是否存在共享内存的情形,可以将各个任务的这些存在共享内存情形的任务节点区段确定为这两个任务之间的临界区,并对这些临界区进行编号给出临界区ID。这些临界区的编号尽管在本申请中采用C 0、C 1、C 2……C n来表达,但是在实际引用中,可以采用其他方式来标记,例如采用任务的ID以及临界区的源节点ID和汇节点ID结合起来标记。每个临界区都包括其起始任务节点和结束任务节点,分别表示临界区的源节点和汇节点。因此,每个临界区编号包含了任务ID、源节点ID以及汇节点ID的信息。
临界区分析组件110针对任意两个任务的分析结果,形成一张记载任意两个任务之间的临界区标记表。如图3所示,在任意两个任务之间存在彼此互斥的临界区时,两个任务之间的互斥临界区采用逻辑数字“1”来标记,否则采用逻辑值“0”标记。因此,临界区标记表实际上记载的是任意两个任务之间存在彼此冲突的临界区的具体情形,或者说,彼此之间不能并行的临界区的具体情形。尽管此处图示的临界区标记表显示任意两个任务之间可能存在两组标记临界区的标记,但是在有些情况下,一对任务之间可能存在多对临界区,因此可以在一张标记表中为一对任务标记三对或三对以上的临界区。可选择地,当任意两个任务之间的两对临界区相距比较近时,可以将两对临界区合并为一对临界区。此处“相距比较近”表示前一临界区的汇节点与后一临界区的源节点之间的不超过十个任务节点,或者前一临界区的汇节点与后一临界区的源节点之间所有任务节点之间总执行时长不超过预定的时间长度,例如一个任务执行总时间长度的百分之一到百分之三之间。
随后,在数据处理系统中部署有临界区监控组件120。在数据处理系统接收到具体的任务实例并执行具体的任务实例时,随着任务实例的进行,在进入任务实例的临界区的源节点之前都会经过临界区监控组件120,也就是说,临界区监控组件120位于每个任务实例数据处理路径中。如图3所示,所有具有临界区的任务J 0、J 1、J 2、J 3…J n,的数据处理路径都经过该临界区监控组件120。该临界区监控组件120与任务集中的所有临界区的源节点相连,因此能够基于临界区ID获知每个任务实例是否开始进行临界区操作,由此将正在执行临界区操作的临界区标记排列在第一临界区监控队列Q 0中,同时,基于临界区分析组件110分析获得的临界区标记关系图表,将与正在执行操作的临界区相冲突的另一个任务实例的临界区标记排列在第二临界区监控队列Q 1中。
举例而言,当临界区监控组件120监控到第一任务实例J 0进入临界区C 0的源节点时,就将第二任务实例J 2中与临界区冲突的临界区C 1排列到第二临界区监控队列Q 1中,使其处于等待执行状态。此处的等待执行状态并不表示第二任务实例J 2一定已经执行到临界区C 1的源节点,只是表示当第二任务实例J 2在执行到临界区C 1的源节点的时候,如果临界区监控组件120还没有收到第一任务实例J 0的临界区C 0的汇节点反馈的消息时,临界区C 1的执行将处于等待状态。反之亦然。通过这种方式,临界区监控组件120在一对彼此冲突的临界区中的临界区处于操作执行状态时,通知与其冲突的另一个临界区不能执行操作。
如图3所示,任务集中的所有临界区的汇节点都与临界区监控组件120。当任何任务实例的任意临界区的汇节点执行完毕之后都将向临界区监控组件120返回执行完毕的消息。举例而言,当临界区监控组件120接收到第一任务实例J 0的临界区C 0的汇节点反馈的消息时,临界区监控组件120会将临界区C 0的标识从第一临界区监控队列Q 0中移出,并将第二临界区监控队列Q 1中的临界区C 1标识移动到第一临界区监控队列Q 0中。通过这种方式,通知第二任务实例J 2中的临界区C 1中的源节点,在其执行时序到来时可以立即开始对临界区C 1操作。
临界区监控组件120通过上述控制方式,使得彼此冲突的临界区之间串行操作,而使得任意两个任务之间的非临界区部分(也称之为“可重叠部分”)之间可以进行并行操作。这样,任意两个任务之间,仅仅在临界区部分进行同步,执行串行,而任务的其他非临界区部分或可重叠部分各自在自己的数据处理路径上异步执行。这样,在多个计算设备之间需要同步(通常存在数量巨大的任务之间的数据同步或存在根据本发明的数据量的临界区)的情况下,通过临界区分析组件110预先分析任意任务之间的存在并行冲突的状态,也就是分析获得两者之间的临界区,使得任意两个任务在各自的临界区执行时保持正确,并通过临界区监控组件120控制彼此冲突的临界区的执行顺序或者控制临界区的执行的切换,从而能够准地以临界区为单位去切换任务的执行。由于在一个任务中,临界区仅仅占据任务极小的一部分,因此通过对临界区执行的控制能够极大地降低数据同步的力度或者切换的力度,从而能够极大地减低目前现有技术中任务切换带来的巨大开销。
以上结合具体实施例描述了本公开的基本原理,但是,需要指出的是,对本领域的普通技术人员而言,能够理解本公开的方法和装置的全部或者任何步骤或者部件,可以在任何计算装置(包括处理器、存储介质等)或者计算装置的网络中,以硬件、固件、软件或者它们的组合加以实现,这是本领域普通技术人员在阅读了本公开的说明的情况下运用他们的基本编程技能就能实现的。
因此,本公开的目的还可以通过在任何计算装置上运行一个程序或者一组程序来实现。所述计算装置可以是公知的通用装置。因此,本公开的目的也可以仅仅通过提供包含实现所述方法或者装置的程序代码的程序产品来实现。也就是说,这样的程序产品也构成本公开,并且存储有这样的程序产品的存储介质也构成本公开。显然,所述存储介质可以是任何公知的存储介质或者将来所开发出来的任何存储介质。
还需要指出的是,在本公开的装置和方法中,显然,各部件或各步骤是可以分解和/或重新组合的。这些分解和/或重新组合应视为本公开的等效方案。并且,执行上述系列处理的步骤可以自然地按照说明的顺序按时间顺序执行,但是并不需要一定按照时间顺序执行。某些步骤可以并行或彼此独立地执行。
上述具体实施方式,并不构成对本公开保护范围的限制。本领域技术人员应该明白的是,取决于设计要求和其他因素,可以发生各种各样的修改、组合、子组合和替代。任何在本公开的精神和原则之内所作的修改、等同替换和改进等,均应包含在本公开保护范围之内。

Claims (10)

  1. 一种控制任务集中的任务并行的系统,包括:
    临界区分析组件,用于分析一个任务集中的任意两个任务之间临界区,并为分析获得的所述临界区赋予预定临界区标记,形成所述任务集中的临界区标记关系图表,所述临界区是所述任意两个任务之间的内存共享部分,所述临界区标记关系图表记载任意两个临界区的互斥关系;以及
    临界区监控组件,其位于每个任务实例数据处理路径中,用于对于多个被执行的任务实例,基于临界区标记关系图表,允许执行存在互斥关系中一对临界区中的先到达的一个临界区而使得另一个临界区处于等待执行状态。
  2. 根据权利要求1所述的控制任务集中的任务并行的系统,其中所述临界区监控组件将第一任务实例中的可立即或正在执行的第一临界区的临界区标记排列第一临界区监控队列中以及将第二任务实例的不能与第一临界区同时执行的第二临界区的临界区标记排列在第二临界区监控队列中,以及监控第一临界区的执行操作是否完成,以便在第一临界区的执行操作完成后,将第一临界区的临界区标记移出第一临界区监控队列,并将第二临界区的临界区标记从第二临界区监控队列移动到第一临界区监控队列中。
  3. 根据权利要求1或2所述的控制任务集中的任务并行的系统,其中所述临界区标记包括临界区ID及源节点和汇节点。
  4. 根据权利要求3所述的控制任务集中的任务并行的系统,其中所述临界区监控组件通过从第一临界区的所述汇节点接收到消息来监控第一临界区被执行操作完成状态,并在从所述汇节点接收到消息后向第二任务实例的临界区的源节点发出消息。
  5. 根据权利要求4所述的控制任务集中的任务并行的系统,其中所述临界区为输入临界区、输出临界区或主体临界区。
  6. 一种控制任务集中的任务并行的方法,包括:
    任务分析步骤,通过临界区分析组件分析一个任务集中的任意两个任务之间临界区,并为分析获得的所述临界区赋予预定临界区标记,形成所述任务集中的临界区标记关系图表,所述临界区是所述任意两个任务之间的内存共享部分,所述临界区标记关系图表记载任意两个临界区的互斥关系;以及
    临界区监控步骤,通过临界区监控组件,针对每个任务实例数据处理路径,对于多个被执行的任务实例,基于临界区标记关系图表,允许执行存在互斥关系中一对临界区中的先到达的一个临界区而使得另一个临界区处于等待执行状态。
  7. 根据权利要求6所述的控制任务集中的任务并行的方法,其中所述临界区监控步骤将第一任务实例中的可立即或正在执行的第一临界区的临界区标记排列第一临界区监控队列中以及将第二任务实例的不能与第一临界区同时执行的第二临界区的临界区标记排列在第二临界区监控队列中,以及监控第一临界区的执行操作是否完成,以便在第一临界区的执行操作完成后,将第一临界区的临界区标记移出第一临界区监控队列,并将第二临界区的临界区标记从第二临界区监控队列移动到第一临界区监控队列中。
  8. 根据权利要求6或7所述的控制任务集中的任务并行的方法,其中所述临界区标记包括临界区ID及源节点和汇节点。
  9. 根据权利要求8所述的控制任务集中的任务并行的方法,其中所述临界区监控步骤通过从第一临界区的所述汇节点接收到消息来监控第一任务实例的临界区被执行操作完成状态,并在从所述汇节点接收到消息后向第二任务实例的临界区的源节点发出消息。
  10. 根据权利要求9所述的控制任务集中的任务并行的方法,其中所述临界区为输入临界区、输出临界区或主体临界区。
PCT/CN2021/072788 2020-01-20 2021-01-20 控制任务集中的任务并行的系统及其方法 WO2021147878A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202010065550.7 2020-01-20
CN202010065550.7A CN111158890A (zh) 2020-01-20 2020-01-20 控制任务集中的任务并行的系统及其方法

Publications (1)

Publication Number Publication Date
WO2021147878A1 true WO2021147878A1 (zh) 2021-07-29

Family

ID=70564736

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2021/072788 WO2021147878A1 (zh) 2020-01-20 2021-01-20 控制任务集中的任务并行的系统及其方法

Country Status (2)

Country Link
CN (1) CN111158890A (zh)
WO (1) WO2021147878A1 (zh)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111158890A (zh) * 2020-01-20 2020-05-15 北京一流科技有限公司 控制任务集中的任务并行的系统及其方法
CN111488221B (zh) * 2020-06-29 2020-10-09 北京一流科技有限公司 静态网络中的内存空间预配系统及其方法
CN114035968B (zh) * 2022-01-10 2022-03-18 北京一流科技有限公司 用于多流并行的冲突处理系统及其方法

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103699437A (zh) * 2013-12-20 2014-04-02 华为技术有限公司 一种资源调度方法及设备
US20140172939A1 (en) * 2012-12-17 2014-06-19 Microsoft Corporation Reachability-Based Coordination for Cyclic Dataflow
CN111158890A (zh) * 2020-01-20 2020-05-15 北京一流科技有限公司 控制任务集中的任务并行的系统及其方法

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2007148582A (ja) * 2005-11-24 2007-06-14 Matsushita Electric Ind Co Ltd タスク実行制御装置、タスク実行制御方法、及びプログラム
CN102929711B (zh) * 2012-09-24 2016-08-10 浙江大学 一种软件实时事务内存的实现方法
CN103699363A (zh) * 2013-12-13 2014-04-02 华中科技大学 一种用于在多核平台下优化关键临界区的方法
CN109558241A (zh) * 2018-11-13 2019-04-02 锐捷网络股份有限公司 一种获取自旋锁的方法及装置

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20140172939A1 (en) * 2012-12-17 2014-06-19 Microsoft Corporation Reachability-Based Coordination for Cyclic Dataflow
CN103699437A (zh) * 2013-12-20 2014-04-02 华为技术有限公司 一种资源调度方法及设备
CN111158890A (zh) * 2020-01-20 2020-05-15 北京一流科技有限公司 控制任务集中的任务并行的系统及其方法

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
CZECH ZBIGNIEW J.: "Introduction to Parallel Computing", CAMBRIDGE UNIVERSITY PRESS, 1 January 2016 (2016-01-01), XP055831348, ISBN: 978-1-107-17439-9, Retrieved from the Internet <URL:https://assets.cambridge.org/97811071/74399/frontmatter/9781107174399_frontmatter.pdf> *
LUI SHA, RAGUNATHAN RAJKUMAR, LEHOCZKY J. P.: "PRIORITY INHERITANCE PROTOCOLS: AN APPROACH TO REAL-TIME SYNCHRONIZATION.", IEEE TRANSACTIONS ON COMPUTERS, IEEE, USA, vol. 39., no. 09., 1 September 1990 (1990-09-01), USA, pages 1175 - 1185., XP000149625, ISSN: 0018-9340, DOI: 10.1109/12.57058 *

Also Published As

Publication number Publication date
CN111158890A (zh) 2020-05-15

Similar Documents

Publication Publication Date Title
WO2021147878A1 (zh) 控制任务集中的任务并行的系统及其方法
CN105956021B (zh) 一种适用于分布式机器学习的自动化任务并行的方法及其系统
US7139629B2 (en) Planning and scheduling for failure recovery system and method
US7386577B2 (en) Dynamic determination of transaction boundaries in workflow systems
US20180158034A1 (en) Dynamic reordering of blockchain transactions to optimize performance and scalability
US7409656B1 (en) Method and system for parallelizing computing operations
US8201142B2 (en) Description language for structured graphs
JPH01194033A (ja) 並列化コンパイル方法
US20080082644A1 (en) Distributed parallel computing
US11947996B2 (en) Execution of services concurrently
CN110928696B (zh) 用户级线程控制系统及其方法
CN107203421B (zh) 一种云计算环境中自适应的组合工作流方法
US10915488B2 (en) Inter-processor synchronization system
CN110764747B (zh) 基于Airflow的数据计算调度方法
EP3114590B1 (en) System and method for out-of-order multiple query execution witin stored procedure
CN114791931A (zh) 一种基于datax的数据治理方法
US20090094606A1 (en) Method for fast XSL transformation on multithreaded environment
Li et al. Gpu accelerated three-stage execution model for event-parallel simulation
Araujo et al. A multi-improvement local search using dataflow and GPU to solve the minimum latency problem
JP3675623B2 (ja) プログラム開発支援装置及び方法並びにプログラム開発支援用ソフトウェアを記録した記録媒体
CN103136035A (zh) 用于混合线程模式的程序的线程管理的方法和装置
CN111475684B (zh) 数据处理网络系统及其计算图生成方法
Merayo et al. Passive testing of communicating systems with timeouts
Jin et al. TurboDL: Improving the CNN training on GPU with fine-grained multi-streaming scheduling
Fang et al. Online incremental mining based on trusted behavior interval

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 21744414

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 21744414

Country of ref document: EP

Kind code of ref document: A1