Distributed compilation method, device, equipment and readable storage medium
By generating concurrent subtask sequences and using task scheduling server distribution, the problem of low efficiency of the traditional distributed compilation mechanism in multi-CPU architecture and frequent iteration environments is solved, an efficient compilation process is achieved, and the release efficiency of large software platforms is improved. .
Patent Information
- Application Number
- CN202111233730.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-10-22
- Publication Date
- 2024-09-20
- Estimated Expiration
- 2041-10-22
AI Technical Summary
In the environment of multi-CPU architecture and frequent software iteration, the traditional distributed compilation mechanism has low compilation efficiency and cannot effectively handle the dependencies between modules, resulting in reduced task parallelism and long compilation time.
By generating concurrent sub-task sequences and using the task scheduling server to distribute sub-tasks, real-time scheduling is avoided and parallelism and compilation efficiency are improved.
It improves the parallelism and compilation efficiency of distributed compilation tasks, reduces compilation time, and improves the release efficiency of middleware for large software platforms.
Smart Images

Figure CN113986239B
Abstract
Description
Technical Field
[0001] The present invention relates to the field of data processing technology, and in particular to a distributed compilation method, device, equipment and readable storage medium. Background Art
[0002] At present, as the functions of large-scale software platform middleware increase, the amount of code reaches millions or even tens of millions. If it is necessary to support multiple CPU architectures, the compilation time of the source code will increase exponentially with the number of CPU architectures. When large-scale software platform middleware needs to be released in binary form, the huge amount of code and the compilation problems caused by multiple CPU architectures will make the overall release take several hours or even longer to complete, which seriously restricts the release efficiency of large-scale software platform middleware.
[0003] Although a distributed compilation mechanism is currently used to improve the release efficiency of middleware for large software platforms, the traditional distributed compilation mechanism requires synchronous compilation files and configurations among multiple virtual machine clusters, which results in reduced compilation efficiency. When there are a large number of compilation dependencies between the various software modules of the middleware for large software platforms, and software iterations and version updates are relatively frequent, the traditional distributed compilation system cannot flexibly analyze and process such dependencies between modules, which will lead to a decrease in the overall task parallelism of the distributed compilation. When choosing to schedule and process these dependencies in real time during the distributed compilation process, additional overhead will be added, resulting in low compilation efficiency for the overall task. Summary of the invention
[0004] The present application provides a distributed compilation method, apparatus, device and readable storage medium to solve the problem that the compilation efficiency of traditional distributed compilation is too low.
[0005] To achieve the above object, an embodiment of the present invention provides a distributed compilation method, which includes the following steps:
[0006] Execute the compilation instruction, and generate a concurrent subtask sequence according to the compilation instruction and the source code package in the preset shared directory;
[0007] Run the task scheduling server in the preset shared directory according to the subtask sequence, so that the task scheduling client in each container compiles the subtasks distributed by the task scheduling server from the subtask sequence;
[0008] After determining that each of the task scheduling clients executes and compiles the subtasks, the task status is updated to complete the packaging work.
[0009] To achieve the above object, an embodiment of the present invention further provides a distributed compilation device, the distributed compilation device comprising:
[0010] An execution module, used for executing compilation instructions and generating a concurrent subtask sequence according to the compilation instructions and the source code package in the preset shared directory;
[0011] Running and distributing, for running the task scheduling server in the preset shared directory according to the subtask sequence, so that the task scheduling client in each container compiles the subtasks distributed by the task scheduling server from the subtask sequence;
[0012] The determination and update module is used to determine that each of the task scheduling clients executes and compiles the subtasks, updates the task status, and completes the packaging work.
[0013] To achieve the above objectives, an embodiment of the present invention further proposes a computer device, which includes a processor, a memory, and a computer program stored in the memory and executable by the processor, wherein when the computer program is executed by the processor, the steps of the distributed compilation method as described above are implemented.
[0014] To achieve the above objectives, an embodiment of the present invention further proposes a computer-readable storage medium, characterized in that a computer program is stored on the computer-readable storage medium, wherein when the computer program is executed by a processor, the steps of the distributed compilation method as described above are implemented.
[0015] The present application discloses a distributed compilation method, device, equipment and readable storage medium, which generates a concurrent subtask sequence according to the compilation instruction and the source code package in the preset shared directory by executing the compilation instruction; runs the task scheduling server in the preset shared directory according to the subtask sequence, so that the task scheduling client in each container compiles the subtasks distributed by the task scheduling server from the subtask sequence; after determining that each of the task scheduling clients compiles the subtask, updates the task status and completes the packaging work. It can be seen that the task granularity is small when the overall compilation task is divided in parallel, and at the same time, there is no need for real-time scheduling in the distributed compilation process, so that the overall parallelism and scheduling of the distributed compilation task can be effectively improved, the compilation time is reduced, and the compilation efficiency is improved. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0017] Figure 1 A schematic diagram of a distributed compilation method provided in an embodiment of the present application;
[0018] Figure 2 A schematic diagram of a terminal scenario provided in an embodiment of the present application;
[0019] Figure 3 for Figure 1 A schematic diagram of the sub-step flow of the distributed compilation method in FIG.
[0020] Figure 4 A schematic diagram of the parsing and slicing process provided in an embodiment of the present application;
[0021] Figure 5 for Figure 1 A schematic diagram of the sub-step flow of the distributed compilation method in FIG.
[0022] Figure 6 A schematic block diagram of a distributed compilation device provided in an embodiment of the present application;
[0023] Figure 7 The present invention is a block diagram showing the structure of a computer device according to an embodiment of the present application.
[0024] The realization of the purpose, functional features and advantages of the present invention will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION
[0025] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0026] The flowcharts shown in the accompanying drawings are only examples and do not necessarily include all the contents and operations / steps, nor must they be executed in the order described. For example, some operations / steps may also be decomposed, combined or partially merged, so the actual execution order may change according to actual conditions.
[0027] The embodiments of the present application provide a distributed compilation method, apparatus, computer device and computer-readable storage medium. The distributed compilation method can be applied to a computer device, which can be an electronic device such as a notebook or a desktop computer.
[0028] In conjunction with the accompanying drawings, some embodiments of the present application are described in detail below. In the absence of conflict, the following embodiments and features in the embodiments can be combined with each other.
[0029] See also Figure 1 , Figure 1It is a schematic flow chart of a distributed compilation method provided by an embodiment of the present application.
[0030] like Figure 1 As shown, this embodiment provides a distributed compilation method, which includes the following steps:
[0031] Step S101: executing a compile instruction, and generating a concurrent subtask sequence according to the compile instruction and a source code package in a preset shared directory.
[0032] Exemplarily, a compilation instruction input by a user is received to execute the compilation instruction. For example, a user login is detected, and the compilation instruction input by the user is received in real time. When the compilation instruction input by the user is received, the compilation instruction is executed. A high-concurrency subtask sequence is generated through the compilation instruction and the source code package in the preset shared directory, wherein the high-concurrency subtask sequence is a subtask sequence with a higher concurrency than the preset concurrency. For example, the source code package in the preset shared directory is compiled through the compilation instruction to generate a high-concurrency subtask sequence with a higher concurrency than the preset concurrency. Figure 2 As shown, multiple virtual machines are pre-set in the terminal, and multiple containers are run in each virtual machine. Through multiple virtual machines, multiple containers are run in each virtual machine to generate a container cluster. For example, N virtual machines are set, M containers are run in each virtual machine, and a container cluster consisting of N×M containers is generated, wherein the container is a Docker container. A shared directory is pre-set in the terminal, and all containers in the container cluster share the preset shared directory through the virtual machine container sharing technology. Among them, the virtual machine can be in the terminal, and the terminal can be one or more, and the number of terminals is not limited to this. For example, when there is one terminal, the terminal is used as a host, multiple virtual machines are set in the host, and a shared directory is set in the host. Or, when there are multiple terminals, one of the multiple terminals is determined as the host, multiple virtual machines are set in the host and / or other terminals, and a shared directory is set in the host. Among them, the source code package includes a pre-task management module. The advantage of this is that when the source code directory and makefile are changed and adjusted, the code of the pre-task management module also needs to be modified synchronously. When the pre-task management module is included in the source code package, there is no need to consider the separate management of the release of the pre-task management module. On the contrary, if the source code package does not contain the predecessor task management module, then when compiling, you need to read the information in the source code package to determine whether the predecessor task management module needs to be updated. If it needs to be updated, you need to download the predecessor task management module from other locations before starting the compilation.
[0033] In one embodiment, specifically, referring to Figure 3 , step S101 includes: sub-step S1011 to sub-step S1013.
[0034] Sub-step S1011, running the predecessor task management module through the compile instruction;
[0035] Exemplarily, the preset shared directory includes a source code package, which includes a pre-task management module, multiple function modules and a total compilation task. When an execution instruction is detected, the pre-task management module is run through the execution instruction.
[0036] Sub-step S1012: analyzing each of the functional modules according to the running predecessor task management module to obtain dependency relationships between the functional modules;
[0037] Exemplarily, the running pre-task management module analyzes each functional module to obtain the dependency relationship between each functional module. For example, the pre-task management module obtains the code logic relationship in each functional module, and obtains the dependency relationship between each functional module through the code logic relationship.
[0038] Specifically, the method of analyzing each of the functional modules according to the running predecessor task management module to obtain the dependency relationship between each of the functional modules includes: analyzing the link parameters of each of the functional modules through the running predecessor task management module to obtain a code compilation dependency graph; parsing the code compilation dependency graph to obtain the dependency relationship between each of the functional modules in the code compilation dependency graph.
[0039] Demonstratively, the link parameters of each functional module are analyzed by running the predecessor task management module to obtain the code compilation dependency graph. For example, each functional module includes a code directory, and the code directory is hierarchical. The predecessor task management module recursively scans the makefile of the code directory from the top of the code directory tree to the leaf node layer by layer, and determines the dependency relationship with other directory levels through the link options in the makefile, and finally generates a code compilation dependency graph managed by tree hierarchy. There are countless source files in a makefile project, which are placed in several directories according to type, function, and module. The makefile defines a series of rules to specify which files need to be compiled first, which files need to be compiled later, and which files need to be recompiled.
[0040] After obtaining the code compilation dependency graph of each functional module, obtain the dependency relationship of each function in the code compilation dependency graph. For example, Figure 4 As shown, the code directory of the functional module includes MOD1, MOD2, MOD3, and MOD4. By obtaining the code compilation dependency graph, it is obtained that MOD3 depends on MOD1, and MOD4 depends on MOD1.
[0041] Sub-step S1013: parsing and segmenting the overall compilation task according to the predecessor task management module and the dependency relationship to generate a concurrent sub-task sequence.
[0042] Exemplarily, the total compilation task is parsed and segmented by running the predecessor task management module and the dependency relationship, that is, the total compilation task is segmented into multiple subtask sequences with high concurrency. Figure 4 As shown, the total compilation task is parsed through the predecessor task management module and the dependency relationship, and the dependent link compilation task and the non-dependency link compilation task in the total compilation task are obtained. By slicing the dependent link compilation task, compilation tasks and link tasks are generated, that is, a high-concurrency sub-task sequence is generated, and the high-concurrency sub-task sequence includes the non-dependency link compilation task, the compilation task and the link task.
[0043] Specifically, the method of parsing and slicing the total compilation task according to the predecessor task management module and the dependency relationship to generate a subtask sequence with a high concurrency includes: parsing the total compilation task by running the predecessor task management module and the dependency relationship to obtain information on each compilation and linking task in the total compilation task, wherein the compilation and linking task information includes dependent compilation and linking tasks and independent compilation and linking tasks; obtaining compilation tasks and linking tasks by slicing and refining the dependent compilation and linking; and generating a subtask sequence with a high concurrency based on the independent compilation and linking tasks, the compilation task and the linking task.
[0044] Exemplarily, the overall compilation task is parsed by running the predecessor task management module and the dependency relationship to obtain the information of each compilation and linking task in the overall compilation task, wherein the parsing includes multiple rounds of parsing. For example, code compilation is divided into two sub-processes: one is compilation and the other is linking. The first round is a direct translation of the compilation command, such as Figure 4 As shown, there are code sub-directories MOD1, MOD2, MOD3, and MOD4; the user requires to compile two tool chains, x86 and ppc, and determines the compilation order of the directories under different tool chains. At this time, there is only one task, namely, compile and link x86 architecture MOD1 → compile and link x86 architecture MOD2 → compile and link x86 architecture MOD3 (depends on MOD1) → compile and link ppc architecture MOD1 → compile and link ppc architecture MOD2 → compile and link ppc architecture MOD4 (depends on MOD1).
[0045] The second round is decomposed according to the tool chain. At this time, there are two concurrent tasks, namely, compile and link x86 architecture MOD1→compile and link x86 architecture MOD2→compile and link x86 architecture MOD3 (depends on MOD1), and compile and link ppc architecture MOD1→compile and link ppc architecture MOD2→compile and link ppc architecture MOD4 (depends on MOD1).
[0046] The third round is to split by directory dependency. There are four concurrent tasks in task pool 1 that are not dependent on each other, namely, compile and link x86 architecture MOD1, compile and link x86 architecture MOD2, compile and link ppc architecture MOD1, and compile and link ppc architecture MOD2. The tasks with dependencies are placed in task pool 2. Task pool 2 depends on the tasks in task pool 1. There are two concurrent tasks in task pool 2, namely, compile and link x86 architecture MOD3 (depends on MOD1) and compile and link ppc architecture MOD4 (depends on MOD1). At this time, the high concurrency of task pool 1 and task pool 2 takes the maximum value of 4.
[0047] The fourth round is to separate the two sub-processes of compiling and linking in task pool 2, where the compiling task is placed in task pool 1, while there are only two linking tasks in task pool 2, namely linking x86 architecture MOD3 and linking ppc architecture MOD4. Overall, the maximum number of concurrent tasks is taken, that is, the number of tasks in task pool 1 is 6, namely compiling and linking x86 architecture MOD1, compiling and linking x86 architecture MOD2, compiling and linking ppc architecture MOD1, compiling and linking ppc architecture MOD2, compiling x86 architecture MOD3, and compiling ppc architecture MOD4. By generating a high-concurrency sub-task sequence from the sub-tasks in task pool 1 and task pool 2, the sub-task sequence includes compiling and linking x86 architecture MOD1, compiling and linking x86 architecture MOD2, compiling and linking ppc architecture MOD1, compiling and linking ppc architecture MOD2, compiling x86 architecture MOD3, and compiling ppc architecture MOD4 of task pool 1, and linking x86 architecture MOD3 and linking ppc architecture MOD4 of task pool 2.
[0048] Step S102: running the task scheduling server in the preset shared directory according to the subtask sequence, so that the task scheduling client in each container compiles the task scheduling server to distribute subtasks from the subtask sequence.
[0049] Exemplarily, when a subtask sequence is obtained, a task scheduling server in a preset shared directory is run through the subtask sequence, and the task scheduling server distributes the subtasks in the subtask sequence to task scheduling clients in each container, so that each task scheduling client compiles the subtask.
[0050] In one embodiment, specifically, referring to Figure 5, step S102 includes: sub-step S1021 to sub-step S1023.
[0051] Sub-step S1021, inputting the sub-task sequence into the task scheduling server to run the task scheduling server;
[0052] Exemplarily, the obtained subtask sequence is input into the task scheduling server to run the task scheduling server. After running the task scheduling server, the request information sent by each task scheduling client is received, the task scheduling client name, task scheduling client address, etc. carried in the request information are obtained, and the obtained task scheduling client, task scheduling client address, etc. are written into the preset assignable task table.
[0053] Sub-step S1022: reading a preset allocatable task table through the running task scheduling server, and obtaining a plurality of task scheduling clients in the preset allocatable task table;
[0054] Exemplarily, by running the task scheduling server, the task scheduling client reads the preset assignable task table and obtains multiple task scheduling clients recorded in the preset assignable task table, for example, obtains the name, address, etc. of each task scheduling client recorded in the preset assignable task table.
[0055] Sub-step S1023: Distribute the subtasks in the subtask sequence to each of the task scheduling clients, so that the task scheduling client in each container compiles the subtasks distributed by the task scheduling server from the subtask sequence.
[0056] Exemplarily, when multiple task scheduling clients in the preset assignable task table are obtained, the subtasks in the subtask sequence are distributed to each task scheduling client. When each task scheduling client receives the subtask distributed by the task scheduling server, it compiles each subtask. The compilation process is completed in the preset shared directory, that is, the sub-compiled file after the subtask is compiled is generated in the preset shared directory. After the task scheduling client completes compiling the subtask, it sends a request message to the task scheduling server to obtain a new subtask.
[0057] Specifically, before the running task scheduling server reads the preset assignable task table, it also includes: receiving request information sent by each task scheduling client, obtaining the task scheduling client information carried in the request information; and adding the task scheduling client information to the preset assignable task table.
[0058] Exemplarily, the request information sent by each task scheduling client is received, and the task scheduling client information carried in the request information is obtained; the task scheduling client information is added to the preset assignable task table. If the task scheduling client does not receive the subtask within the preset time after sending the request information to the task scheduling server, the request information is sent to the task scheduling server again. In the embodiment, when the terminal is started, the container in the terminal is also started with the terminal. When the container is started, the task scheduling client is run. The task scheduling client sends a task request message REQ to the task scheduling server, and then waits for the task scheduling server to reply with an ACK message; the task scheduling server receives the REQ message from the task scheduling client, schedules and distributes a task from the local subtask sequence and sends it to the task scheduling client for execution along with the ACK message; the task scheduling client receives the ACK message from the task scheduling server, executes the subtask instruction, and sends a REP message to the task scheduling server after completion, and then waits for the task scheduling server to reply with a CLOS message; the task scheduling server receives the REP message from the task scheduling client, updates the subtask status to completion, and then replies with a CLOS message to the task scheduling client; the task scheduling client receives the CLOS message from the task scheduling server, closes the current task after completion, and starts the next task request. The sending of the request information also includes obtaining the address information of the task scheduling server when the task scheduling server is running, and sending the request information to the task scheduling server through the address information.
[0059] Step S103: after determining that each of the task scheduling clients has executed the compilation of the subtasks, the task status is updated to complete the packaging work.
[0060] Exemplarily, after determining that the task scheduling client executes the compilation of the subtask, the task status is updated. After the task scheduling client executes the compilation of the subtask distributed by the task scheduling server, it sends a request message to the task scheduling server again to compile a new subtask. After completing all the subtasks distributed by the task scheduling server, the task scheduling server updates the task status, that is, stops running. Obtain the sub-compiled files of each subtask in the preset shared directory, package multiple sub-compiled files, generate a compiled file, and complete the packaging work.
[0061] In the embodiment of the present application, a high-concurrency subtask sequence is generated by executing the compilation instruction and the source code package in the preset shared directory, and the task scheduling server in the preset shared directory is run according to the subtask sequence, so that the task scheduling client in each container compiles the subtasks distributed by the task scheduling server from the subtask sequence; after determining that each task scheduling client executes the compilation of the subtask, the task status is updated to complete the packaging work. It can be seen that the task granularity is small when the overall compilation task is divided in parallel, and at the same time, there is no need for real-time scheduling in the distributed compilation process, so that the overall parallelism and scheduling of the distributed compilation task can be effectively improved, the compilation time is reduced, and the compilation efficiency is improved.
[0062] Please refer to Figure 6 , Figure 6 A schematic block diagram of a distributed compilation device provided in an embodiment of the present application.
[0063] like Figure 6 As shown, the distributed compilation device 300 includes: an execution module 301 , a running and distributing module 302 , and a determining and updating module 303 .
[0064] An execution module 301 is used to execute a compilation instruction and generate a concurrent subtask sequence according to the compilation instruction and the source code package in the preset shared directory;
[0065] Running and distributing 302, for running the task scheduling server in the preset shared directory according to the subtask sequence, so that the task scheduling client in each container compiles the task scheduling server to distribute subtasks from the subtask sequence;
[0066] The determination and update module 303 is used to determine that each of the task scheduling clients executes and compiles the subtasks, updates the task status, and completes the packaging work.
[0067] The execution module 301 is further used for:
[0068] Run the preceding task management module through the compilation instruction;
[0069] Analyze each of the functional modules according to the running predecessor task management module to obtain the dependency relationship between the functional modules;
[0070] The total compilation task is parsed and segmented according to the predecessor task management module and the dependency relationship to generate a concurrent subtask sequence.
[0071] The execution module 301 is further used for:
[0072] Analyzing the link parameters of each of the functional modules by running the preceding task management module to obtain a code compilation dependency graph;
[0073] The code compilation dependency graph is parsed to obtain dependency relationships among the functional modules in the code compilation dependency graph.
[0074] The execution module 301 is further used for:
[0075] The total compilation task is parsed by running the predecessor task management module and the dependency relationship to obtain information of each compilation and linking task in the total compilation task, wherein the compilation and linking task information includes dependent compilation and linking tasks and independent compilation and linking tasks;
[0076] By slicing and refining the dependent compilation and linking, a compilation task and a linking task are obtained;
[0077] A concurrent subtask sequence is generated based on the independent compile and link task, the compile task and the link task.
[0078] The operation and distribution 302 is also specifically used for:
[0079] Inputting the subtask sequence into a task scheduling server to run the task scheduling server;
[0080] The task scheduling server reads a preset allocatable task table through the running task scheduling server, and obtains a plurality of task scheduling clients in the preset allocatable task table;
[0081] The subtasks in the subtask sequence are distributed to each of the task scheduling clients, so that the task scheduling clients in each container compile the subtasks distributed from the subtask sequence by the task scheduling server.
[0082] The distributed compilation device is also specifically used for:
[0083] Receiving request information sent by each of the task scheduling clients, and obtaining the task scheduling client information carried in the request information;
[0084] The task scheduling client information is added to the preset allocatable task table.
[0085] The distributed compilation device is also specifically used for:
[0086] Pre-setting a plurality of virtual machines, and running a plurality of containers on each of the virtual machines to generate a container cluster, wherein each of the containers includes a task scheduling client;
[0087] A shared directory is pre-set so that each container in the container cluster shares the pre-set shared directory.
[0088] It should be noted that those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the above-described device and each module and unit can refer to the corresponding process in the aforementioned distributed compilation method embodiment, and will not be repeated here.
[0089] The apparatus provided in the above embodiment may be implemented in the form of a computer program. The computer program may be Figure 7 Runs on the computer device shown.
[0090] See also Figure 7 , Figure 7 A schematic block diagram of the structure of a computer device provided in an embodiment of the present application. The computer device may be a terminal.
[0091] like Figure 7 As shown, the computer device includes a processor, a memory, and a network interface connected via a system bus, wherein the memory may include a non-volatile storage medium and an internal memory.
[0092] The non-volatile storage medium can store an operating system and a computer program. The computer program includes program instructions, and when the program instructions are executed, the processor can execute any distributed compilation method.
[0093] The processor is used to provide computing and control capabilities and support the operation of the entire computer equipment.
[0094] The internal memory provides an environment for the operation of the computer program in the non-volatile storage medium. When the computer program is executed by the processor, the processor can execute any distributed compilation method.
[0095] The network interface is used for network communication, such as sending assigned tasks, etc. Those skilled in the art will appreciate that Figure 7 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0096] It should be understood that the processor may be a central processing unit (CPU), and the processor may also be other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. Among them, the general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc.
[0097] In one embodiment, the processor is used to run a computer program stored in the memory to implement the following steps:
[0098] Execute the compilation instruction, and generate a concurrent subtask sequence according to the compilation instruction and the source code package in the preset shared directory;
[0099] Run the task scheduling server in the preset shared directory according to the subtask sequence, so that the task scheduling client in each container compiles the task scheduling server to distribute subtasks from the subtask sequence;
[0100] After determining that each of the task scheduling clients executes and compiles the subtasks, the task status is updated to complete the packaging work.
[0101] In one embodiment, the processor source code package includes a pre-task management module, multiple function modules and a total compilation task; when the concurrent subtask sequence is generated according to the compilation command and the source code package, it is used to implement:
[0102] Run the preceding task management module through the compilation instruction;
[0103] Analyze each of the functional modules according to the running predecessor task management module to obtain the dependency relationship between the functional modules;
[0104] The total compilation task is parsed and segmented according to the predecessor task management module and the dependency relationship to generate a concurrent subtask sequence.
[0105] In one embodiment, the processor analyzes each of the functional modules according to the running predecessor task management module to obtain the dependency relationship between the functional modules, and is used to implement:
[0106] Analyzing the link parameters of each of the functional modules by running the preceding task management module to obtain a code compilation dependency graph;
[0107] The code compilation dependency graph is parsed to obtain dependency relationships among the functional modules in the code compilation dependency graph.
[0108] In one embodiment, the processor parses and segments the total compilation task according to the predecessor task management module and the dependency relationship to generate a concurrent subtask sequence for implementation, which is used to implement:
[0109] The total compilation task is parsed by running the predecessor task management module and the dependency relationship to obtain information of each compilation and linking task in the total compilation task, wherein the compilation and linking task information includes dependent compilation and linking tasks and independent compilation and linking tasks;
[0110] By slicing and refining the dependent compilation and linking, a compilation task and a linking task are obtained;
[0111] A concurrent subtask sequence is generated based on the independent compile and link task, the compile task and the link task.
[0112] In one embodiment, the processor enables the task scheduling client in each container to compile the task scheduling server to distribute the subtasks from the subtask sequence to implement:
[0113] Inputting the subtask sequence into a task scheduling server to run the task scheduling server;
[0114] The task scheduling server reads a preset allocatable task table through the running task scheduling server, and obtains a plurality of task scheduling clients in the preset allocatable task table;
[0115] The subtasks in the subtask sequence are distributed to each of the task scheduling clients, so that the task scheduling clients in each container compile the subtasks distributed from the subtask sequence by the task scheduling server.
[0116] In one embodiment, the processor is used to implement the following when the task scheduling server reads the preset allocable task table before running the task scheduling server:
[0117] Receiving request information sent by each of the task scheduling clients, and obtaining the task scheduling client information carried in the request information;
[0118] The task scheduling client information is added to the preset allocatable task table.
[0119] In one embodiment, when the processor is implemented before executing the compilation instruction, it is used to implement:
[0120] Pre-setting a plurality of virtual machines, and running a plurality of containers on each of the virtual machines to generate a container cluster, wherein each of the containers includes a task scheduling client;
[0121] A shared directory is pre-set so that each container in the container cluster shares the pre-set shared directory.
[0122] An embodiment of the present application further provides a computer-readable storage medium, on which a computer program is stored. The computer program includes program instructions. The method implemented when the program instructions are executed can refer to the various embodiments of the distributed compilation method of the present application.
[0123] The computer-readable storage medium may be an internal storage unit of the computer device described in the foregoing embodiment, such as a hard disk or memory of the computer device. The computer-readable storage medium may also be an external storage device of the computer device, such as a plug-in hard disk, a smart memory card (SmartMedia Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc., equipped on the computer device.
[0124] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or system including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or system. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or system including the element.
[0125] The serial numbers of the embodiments of the present application are for description only and do not represent the advantages and disadvantages of the embodiments. The above description is only a specific implementation mode of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of various equivalent modifications or replacements within the technical scope disclosed in the present application, and these modifications or replacements should be included in the protection scope of the present application. Therefore, the protection scope of the present application shall be based on the protection scope of the claims.
Claims
1. A distributed compilation method, characterized in that: The method comprises: Execute the compilation instruction, and generate a concurrent subtask sequence according to the compilation instruction and the source code package in the preset shared directory, wherein the source code package includes a predecessor task management module, multiple function modules and a total compilation task; The generating of a concurrent subtask sequence according to the compilation instruction and the source code package in the preset shared directory includes: Run the preceding task management module through the compilation instruction; Analyze each of the functional modules according to the running predecessor task management module to obtain the dependency relationship between the functional modules; Parsing and slicing the total compilation task according to the predecessor task management module and the dependency relationship to generate a concurrent subtask sequence; The parsing and slicing of the total compilation task according to the predecessor task management module and the dependency relationship to generate a concurrent subtask sequence includes: The total compilation task is parsed by running the predecessor task management module and the dependency relationship to obtain information of each compilation and linking task in the total compilation task, wherein the compilation and linking task information includes dependent compilation and linking tasks and non-dependent compilation and linking tasks; By slicing and refining the dependent compilation and linking, a compilation task and a linking task are obtained; Generate a concurrent subtask sequence based on the independent compile and link task, the compile task and the link task; Running the task scheduling server in the preset shared directory according to the subtask sequence, so that the task scheduling client in each container compiles the subtasks distributed by the task scheduling server from the subtask sequence; After determining that each of the task scheduling clients executes and compiles the subtasks, the task status is updated to complete the packaging work.
2. The distributed compilation method according to claim 1, wherein: Analyzing each of the functional modules according to the running predecessor task management module to obtain the dependency relationship between the functional modules includes: Analyzing the link parameters of each of the functional modules by running the preceding task management module to obtain a code compilation dependency graph; The code compilation dependency graph is parsed to obtain dependency relationships among the functional modules in the code compilation dependency graph.
3. The distributed compilation method according to claim 1, characterized in that: The step of enabling the task scheduling client in each container to compile the subtasks distributed by the task scheduling server from the subtask sequence includes: Inputting the subtask sequence into a task scheduling server to run the task scheduling server; The task scheduling server reads a preset allocatable task table through the running task scheduling server, and obtains a plurality of task scheduling clients in the preset allocatable task table; The subtasks in the subtask sequence are distributed to each of the task scheduling clients, so that the task scheduling clients in each container compile the subtasks distributed from the subtask sequence by the task scheduling server.
4. The distributed compilation method according to claim 3, characterized in that: Before the task scheduling server reads the preset allocatable task table through operation, the method further includes: Receiving request information sent by each of the task scheduling clients, and obtaining the task scheduling client information carried in the request information; The task scheduling client information is added to the preset allocatable task table.
5. The distributed compilation method as claimed in claim 1, characterized in that: Before executing the compilation instruction, the method further includes: Pre-setting a plurality of virtual machines, and running a plurality of containers on each of the virtual machines to generate a container cluster, wherein each of the containers includes a task scheduling client; A shared directory is pre-set so that each container in the container cluster shares the pre-set shared directory.
6. A distributed compilation device, characterized in that: The distributed compilation device comprises: An execution module, used for executing a compilation instruction, generating a concurrent subtask sequence according to the compilation instruction and a source code package in a preset shared directory, wherein the source code package includes a pre-task management module, a plurality of function modules and a total compilation task; The generating of a concurrent subtask sequence according to the compilation instruction and the source code package in the preset shared directory includes: Run the preceding task management module through the compilation instruction; Analyze each of the functional modules according to the running predecessor task management module to obtain the dependency relationship between the functional modules; Parsing and slicing the total compilation task according to the predecessor task management module and the dependency relationship to generate a concurrent subtask sequence; The parsing and slicing of the total compilation task according to the predecessor task management module and the dependency relationship to generate a concurrent subtask sequence includes: The total compilation task is parsed by running the predecessor task management module and the dependency relationship to obtain information of each compilation and linking task in the total compilation task, wherein the compilation and linking task information includes dependent compilation and linking tasks and non-dependent compilation and linking tasks; By slicing and refining the dependent compilation and linking, a compilation task and a linking task are obtained; Generate a concurrent subtask sequence based on the independent compile and link task, the compile task and the link task; Running and distributing, for running the task scheduling server in the preset shared directory according to the subtask sequence, so that the task scheduling client in each container compiles the subtasks distributed by the task scheduling server from the subtask sequence; The determination and update module is used to determine that each of the task scheduling clients executes and compiles the subtasks, updates the task status, and completes the packaging work.
7. A computer device, characterized in that: The computer device comprises a processor, a memory, and a computer program stored in the memory and executable by the processor, wherein when the computer program is executed by the processor, the steps of the distributed compilation method according to any one of claims 1 to 5 are implemented.
8. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, wherein when the computer program is executed by a processor, the steps of the distributed compilation method according to any one of claims 1 to 5 are implemented.
