Program generation method and program generation device
By mounting a compiler directory to a container and compiling source code within, the method simplifies program generation across multiple Linux distributions, addressing the complexity of direct compiler invocation.
Patent Information
- Application Number
- JP2022002403
- Authority / Receiving Office
- JP · JP
- Patent Type
- Patents
- Current Assignee / Owner
- Filing Date
- 2022-01-11
- Publication Date
- 2025-08-15
- Estimated Expiration
- 2042-01-11
AI Technical Summary
Compilers capable of generating programs for multiple Linux distributions cannot be directly invoked from a container, requiring a complicated procedure.
A method and device that mount a directory containing a compiler capable of generating programs for multiple distributions to a container, compile source code within the container, and save the generated program in the host OS directory.
Enables the generation of programs for multiple Linux distributions using a single compiler in a simple procedure, without needing separate compilers for each container.
Smart Images

Figure 0007724163000001 
Figure 0007724163000002 
Figure 0007724163000003
Abstract
Description
[Technical Field]
[0001] FIELD Embodiments of the present invention relate to a program generation method and a program generation device. [Background technology]
[0002] A technology is disclosed that mounts local storage and network storage in an application container and transfers intermediate training model files to the mounted network storage in a timely manner.
[0003] Also disclosed is a compiler that can generate a program that can be executed on multiple Linux (registered trademark) distributions on multiple Linux distributions. [Prior art documents] [Patent documents]
[0004] [Patent Document 1] Patent Publication No. 2021-26766 [Non-patent literature]
[0005] [Non-Patent Document 1] https: / / software.intel.com / content / dam / develop / external / us / en / documents / iccrn-19-1-0-linux.pdf Summary of the Invention [Problem to be solved by the invention]
[0006] If a compiler capable of generating programs that can be run on multiple Linux distributions is installed on a single device, the compiler cannot be directly invoked from a container on that device, and invocation requires a complicated procedure.
[0007] The problem to be solved by the present invention is to provide a program generation method and a program generation device that generate a program by calling the above compiler in a simple procedure. [Means for solving the problem]
[0008] A program generation method according to an embodiment includes the steps of: mounting a first directory of a host OS, in which a compiler capable of generating a program that can be executed on multiple distributions is stored, to a first directory of a container; mounting a second directory of the host OS, in which source code to be compiled is stored, to a second directory of the container; compiling the source code in the container using the compiler to generate a program; and generating the program in the second directory of the host OS by saving the generated program in the second directory of the container.
[0009] A program generation device according to an embodiment includes a CPU and a storage device storing a software configuration of a host OS. The CPU is configured to mount a first directory of the host OS, in which a compiler capable of generating a program executable on a plurality of distributions is stored, to a first directory of a container, mount a second directory of the host OS, in which source code to be compiled is stored, to a second directory of the container, compile the source code in the container using the compiler to generate a program, and store the generated program in the second directory of the container, thereby generating the program in the second directory of the host OS. [Brief explanation of the drawings]
[0010] [Figure 1]FIG. 1 is a hardware configuration diagram of a program generation device according to an embodiment. [Figure 2] FIG. 1 is a functional configuration diagram of a program generation device according to an embodiment. [Figure 3] FIG. 2 is a software configuration diagram of a host OS in a hard disk of the program generation device according to the embodiment. [Figure 4] 4 is a flowchart showing a processing procedure and processing content for generating a program executed by the program generation device according to the embodiment. [Figure 5] 5 is a software configuration diagram of a Debian container after step S101 of the flowchart in FIG. 4 is performed. [Figure 6] 5 is a software configuration diagram of a Debian container after step S103 of the flowchart in FIG. 4 is performed. [Figure 7] 5 is a software configuration diagram of a Debian container after step S106 of the flowchart in FIG. 4 is performed. [Figure 8] FIG. 5 is a software configuration diagram of the host OS after step S109 in the flowchart of FIG. 4 is performed. DETAILED DESCRIPTION OF THE INVENTION
[0011] Hereinafter, embodiments will be described with reference to the drawings.
[0012] [composition] (Hardware configuration) First, the hardware configuration of a program generation device 100 according to an embodiment will be described with reference to Fig. 1. Fig. 1 is a diagram showing the hardware configuration of the program generation device 100 according to an embodiment. The program generation device 100 is configured by a computer. For example, the program generation device 100 is configured by a personal computer, a server computer, or the like.
[0013] 1, the program generation device 100 includes a CPU 101, a RAM 102, a display 103, a keyboard 104, a NIC 105, a hard disk 106, and a system bus 107. In addition to these, the program generation device 100 may also include other peripheral devices.
[0014] The CPU 101, RAM 102, display 103, keyboard 104, NIC 105, and hard disk 106 are electrically connected to one another via a system bus 107, and exchange data and commands via the system bus 107.
[0015] The CPU 101 is a processor, which is hardware that executes programs and processes data, and controls the RAM 102, the display 103, the keyboard 104, the NIC 105, and the hard disk 106.
[0016] The RAM 102 is an auxiliary storage device that temporarily stores data, and temporarily stores programs and data required for processing executed by the CPU 101.
[0017] The display 103 is an output device that outputs data and presents various types of information to the user.
[0018] The keyboard 104 is an input device for receiving data, such as instructions to be executed by the CPU 101 and data to be stored in the hard disk 106.
[0019] The NIC 105 is a network interface card, which is a card-type device that connects to a communication network to input and output data.
[0020] The hard disk 106 is an auxiliary storage device that permanently stores data. The hard disk 106 stores programs and data supplied from external devices or via a network, and provides the RAM 102 with programs and data required for processing by the CPU 101.
[0021] The CPU 101 performs various processes by loading necessary programs from the hard disk 106 into the RAM 102 and executing them. When executing a program, the CPU 101 loads data into the RAM 102, processes the loaded data, and provides the processed data to the RAM 102.
[0022] (Functional configuration) Next, the functional configuration of the program generation device 100 will be described with reference to FIG. 2. FIG. 2 is a diagram schematically illustrating the functional configuration of the program generation device 100. In the program generation device 100, a container engine 120, which is a platform that realizes a container-type virtual environment, is installed in a host OS 110. A container 130 is formed by mounting a container image on the container engine 120. The containers 130 provide application execution environments that are isolated from each other. Each container 130 includes an application, a library, middleware, etc., and operates using the kernel of the host OS 110. For example, the container engine 120 is a Docker (registered trademark) engine or a Docker (registered trademark) host, and the container 130 is a Docker (registered trademark) container.
[0023] (Software configuration) Next, the software configuration of the host OS 110 in the hard disk 106 will be described with reference to Fig. 3. Fig. 3 is a diagram showing a schematic view of the software configuration of the host OS 110 in the hard disk 106 of the program generation device 100.
[0024] The hard disk 106 contains a / home / user directory 200, an / opt directory 220, a / usr directory 230, an / etc directory 241, a / bin directory 242, a / lib directory 243, a / boot directory 244, a / root directory 245, and a / var directory 246 of the host OS 110.
[0025] The / home / user directory 200 is the user's home directory. The / home / user directory 200 has a working directory 210. The working directory 210 is a directory in which working files are saved. A Makefile 211 and source code 212 are saved in the working directory 210. The source code 212 is code to be compiled. The Makefile 211 is a file that describes the rules for compilation.
[0026] Also, the / home / user directory 200 contains a Debian container 201, a Fedra container 202, an RHEL container 203, a SUSE container 204, an Ubuntu container 205, and a CentOS container 206. The Debian container 201 contains a distribution called Debian. Similarly, the Fedra container 202 contains a distribution called Fedra. The RHEL container 203 contains a distribution called RHEL. The SUSE container 204 contains a distribution called SUSE. The Ubuntu container 205 contains a distribution called Ubuntu. The CentOS container 206 contains a distribution called CentOS.
[0027] The / opt directory 220 is a directory where additional selectable application packages are installed. The / opt directory 220 stores the Intel compiler 221 and compiler setting file 222. The Intel compiler 221 is a compiler that can generate programs that can be executed on multiple distributions in multiple distributions. The Intel compiler 221 is installed in the host OS 110. The Intel compiler 221 may be replaced with another compiler that has the same functions. An example of a distribution is a Linux distribution. A Linux distribution is a collection of the Linux kernel, libraries, and software required for its operation. The compiler setting file 222 is a file that describes the environment variables required by the Intel compiler 221.
[0028] The aforementioned Debian, Fedra, RHEL, SUSE, Ubuntu, and CentOS are all types of Linux distributions, and the Intel Compiler 221 can perform compilation on any of these Linux distributions.
[0029] The / usr directory 230 is a directory where user applications are installed. The / usr directory 230 stores an Ubuntu command 231, an Ubuntu library 232, an Ubuntu header file 233, and a wrapper 234. The Ubuntu command 231, the Ubuntu library 232, and the Ubuntu header file 233 configure the container engine 120. The wrapper 234 records arguments required for program generation, such as arguments for the container to be executed and arguments for the Intel compiler 221.
[0030] The / etc directory 241 is a directory in which various Linux files are stored. The / bin directory 242 is a directory in which basic commands are stored. The / lib directory 243 is a directory in which shared libraries are stored. The / boot directory 244 is a directory in which files necessary for startup are stored. The / root directory 245 is the home directory of the root account. The / var directory 246 is a directory in which data that is created and deleted during use is stored.
[0031] [Operation] Next, the processing procedure and processing content for generating a program executed by program generation device 100 will be described with reference to Fig. 4. Fig. 4 is a flowchart showing the processing procedure and processing content for generating a program executed by program generation device 100. The program is generated by processing by CPU 101, RAM 102, and hard disk 106.
[0032] In step S101, the argument of the wrapper 234 is received and the specified container is executed. In the embodiment, an example of executing a Debian container 201 will be described.
[0033] 5 is a diagram schematically illustrating the software configuration of the Debian container 201 after step S101 is performed. The Debian container 201 has a / home / user directory 300, an / opt directory 320, a / usr directory 330, an / etc directory 241, a / bin directory 242, a / lib directory 243, a / boot directory 244, a / root directory 245, and a / var directory 246.
[0034] The / home / user directory 300 has a working directory 310. The / usr directory 330 stores Debian commands 331, Debian libraries 332, and Debian header files 333.
[0035] At this point, the working directory 310 and the / opt directory 320 are empty.
[0036] In step S102, the / opt directory 220 of the host OS 110 in which the Intel compiler 221 and the compiler setting file 222 are saved is mounted to the / opt directory 320 of the Debian container 201.
[0037] In step S103 , the working directory 210 of the host OS 110 in which the Makefile 211 and the source code 212 are saved is mounted to the working directory 310 of the Debian container 201 .
[0038] 6 is a diagram schematically illustrating the software configuration of the Debian container 201 after step S102 is performed. As a result of performing step S101, an Intel compiler 221 and a compiler configuration file 222 are saved in the / opt directory 320 of the Debian container 201. As a result of performing step S102, a Makefile 211 and source code 212 are saved in the working directory 310 of the Debian container 201.
[0039] In step S104, the compiler setting file 222 is set up, that is, the compiler setting file 222 is read and the environment variables required by the Intel compiler 221 are set up.
[0040] In step S105, the Intel compiler 221 is executed with the arguments received as arguments of the wrapper 234. That is, the source code 212 stored in the working directory 310 is compiled by the Intel compiler 221 in accordance with the rules described in the Makefile 211 stored in the working directory 310 to generate a program 213.
[0041] In step S 106 , the program 213 is saved in the working directory 310 according to the rules described in the Makefile 211 .
[0042] 7 is a diagram schematically illustrating the software configuration of the Debian container 201 after step S106 is performed. As a result of performing steps S104 to S106, the program 213 is saved in the working directory 310 of the Debian container 201. At this time, the program 213 is generated in the working directory 210 of the host OS 110.
[0043] In step S107, the working directory 310 of the Debian container 201 is unmounted. This empties the working directory 310 of the Debian container 201. That is, the Makefile 211, the source code 212, and the program 213 are deleted from the working directory 310.
[0044] In step S108, the / opt directory 320 of the Debian container 201 is unmounted. This empties the / opt directory 320 of the Debian container 201. That is, the Intel compiler 221 and the compiler setting file 222 are deleted from the / opt directory 320. As a result, the Debian container 201 returns to the state it was in after step S101 was performed.
[0045] In step S109, the execution of the Debian container 201 is terminated.
[0046] 8 is a diagram schematically showing the software configuration of the host OS 110 after step S109 is performed. As a result of performing steps S104 to S106, a program 213 is generated in the working directory 210 of the host OS 110. Even after steps S107 to S109 are performed, the program 213 remains in the working directory 210 of the host OS 110.
[0047] In the embodiment, an example of executing a Debian container 201 is described, but the same process can also be used to generate programs for other containers, namely, a Fedra container 202, an RHEL container 203, a SUSE container 204, an Ubuntu container 205, and a CentOS container 206.
[0048] [effect] In the embodiment, a program is generated in the following procedure: (1) The / opt directory 220 of the host OS 110, in which the Intel compiler 221 and the compiler setting file 222 are saved, is mounted to the / opt directory 320 of the Debian container 201. (2) The working directory 210 of the host OS 110, in which the source code 212 to be compiled is saved, is mounted to the working directory 310 of the Debian container 201. (3) In the Debian container 201, the source code 212 is compiled to generate the program 213. (4) The generated program 213 is saved in the working directory 310 of the Debian container 201, thereby generating the program 213 in the working directory 210 of the host OS 110.
[0049] Therefore, without preparing a compiler for each of multiple containers, it is possible to use one Intel compiler 221 installed in one program generation device 100 to generate a program that can be executed in containers built with multiple distributions that are compatible with the Intel compiler 221. In other words, it is possible to generate a program by calling the Intel compiler 221 using a simple procedure.
[0050] Although several embodiments of the present invention have been described, these embodiments are presented as examples and are not intended to limit the scope of the invention. These novel embodiments can be embodied in various other forms, and various omissions, substitutions, and modifications can be made without departing from the spirit of the invention. These embodiments and their modifications are included within the scope and spirit of the invention, and are also included in the scope of the invention and its equivalents as defined in the claims. [Explanation of symbols]
[0051] 100...Program generation device, 101...CPU, 102...RAM, 103...Display, 104...Keyboard, 106...Hard disk, 107...System bus, 110...Host OS, 120...Container engine, 130...Container, 200... / home / user directory, 201...Debian container, 202...Fedra container, 203...RHEL container, 204...SUSE container, 205...Ubuntu container, 206...CentOS container, 210...Working directory, 212...Source code, 213...Program, 220... / opt directory, 221...Intel compiler, 222...Compiler settings Files, 230... / usr directory, 231...Ubuntu commands, 232...Ubuntu libraries, 233...Ubuntu header files, 234...wrapper, 241... / etc directory, 242... / bin directory, 243... / lib directory, 244... / boot directory, 245... / root directory, 246... / var directory, 300... / home / user directory, 310...working directory, 320... / opt directory, 330... / usr directory, 331...Debian commands, 332...Debian libraries, 333...Debian header files.
Claims
1. Mounting a first directory of a host OS, in which a compiler capable of generating a program executable in a plurality of distributions is stored, to a first directory of a container; Mounting a second directory of the host OS, in which source code to be compiled is stored, to a second directory of the container; compiling the source code in the container using the compiler to generate a program; generating the program in the second directory of the host OS by saving the generated program in the second directory of the container; A program generation method comprising:
2. a compiler setting file is stored in the first directory of the host OS; before the step of generating the program, a step of setting, in the container, environment variables required by the compiler based on the compiler configuration file; the step of generating the program includes compiling the source code using the compiler based on the set environment variables; The program generation method according to claim 1 .
3. A CPU and a storage device that stores the software configuration of a host OS; The CPU Mounting a first directory of the host OS, in which a compiler capable of generating a program executable in a plurality of distributions is stored, to a first directory of the container; Mounting a second directory of the host OS, in which source code to be compiled is stored, to a second directory of the container; In the container, compiling the source code using the compiler to generate a program; The generated program is stored in the second directory of the container, thereby generating the program in the second directory of the host OS. A program generating device configured as follows.
4. a compiler setting file is stored in the first directory of the host OS; The CPU before generating the program, setting, in the container, environment variables required by the compiler based on the compiler configuration file; Compiling the source code using the compiler based on the set environment variables 4. The program generating device according to claim 3, wherein the program generating device is configured as follows.
Citation Information
Patent Citations
System and method for multi-tenant execution of OS programs called from multi-tenant middleware applications
JP2018536206A
Processing method and device for deep learning task, and computer-readable recording medium
JP2021026766A
Container chaining for automated process completion
US20180285156A1
Container testing using a directory and test artifacts and / or test dependencies
US20180336123A1
Container-based virtualization system
US20210019169A1