WO2022091651A1 - 演算装置及び検査方法 - Google Patents

演算装置及び検査方法 Download PDF

Info

Publication number
WO2022091651A1
WO2022091651A1 PCT/JP2021/034804 JP2021034804W WO2022091651A1 WO 2022091651 A1 WO2022091651 A1 WO 2022091651A1 JP 2021034804 W JP2021034804 W JP 2021034804W WO 2022091651 A1 WO2022091651 A1 WO 2022091651A1
Authority
WO
WIPO (PCT)
Prior art keywords
task
condition
tasks
core
violation
Prior art date
Application number
PCT/JP2021/034804
Other languages
English (en)
French (fr)
Inventor
宏貴 中村
一 芹沢
Original Assignee
日立Astemo株式会社
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 日立Astemo株式会社 filed Critical 日立Astemo株式会社
Priority to JP2022558922A priority Critical patent/JP7454700B2/ja
Publication of WO2022091651A1 publication Critical patent/WO2022091651A1/ja

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • 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/52Program synchronisation; Mutual exclusion, e.g. by means of semaphores

Definitions

  • This disclosure relates to an arithmetic unit and an inspection method.
  • a part that can be processed in parallel is extracted from a program for a single processor core, and a parallelization program containing multiple programs executed in each processor core is created.
  • a parallelization program containing multiple programs executed in each processor core is created.
  • each task of the original program is appropriately assigned to a plurality of processor cores.
  • Patent Document 1 among a plurality of tasks assigned to each CPU core, two tasks that can be executed simultaneously with each other are focused on, and the execution order of those tasks is changed and executed. And, a method of confirming a predetermined condition that causes a defect in the case of simultaneous execution is disclosed.
  • Patent Document 1 does not disclose a method of acquiring a task that can be executed simultaneously.
  • An object of the present disclosure is to provide an algorithm for efficiently and automatically acquiring a relationship between a plurality of tasks constituting a parallelization program, and to determine a predetermined condition between the tasks to inspect the operation of the parallelization program. It is an object of the present invention to provide an arithmetic unit and an inspection method capable of reducing the applied load.
  • An arithmetic unit that inspects the operation of a parallelized program that parallelizes a program consisting of a plurality of tasks executed on each of a plurality of processor cores, and uses resources shared by the plurality of tasks and the parallelized program.
  • a memory to be stored and a control unit that operates based on the parallelization program are provided, and the control unit acquires access information regarding access to the resource shared by the plurality of tasks, and at least the plurality of.
  • the second processing order of the plurality of tasks is obtained, and in the first processing order and the second processing order, before the first task to access the resource shared by the plurality of tasks.
  • the preceding task group consisting of the tasks to be performed and the succeeding task group consisting of the tasks performed after the first task are compared, and the access information is used for the task specified based on the comparison result. , Detects the presence or absence of a predetermined violation in the parallelization program.
  • the first processing order of the plurality of tasks when the first condition is applied to the plurality of tasks is different from the first condition for the plurality of tasks.
  • a predecessor task group consisting of tasks performed before the first task and a succeeding task group consisting of tasks performed after the first task are compared, and the task specified based on the comparison result is compared.
  • the presence or absence of a predetermined violation in the parallelization program is detected by using the access information.
  • an algorithm for efficiently and automatically acquiring a relationship between a plurality of tasks constituting a parallelization program is provided, and a predetermined condition is determined between the tasks to check the operation of the parallelization program. It is possible to provide an arithmetic unit and an inspection method capable of reducing the applied load.
  • the present disclosure is an arithmetic unit and an inspection device for inspecting the operation of a parallelized program in which a program consisting of a plurality of tasks executed on each of a plurality of processor cores is parallelized.
  • Example 1 First, Example 1 will be described with reference to FIGS. 1 to 18.
  • FIG. 1 is a block diagram showing a schematic configuration of the test apparatus 1000 according to the first embodiment of the present disclosure.
  • the test device 1000 is an arithmetic unit that executes an inspection process for inspecting the operation of a parallelization program that is a program for a plurality of processor cores.
  • the parallelization program may be generated from a program for a single core, which is a program for a single processor core, by using a predetermined tool or the like.
  • a parallelization program contains multiple individual programs running on each of multiple processor cores.
  • the test device 1000 has a memory 1100 and a CPU 1200.
  • the memory 1100 and the CPU 1200 are connected to each other via an internal bus, an adapter, or the like.
  • the memory 1100 stores resources shared by a plurality of tasks and a parallelization program. That is, the memory 1100 is a storage unit that stores various information including various programs that define the operation of the CPU 1200.
  • the CPU 1200 is a control unit that operates based on the parallelization program. The CPU 1200 detects (inspects) the presence or absence of a predetermined violation in the parallelization program according to the program described below.
  • the memory 1100 stores the emulator 1101, the violation inspection program 1102, the core0 program 1103, the core1 program 1104, and the core2 program 1105.
  • the memory 1100 further stores violation information 1106, variable access information 1107, task group information 1108, execution order information 1109, selection core information 1110, and synchronization flag 1111.
  • the variable access information 1107 also includes variables such as global variables, and these variables are resources shared by a plurality of tasks.
  • Emulator 1101 is a program for virtually realizing a plurality of processor cores that execute each individual program of the parallelization program.
  • three CPU cores (virtual CPU core 0, virtual CPU core 1 and virtual CPU core 2) are virtually realized as a plurality of processor cores.
  • the violation inspection program 1102 is a program for inspecting the parallelized program on the emulator 1101 whether or not the program satisfies a predetermined condition.
  • the task execution order required at that time is acquired by using the realized virtual CPU core 0, virtual CPU core 1 and virtual CPU core 2 as processor cores for executing the parallelization program.
  • the program 1103 for core0, the program 1104 for core1 and the program 1105 for core2 constitute a parallelization program to be inspected in the inspection process.
  • the program 1103 for core 0, the program 1104 for core 1, and the program 1105 for core 2 are individually realized by the virtual CPU core 0, the virtual CPU core 1, and the virtual CPU core 2, respectively.
  • Violation information 1106 indicates information such as whether or not the parallelization program satisfies a predetermined condition.
  • variable access information 1107 indicates information on the variables accessed by the programs 1103 to 1105 for each core.
  • the task group information 1108 shows a list grouped according to the states that other tasks or processes can take for a certain task or process.
  • Execution order information 1109 indicates the order in which tasks or processes are executed.
  • Selected core information 1110 is management information used to manage processor cores in the execution order acquisition (schedule) process, and in the first embodiment, it indicates the processor cores selected and selected in the inspection process.
  • the synchronization flag 1111 is constraint information for defining a constraint regarding the execution order of each task of the parallelization program. Specifically, the synchronization flag 1111 indicates whether or not the dependent task that depends on the other task among the tasks of the parallelization program can be executed.
  • a dependent task is a task that has restrictions on the execution order with the dependent task, such as using the calculation result of the dependent task. There may be a plurality of synchronization flags 1111.
  • FIG. 2 is a diagram showing an example of a functional configuration of the CPU 1200 realized by executing a program.
  • the virtual CPU core 0, the virtual CPU core 1 and the virtual CPU core 2 are virtually realized by the emulator 1101.
  • the program 1103 for core0, the program 1104 for core1 and the program 1105 for core2 are created here so that parallel processing can be performed by three processor cores from a single core program including tasks T1 to T10.
  • the program 1103 for core0 is an individual program that causes the virtual CPU core 0 to execute the tasks T1, T2, T6, and T7.
  • the tasks T3, T4 and T5 of the program 1104 for core1 and the tasks T8, T9 and T10 of the program 1105 for core2 are also executed by the respective virtual CPUs.
  • Flag A is a synchronization flag for controlling not to start task T3 (dependent task depending on task T1) until task T1 is completed. Flag A is set by task T1. Task T3 waits until flag A is set by task T1.
  • flag B controls the dependency between task T7 and task T4
  • flag C controls the dependency between task T4 and task T8.
  • the violation inspection system performs an inspection process for sequentially executing tasks T1 to T10 according to priority conditions while satisfying restrictions on the execution order of each task T1 to T10 defined by synchronization flag 1111.
  • the constraint on the execution order of each task of the program 1104 for core1 and the program 1105 for core2, that is, whether the dependency of each task is equal to the original single core program is checked.
  • the task whose order is always decided and the task that can be executed at the same time are decided for that task.
  • tasks T2, T6, T9, and T10 are tasks that can be executed simultaneously.
  • Other tasks are tasks whose order is always determined.
  • variable access in a task that can be executed simultaneously on different cores, whether the variable access is a read operation or a write operation to a predetermined condition (for example, the same variable (shared resource)) (read).
  • a predetermined condition for example, the same variable (shared resource)
  • the violation inspection system 3101 shown in FIG. 3 is an inspection system for inspecting conflicts.
  • the violation inspection system 3101 includes a violation determination process 3102, an access conflict analysis process 3103, a simultaneously executable task acquisition process 3104, a preceding / succeeding task group acquisition process 3105, and a scheduler (execution order acquisition process) 3106. Will be done.
  • the violation determination process 3102 is a process for determining the presence or absence of a violation in the entire program. In the first embodiment, the competition is checked.
  • the access conflict analysis process 3103 determines that a variable is not accessed from a plurality of tasks at the same time, and returns the result to the violation determination process 3102.
  • a certain variable is all the variables that are subjected to the Write process in the task (hereinafter referred to as the reference task) received from the violation determination process 3102.
  • the concurrency-executable task acquisition process 3104 acquires the reference task received from the access conflict analysis process 3103 and the task that can be executed at the same time (task that can be executed simultaneously), and returns it to the access conflict analysis process 3103.
  • the preceding / succeeding task group acquisition process 3105 acquires a list of task groups that operated before the reference task and a list of task groups that operated after the reference task in various execution orders, and can simultaneously execute the task group acquisition process 3104.
  • the various execution orders are based on the execution order conditions received from the task acquisition process 3104 that can be executed simultaneously.
  • the scheduler (execution order acquisition process) 3106 is a process of acquiring the execution order according to the execution order condition received from the predecessor / successor task group acquisition process 3105 and returning it to the predecessor / successor task group acquisition process 3105.
  • FIG. 4 is a flowchart showing an example of the contents of the violation determination process 3102 of FIG.
  • the violation inspection system 3101 inspects all the tasks constituting the parallelization program in order in the loop 4100.
  • the violation inspection system 3101 determines in the loop 4100 whether or not there is a write process for the shared (global) variable in the selected task. If there is a Write process for the shared (global) variable (yes), set the flag.
  • the violation inspection system 3101 is a subflow that inspects access conflicts for the reference task. Details of step 4102 will be described with reference to FIG.
  • step 4102 If the result of step 4102 is OK, the violation inspection system 3101 continues the loop 4100 without doing anything, and if it is NG, executes step 4104 (step 4104).
  • the violation inspection system 3101 stores the violation in the violation information 1106 in FIG. 1 and terminates the program.
  • FIG. 5 is a flowchart for determining the presence / absence of a variable access conflict, and is a subflow of the access conflict analysis in step 4102 of FIG.
  • the flowchart shown in FIG. 5 corresponds to the operation of the access conflict analysis process 3103 in FIG.
  • the access conflict analysis process 3103 acquires a task that can be executed at the same time as the reference task received from the violation determination process 3102 from the simultaneously executable task process 3104 (step 5101).
  • the access contention analysis process 3103 checks for access contention (step 5102). That is, for the task group acquired in step 5101, it is determined whether or not there is R / W for at least one of the inter-core shared variables to be written in the task.
  • step 5103 For all shared variables that are written in the reference task, search for the presence or absence of Read or Write in the shared variable in the task that can be executed simultaneously with the reference task, and set it to at least one shared variable among all the shared variables. If one Read or Write is detected, step 5103 is executed.
  • the violation determination program 3101 is a flow executed when there is an access conflict, and returns the violation to the flow of FIG. 4 (step 5103).
  • the violation location is changed to be stored in the violation information 1106 of the memory 1100.
  • the violated part can be output to an appropriate output device such as a display. This is useful information when modifying the code.
  • FIG. 6 is a flowchart showing an example of the contents of the simultaneously executable task acquisition process 3104 shown in FIG.
  • the flowchart shown in FIG. 6 shows a first condition in which an arbitrary execution priority order is assigned to each of a plurality of processor cores (virtual CPU core 0, virtual CPU core 1, virtual CPU core 2), and a plurality of processor cores (virtual CPU).
  • a second condition is used in which the priority order opposite to the first condition is assigned to each of the core 0, the virtual CPU core 1, and the virtual CPU core 2).
  • the flowchart shown in FIG. 6 acquires a task that can be executed simultaneously with the reference task received from the access conflict analysis process 3103 from the two execution orders of forward order and reverse order.
  • the violation inspection system 3101 initializes a predecessor task group that stores tasks executed before the reference task and a successor task group that stores tasks executed after the reference task in a plurality of execution orders (empty list). (Step 6101).
  • the violation inspection system 3101 sets a policy in the execution order acquisition process when acquiring the execution order (step 6102).
  • a policy of setting two lists in the normal order and the reverse order is set.
  • the execution priority is set for each core for all tasks. For example, the virtual CPU core 0 has the first priority, the virtual CPU core 1 has the second priority, and so on.
  • the reverse order is the reverse of the execution priority set in the normal order.
  • the task belonging to the virtual CPU core 0 having the first priority is scheduled to be executed before the task belonging to the core having the second priority or lower.
  • the violation inspection system 3101 acquires information from the execution order in the loop 6103 in all the policies set in step 6102.
  • the number of loops is 2.
  • the violation inspection system 3101 is a process of acquiring a preceding / succeeding task group, and distributes each task to a preceding task group and a succeeding task group from the execution order (step 6104).
  • the violation inspection system 3101 takes the set union of the preceding task group and the succeeding task group, and returns the list to the flow of FIG. 5 as a task that can be executed simultaneously (step 6105). That is, the AND of the preceding task group and the succeeding task group is taken and returned to the flow of FIG. Tasks that can be executed simultaneously are included in both the preceding task group and the succeeding task group because the order is indefinite (replaceable) with respect to the reference task. Can be obtained.
  • FIG. 7 is a flowchart showing an example of the contents of the preceding / task group acquisition process 3105 of FIG.
  • step 7101 is a branching process for selecting a scheduler (earliest scheduler, latest scheduler, forward / reverse scheduler) used for acquiring the execution order.
  • the violation inspection system 3101 selects the earliest scheduler that performs the earliest scheduling to execute a core at the earliest.
  • step 7103 the violation inspection system 3101 selects the slowest scheduler that executes the slowest scheduling to execute a certain core at the latest.
  • step 7104 the violation inspection system 3101 selects an all-priority scheduler that performs prioritized scheduling to be executed by giving priority to all cores.
  • step 7105 the violation inspection system 3101 acquires the execution order with the selected scheduler.
  • the violation inspection system 3101 adds a task to be executed before the reference task in the execution order acquired in step 7105 to the preceding task group (step 7106).
  • step 7106 is executed from the second time onward, it is added while taking the OR with the task already in the preceding task group.
  • the violation inspection system 3101 adds a task to be executed after the reference task in the execution order acquired in step 7105 to the succeeding task group (step 7107).
  • step 7107 is executed from the second time onward, it is added while taking the OR with the task already in the succeeding task group.
  • FIG. 8 is a flowchart for explaining an example of the execution order acquisition process when the scheduler with all priorities set in step 7104 of FIG. 7 is executed in step 7105.
  • the flowchart shown in FIG. 8 corresponds to the operation of the scheduler 3106 in FIG.
  • step 8101 the violation inspection system 3101 selects the processor core having the highest priority as the target processor core.
  • step 8102 the violation inspection system 3101 determines whether the selected target processor core is executable. If the target processor core is not executable, the process of step 8103 is executed. If the target processor core is executable, step 8104 is executed.
  • step 8103 the violation inspection system 3101 selects the processor core next to the target processor core whose priority is selected as the target processor core, and returns to the process of step 8102.
  • step 8104 the violation inspection system 3101 instructs the target processor core to execute the task, and adds the executed task to the end of the execution order list in the execution order information 1109.
  • step 8105 the violation inspection system 3101 determines whether or not the target processor core that executed the task has set the flag.
  • step 8106 If the target processor core sets the flag, the process returns to step 8101. On the other hand, if the target processor core does not set the flag, the process of step 8106 is executed.
  • step 8106 the violation inspection system determines whether all the tasks of all the processor cores have been completed. If all the tasks are not completed, the process returns to the process of step 8102, and if all the tasks are completed, the process is terminated.
  • the task can be executed in each processor core according to the priority set in step 6102 of FIG. 6, and the execution order can be acquired. Also, if any of the processor cores set the flag (step 4101: Yes), the processor core with a higher priority than that processor core may be able to execute the task, so the process returns to step 8101. ing.
  • a modification 1 of the first embodiment will be described with reference to FIG. 9.
  • a task that can be executed simultaneously with the reference task is acquired by using the execution order of several cores in which all the cores are set once at the earliest.
  • the difference from FIG. 6 is that step 9102 is different from step 6102 and step 9102 is different from step 6103.
  • the first condition is that one processor core of a plurality of processor cores (virtual CPU core 0, virtual CPU core 1, virtual CPU core 2) is compared with other processor cores. It is the earliest condition to be executed with priority, and the second condition is a condition in which a processor core other than the above one processor core is set as the earliest condition one by one.
  • the violation inspection system 3101 provides all cores with the condition that one core is executed at the earliest (a task executed in the selected core precedes a task executed in another core as much as possible). Adapted execution conditions for several cores are set (step 9102).
  • the violation inspection system 3101 acquires information from the execution order in the loop 9103 for all the policies set in step 9102.
  • the number of loops is the same as the number of cores.
  • a modified example 2 of the first embodiment will be described with reference to FIG.
  • the example of FIG. 10 is different from the example of FIG. 6, and the task that can be executed simultaneously with the reference task is acquired by using the execution order of several cores in which all the cores are set once at the latest.
  • the difference from FIG. 6 is that step 10102 is different from step 6102 and step 10102 is different from step 6103.
  • the violation inspection system 3101 provides all cores with the condition that one core is executed at the latest (a task executed in the selected core is preceded by a task executed in another core as much as possible). Adapted execution conditions for several cores are set (step 10102).
  • the violation inspection system 3101 acquires information from the execution order in the loop 10103 for all the policies set in step 10102.
  • the number of loops is the same as the number of cores.
  • a modified example 3 of the first embodiment will be described with reference to FIG.
  • a task that can be executed simultaneously with the reference task is acquired by using the two execution orders set to the earliest and the latest in the core to which the reference task belongs.
  • the difference from FIG. 6 is that step 11102 is different from step 6102.
  • the first condition gives priority to one processor core of a plurality of processor cores (virtual CPU core 0, virtual CPU core 1, virtual CPU core 2) over other processor cores.
  • the second condition is that the other processor cores are prioritized over one processor core of a plurality of processor cores (virtual CPU core 0, virtual CPU core 1, virtual CPU core 2). This is the slowest condition to execute.
  • the violation inspection system 3101 sets two execution conditions, one is to make the core to which the reference task belongs the earliest and the other is to execute it at the latest (step 10102).
  • FIG. 12 is a diagram for explaining an example of the task execution process of step 7103 of FIG.
  • the task execution process in FIG. 12 is the slowest scheduler that acquires the execution order under the slowest condition in which the target processor core has a lower priority than all other processor cores.
  • the latest condition means that the task is executed by the target processor core as late as possible.
  • the slowest condition is more specifically, if the other processor core can execute the task, the other processor core can execute the task, and if the other processor core cannot execute the task, the target processor core has the task. It is a condition to execute.
  • a processor core capable of executing a task is a processor core in which the assigned task has a task that has not yet been executed and the task to be executed next is not waiting for a set.
  • step S201 in the task execution process (latest scheduling), the violation inspection system 3101 first determines whether or not there is another processor core capable of executing the task. At this time, the violation inspection system 3101 causes the task to be executed until the target processor core cannot execute the task.
  • processor cores are processor cores other than the selected target processor core.
  • step S202 if there is another processor core capable of executing the task, the violation inspection system 3101 instructs the other processor core capable of executing the task to execute the task, and causes the task to be executed. The process returns to the process of step S201.
  • step S203 if there is no other processor core capable of executing the task, the violation inspection system 3101 instructs the selected target processor core to execute the task and causes the task to be executed. At this time, the violation inspection system 3101 causes the target processor core to execute the task until the target processor core sets the flag, waits for the set, or finishes all the tasks.
  • step S204 the violation inspection system 3101 determines whether or not all the tasks of all the processor cores have been completed.
  • the violation inspection system 3101 returns to the process of step S201 when all the tasks are not completed, and ends the process when all the tasks are completed.
  • FIG. 13 is a diagram for explaining another example of the task execution process of step 7102 of FIG.
  • the task execution process in FIG. 13 is the earliest scheduler that acquires the execution order under the earliest condition in which the target processor core has a higher priority than all other processor cores.
  • the earliest condition means that the task is executed by the target processor core as soon as possible.
  • the earliest condition is, more specifically, to have the target processor core execute the task if the target processor core can execute the task, and to have another processor core execute the task if the target processor core cannot execute the task. It is a condition.
  • the violation inspection system 3101 first determines whether or not the selected target processor core can execute the task (step S301).
  • the violation inspection system 3101 instructs the target processor core to execute the task, causes the target processor core to execute the task (step S302), and returns to the process of step S301. At this time, the violation inspection system 3101 causes the task to be executed until the target processor core cannot execute the task.
  • the violation inspection system 3101 searches for a processor core that sets a flag waiting for the target processor core to be set (step S303).
  • the violation inspection system 3101 determines whether or not the searched processor core is waiting for a set (step S304).
  • the violation inspection system 3101 searches for a processor core that sets a flag for waiting for a set of the searched processor core (step S305), and returns to the process of step S304.
  • step S304 it is determined whether or not the last selected processor core is waiting for a set.
  • the violation inspection system 3101 instructs the searched processor core to execute a task and causes one task to be executed (step S306).
  • the violation inspection system 3101 determines whether or not all the tasks of all the processor cores have been completed (step S307). The violation inspection system 3101 returns to the process of step S301 when all the tasks are not completed, and ends the process when all the tasks are completed.
  • step S303 the violation inspection system 3101 searches for the processor core that sets the flag for waiting for the set of the target processor core. Search for a viable processor core among other processor cores.
  • tasks that can be executed simultaneously can be obtained by comparing the execution orders obtained by applying a plurality of conditions. Specifically, an order relationship between a plurality of execution orders appears as two task pairs in which at least one combination of execution orders is interchanged.
  • FIG. 14A is a graph model of a parallelization program composed of tasks A to H.
  • tasks are represented as nodes, and dependencies between tasks are represented as edges.
  • edges A relationship is established between the task ⁇ that is connected to the start point of the edge and the task ⁇ that is connected to the end point of the edge that the execution of the task ⁇ must be completed and the task ⁇ must be executed.
  • tasks A, B, G, and H are executed by core0
  • tasks C and E are executed by core1
  • tasks D and F are executed by core2.
  • tasks that have no dependency are tasks that can be executed simultaneously. These tasks have no order constraint and are executed in reverse order or at the same time. For example, tasks E and F do not depend on each other and can be executed simultaneously.
  • FIG. 14B is a diagram showing an execution order with each core as the slowest.
  • FIG. 14B pay attention to tasks E and F, and compare the case where core1 is the slowest and the execution order where core2 is the slowest.
  • tasks F to E are executed
  • core2 is the latest
  • tasks E to F are executed in this order, and it can be seen that the two are tasks that can be executed simultaneously.
  • FIG. 15 is a diagram showing an example of a preceding task group and a succeeding task group.
  • the task F is used as a reference, and the task executed before the task F is added to the preceding task group, and the task executed after the task F is added to the succeeding task group.
  • FIG. 16 shows the tasks A, D, and C that always precede the task A, D, and C that are always executed before the reference task F from the preceding task group and the succeeding task group shown in FIG. 15, and the tasks B and E that can be executed simultaneously.
  • G and, in any case, a diagram showing how the tasks are classified into the task H that always follows the task F, which is executed after the reference task F.
  • the preceding tasks A, D, and C are always complements of the succeeding task group in the preceding task group.
  • Tasks B, E, and G that can be executed simultaneously are the intersection of the preceding task group and the succeeding task group.
  • the task H that always follows is a complement of the preceding task group in the succeeding task group.
  • FIG. 17 is a diagram showing tasks A, C, and D that always precede the task F, tasks B, E, and G that can be executed simultaneously, and a task H that always follows.
  • the modified example 1 and the modified example 3 are the same as the modified example 2.
  • FIG. 18 shows the examples shown in FIG. 14A in normal order (first priority: core2, second priority: core0, third priority: core1) and reverse order (first priority: core1, second priority: core0, third).
  • Priority It is a figure which shows the execution order scheduled in core2).
  • F is a reference task
  • tasks that can be executed simultaneously are tasks B, E, and G
  • the order of tasks E and G is changed in the order of forward and reverse with respect to the reference task F. It can be seen that the order of task B is not changed with respect to the reference task F, and all tasks that can be executed simultaneously cannot be acquired.
  • the reference task must be executed in advance of the task that can be executed concurrently, but the blocking core prevents the execution of the reference core in the reference task, so that the task can be executed concurrently. Is executed first.
  • the core Since the blocking core has not issued the synchronization flag, the core is waiting for execution and executes a task with a lower priority than the core. If the core to which the reference task and the task that can be executed concurrently belong has a higher priority than the blocking core, the task that can be executed concurrently will be executed before the blocking core issues the synchronization flag.
  • a core other than the core including the reference task is the earliest or the latest
  • the tasks that can be executed simultaneously in the core set to the earliest or the latest are always executed before or after the reference task.
  • all cores other than the core including the reference task are set to be the earliest or the latest once and executed, the tasks that can be executed simultaneously with respect to the reference task are always executed first or later in either order.
  • Modification example 3 can also extract all tasks that can be executed simultaneously, which are determined for the reference task.
  • a core other than the core containing the reference task is the earliest or the latest
  • the concurrently executable tasks included in the core set to the earliest or the latest are always executed before or after the reference task. Therefore, even if the preceding task group and the succeeding task group are acquired from the execution order in which the reference task is set to the earliest and the latest, the tasks that can be executed simultaneously are included in both.
  • the amount of calculation can be reduced by executing the execution order only once under each condition and recording the result in the task group information 1108 of the memory 1100.
  • the scheduler can be executed by changing the execution order that matches the specified condition to be referred to when the execution order has already been generated.
  • the number of times the execution order is generated in the modified examples 1 and 2 is the number of cores, and in the modified example 3, the number of cores ⁇ 2 times.
  • all the tasks that can be executed simultaneously can be extracted. Therefore, it is possible to detect whether or not there is a violation of the parallelization program by making a determination between those tasks under predetermined conditions. It is possible to provide an arithmetic unit and an inspection method capable of reducing the load on the inspection of the operation of the parallelization program.
  • the CPU 1200 which is a control unit, acquires access information regarding access to resources shared by the plurality of tasks T1 to T10, and applies the first condition to at least the plurality of tasks T1 to T10.
  • the first processing sequence of the plurality of tasks T1 to T10 at the time of the operation, and the first of the plurality of tasks T1 to T10 when the second condition different from the first condition is applied to the plurality of tasks T1 to T10. Find the second processing order.
  • a predecessor task group consisting of tasks performed before the first task to access the resource shared by the plurality of tasks T1 to T10, and the first task. Compare with subsequent task groups consisting of later tasks. For the task specified based on the comparison result, the presence or absence of a predetermined violation in the parallelization program is detected by using the above access information.
  • Example 2 of the present disclosure will be described with reference to FIGS. 19 to 25.
  • FIG. 19 is a schematic configuration diagram of the violation inspection system 19101 according to the second embodiment of the present disclosure.
  • the violation inspection system 19101 shown in FIG. 19 is an inspection system that inspects execution order violations.
  • the violation inspection system 19101 shown in FIG. 19 has substantially the same configuration as the violation inspection system 3101 shown in FIG.
  • the parts different from the configuration shown in FIG. 3 are the access order analysis process 19103 and the preceding / succeeding task acquisition process 19104.
  • the access order analysis process 19103 confirms that a predetermined order constraint is satisfied for a certain process in a certain variable and a process for another same variable, and returns the result to the violation determination process 19102.
  • a certain variable is all the variables that are undergoing Write processing in the task (reference task) received from the violation determination processing 19102.
  • the preceding / succeeding task acquisition process 19104 acquires the preceding task group and the succeeding task group from the reference task received from the access order analysis process 19103, and returns them to the access order analysis process 19102.
  • FIG. 20 is a flowchart showing an example of the contents of the violation determination process 19102 of FIG.
  • the content of step 4102 of the flowchart shown in FIG. 4 becomes the content of step 20102, and the content of the other steps is the same as the flowchart shown in FIG.
  • the violation inspection system 19101 is a subflow that inspects the execution order for a certain task (reference task). Details will be described with reference to FIG.
  • FIG. 21 is a flowchart for analyzing the access order of variables and determining the validity. It corresponds to the operation of the access order analysis process 19103 in FIG.
  • the task that always precedes and the task that always follows the reference task received by the processing of the flowchart shown in FIG. 20 are acquired (step 21101).
  • the violation inspection system 19101 performs a process of determining whether or not there is an access order violation (breaking a predetermined order constraint). Regarding other processing of the same variable as the shared variable to be written in the task, the processing that should be earlier is not in the succeeding task group, the processing that should be later is not in the succeeding task group, and it exists in the program. (Step 21102).
  • step 21103 is executed. In other cases, the process ends and the process returns to the flow of FIG.
  • condition C221 If condition C221 is satisfied, there is always a process to be executed before the process only in the preceding task. Therefore, when the program is executed, it is guaranteed that those processes are always executed before the processes.
  • condition C222 there is always a process to be executed after the process only in the succeeding task. Therefore, when the program is executed, it is guaranteed that those processes are always executed after the process.
  • the program satisfies the rule of the execution order in the certain variable. Further, if the above conditions are satisfied for all variables, the program satisfies the execution order rule for all variables in any case.
  • step 21103 the violation determination program is a flow executed when there is an access order violation, and the violation is returned to the flow of FIG. 20.
  • FIG. 22 is a flowchart showing an example of the contents of the preceding / succeeding task acquisition process 19104 shown in FIG.
  • the flowchart shown in FIG. 22 is a process of acquiring a preceding task group and a succeeding task group determined for the reference task received by the processing of the flowchart shown in FIG. 21 from the two execution orders of forward order and reverse order. be.
  • Steps 22101 to 20104 in FIG. 22 are the same as steps 6101 to 6104 in FIG.
  • step 22105 of FIG. 22 the violation inspection system 19101 returns the preceding task group and the succeeding task group to the flow of FIG.
  • a modification 1 of the second embodiment will be described with reference to FIG. 23.
  • the flowchart shown in FIG. 23 is a reference task received from the processing of the flowchart of FIG. 21 using the execution order of several cores in which all the cores are set once at the earliest. Acquire the preceding task group and the succeeding task group that are determined for the above.
  • Steps 23101 to 23104 are the same as steps 9101 to 9104 in FIG.
  • Step 23105 is the same as 22105 in FIG.
  • FIG. 24 A modified example 2 of the second embodiment will be described with reference to FIG. 24.
  • the flowchart shown in FIG. 24 is different from the flowchart shown in FIG. 22, and the reference received by processing the flowchart of FIG. 21 using the execution order of several cores in which all the cores are set once at the latest. Acquires the preceding task group and the succeeding task group that are determined for the task.
  • Steps 24101 to 24104 in FIG. 24 are the same as steps 10101 to 10104 in FIG.
  • Step 24105 is the same as step 22105 in FIG.
  • a modified example 3 of the second embodiment will be described with reference to the flowchart shown in FIG.
  • the flowchart shown in FIG. 25 is different from the flowchart shown in FIG. 22, and the reference received by processing the flowchart of FIG. 21 using the two execution orders set to the earliest and the latest by the core to which the reference task belongs. Acquires the preceding task group and the succeeding task group that are determined for the task.
  • Steps 25101 to 25104 are the same as steps 11101 to 11104 in FIG.
  • Step 25105 is the same as step 22105 in FIG.
  • the second embodiment of the present disclosure is configured to always refer to the task in which the order is determined to check whether the execution order for a certain variable satisfies the regulation, so that the presence or absence of the violation of the parallelization program is detected. It is possible to provide an arithmetic unit and an inspection method capable of reducing the load on the inspection of the operation of the parallelization program.

Landscapes

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

Abstract

並列化プログラムの動作の検査に掛かる負荷を軽減することが可能な演算装置を提供する。複数のタスクT1~T10で共有される資源へのアクセスに関するアクセス情報を取得し、複数のタスクT1~T10に対して第一の条件を適用したときの複数のタスクT1~T10の第一の処理順序と、複数のタスクT1~T10に対して第一の条件とは異なる第二の条件を適用したときの複数のタスクT1~T10の第二の処理順序とを求める。第一の処理順序および第二の処理順序にて、複数のタスクT1~T10で共有される資源へアクセスする第一のタスクより前に行われる先行タスクグループと、第一のタスクより後に行われる後続タスクグループとを比較する。比較結果に基づいて特定されたタスクに対して、アクセス情報を用いて、並列化プログラムにおける所定の違反の有無を検知する。

Description

演算装置及び検査方法
 本開示は、演算装置及び検査方法に関する。
 近年、電子機器の多機能化などにより、電子機器で実行される演算処理の演算量が年々増加しており、それに伴い、電子機器に搭載するCPU(Central Processing Unit)などのプロセッサの性能の向上が望まれている。
 このため、電子機器に搭載するプロセッサの数を増やしたり、プロセッサに内蔵させるプロセッサコアの数を増やしたりすることで、電子機器にプロセッサコアを複数搭載するマルチコア化を図ることが多くなっている。
 また、複数のプロセッサコアを利用するために、単一のプロセッサコア向けのプログラムから並列処理が可能な部分を抽出して、各プロセッサコアで実行される複数のプログラムを含む並列化プログラムを作成することがある。並列化プログラムでは、元のプログラムの各タスクが複数のプロセッサコアに適宜割り当てられている。
 並列化プログラムによって元のプログラムと同じ実行結果を得るためには、各タスクの依存関係を考慮して、各プロセッサコアで実行されるプログラムを作成する必要がある。
 例えば、あるタスクの計算結果が別のタスクで使用される場合、それらのタスクの実行順序が元のプログラムでの実行順序と同じにように、各プロセッサコアで実行されるプログラムを作成する必要がある。
 このため、並列化プログラムの動作を検査する際に、依存関係を有するタスクの実行順序が元のプログラムでの実行順序と同一か否かを確認することがある。
 これに対して、特許文献1には、各CPUコアに割り当てた複数のタスクのうち、互いに同時実行可能な2つのタスクに注目して、それらのタスクの実行順序を入れ替えて実行した時の結果と、同時実行される場合の不具合を、それを引き起こす所定の条件を確認する方法が開示されている。
特開2018-151803号公報
 同時実行可能なタスクを取得し、それらのタスク間で、所定の条件を判定することができれば、並列化プログラムにおける所定の違反の有無を検知することができる。
 しかしながら、従来技術においては、同時実行可能なタスクを見出すことは非常に困難であり、特許文献1においても、同時実行可能なタスクを取得する方法は開示されていない。
 自動で並列化された並列化プログラムは、どのタスクが同時に実行されるかが自明ではないため、並列化プログラムが複雑になればなるほど、同時実行可能なタスクの取得は困難となる。
 本開示の目的は、並列化プログラムを構成する複数のタスク間の関係を効率的に自動取得するアルゴリズムを提供し、タスク間において所定の条件を判定することで、並列化プログラムの動作の検査に掛かる負荷を軽減することが可能な演算装置及び検査方法を提供することである。
 上記目的を達成するため、本開示は次のように構成される。
 複数のプロセッサコアのそれぞれで実行される複数のタスクからなるプログラムを並列化した並列化プログラムの動作を検査する演算装置であって、前記複数のタスクで共有される資源と、前記並列化プログラムを記憶するメモリと、前記並列化プログラムに基づいて動作する制御部と、を備え、前記制御部は、前記複数のタスクで共有される前記資源へのアクセスに関するアクセス情報を取得し、少なくとも、前記複数のタスクに対して第一の条件を適用したときの前記複数のタスクの第一の処理順序と、前記複数のタスクに対して前記第一の条件とは異なる第二の条件を適用したときの前記複数のタスクの第二の処理順序と、を求め、前記第一の処理順序および前記第二の処理順序において、前記複数のタスクで共有される前記資源へアクセスする第一のタスクより前に行われるタスクからなる先行タスクグループと、前記第一のタスクより後に行われるタスクからなる後続タスクグループと、を比較し、比較結果に基づいて特定されたタスクに対して、前記アクセス情報を用いて、前記並列化プログラムにおける所定の違反の有無を検知する。
 複数のプロセッサコアのそれぞれで実行される複数のタスクからなるプログラムを並列化した並列化プログラムの動作を検査する検査方法であって、前記複数のタスクで共有される前記資源へのアクセスに関するアクセス情報を取得し、少なくとも、前記複数のタスクに対して第一の条件を適用したときの前記複数のタスクの第一の処理順序と、前記複数のタスクに対して前記第一の条件とは異なる第二の条件を適用したときの前記複数のタスクの第二の処理順序と、を求め、前記第一の処理順序および前記第二の処理順序において、前記複数のタスクで共有される資源へアクセスする第一のタスクより前に行われるタスクからなる先行タスクグループと、前記第一のタスクより後に行われるタスクからなる後続タスクグループと、を比較し、比較結果に基づいて特定されたタスクに対して、前記アクセス情報を用いて、前記並列化プログラムにおける所定の違反の有無を検知する。
 本開示によれば、並列化プログラムを構成する複数のタスク間の関係を効率的に自動取得するアルゴリズムを提供し、タスク間において所定の条件を判定することで、並列化プログラムの動作の検査に掛かる負荷を軽減することが可能な演算装置及び検査方法を提供することができる。
本開示の実施例1に係るテスト装置の構成を示すブロック図である。 本開示の実施例1に係るプログラムが実行されることで実現されるCPU1200の機能的な構成の一例を示す図である。 本開示の実施例1に係るテスト装置の機能的な構成を示す図である。 本開示の実施例1に係る違反判定処理の動作の一例を説明するためのフローチャートである。 本開示の実施例1に係るアクセス競合解析処理の動作の一例を説明するためのフローチャートである。 本開示の実施例1に係る同時実行可能なタスク取得処理の一例である正順/逆順を説明するための図である。 本開示の実施例1に係る先行/後続タスク取得処理の動作の一例を説明するためのフローチャートである。 本開示の実施例1に係るスケジューラの一例である全優先度付きスケジューラを説明するための図である。 本開示の実施例1に係る同時実行可能なタスク取得処理の一例である最早を説明するための図である。 本開示の実施例1に係る同時実行可能なタスク取得処理の一例である最遅を説明するための図である。 本開示の実施例1に係る同時実行可能なタスク取得処理の一例である最早/最遅を説明するための図である。 本開示の実施例1に係るスケジューラの一例である最遅スケジューラを説明するための図である。 本開示の実施例1に係るスケジューラの一例である最早スケジューラを説明するための図である。 並列化プログラムの依存関係の具体例を説明するための図である。 最遅スケジューラによる実行順序の具体例を説明するための図である。 先行タスクグループおよび後続タスクグループの具体例を説明するための図である。 先行タスクグループおよび後続タスクグループを弁図の形式で表した図である。 常に先行するタスク、同時実行可能なタスク、常に後続するタスクの具体例を説明するための図である。 全優先度付きスケジューラによる実行順序の具体例を説明するための図である。 本開示の実施例2に係るテスト装置の機能的な構成を示す図である。 本開示の実施例2に係る違反判定処理の動作の一例を説明するためのフローチャートである。 本開示の実施例2に係るアクセス順序解析処理の動作の一例を説明するためのフローチャートである。 本開示の実施例2に係る先行/後続タスク取得処理の動作の一例を説明するためのフローチャートである。 本開示の実施例2に係る同時実行可能なタスク取得処理の一例である最早を説明するための図である。 本開示の実施例2に係る同時実行可能なタスク取得処理の一例である最遅を説明するための図である。 本開示の実施例2に係る同時実行可能なタスク取得処理の一例である最早/最遅を説明するための図である。
 以下、本開示の実施形態について図面を参照して説明する。本開示は、複数のプロセッサコアのそれぞれで実行される複数のタスクからなるプログラムを並列化した並列化プログラムの動作を検査する演算装置及び検査装置である。
 (実施例1)
 まず、実施例1を図1から図18を用いて説明する。
 図1は、本開示の実施例1に係るテスト装置1000の概略構成を示すブロック図である。
 図1において、テスト装置1000は、複数のプロセッサコア向けのプログラムである並列化プログラムの動作を検査する検査処理を実行する演算装置である。並列化プログラムは、単一のプロセッサコア向けのプログラムである単一コア用プログラムから所定のツール等を用いて生成されたものでもよい。並列化プログラムは、複数のプロセッサコアのそれぞれで実行される複数の個別プログラムを含む。
 テスト装置1000は、メモリ1100と、CPU1200とを有する。メモリ1100及びCPU1200は、内部バス又はアダプタなどを介して相互に接続される。
 メモリ1100は、複数のタスクで共有される資源と、並列化プログラムを記憶する。つまり、メモリ1100は、CPU1200の動作を規定する種々のプログラムを含む種々の情報を記憶する記憶部である。そして、CPU1200は、並列化プログラムに基づいて動作する制御部である。CPU1200は、以下に説明するプログラムに従って、並列化プログラムにおける所定の違反の有無を検知する(検査する)。
 本実施例1では、メモリ1100は、エミュレータ1101と、違反検査プログラム1102と、core0用プログラム1103と、core1用プログラム1104と、core2用プログラム1105と、を記憶する。メモリ1100は、さらに、違反情報1106と、変数アクセス情報1107と、タスクグループ情報1108と、実行順序情報1109と、選択コア情報1110と、同期フラグ1111と、を記憶する。変数アクセス情報1107には、例えば、グローバル変数等の変数も含まれ、これらの変数は、複数のタスクで共有される資源である。
 エミュレータ1101は、並列化プログラムの各個別プログラムを実行する複数のプロセッサコアを仮想的に実現するためのプログラムである。本実施例1では、複数のプロセッサコアとして、3つのCPUコア(仮想CPUコア0、仮想CPUコア1および仮想CPUコア2)が仮想的に実現される。
 違反検査プログラム1102は、エミュレータ1101にて、並列化プログラムに対し、そのプログラムが所定の条件を満たすか否かを検査するためのプログラムである。そのときに必要なタスク実行順序は、実現された仮想CPUコア0、仮想CPUコア1および仮想CPUコア2を、並列化プログラムを実行させるプロセッサコアとして用いて取得する。
 以下では、便宜上、プログラム及びタスクを各処理の動作主体として説明することもあるが、各処理の実際の動作主体は制御部であるCPU1200である。
 core0用プログラム1103、core1用プログラム1104およびcore2用プログラム1105は、検査処理の検査対象となる並列化プログラムを構成する。core0用プログラム1103、core1用プログラム1104およびcore2用プログラム1105は、それぞれ、仮想CPUコア0、仮想CPUコア1および仮想CPUコア2により個別に実現される。
 違反情報1106は、並列化プログラムが所定の条件の成立可否などの情報を示す。
 変数アクセス情報1107は、各core用プログラム1103~1105が、アクセスしている変数の情報を示す。
 タスクグループ情報1108は、あるタスクあるいは処理に対し、それ以外のタスクあるいは処理が、とりうる状態毎にグループ分けしたリストを示す。
 実行順序情報1109は、タスクあるいは処理が実行された順序を示す。
 選択コア情報1110は、実行順序取得(スケジュール)処理において、プロセッサコアを管理するために使用される管理情報であり、本実施例1では、検査処理において選択中及び選択済みのプロセッサコアを示す。
 同期フラグ1111は、並列化プログラムの各タスクの実行順序に関する制約を規定するための制約情報である。同期フラグ1111は、具体的には、並列化プログラムの各タスクのうち、他のタスクに依存している依存タスクの実行可否を示す。
 依存タスクは、依存対象のタスクの演算結果を使用するなど、依存対象のタスクとの間に実行順序に関する制約を有するタスクである。なお、同期フラグ1111は、複数あってもよい。
 図2は、プログラムが実行されることで実現されるCPU1200の機能的な構成の一例を示す図である。
 図2に示すように、エミュレータ1101にて、仮想CPUコア0、仮想CPUコア1及び仮想CPUコア2が仮想的に実現される。core0用プログラム1103、core1用プログラム1104及びcore2用プログラム1105は、ここでは、タスクT1~T10を含む単一コア用プログラムから、3つのプロセッサコアで並列処理が可能なように作成されている。
 core0用プログラム1103は、仮想CPUコア0にタスクT1、T2、T6及びT7を実行させる個別プログラムである。core1用プログラム1104のタスクT3、T4及びT5、core2用プログラム1105のタスクT8、T9及びT10も同様にそれぞれの仮想CPUで実行される。
 フラグAは、タスクT1が終了するまでタスクT3(タスクT1に依存した依存タスク)を開始させないように制御するための同期フラグである。フラグAは、タスクT1によってセットされる。タスクT3はタスクT1によってフラグAがセットされるまで待機する。
 なお、フラグを、実行可能を示す状態にすることを「フラグをセットする」と呼び、フラグが実行可能を示す状態になるまで待機することを「セット待ち」と呼ぶ。同様に、フラグBは、タスクT7とタスクT4の依存関係を制御し、フラグCは、タスクT4とタスクT8の依存関係を制御する。
 違反検査システムは、同期フラグ1111にて規定される各タスクT1~T10の実行順序に関する制約を満たしつつ、優先条件に従ってタスクT1~T10を順次実行させる検査処理を行うことで、core0用プログラム1103、core1用プログラム1104及びcore2用プログラム1105の各タスクの実行順序に関する制約、つまり各タスクの依存関係が元の単一コア用プログラムと等しいか否かを検査する。
 あるタスクに着目した時、そのタスクに対して、必ず順序が決まるタスクと同時実行可能なタスクが定まる。
 したがって、全てのコアに着目することで、全ての同時実行可能なタスクを抽出できる。
 例えば、タスクT4に着目すると、タスクT2、T6、T9、T10が同時実行可能なタスクである。それ以外のタスクは、必ず順序が決まるタスクである。
 実施例1では、異なるコア上で実行される同時実行可能なタスクにおいて、変数アクセスが所定の条件(例えば、同一の変数(共有の資源)へのリード動作またはライト動作が行われているか(リード動作またはライト動作の競合が存在するか(ただし、少なくとも一つのライト動作の競合が存在することが必要である)))を満たすか否かを判定することで、並列プログラムの違反を検査する。
 図3に示す違反検査システム3101は、競合を検査する検査システムである。違反検査システム3101は、違反判定処理3102と、アクセス競合解析処理3103と、同時実行可能タスク取得処理3104と、先行/後続タスクグループ取得処理3105と、スケジューラ(実行順序取得処理)3106と、で構成される。
 違反判定処理3102は、プログラム全体における違反の有無を判定する処理である。本実施例1では、競合を検査する。
 アクセス競合解析処理3103は、ある変数に対して、複数のタスクから、同時にアクセスが発生しないことを判定し、その結果を違反判定処理3102に返す。ある変数は、違反判定処理3102から受け取った、タスク(以下、基準タスクと記述)内で、Write処理をしている変数すべてである。
 同時実行可能タスク取得処理3104は、アクセス競合解析処理3103から受け取った、基準タスクと、同時に実行されうるタスク(同時実行可能なタスク)を取得し、アクセス競合解析処理3103に返す。
 先行/後続タスクグループ取得処理3105は、様々な実行順序において、基準タスクより先に動作したタスクグループのリストと、より後に動作したタスクグループのリストと、を取得し、同時実行可能タスク取得処理3104に返す。
 なお、様々な実行順序は、同時実行可能なタスク取得処理3104から受け取った、実行順序条件に基づく。
 スケジューラ(実行順序取得処理)3106は、先行後続タスクグループ取得処理3105から受け取った実行順序条件に従い、実行順序を取得して、先行後続タスクグループ取得処理3105に返す処理である。
 図4は、図3の違反判定処理3102の内容の一例を示すフローチャートである。
 違反検査システム3101は、並列化プログラムを構成する全てのタスクについて、ループ4100で、順番に検査する。
 違反検査システム3101は、ループ4100で、選択されているタスクにおいて、共有(グローバル)変数へのWrite処理の有無を判定する。共有(グローバル)変数へのWrite処理が有の場合(Yesの場合)は、フラグをセットする。
 なお、ポインタ変数はローカルで宣言されていても、その指し先がグローバル領域ならグローバル変数として扱う(ステップ4101)。
 違反検査システム3101は、基準タスクに対する、アクセス競合を検査するサブフローである。ステップ4102の詳細は図5で説明する。
 違反検査システム3101は、ステップ4102の結果がOKである場合、何もせずループ4100を続行し、NGであった場合、ステップ4104を実行する(ステップ4104)。
 違反検査システム3101は、違反ありを図1の違反情報1106に格納し、プログラムを終了させる。
 図5は、変数のアクセス競合の有無を判定するためのフローチャートであり、図4のステップ4102のアクセス競合解析のサブフローである。なお、図5に示したフローチャートは、図3のアクセス競合解析処理3103の動作に相当する。
 アクセス競合解析処理3103は、違反判定処理3102から受け取った、基準タスクに対して、それと同時に実行されうるタスクを、同時実行可能タスク処理3104から取得する(ステップ5101)。
 アクセス競合解析処理3103は、アクセス競合を検査する(ステップ5102)。つまり、ステップ5101で取得したタスク群に対し、当該タスクでWriteするコア間共有変数の少なくとも一つに対するR/W有りか無しかを判定する。
 基準タスクでWriteしている共有変数すべてに対し、基準タスクと同時実行可能なタスクで、当該共有変数へのReadあるいはWriteの有無を検索し、当該共有変数すべてのうち、少なくとも1つの共有変数に1つのReadあるいはWriteが検出された場合、ステップ5103を実行する。
 一方、基準タスクと同時実行可能なタスクにおいて、すべての当該共有変数に対するReadとWriteが一つも見つからなかった場合、処理を終了し、図4のフローに戻る。
 違反判定プログラム3101は、アクセス競合があった場合に実行されるフローであり、違反ありを図4のフローに返す(ステップ5103)。なお、違反箇所をメモリ1100の違反情報1106に格納するように変更する。違反箇所はディスプレイ等の適切な出力装置に出力することができる。これは、コードを修正する際に有用な情報である。
 図6は、図3に示した同時実行可能タスク取得処理3104の内容の一例を示すフローチャートである。図6に示すフローチャートは、複数のプロセッサコア(仮想CPUコア0、仮想CPUコア1、仮想CPUコア2)のそれぞれに任意の実行優先順序を割り当てる第一の条件と、複数のプロセッサコア(仮想CPUコア0、仮想CPUコア1、仮想CPUコア2)のそれぞれに第一の条件と逆の優先順序を割り当てる第二の条件を用いる。
 複数のタスクに対して第一の条件を適用したときの複数のタスクの処理順序を第一の処理順序とし、複数のタスクに対して第一の条件とは異なる第二の条件を適用したときの複数のタスクの処理順序を第二の処理順序とする(以下の説明においても、同様である)。
 図6に示したフローチャートは、正順・逆順の二通りの実行順序から、アクセス競合解析処理3103より受け取った、基準タスクと同時実行可能なタスクを取得する。
 違反検査システム3101は、複数の実行順序において、基準タスクより先に実行されたタスクを格納する先行タスクグループおよび、基準タスクより後に実行されたタスクを格納する後続タスクグループを初期化(リストを空に)する(ステップ6101)。
 違反検査システム3101は、実行順序を取得するにあたって、実行順序取得処理におけるポリシーを設定する(ステップ6102)。実施例1では、正順、逆順の2本のリストを設定するというポリシーを設定する。
 正順は、すべてのタスクに対して、コアごとに実行優先度を設定する。たとえば、仮想CPUコア0を第一優先、仮想CPUコア1を第二優先、・・・というような具合である。
 逆順は、正順で設定した実行優先度を逆転したものである。実行順序取得処理において、優先度が第一優先の仮想CPUコア0に属するタスクは、第二優先以下のコアに属するタスクより可能な限り先に実行するようにスケジュールされる。
 違反検査システム3101は、ステップ6102で設定した全てのポリシーで、実行順序から情報をループ6103で取得する。本実施例1では、ループ回数は2である。
 違反検査システム3101は、先行/後続タスクグループを取得する処理であり、実行順序から、先行タスクグループおよび後続タスクグループに各タスクを振り分ける(ステップ6104)。
 違反検査システム3101は、先行タスクグループ、後続タスクグループの集合和を取り、同時実行可能なタスクとして、図5のフローに、そのリストを返す(ステップ6105)。つまり、先行タスクグループと後続タスクグループのANDを取り、図5のフローに返す。同時実行可能なタスクは、基準タスクに対し、順序が不定(入れ替え可能)であることから、先行タスクグループ、後続タスクグループの両方に含まれ、集合和を取ることで、同時実行可能なタスクを取得することができる。
 図7は、図3の先行/タスクグループ取得処理3105の内容の一例を示すフローチャートである。
 図7において、ステップ7101は、実行順序の取得に用いるスケジューラ(最早スケジューラ、最遅スケジューラ、正順/逆順スケジューラ)を選択する分枝処理である。
  ステップ7102で、違反検査システム3101は、あるコアを最早で実行する最早スケジューリングを実施する最早スケジューラを選択する。
 ステップ7103で、違反検査システム3101は、あるコアを最遅で実行する最遅スケジューリングを実施する最遅スケジューラを選択する。
 ステップ7104で、違反検査システム3101は、全てのコアに優先度を付与して実行する優先度付きスケジューリングを実施する全優先度付きスケジューラを選択する。
 ステップ7105で、違反検査システム3101は、選択されたスケジューラで実行順序を取得する。
 違反検査システム3101は、先行タスクグループに、ステップ7105において取得した実行順序において、基準タスクより先に実行されるタスクを追加する(ステップ7106)。
 なお、ステップ7106が2回目以降に実行される場合は、先行タスクグループに既にあるタスクとORを取りながら追加する。
 違反検査システム3101は、後続タスクグループに、ステップ7105において取得した実行順序において、基準タスクより後に実行されるタスクを追加する(ステップ7107)。
 なお、ステップ7107が2回目以降に実行される場合は、後続タスクグループに既にあるタスクとORを取りながら追加する。
 図8は、図7のステップ7104で設定した全優先度付きスケジューラを、ステップ7105で実行するときの実行順序取得処理の一例を説明するためのフローチャートである。図8に示したフローチャートは、図3では、スケジューラ3106の動作に相当する。
 ステップ8101で、違反検査システム3101は、優先順位が最も高いプロセッサコアを対象プロセッサコアとして選択する。ステップ8102で、違反検査システム3101は、選択中の対象プロセッサコアが実行可能か否かを判断する。対象プロセッサコアが実行可能でない場合、ステップ8103の処理を実行する。対象プロセッサコアが実行可能である場合、ステップ8104を実行する。
 ステップ8103で、違反検査システム3101は、優先順位が選択中の対象プロセッサコアの次に高いプロセッサコアを対象プロセッサコアとして選択し、ステップ8102の処理に戻る。
 ステップ8104で、違反検査システム3101は、対象プロセッサコアに対してタスクの実行を指示し、実行したタスクを実行順序情報1109にある実行順序リストの末尾に追加する。
 ステップ8105で、違反検査システム3101は、タスクを実行した、対象プロセッサコアがフラグをセットしたか否かを判断する。
 対象プロセッサコアがフラグをセットした場合、ステップ8101の処理に戻る。一方、対象プロセッサコアがフラグをセットしていない場合、ステップ8106の処理を実行する。
 ステップ8106で、違反検査システムは、全てのプロセッサコアの全てのタスクが終了したか否かを判断する。全てのタスクが終了していない場合、ステップ8102の処理に戻り、全てのタスクが終了した場合、処理を終了する。
 以上の動作により、図6のステップ6102で設定した優先順位に従って各プロセッサコアにタスクを実行し、その実行順序を取得することができる。また、プロセッサコアのいずれかがフラグをセットした場合(ステップ4101:Yes)、そのプロセッサコアよりも優先順位が高いプロセッサコアがタスクを実行可能である可能性があるため、ステップ8101の処理に戻している。
 図9を用いて、実施例1の変形例1を説明する。図9は図6と異なり、全てのコアを1回ずつ最早に設定したコア数本の実行順序を用いて、基準タスクと同時実行可能なタスクを取得する。図6との相違点は、ステップ9102がステップ6102と異なり、ステップ9102がステップ6103と異なる点である。
 図9に示したフローチャートの動作においては、第一の条件は、複数のプロセッサコア(仮想CPUコア0、仮想CPUコア1、仮想CPUコア2)の一つのプロセッサコアに対し、その他のプロセッサコアより優先して実行する最早条件であり、第二の条件は、上記一つのプロセッサコア以外のプロセッサコアを一度ずつ最早条件とする条件である。
 違反検査システム3101は、あるコアを最早(選択したコアで実行されるタスクが、その他のコアで実行されるタスクに対して、可能な限り先行する)で実行するという条件を、全てのコアに適応した、コア数本の実行条件を設定する(ステップ9102)。
 違反検査システム3101は、ループ9103で、ステップ9102で設定した全てのポリシーで、実行順序から情報を取得する。本実施例1の変形例1では、ループ回数はコア数と同じである。
 図10を用いて、実施例1の変形例2を説明する。図10の例は図6の例と異なり、全てのコアを1回ずつ最遅に設定したコア数本の実行順序を用いて、基準タスクと同時実行可能なタスクを取得する。図6との相違点は、ステップ10102がステップ6102と異なり、ステップ10102がステップ6103と異なる点である。
 違反検査システム3101は、あるコアを最遅(選択したコアで実行されるタスクに対し、その他のコアで実行されるタスクが、可能な限り先行する)で実行するという条件を、全てのコアに適応した、コア数本の実行条件を設定する(ステップ10102)。
 違反検査システム3101は、ループ10103で、ステップ10102で設定した全てのポリシーで、実行順序から情報を取得する。本実施例1の変形例2では、ループ回数はコア数と同じである。
 図11を用いて、実施例1の変形例3を説明する。図11は図6と異なり、基準タスクが属するコアが最早、最遅に設定した2本の実行順序を用いて、基準タスクと同時実行可能なタスクを取得する。図6との相違点は、ステップ11102がステップ6102と異なる点である。
 図11に示したフローチャートにおいては、第一の条件は、複数のプロセッサコア(仮想CPUコア0、仮想CPUコア1、仮想CPUコア2)の一つのプロセッサコアに対し、その他のプロセッサコアより優先して実行する最早条件であり、第二の条件は、複数のプロセッサコア(仮想CPUコア0、仮想CPUコア1、仮想CPUコア2)の一つのプロセッサコアに対し、その他のプロセッサコアを優先して実行する最遅条件である。
 違反検査システム3101は、基準タスクが属するコアを最早にする条件と、最遅にして実行するという条件の、2本の実行条件を設定する(ステップ10102)。
 図12は、図7のステップ7103のタスク実行処理の一例を説明するための図である。図12におけるタスク実行処理は、優先条件を、対象プロセッサコアを他の全てのプロセッサコアよりも優先度を低くする最遅条件下で実行順序を取得する最遅スケジューラである。
 最遅条件は、対象プロセッサコアによるタスクの実行をできるだけ後に行うことを意味する。最遅条件は、より具体的には、他のプロセッサコアがタスクを実行可能な場合、他のプロセッサコアにタスクを実行させ、他のプロセッサコアがタスクを実行可能でない場合、対象プロセッサコアにタスクを実行させる条件である。タスクを実行可能なプロセッサコアは、割り当てられたタスクに未だ実行していないタスクがあり、かつ、次に実行するタスクがセット待ちでないプロセッサコアである。
 ステップS201において、タスク実行処理(最遅スケジューリング)では、先ず、違反検査システム3101は、タスクを実行可能な他のプロセッサコアが存在するか否かを判断する。このとき、違反検査システム3101は、対象プロセッサコアがタスクを実行可能でなくなるまで、タスクを実行させる。
 なお、他のプロセッサコアは、選択中の対象プロセッサコア以外のプロセッサコアである。
 ステップS202において、タスクを実行可能な他のプロセッサコアが存在する場合、違反検査システム3101は、そのタスクを実行可能な他のプロセッサコアに対してタスクの実行を指示して、タスクを実行させ、ステップS201の処理に戻る。
 ステップS203において、タスクを実行可能な他のプロセッサコアが存在しない場合、違反検査システム3101は、選択中の対象プロセッサコアに対してタスクの実行を指示して、タスクを実行させる。このとき、違反検査システム3101は、対象プロセッサコアがフラグをセットするか、セット待ちになるか、又は、全てのタスクを終了するまで、対象プロセッサコアにタスクを実行させる。
 ステップS204において、違反検査システム3101は、全てのプロセッサコアの全てのタスクが終了したか否かを判断する。違反検査システム3101は、全てのタスクが終了していない場合、ステップS201の処理に戻り、全てのタスクが終了した場合、処理を終了する。
 図13は、図7のステップ7102のタスク実行処理の他の例を説明するための図である。図13におけるタスク実行処理は、優先条件を、対象プロセッサコアを他の全てのプロセッサコアよりも優先度を高くする最早条件下で実行順序を取得する最早スケジューラである。
 最早条件は、対象プロセッサコアによるタスクの実行をできるだけ早く行うことを意味する。最早条件は、より具体的には、対象プロセッサコアがタスクを実行可能な場合、対象プロセッサコアにタスクを実行させ、対象プロセッサコアがタスクを実行可能でない場合、他のプロセッサコアにタスクを実行させる条件である。
 タスク実行処理(最早スケジューリング)では、先ず、違反検査システム3101は、選択中の対象プロセッサコアがタスクを実行可能であるか否かを判断する(ステップS301)。
 対象プロセッサコアがタスクを実行可能である場合、違反検査システム3101は、対象プロセッサコアに対してタスクの実行を指示して、タスクを実行させ(ステップS302)、ステップS301の処理に戻る。このとき、違反検査システム3101は、対象プロセッサコアがタスクを実行可能でなくなるまで、タスクを実行させる。
 対象プロセッサコアがタスクを実行可能でない場合、違反検査システム3101は、対象プロセッサコアのセット待ちのフラグをセットするプロセッサコアを検索する(ステップS303)。
 違反検査システム3101は、検索されたプロセッサコアがセット待ちか否かを判断する(ステップS304)。
 検索されたプロセッサコアがセット待ちの場合、違反検査システム3101は、検索されたプロセッサコアのセット待ちのフラグをセットするプロセッサコアを検索し(ステップS305)、ステップS304の処理に戻る。
 なお、ステップS304では、最後に選択されたプロセッサコアがセット待ちか否かが判断される。
 検索されたプロセッサコアがセット待ちでない場合、違反検査システム3101は、検索されたプロセッサコアに対してタスクの実行を指示して、タスクを1つ実行させる(ステップS306)。
 違反検査システム3101は、全てのプロセッサコアの全てのタスクが終了したか否かを判断する(ステップS307)。違反検査システム3101は、全てのタスクが終了していない場合、ステップS301の処理に戻り、全てのタスクが終了した場合、処理を終了する。
 なお、上記の動作において、ステップS302によって対象プロセッサコアが割り当てられたタスクを終了した場合、ステップS303では、違反検査システム3101は、対象プロセッサコアのセット待ちのフラグをセットするプロセッサコアを検索する代わりに、他のプロセッサコアのうち実行可能なプロセッサコアを検索する。
 本実施例1では、複数の条件を適用して得られた実行順序を比較することにより、同時実行可能なタスクが得られる。具体的には、複数の実行順序間で順序関係が、少なくとも1つの実行順序の組み合わせで入れ替わっている2つのタスク対として現れる。
 この原理に基づき取得した同時実行可能なタスクの全ての組み合わせで、任意の変数に対して、Read-Write、Write-Writeなるアクセスがないことを確認することで、その変数に対しては、プログラム全体を通して、競合が発生しえないことが示せる。すなわち、いかなる場合においてもデータ競合が発生しないことが示せる。
 以下では、変形例2について前記の原理と、前記のフローの動作を解説する。
 図14Aは、タスクA~Hで構成されたある並列化プログラムのグラフモデルである。グラフモデルにおいてタスクはノードとして表現され、タスク間の依存関係はエッジとして表現される。エッジの始点に結合するタスクαとエッジの終点に結合するタスクβとの間には、必ずタスクαの実行終了をまってタスクβを実行しなければならない、という関係が成立する。
 図14Aでは、タスクA、B、G、Hがcore0で実行され、タスクC、Eがcore1で実行され、タスクD、Fがcore2で実行される。
 並列プログラムで特に重要となるものは、コア間の依存関係である。タスクAからタスクC、Dに、タスクCからタスクFに、タスクEからタスクGに、タスクFからHにというコア間依存関係がある。
 したがって、これらのタスクには順序制約あり、一方が必ず先、もう一方が必ず後に実行される。
 一方、依存関係がないタスクは、同時実行可能なタスクである。それらのタスクには順序制約がなく、逆転した順序や同時に実行される。例えば、タスクEとFは互いに依存関係がなく、同時実行可能である。
 図14Bは、各コアを最遅とした実行順序を示す図である。
 図14Bにおいて、タスクEとFに注目し、core1が最遅の場合と、core2が最遅の実行順序を比較する。core1が最遅の場合では、タスクFからE、core2が最遅の場合では、タスクEからFなる順序で実行されており、2つは同時実行可能なタスクであることが分かる。
 最遅を課した最遅スケジューリングにおいて、最遅に指定したcoreに含まれるタスクに対して、その他のcoreに含まれるタスクが可能な限り先行して実行されるという制約がある。core1が最遅の場合では、タスクE(core1)よりタスクF(core2)が先に動作するように制御される。core2が最遅の場合では、タスクF(core2)よりタスクE(core1)が先に動作するように制御される。
 ここで重要なのは、最遅を課した最遅スケジューリングにおける制約より、プログラムの依存関係の方が強い制約であるという点にある。したがって、最遅スケジューリングは、プログラムの依存関係を無視した実行制御をしないということである。
 これにより、必ず同時実行可能なタスクのみが、複数の実行順序で、その順序が入れ替わることが保証できる。
 図15は、先行タスクグループと後続タスクグループの例を示す図である。図15では、タスクFを基準とし、それより先に実行されたタスクを先行タスクグループに、タスクFより後に実行されたタスクを後続タスクグループに追加する。
 図16は、図15に示した先行タスクグループと後続タスクグループから、いかなる場合も基準タスクFよりも先に実行される常に先行するタスクA、D、Cと、同時実行可能なタスクB、E、Gと、いかなる場合も基準タスクFよりも後に実行される常に後続するタスクHに分類する様子を示した図である。
 常に先行するタスクA、D、Cは、先行タスクグループにおける後続タスクグループの補集合となる。同時実行可能なタスクB、E、Gは、先行タスクグループと後続タスクグループの積集合となる。常に後続するタスクHは、後続タスクグループにおける先行タスクグループの補集合である。
 図17は、タスクFに対して定まる常に先行するタスクA、C、Dと、同時実行可能なタスクB、E、Gと、常に後続するタスクHを示す図である。
 本実施例1では、すべての共有変数にWriteしているタスクに対して、同時実行可能なタスクのみを抽出し、その中で共有変数へのRead-Write競合、Write-Write競合がないかをチェックすることで、共有変数の競合(データ競合、不可分操作違反)を検出でき、それらがないことが示せれば、共有変数へのアクセスの順序が一意に定まることが示せる。
 したがって、実施例1の変形例2によれば、基準タスクに対して定まる同時実行可能なタスクをもれなく抽出することができる。変形例1と変形例3も変形例2と同様である。
 一方、正順・降順は同時実行可能なタスクを見逃してしまうケースがある。図18は、図14Aに示した例を、正順(第一優先:core2、第二優先:core0、第三優先:core1)、逆順(第一優先:core1、第二優先:core0、第三優先:core2)でスケジュールした実行順序を示す図である。図18において、Fを基準タスク(同時実行可能なタスクはタスクB、E、G)としたとき、タスクE、Gは基準タスクFに対して、正順と逆順で順序が入れ替わっているが、タスクBは基準タスクFに対して順序が入れ替わっておらず、同時実行可能なタスクを全て取得できないことが分かる。
 このような現象が発生するケースとして、当該コア(基準タスクFがあるCPUコア)より優先度が低く設定されているコアに、基準タスクと同時実行可能なコアが存在し、当該コアにおいて基準タスク以前のタスクに対し、同期フラグを送信するタスクを含むコア(遮断するコア(遮断コア))の優先度が、同時実行可能なタスクを含むコアのより低い場合などが考えられる。
 本来であれば、基準タスクは、同時実行可能なタスクに対し、先行して実行されなければならないところを、遮断コアが基準タスクにある基準コアの実行を妨げることによって、同時実行可能なタスクの方が先に実行される。
 遮断コアが同期フラグを発行していないため、当該コアは実行待ちとなり、当該コアより優先度が低いタスクを実行する。基準タスクと同時実行可能なタスクが属するコアが、遮断コアより優先度が高い場合、遮断コアが同期フラグを発行する前に、同時実行可能なタスクが実行されてしまう。
 変形例1あるいは変形例2では、基準タスクを含むコアが最早あるいは最遅の順序では、基準タスクと同時実行可能なタスクは必ず、基準タスクより必ず後あるいは先に実行されることが保証される。
 基準タスクを含むコア以外が最早あるいは最遅のとき、その最早あるいは最遅に設定されたコアに含まれる同時実行可能なタスクは基準タスクに対し、必ず先あるいは後に実行される。基準タスクを含むコア以外のコアを全て一度ずつ最早あるいは最遅に設定して、実行した場合、基準タスクに対し、同時実行可能なタスクはいずれかの順序で必ず先あるいは後に実行される。
 したがって、各コアを一度ずつ最遅に設定した実行順序から、先行タスクグループと後続タスクグループを取得した時、同時実行可能なタスクは両者に含まれる。すなわち、両者の集合和には、全ての基準タスクに対して定まる同時実行可能なタスクが必ず含まれる。
 変形例3も、同様に基準タスクに対して定まる同時実行可能なタスクをもれなく抽出できる。基準タスクを含むコア以外が最早あるいは最遅のとき、その最早あるいは最遅に設定されたコアに含まれる同時実行可能なタスクは基準タスクに対し、必ず先あるいは後に実行される。したがって、基準タスクを最早、最遅に設定した実行順序から、先行タスクグループと後続タスクグループを取得した場合でも、同時実行可能なタスクは両者に含まる。
 さらに、実行順序を各条件で一回だけ実行し、その結果をメモリ1100のタスクグループ情報1108に記録しておくことで、計算量を減らすことが可能である。図7においてスケジューラは、指定された条件と一致する実行順序が生成済みの場合、それを参照するように変更することで実施できる。この場合、変形例1、2における実行順を序生成する回数はコア数、変形例3では、コア数×2回となる。
 本開示の実施例1によれば、全ての同時実行可能なタスクを抽出することができるので、それらのタスク間で所定の条件により判定して、並列化プログラムの違反の有無を検知することができ、並列化プログラムの動作の検査に掛かる負荷を軽減することが可能な演算装置及び検査方法を提供することができる。
 本開示においては、制御部であるCPU1200は、複数のタスクT1~T10で共有される資源へのアクセスに関するアクセス情報を取得し、少なくとも、複数のタスクT1~T10に対して第一の条件を適用したときの複数のタスクT1~T10の第一の処理順序と、複数のタスクT1~T10に対して第一の条件とは異なる第二の条件を適用したときの複数のタスクT1~T10の第二の処理順序とを求める。
 そして、第一の処理順序および第二の処理順序において、複数のタスクT1~T10で共有される資源へアクセスする第一のタスクより前に行われるタスクからなる先行タスクグループと、第一のタスクより後に行われるタスクからなる後続タスクグループとを比較する。比較結果に基づいて特定されたタスクに対して、上記アクセス情報を用いて、並列化プログラムにおける所定の違反の有無を検知する。
 (実施例2)
 以下では、本開示の実施例2について図19から図25を使用して、説明する。
 実施例2では、ある変数に対する実行順序が規定を満たすかを、必ず順序が決まるタスクを参照して検査する。
 実施例2では、先行タスクグループと後続タスクグループのそれぞれに存在してはいけない、共有資源へのアクセス処理が存在する違反であり、先行タスクグループと後続タスクグループに、そのような共有資源へのアクセス処理が一つでも存在する場合に違反とする。
 より具体的に言えば、ある変数へのWrite処理を含むタスクに対して定まる、必ず順序が決まるタスク(先か後に実行)から、ある変数に対する処理の実行順序を得ることが可能であり、その順序が規定を満たすかを判定する。上記判定を、ある変数へのすべてのWrite処理に対して実施する。
 図19は本開示の実施例2における違反検査システム19101の概略構成図である。
  図19に示す違反検査システム19101は、実行順序違反を検査する検査システムである。図19に示した違反検査システム19101は、図3に示した違反検査システム3101とおおよそ同じ構成である。図3に示した構成と異なる部分は、アクセス順序解析処理19103と、先行/後続タスク取得処理19104である。
 アクセス順序解析処理19103は、ある変数におけるある処理に対して、他の同一変数への処理に対して、所定の順序制約が満たされることを確認し、その結果を違反判定処理19102に返す。ある変数は、違反判定処理19102から受け取った、タスク(基準タスク)内で、Write処理をしている変数すべてである。
 先行/後続タスク取得処理19104は、アクセス順序解析処理19103から受け取った、基準タスクより、先行タスクグループと後続タスクグループを取得し、アクセス順序解析処理19102に返す。
 図20は、図19の違反判定処理19102の内容の一例を示すフローチャートである。図20に示したフローチャートは、図4に示したフローチャートのステップ4102の内容が、ステップ20102の内容となり、その他のステップの内容は図4に示したフローチャートと同様である。ステップ20102において、違反検査システム19101は、あるタスク(基準タスク)に対する、実行順序を検査するサブフローである。詳細は図21で説明する。
 図21は、変数のアクセス順序の解析処理を行い、正当性を判定するためのフローチャートである。なお、図19のアクセス順序解析処理19103の動作に相当する。
 違反検査システム19101においては、図20に示したフローチャートの処理により受け取った、基準タスクに対して、常に先行するタスクと常に後続するタスクを取得する(ステップ21101)。
 違反検査システム19101においては、アクセス順序違反(所定の順序制約を破る)の有無を判断する処理を行う。当該タスクでWriteする共有変数と同一変数のその他の処理について、先にあるべき処理が、後続タスクグループに無いか、後にあるべき処理が、後続タスクグループに無いか、かつ、プログラム上に存在するかを判定する(ステップ21102)。
 つまり、基準タスクでWriteしている共有変数すべてに対し、以下の2点を確認する(ステップ21102)。
 当該処理より先に実行されるべき処理が、いずれかのタスクに存在し、かつ後続タスクグループに存在しないこと(条件C221)を確認する。
 当該処理より後に実行されるべき処理が、いずれかのタスクに存在し、かつ先行タスクグループに存在しないこと(条件C222)を確認する。
 上記条件C221及びC222が破られた場合、ステップ21103を実行する。それ以外の場合、処理を終了し、図20のフローに戻る。
 条件C221が成立するならば、常に先行するタスクのみに、当該処理より先に実行されるべき処理が存在する。したがって、プログラム実行時に、それらの処理は当該処理より常に先に実行されることが保証される。
 条件C222が成立するならば、常に後続するタスクのみに、当該処理より後に実行されるべき処理が存在する。したがって、プログラム実行時に、それらの処理は当該処理より常に後に実行されることが保証される。
 上記条件が、ある変数のWrite処理に対して成立すれば、プログラムは、ある変数における実行順序の規定を満たす。さらに、全ての変数に対し、上記条件が成立するなら、いかなる場合でも、プログラムは全ての変数に対する実行順序の規定を満たす。
 ステップ21103において、違反判定プログラムは、アクセス順序違反があった場合に実行されるフローであり、違反ありを図20のフローに返す。
 図22は、図19に示した先行/後続タスク取得処理19104の内容の一例を示すフローチャートである。図22に示したフローチャートは、正順・逆順の二通りの実行順序から、図21に示したフローチャートの処理により受け取った、基準タスクに対して定まる先行タスクグループ、後続タスクグループを取得する処理である。
 図22のステップ22101から20104は、図6のステップ6101からステップ6104と同じである。
 図22のステップ22105において、違反検査システム19101は、先行タスクグループ、後続タスクグループを図21のフローに返す。
 図23を用いて、実施例2の変形例1を説明する。図23に示すフローチャートは、図22に示したフローチャートと異なり、全てのコアを1回ずつ最早に設定したコア数本の実行順序を用いて、図21のフローチャートの処理より受け取った、基準タスクに対して定まる先行タスクグループ、後続タスクグループを取得する。
 ステップ23101から23104は、図9のステップ9101から9104と同じである。ステップ23105は、図22の22105と同じである。
 図24を用いて、実施例2の変形例2を説明する。図24に示したフローチャートは、図22に示したフローチャートと異なり、全てのコアを1回ずつ最遅に設定したコア数本の実行順序を用いて、図21のフローチャートの処理により受け取った、基準タスクに対して定まる先行タスクグループ、後続タスクグループを取得する。
 図24のステップ24101から24104は、図10のステップ10101から10104と同じである。
 ステップ24105は、図22のステップ22105と同じである。
 図25に示したフローチャートを用いて、実施例2の変形例3を説明する。図25に示したフローチャートは、図22に示したフローチャートと異なり、基準タスクが属するコアが最早、最遅に設定した2本の実行順序を用いて、図21のフローチャートの処理により受け取った、基準タスクに対して定まる先行タスクグループ、後続タスクグループを取得する。
 ステップ25101から25104は、図11のステップ11101から11104と同じである。ステップ25105は、図22のステップ22105と同じである。
 本開示の実施例2によれば、ある変数に対する実行順序が規定を満たすかを、必ず順序が決まるタスクを参照して検査するように構成したので、並列化プログラムの違反の有無を検知することができ、並列化プログラムの動作の検査に掛かる負荷を軽減することが可能な演算装置及び検査方法を提供することができる。
 1000・・・テスト装置、1100・・・メモリ、1101・・・エミュレータ、1102・・・違反プログラム、1103・・・core0用プログラム、1104・・・core1用プログラム、1105・・・core2用プログラム、1106・・・違反情報、1107・・・変数アクセス情報、1108・・・タスクグループ情報、1109・・・実行順序情報、1110・・・選択コア情報、1111・・・同期フラグ、1200・・・CPU(制御部)、3101、19101・・・違反検出システム、T1~T10・・・タスク

Claims (14)

  1.  複数のプロセッサコアのそれぞれで実行される複数のタスクからなるプログラムを並列化した並列化プログラムの動作を検査する演算装置であって、
     前記複数のタスクで共有される資源と、前記並列化プログラムを記憶するメモリと、
     前記並列化プログラムに基づいて動作する制御部と、
     を備え、
     前記制御部は、前記複数のタスクで共有される前記資源へのアクセスに関するアクセス情報を取得し、少なくとも、前記複数のタスクに対して第一の条件を適用したときの前記複数のタスクの第一の処理順序と、前記複数のタスクに対して前記第一の条件とは異なる第二の条件を適用したときの前記複数のタスクの第二の処理順序と、を求め、前記第一の処理順序および前記第二の処理順序において、前記複数のタスクで共有される前記資源へアクセスする第一のタスクより前に行われるタスクからなる先行タスクグループと、前記第一のタスクより後に行われるタスクからなる後続タスクグループと、を比較し、比較結果に基づいて特定されたタスクに対して、前記アクセス情報を用いて、前記並列化プログラムにおける所定の違反の有無を検知することを特徴とする演算装置。
  2.  請求項1に記載の演算装置において、
     前記第一の条件は、前記複数のプロセッサコアのそれぞれに任意の実行優先順序を割り当てる条件であり、前記第二の条件は前記複数のプロセッサコアのそれぞれに前記第一の条件と逆の優先順序を割り当てる条件であることを特徴とする演算装置。
  3.  請求項1に記載の演算装置において、
     前記第一の条件は、前記複数のプロセッサコアの一つのプロセッサコアに対し、その他のプロセッサコアより優先して実行する最早条件であり、前記第二の条件は前記一つのプロセッサコア以外のプロセッサコアを一度ずつ前記最早条件とすることを特徴とする演算装置。
  4.  請求項1に記載の演算装置において、
     前記第一の条件は、前記複数のプロセッサコアの一つのプロセッサコアに対し、その他のプロセッサコアを優先して実行する最遅条件であり、前記第二の条件は前記一つのプロセッサコア以外のプロセッサコアを一度ずつ前記最遅条件とすることを特徴とする演算装置。
  5.  請求項1に記載の演算装置において、
     前記第一の条件は、前記複数のプロセッサコアの一つのプロセッサコアに対し、その他のプロセッサコアより優先して実行する最早条件であり、前記第二の条件は、前記複数のプロセッサコアの前記一つのプロセッサコアに対し、その他のプロセッサコアを優先して実行する最遅条件であることを特徴とする演算装置。
  6.  請求項1に記載の演算装置において、
     前記所定の違反は、前記先行タスクグループと前記後続タスクグループの集合和で得られたタスクでアクセスしている前記共有される資源のうち、同一の資源に対するリード動作またはライト動作の競合が少なくとも1つ存在する場合に、違反とすることを特徴とする演算装置。
  7.  請求項1に記載の演算装置において、
     前記所定の違反は、前記先行タスクグループと前記後続タスクグループのそれぞれに存在してはいけない、前記共有される資源へのアクセス処理が存在する違反であり、前記先行タスクグループと前記後続タスクグループに、前記共有される資源への前記アクセス処理が一つでも存在する場合に、違反とすることを特徴とする演算装置。
  8.  複数のプロセッサコアのそれぞれで実行される複数のタスクからなるプログラムを並列化した並列化プログラムの動作を検査する検査方法であって、
     前記複数のタスクで共有される前記資源へのアクセスに関するアクセス情報を取得し、少なくとも、前記複数のタスクに対して第一の条件を適用したときの前記複数のタスクの第一の処理順序と、前記複数のタスクに対して前記第一の条件とは異なる第二の条件を適用したときの前記複数のタスクの第二の処理順序と、を求め、前記第一の処理順序および前記第二の処理順序において、前記複数のタスクで共有される資源へアクセスする第一のタスクより前に行われるタスクからなる先行タスクグループと、前記第一のタスクより後に行われるタスクからなる後続タスクグループと、を比較し、比較結果に基づいて特定されたタスクに対して、前記アクセス情報を用いて、前記並列化プログラムにおける所定の違反の有無を検知することを特徴とする検査方法。
  9.  請求項8に記載の検査方法において、
     前記第一の条件は、前記複数のプロセッサコアのそれぞれに任意の実行優先順序を割り当てる条件であり、前記第二の条件は前記複数のプロセッサコアのそれぞれに前記第一の条件と逆の優先順序を割り当てる条件であることを特徴とする検査方法。
  10.  請求項8に記載の検査方法において、
     前記第一の条件は、前記複数のプロセッサコアの一つのプロセッサコアに対し、その他のプロセッサコアより優先して実行する最早条件であり、前記第二の条件は前記一つのプロセッサコア以外のプロセッサコアを一度ずつ前記最早条件とすることを特徴とする検査方法。
  11.  請求項8に記載の検査方法において、
     前記第一の条件は、前記複数のプロセッサコアの一つのプロセッサコアに対し、その他のプロセッサコアを優先して実行する最遅条件であり、前記第二の条件は前記一つのプロセッサコア以外のプロセッサコアを一度ずつ前記最遅条件とすることを特徴とする検査方法。
  12.  請求項8に記載の検査方法において、
     前記第一の条件は、前記複数のプロセッサコアの一つのプロセッサコアに対し、その他のプロセッサコアより優先して実行する最早条件であり、前記第二の条件は、前記複数のプロセッサコアの前記一つのプロセッサコアに対し、その他のプロセッサコアを優先して実行する最遅条件であることを特徴とする検査方法。
  13.  請求項8に記載の検査方法において、
     前記所定の違反は、前記先行タスクグループと前記後続タスクグループの集合和で得られたタスクでアクセスしている前記共有される資源のうち、同一の資源に対するリード動作またはライト動作の競合が少なくとも1つ存在する場合に、違反とすることを特徴とする検査方法。
  14.  請求項8に記載の検査方法において、
     前記所定の違反は、前記先行タスクグループと前記後続タスクグループのそれぞれに存在してはいけない、前記共有される資源へのアクセス処理が存在する違反であり、前記先行タスクグループと前記後続タスクグループに、前記共有される資源への前記アクセス処理が一つでも存在する場合に、違反とすることを特徴とする検査方法。
PCT/JP2021/034804 2020-10-28 2021-09-22 演算装置及び検査方法 WO2022091651A1 (ja)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2022558922A JP7454700B2 (ja) 2020-10-28 2021-09-22 演算装置及び検査方法

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
JP2020180649 2020-10-28
JP2020-180649 2020-10-28

Publications (1)

Publication Number Publication Date
WO2022091651A1 true WO2022091651A1 (ja) 2022-05-05

Family

ID=81382361

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/JP2021/034804 WO2022091651A1 (ja) 2020-10-28 2021-09-22 演算装置及び検査方法

Country Status (2)

Country Link
JP (1) JP7454700B2 (ja)
WO (1) WO2022091651A1 (ja)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2007011690A (ja) * 2005-06-30 2007-01-18 Fujitsu Ltd プログラムの検証プログラム、プログラムの検証装置、プログラムの検証方法
JP2013528853A (ja) * 2010-04-19 2013-07-11 インターナショナル・ビジネス・マシーンズ・コーポレーション マルチスレッド・コードをデバッグする方法、システム、及びコンピュータ・プログラム
JP2013254371A (ja) * 2012-06-07 2013-12-19 Toyota Motor Corp ソフトウェア開発支援装置、ソフトウェア開発支援方法及びソフトウェア開発支援プログラム
JP2016091138A (ja) * 2014-10-31 2016-05-23 日立オートモティブシステムズ株式会社 ソースコード検証システム
JP2017503233A (ja) * 2013-12-12 2017-01-26 インテル コーポレイション 競合状態を検出する技法

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2007011690A (ja) * 2005-06-30 2007-01-18 Fujitsu Ltd プログラムの検証プログラム、プログラムの検証装置、プログラムの検証方法
JP2013528853A (ja) * 2010-04-19 2013-07-11 インターナショナル・ビジネス・マシーンズ・コーポレーション マルチスレッド・コードをデバッグする方法、システム、及びコンピュータ・プログラム
JP2013254371A (ja) * 2012-06-07 2013-12-19 Toyota Motor Corp ソフトウェア開発支援装置、ソフトウェア開発支援方法及びソフトウェア開発支援プログラム
JP2017503233A (ja) * 2013-12-12 2017-01-26 インテル コーポレイション 競合状態を検出する技法
JP2016091138A (ja) * 2014-10-31 2016-05-23 日立オートモティブシステムズ株式会社 ソースコード検証システム

Also Published As

Publication number Publication date
JP7454700B2 (ja) 2024-03-22
JPWO2022091651A1 (ja) 2022-05-05

Similar Documents

Publication Publication Date Title
CN113535367B (zh) 任务调度方法及相关装置
Axer et al. Response-time analysis of parallel fork-join workloads with real-time constraints
US9417935B2 (en) Many-core process scheduling to maximize cache usage
US10943041B2 (en) Electronic system level parallel simulation method with detection of conflicts of access to a shared memory
TWI451340B (zh) 使用交易以平行化循序框架之方法及電腦可讀取媒體
Shousha et al. A uml/marte model analysis method for uncovering scenarios leading to starvation and deadlocks in concurrent systems
US20120311607A1 (en) Deterministic parallelization through atomic task computation
Dinh et al. Blocking analysis for spin locks in real-time parallel tasks
Stigge et al. Combinatorial abstraction refinement for feasibility analysis of static priorities
CN111897647A (zh) 一种多核系统中多线程调度方法、装置及设备
Zahaf et al. A C-DAG task model for scheduling complex real-time tasks on heterogeneous platforms: preemption matters
US20220164507A1 (en) Electronic system-level reproducible parallel simulation method implemented by way of a discrete event simulation multicore computing system
US20110167413A1 (en) Coverage apparatus and method for testing multi-thread environment
JP6427055B2 (ja) 並列化コンパイル方法、及び並列化コンパイラ
WO2022091651A1 (ja) 演算装置及び検査方法
US9135058B2 (en) Method for managing tasks in a microprocessor or in a microprocessor assembly
CN112751906B (zh) 针对分布式账本的粒度存储管理
Tran et al. Domain-specific language facilitates scheduling in model checking
CN110046809B (zh) 作业调度方法及装置
Shi et al. Partitioned scheduling for dependency graphs in multiprocessor real-time systems
Han et al. A temporal dependency aware approach for scheduling real-time tasks on multi-core platforms
Zhao et al. Index-based scheduling for parallel state machine replication
JP4997144B2 (ja) マルチタスク処理装置およびその方法
Li et al. Extending schedulability tests of tree-shaped transactions for TDMA radio protocols
JP2018151803A (ja) コンピュータプログラムの検査装置および車両制御用コンピュータプログラムの検査を行う車載装置

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: 21885770

Country of ref document: EP

Kind code of ref document: A1

ENP Entry into the national phase

Ref document number: 2022558922

Country of ref document: JP

Kind code of ref document: A

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 21885770

Country of ref document: EP

Kind code of ref document: A1