OFFLOAD SERVER, OFFLOAD CONTROL METHOD, AND OFFLOAD PROGRAM

The offload server optimizes resource allocation between CPUs and offload devices like GPUs and FPGAs by analyzing application code and using genetic algorithms, addressing inefficiencies and performance bottlenecks in automatic offloading.

JP7544142B2Active Publication Date: 2024-09-03NIPPON TELEGRAPH & TELEPHONE CORP
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
JP2022561797
Authority / Receiving Office
JP · JP
Patent Type
Patents
Current Assignee / Owner
Filing Date
2020-11-12
Publication Date
2024-09-03
Estimated Expiration
2040-11-12

AI Technical Summary

Technical Problem

Existing technologies face challenges in optimizing resource allocation between CPUs and offload devices like GPUs and FPGAs, leading to inefficiencies and performance bottlenecks during automatic offloading, particularly due to the high technical barriers in programming for heterogeneous devices.

Method used

An offload server that analyzes application code, determines resource ratios and amounts, and performs automatic offloading by specifying data transfer and parallel processing, using genetic algorithms to optimize performance and resource allocation.

Benefits of technology

The offload server effectively sets appropriate resource amounts for CPUs and offload devices, ensuring balanced processing times and reducing equipment costs by optimizing resource usage and preventing bottlenecks.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure 0007544142000002
    Figure 0007544142000002
  • Figure 0007544142000003
    Figure 0007544142000003
  • Figure 0007544142000009
    Figure 0007544142000009
Patent Text Reader

Abstract

An offload server (1) comprises: a performance measurement unit (118) that carries out a performance measurement process of a case when an application program of parallel processing patterns is compiled, is disposed in a verification machine (14), and is offloaded to an offload device; a resource ratio determination unit (115) that determines the processing time ratio of a CPU to the offload device as a resource ratio on the basis of the performance measurement result; and a resource amount setting unit (116) that sets resource amounts of the CPU and the offload device so as to satisfy prescribed cost conditions on the basis of the determined resource ratio.
Need to check novelty before this filing date? Find Prior Art

Description

[Technical field]

[0001] The present invention relates to an offload server, an offload control method, and an offload program that automatically offload functional processing to an accelerator such as an FPGA (Field Programmable Gate Array). [Background technology]

[0002] In recent years, it has been said that Moore's Law, which states that the semiconductor integration density of CPUs doubles every 1.5 years, may be slowing down. In light of this situation, the use of devices such as FPGAs (Field Programmable Gate Arrays) and GPUs (Graphics Processing Units) is increasing in addition to CPUs with fewer cores. For example, Microsoft (registered trademark) is working to improve the search efficiency of Bing using FPGAs, and Amazon (registered trademark) is providing FPGAs, GPUs, etc. as cloud instances.

[0003] In order to properly utilize devices other than low-core CPUs in a system, it is necessary to configure and write programs that take into account the characteristics of the device. This requires knowledge of OpenMP (Open Multi-Processing), OpenCL (Open Computing Language), and CUDA (Compute Unified Device Architecture), making the skill barrier high for most programmers.

[0004] It is expected that the number of systems that utilize devices other than few-core CPUs, such as GPUs, FPGAs, and many-core CPUs, will continue to increase in the future, but there are high technical barriers to making the most of them.Therefore, in order to remove such barriers and make full use of devices other than few-core CPUs, there is a demand for a platform that can adaptively convert and configure software in which a programmer writes processing logic to suit the environment in which it is deployed (FPGA, GPU, many-core CPU, etc.), and allow it to operate in a way that suits the environment.

[0005] Non-Patent Document 1 describes environment adaptive software that aims to run applications with high performance by automatically converting and configuring resources so that code written once can utilize GPUs, FPGAs, many-core CPUs, etc. present in the deployment environment.

[0006] Non-Patent Documents 2, 3, and 4 describe a method for automatically offloading loop statements and function blocks of application code to FPGAs and GPUs as elements of environment adaptive software. Non-Patent Document 5 describes a technology for automatic performance testing.

[0007] CUDA has become popular as an environment for GPGPU (General Purpose GPU), which uses the parallel computing power of GPU for purposes other than image processing. CUDA is an environment for GPGPU developed by NVIDIA (registered trademark). In addition, there is OpenCL, a specification for handling heterogeneous devices such as FPGA, many-core CPU, and GPU in the same way, and its development environment is also in the process of being established. CUDA and OpenCL are programmed by extending the C language, and are difficult to program (e.g., explicitly writing descriptions for copying and releasing memory data between kernels such as FPGA and the CPU host).

[0008] Furthermore, compared to CUDA and OpenCL, there are technologies such as OpenACC and OpenMP (registered trademark) that allow easier use of heterogeneous devices, and compilers such as the PGI compiler and gcc (registered trademark). These compilers specify the locations where parallel processing is to be performed on a directive line basis, and create executable files for GPUs, many-core CPUs, etc. according to the directive lines.

[0009] By using the above technical specifications such as CUDA, OpenCL, OpenACC, and OpenMP, it is possible to offload to FPGA, GPU, and many-core CPU. However, even if device processing itself can be performed, there are challenges in accelerating it. For example, Intel Compiler (registered trademark) is a compiler with an automatic parallelization function for multi-core CPUs. During automatic parallelization, these extract parts of loop statements in the code that can be processed in parallel and parallelize them. However, due to the influence of memory processing, etc., it is often the case that performance cannot be achieved simply by parallelizing parallelizable loop statements. When accelerating using FPGA, GPU, etc., OpenCL and CUDA engineers repeatedly tune the system, or use OpenACC compilers, etc. to search and try appropriate parallel processing ranges.

[0010] For this reason, it is difficult for programmers with little technical skill to use FPGAs, GPUs, or many-core CPUs to speed up applications, and even when using automatic parallelization technology, it is necessary to go through a process of trial and error to find parallel processing locations. Currently, offloading to heterogeneous devices is mainly done manually. [Prior art documents] [Non-patent literature]

[0011] [Non-Patent Document 1] Y. Yamato, H. Noguchi, M. Kataoka and T. Isoda, “Proposal of Environment Adaptive Software,” The 2nd International Conference on Control and Computer Vision (ICCCV 2019), pp.102-108, Jeju, June 2019. [Non-Patent Document 2] Y. Yamato, “Study of parallel processing area extraction and data transfer number reduction for automatic GPU offloading of IoT applications,” Journal of Intelligent Information Systems, Springer, DOI: 10.1007 / s10844-019-00575-8, Aug. 2019. [Non-Patent Document 3] Y. Yamato, “Proposal of Automatic FPGA Offloading for Applications Loop Statements,” The 7th Annual Conference on Engineering and Information Technology (ACEAIT 2020), pp.111-123, 2020. [Non-Patent Document 4] Y. Yamato, “Proposal of Automatic Offloading for Function Blocks of Applications,” The 8th IIAE International Conference on Industrial Application Engineering 2020 (ICIAE 2020), pp.4-11, Mar. 2020. [Non-Patent Document 5] Y. Yamato, "Automatic verification technology of software patches for user virtual environments on IaaS cloud," Journal of Cloud Computing, Springer, 2015, 4:4, DOI: 10.1206 / s13677-015-0028-6, Feb. 2015. Summary of the Invention [Problem to be solved by the invention]

[0012] When offloading a CPU program to a device such as a GPU, it is necessary to optimize the amount of resources available to the CPU and the offload device in order to run the application cost-effectively. Non-Patent Documents 1 to 5 do not consider the amount of resources of the offload device after automatic offloading.

[0013] The present invention has been made in view of the above-mentioned points, and an object of the present invention is to enable setting appropriate resource amounts for the CPU and offload device in automatic offloading. [Means for solving the problem]

[0014] In order to solve the above-mentioned problems, an offload server that offloads a specific process of an application program from a CPU to an offload device includes an application code analysis unit that analyzes a source code of the application program, a data transfer specification unit that analyzes reference relationships of variables used in loop statements of the application program, and for data that may be transferred outside the loop, performs data transfer specification using an explicit specification line that explicitly specifies data transfer outside the loop, a parallel processing specification unit that identifies loop statements of the application program, and compiles each identified loop statement by specifying a parallel processing specification statement in the offload device, and a compilation error specification unit that detects a compilation error and a data transfer specification unit that performs data transfer specification using an explicit specification line that explicitly specifies data transfer outside the loop for each identified loop statement. a parallel processing pattern creation unit that creates a parallel processing pattern that excludes a loop statement that generates a compilation error from being offloaded and specifies whether or not to perform parallel processing for a loop statement that does not generate a compilation error; a performance measurement unit that compiles the application program of the parallel processing pattern, places it in an accelerator verification device, and executes processing for measuring performance when offloaded to the offload device; a resource ratio determination unit that determines a ratio of processing times of the CPU and the offload device as a resource ratio based on a performance measurement result; and a resource amount setting unit that sets resource amounts of the CPU and the offload device so as to satisfy a predetermined cost condition based on the determined resource ratio. and if the predetermined cost condition is not satisfied by setting the minimum resource amount while maintaining the determined resource ratio, the resource amount setting unit sets the resource amount of the CPU and the offload device starting from the minimum so as to approach the set resource ratio while satisfying the cost condition. The offload server is characterized by the above. Effect of the Invention

[0015] According to the present invention, in automatic offloading, appropriate resource amounts for the CPU and the offload device can be set. [Brief description of the drawings]

[0016] [Figure 1] 2 is a functional block diagram showing a configuration example of an offload server according to the first embodiment of the present invention; FIG. [Diagram 2] FIG. 2 is a diagram illustrating an automatic offload process using an offload server according to the first embodiment of the present invention. [Diagram 3] FIG. 2 is a diagram showing a search image of processing by a control unit (automatic offload function unit) by Simple GA of the offload server according to the first embodiment of the present invention and gene sequence mapping of a for statement. [Figure 4A] 4 is a flowchart of <<loop statement offloading>> of the offload server according to the first embodiment of the present invention. [Figure 4B] 4 is a flowchart of <<loop statement offloading>> of the offload server according to the first embodiment of the present invention. [Diagram 5] 11 is a flowchart for setting a resource ratio and a resource amount added after a GPU or FPGA offload attempt of an offload server according to the first embodiment of the present invention. [Figure 6] FIG. 11 is a functional block diagram illustrating a configuration example of an offload server according to a second embodiment of the present invention. [Figure 7] This is a flowchart when a control unit (automatic offload function unit) of an offload server relating to the second embodiment of the present invention executes <Process A-1>, <Process B-1>, and <Process C-1> in the offload processing of <Function block offload: common>. [Figure 8] This is a flowchart when a control unit (automatic offload function unit) of an offload server relating to the second embodiment of the present invention executes <Process A-2>, <Process B-2>, and <Process C-2> in the offload processing of a functional block. [Figure 9] FIG. 2 is a hardware configuration diagram illustrating an example of a computer that realizes the functions of an offload server according to an embodiment of the present invention. DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS

[0017] Next, an offload server and the like in an embodiment of the present invention (hereinafter, referred to as "the present embodiment") will be described. (Basic concept of the present invention) In order to embody the concept of environment-adaptive software, the present inventors have hitherto proposed methods for automatically offloading GPU, FPGA, and program function blocks of program loop statements (see Non-Patent Documents 2, 3, and 4). Based on the consideration of the elemental technologies of these Non-Patent Documents 2, 3, and 4, the basic concept of the present invention will be described.

[0018] <Optimization of the resource ratio between the CPU and the offloading device> First, the optimization of the resource ratio between the CPU and the offloading device after the program conversion that can be offloaded to the device will be described. By the methods such as Non-Patent Document 2, etc., a normal program can be automatically offloaded to an offloading device such as a GPU or an FPGA. Currently, multi-core CPUs and many-core CPUs can be flexibly configured to allocate a certain percentage of all cores through virtualization using virtual machines or containers. Regarding GPUs, similar virtualization to that of CPUs has been carried out in recent years, and operations such as allocating a certain percentage of all cores of the GPU are becoming possible. Regarding FPGAs, the resource usage amount is often represented by the number of settings of Look Up Tables and Flip Flops, and unused gates can be used for other purposes.

[0019] Thus, it is possible to operate using a part of the total resources for CPUs, GPUs, and FPGAs, and it is important to optimize the resources of the CPU and the offloading device according to the application in order to improve the cost performance.

[0020] Also, using the methods such as Non-Patent Document 2, etc., an application can be converted into code for CPU and GPU processing. However, even if the code itself is appropriate, if the resource amounts of the CPU and the GPU are not in an appropriate balance, the performance will not be achieved. For example, when performing a certain process, if the processing time of the CPU is 1000 seconds and the processing time of the GPU is 1 second, even if the process that can be offloaded is accelerated to some extent by the GPU, the CPU becomes the bottleneck overall.

[0021] Furthermore, in the non-patent document "K. Shirahata, H. Sato and S. Matsuoka, "Hybrid Map Task Scheduling for GPU-Based Heterogeneous Clusters," IEEE Second International Conference on Cloud Computing Technology and Science (CloudCom), pp.733-740, Dec. 2010," it is described how, when processing tasks using a CPU and a GPU in the MapReduce (registered trademark) framework, map tasks are allocated so that the execution times of the CPU and GPU are equal, thereby improving overall performance.

[0022] The inventors have come up with the idea of ​​determining the resource ratio between the CPU and the offload device as follows: In other words, in order to prevent processing in any of the devices from becoming a bottleneck, and with reference to the above non-patent documents, the resource ratio between the CPU and the offload device (hereinafter referred to as "resource ratio") is determined based on the processing time of the test case so that the processing time of the CPU and the offload device are of the same order of magnitude.

[0023] In addition, the present inventor adopts a method of gradually increasing the speed based on the performance measurement results in a verification environment during automatic offloading, as in the method of Non-Patent Document 2. The reason is that performance varies greatly not only depending on the code structure, but also on the specifications of the hardware that actually processes it, data size, loop count, and other contents that are actually processed. Also, performance is difficult to predict statically, and dynamic measurement is necessary. Therefore, since the performance measurement results in the verification environment are already available during code conversion, the resource ratio is determined using those results.

[0024] When measuring performance, measurements are taken by specifying test cases. For example, if the processing time of a test case in a verification environment is 10 seconds for CPU processing and 5 seconds for GPU processing, the resources on the CPU side are considered to be about twice as much for the same processing time. Therefore, the resource ratio is 2:1. For user requirements such as speeding up a particular process through offloading, it is reflected by preparing a test case that includes that process and speeding it up using a method such as Non-Patent Document 2 for that test case.

[0025] <Determination of Resource Amounts of CPU and Offloading Devices and Automatic Verification> Next, the determination and automatic verification of the resource amounts (hereinafter referred to as "resource amounts") of the CPU and offloading devices will be described. When the resource ratio is determined by the above <Optimization of Resource Ratio between CPU and Offloading Device>, next, the application is placed in the commercial environment. When placing in the commercial environment, the resource amount is determined while keeping (maintaining) the resource ratio as much as possible so as to meet the cost requirements specified by the user. For example, regarding the CPU, assume that 1 VM costs 1000 yen per month, the GPU costs 4000 yen per month, and the appropriate resource ratio is 2:1. And assume that the user's budget is within 10000 yen per month. In this case, even if the resource ratio is 2:1, it is within the user's budget of within 10000 yen per month. So, the resource amount that keeps the appropriate resource ratio of 2:1, that is, "2" for the CPU and "1" for the GPU, is secured and placed in the commercial environment. Also, if the user's budget is within 5000 yen per month, the appropriate resource ratio of 2:1 cannot be kept. In this case, as the resource amount, "1" for the CPU and "1" for the GPU are secured and placed.

[0026] After reserving resources in the commercial environment and placing the program, automatic verification is performed to confirm that the program works before the user uses it. In the automatic verification, performance verification test cases and regression test cases are executed. For the performance verification test cases, assumed test cases specified by the user are executed using an automatic test execution tool such as Jenkins (registered trademark), and processing time, throughput, etc. are measured. For the regression test cases, information on software such as middleware and the OS installed in the system is obtained, and the corresponding regression tests are executed using Jenkins or the like. A study on how to perform these automatic verifications with the preparation of fewer test cases has been conducted in Non-Patent Document 5 and the like, and the technology in Non-Patent Document 5 is used.

[0027] The performance verification test cases check whether the calculation results are invalid even when offloading is used. The performance verification test cases also check the difference in calculation results from when offloading is not used. For example, the PGI compiler that processes GPUs can check the difference in calculation results between when a GPU is used and when it is not, using APIs (Application Programming Interfaces) called PGI_compare(registered trademark) and acc_compare(registered trademark), which are functions of PCAST(registered trademark). Note that there are cases where the calculation results do not match perfectly even if parallel processing is offloaded correctly due to differences in rounding errors between GPUs and CPUs. For this reason, for example, confirmation is performed according to the IEEE 754 specifications, and the user is informed of the allowable difference and asked to confirm it.

[0028] As a result of the automatic verification, the processing time and throughput of the performance verification test cases, the difference in the calculation results, and the results of the regression tests are presented to the user. The user is also presented with the secured resources (number of VMs, specifications, etc.) and their prices, and the user refers to this information when deciding to start operation.

[0029] <Resources, resource ratios, test case processing time> The resources, resource ratios, and test case processing times in this embodiment will be described. About Resources CPUs, GPUs, FPGAs, etc. are now being provided as instances of virtual resources. Resources include the number of CPU cores, clock, memory amount, disk size, the number of GPU cores, clock, memory amount, and FPGA gate size (the unit is LE (registered trademark) for Intel (registered trademark), and LC (registered trademark) for Xilinx (registered trademark). Cloud and other businesses package these and provide them in the form of small-sized virtual machines and GPU instances. When virtualizing, the number of instances used can be said to be the amount of resources used.

[0030] About resource ratio The ratio of the number of CPU, GPU, and FPGA instances is the resource ratio. If the number of instances is 1, 2, or 3, the resource ratio is 1:2:3.

[0031] Test case processing time In this embodiment, an offload pattern that speeds up a test case specified by a user is searched for and found. A test case is a transaction processing number such as TPC-C (registered trademark) for DB (database), and execution of Fourier transform processing on sample data for FFT. The processing time is the execution time when the sample processing is executed. For example, the processing time of processing A was 10 seconds before offloading, but became 2 seconds after offloading, and the execution times when it was executed by the CPU and when it was executed by the offload device are respectively acquired.

[0032] (First embodiment) The present invention is characterized by the setting of resource ratios and resource amounts in automatic offloading. In the first embodiment, the setting of resource ratios and resource amounts in offloading a loop statement will be described. First, the offloading of a loop statement will be described. FIG. 1 is a functional block diagram showing an example of the configuration of an offload server 1 according to the first embodiment of the present invention. The offload server 1 is a device that automatically offloads specific processing of an application to an accelerator. As shown in FIG. 1, the offload server 1 includes a control unit 11, an input / output unit 12, a storage unit 13, and a verification machine 14 (accelerator verification device).

[0033] The input / output unit 12 is composed of a communication interface for transmitting and receiving information between each device, etc., and an input / output interface for transmitting and receiving information between input devices such as a touch panel and a keyboard, and output devices such as a monitor.

[0034] The memory unit 13 is composed of a hard disk, flash memory, RAM (Random Access Memory), etc., and temporarily stores programs (offload programs) for executing each function of the control unit 11, and information necessary for processing by the control unit 11 (for example, intermediate language file (Intermediate file) 133).

[0035] The storage unit 13 includes a test case database 131, a facility resource DB 132, and an intermediate language file 133.

[0036] The test case DB 131 stores data of test items corresponding to the software to be verified. For example, in the case of a database system such as MySQL, the test item data is data of a transaction test such as TPC-C.

[0037] The facility resource DB 132 holds information prepared in advance about resources such as servers held by the business operator, such as prices, and information about how much they are being used. For example, there are 10 servers that can accommodate 3 GPU instances, one GPU instance costs 5,000 yen per month, and out of the 10 servers, three servers A, B, and C are being used. This information is used to determine the amount of resources to be secured when a user specifies operation conditions (conditions such as cost and performance). The user operation conditions are cost conditions (e.g., a budget of 10,000 yen per month) and performance conditions (e.g., a transaction throughput of TPC-C or the like or a sample Fourier transform processing time of one thread within a certain number of seconds, etc.) specified by the user when making an offload request.

[0038] The intermediate language file 133 temporarily stores information necessary for processing by the control unit 11 in the form of a programming language that exists between a high-level language and a machine language.

[0039] The verification machine 14 includes a CPU, a GPU, and an FPGA as a verification environment for the environment adaptive software.

[0040] The control unit 11 is an automatic offloading function that controls the entire offload server 1. The control unit 11 is realized, for example, by a central processing unit (CPU) (not shown) expanding an application program (offload program) stored in the storage unit 13 into a RAM and executing the program.

[0041] The control unit 11 includes an application code specification unit (Specify application code) 111, an application code analysis unit (Analyze application code) 112, a data transfer specification unit 113, a parallel processing specification unit 114, a resource ratio determination unit 115, a resource amount setting unit 116, a parallel processing pattern creation unit 117, a performance measurement unit 118, an executable file creation unit 119, a production environment deployment unit (Deploy final binary files to production environment) 120, a performance measurement test extraction and execution unit (Extract performance test cases and run automatically) 121, and a user provision unit (Provide price and performance to a user to judge) 122.

[0042] <Application code designation section 111> The application code designation unit 111 designates the input application code. Specifically, the application code designation unit 111 passes the application code described in the received file to the application code analysis unit 112.

[0043] <Application Code Analysis Unit 112> The application code analysis unit 112 analyzes the source code of the processing function and grasps the structure of loop statements, FFT library calls, and the like.

[0044] <Data transfer designation unit 113> The data transfer specification unit 113 analyzes the reference relationships of variables used in loop statements of an application program, and for data that may be transferred outside the loop, specifies the data transfer using an explicit specification line that explicitly specifies the data transfer outside the loop.

[0045] <Parallel processing designation section 114> The parallel processing specification unit 114 identifies loop statements (repetitive statements) in the application program, and for each loop statement, specifies a parallel processing specification statement in the accelerator and compiles it. The parallel processing designation unit 114 includes an offloadable area extraction unit (Extract offloadable area) 114a and an intermediate language file output unit (Output intermediate file) 114b.

[0046] The offload range extraction unit 114a identifies processes that can be offloaded to the GPU / FPGA, such as loop statements and FFTs, and extracts an intermediate language corresponding to the offloaded processes. The intermediate language file output unit 114b outputs the extracted intermediate language file 133. The intermediate language extraction is not a one-time process, but is repeated to perform trial and error and optimize the execution for searching for an appropriate offload area.

[0047] <Resource ratio determination unit 115> Based on the performance measurement results, the resource ratio determination unit 115 determines the processing times of the CPU and offload device (test case CPU processing time and offload device processing time) as a resource ratio (described later). Specifically, the resource ratio determination unit 115 determines the resource ratio so that the processing times of the CPU and offload device are of the same order. Furthermore, when the difference between the processing times of the CPU and the offload device is equal to or greater than a predetermined threshold, the resource ratio determination unit 115 sets the resource ratio to a predetermined upper limit value.

[0048] <Resource amount setting unit 116> The resource amount setting unit 116 sets the resource amounts of the CPU and offload devices based on the determined resource ratio so as to satisfy a predetermined cost condition (described later). Specifically, the resource amount setting unit 116 maintains the determined resource ratio and sets the maximum resource amount that satisfies the predetermined cost condition. Furthermore, if the resource amount setting unit 116 does not satisfy the predetermined cost condition with the setting of the minimum resource amount that maintains the determined resource ratio, it breaks the resource ratio and sets the resource amounts of the CPU and offload devices to a smaller value (e.g., the minimum) that satisfies the cost condition.

[0049] <Parallel processing pattern creation unit 117> The parallel processing pattern creation unit 117 creates a parallel processing pattern that excludes loop statements (repetitive statements) that cause a compilation error from being offloaded, and specifies whether or not to process repetitive statements that do not cause a compilation error in parallel.

[0050] <Performance measurement section 118> The performance measurement unit 118 compiles an application program of a parallel processing pattern, places it in the verification machine 14, and executes a process for measuring performance when offloaded to the accelerator. The performance measurement unit 118 includes a binary file deployment unit (Deploy binary files) 118a. The binary file deployment unit 118a deploys (places) an executable file derived from an intermediate language in the verification machine 14 equipped with a GPU and / or FPGA.

[0051] The performance measurement unit 118 executes the placed binary file, measures the performance when offloaded, and returns the performance measurement result to the offload range extraction unit 114a. In this case, the offload range extraction unit 114a extracts another parallel processing pattern, and the intermediate language file output unit 114b attempts to measure the performance based on the extracted intermediate language (see symbol a in FIG. 2 described later).

[0052] <Executable File Creation Section 119> The executable file creation unit 119 selects multiple parallel processing patterns with high processing performance from the multiple parallel processing patterns based on the performance measurement results repeated a predetermined number of times, crosses the parallel processing patterns with high processing performance, and creates multiple other parallel processing patterns by mutation processing.The executable file creation unit 119 then performs new performance measurements, and after the performance measurements have been performed a specified number of times, selects the parallel processing pattern with the highest processing performance from the multiple parallel processing patterns based on the performance measurement results, compiles the parallel processing pattern with the highest processing performance, and creates an executable file.

[0053] <Production Environment Configuration Department 120> The production environment deployment unit 120 deploys the created executable file in the production environment for the user ("Deployment of final binary file in production environment"). The production environment deployment unit 120 determines a pattern that specifies the final offload area, and deploys it to the production environment for the user.

[0054] <Performance Measurement Test Extraction Execution Unit 121> After placing the executable file, the performance measurement test extraction execution unit 121 extracts performance test items from the test case DB 131 and executes the performance tests ("Placement of final binary file in production environment"). After arranging the executable file, the performance measurement test extraction execution unit 121 extracts performance test items from the test case DB 131 and automatically executes the extracted performance tests in order to show the performance to the user.

[0055] <User provision section 122> The user providing unit 122 presents the user with information such as price and performance based on the performance test results ("Providing information such as price and performance to user"). Performance test items are stored in the test case DB 131. The user providing unit 122 presents the user with data such as price and performance based on the results of the performance tests corresponding to the test items stored in the test case DB 131, together with the performance test results. The user decides whether to start using the service for which a fee is charged based on the presented information such as price and performance. Here, the technology in non-patent document (Y. Yamato, M. Muroi, K. Tanaka and M. Uchimura, “Development of Template Management Technology for Easy Deployment of Virtual Resources on OpenStack,” Journal of Cloud Computing, Springer, 2014, 3:7, DOI: 10.1206 / s13677-014-0007-3, 12 pages, June 2014.) can be used for bulk deployment to the production environment, and the technology in non-patent document 5 can be used for automatic performance testing.

[0056] [Application of genetic algorithms] The offload server 1 can use GA (Genetic Algorithms) for optimizing offloading. The offload server 1 is configured as follows when using GA. That is, the parallel processing specification unit 114 sets the number of loop statements (repetitive statements) that do not cause a compilation error based on a genetic algorithm as the gene length. The parallel processing pattern creation unit 117 maps whether or not accelerator processing is possible to the gene pattern by setting either 1 or 0 when accelerator processing is performed and the other 0 or 1 when accelerator processing is not performed.

[0057] The parallel processing pattern creation unit 117 prepares a specified number of gene patterns by randomly creating each gene value as 1 or 0. The performance measurement unit 118 compiles application code specifying a parallel processing specification statement in the accelerator according to each individual, and places the code in the verification machine 14. The performance measurement unit 118 executes a process for performance measurement in the verification machine 14.

[0058] Here, if a gene with the same parallel processing pattern as before occurs in an intermediate generation, the performance measurement unit 118 does not compile the application code corresponding to that parallel processing pattern or measure its performance, but uses the same value as the performance measurement value. Furthermore, for application code in which a compilation error occurs and application code for which performance measurement does not end within a predetermined time, the performance measuring unit 118 treats the application code as timeout and sets the performance measurement value to a predetermined time (long time).

[0059] The executable file creation unit 119 performs performance measurement on all the individuals, and evaluates them so that the shorter the processing time, the higher the fitness. From all the individuals, the executable file creation unit 119 selects those with a fitness higher than a predetermined value (for example, the top n% of the total number, or the top m of the total number, n and m are natural numbers) as high-performance individuals, and performs crossover and mutation processes on the selected individuals to create the next generation of individuals. After completing processing for the specified number of generations, the executable file creation unit 119 selects the parallel processing pattern with the highest performance as a solution.

[0060] The automatic offload operation of the offload server 1 configured as above will now be described. [Automatic offload operation] FIG. 2 is a diagram showing an automatic offload process using the offload server 1. As shown in FIG. 2, the offload server 1 is applied to the elemental technology of the environment adaptive software. The offload server 1 has a control unit (automatic offload function unit) 11, a test case DB 131, a facility resource DB 132, an intermediate language file 133, and a verification machine 14. The offload server 1 acquires an application code 125 that is used by the user.

[0061] The user is, for example, a person who has signed a contract to use various devices (Device 151, device having CPU-GPU 152, device having CPU-FPGA 153, device having CPU 154). The offload server 1 automatically offloads function processing to accelerators such as a device 152 having a CPU-GPU and a device 153 having a CPU-FPGA.

[0062] The operation of each unit will be described below with reference to the step numbers in FIG. <Step S11: Specify application code> In step S11, the application code designation unit 111 (see FIG. 1) passes the application code described in the received file to the application code analysis unit 112.

[0063] <Step S12: Analyze application code> In step S12, the application code analysis unit 112 (see FIG. 1) analyzes the source code of the processing function and grasps the structures of loop statements, FFT library calls, and the like.

[0064] <Step S13: Extract offloadable area> In step S13, the parallel processing specification unit 114 (see FIG. 1) identifies loop statements (repetitive statements) in the application, and for each repetitive statement, specifies a parallel processing specification statement in the accelerator and compiles it. Specifically, the offload range extraction unit 114a (see FIG. 1) identifies processes that can be offloaded to the GPU / FPGA, such as loop statements and FFT, and extracts an intermediate language corresponding to the offloaded process.

[0065] <Step S14: Output intermediate file> In step S14, the intermediate language file output unit 114b (see FIG. 1) outputs the intermediate language file 133. The intermediate language extraction is not a one-time process, but is repeated to perform trial and error optimization to find an appropriate offload area.

[0066] <Step S15: Compile error> In step S15, the parallel processing pattern creation unit 117 (see FIG. 1) creates a parallel processing pattern that excludes loop statements that produce a compilation error from being offloaded, and specifies whether or not to perform parallel processing on repetitive statements that do not produce a compilation error.

[0067] <Step S21: Deploy binary files> In step S21, the binary file placement unit 118a (see FIG. 1) deploys an executable file derived from the intermediate language to the verification machine 14 equipped with a GPU and FPGA.

[0068] <Step S22: Measure performance> In step S22, the performance measurement unit 118 (see FIG. 1) executes the arranged file and measures the performance when offloaded. In order to make the offload area more appropriate, the performance measurement result is returned to the offload range extraction unit 114a, which extracts another pattern. Then, the intermediate language file output unit 114b attempts to measure performance based on the extracted intermediate language (see symbol a in FIG. 2).

[0069] As shown by the reference character a in FIG. 2, the control unit 11 repeatedly executes the above steps S12 to S22. The automatic offload function of the control unit 11 can be summarized as follows. That is, the parallel processing designation unit 114 identifies loop statements (repeated statements) of the application program, and compiles each repeated statement by designating a parallel processing designation statement for GPU. The parallel processing pattern creation unit 117 creates a parallel processing pattern that excludes loop statements that generate a compilation error from the offload target and designates whether or not to perform parallel processing for loop statements that do not generate a compilation error. The binary file placement unit 118a then compiles the application program of the corresponding parallel processing pattern and places it on the verification machine 14, and the performance measurement unit 118 executes the performance measurement process on the verification machine 14. The execution file creation unit 119 selects a pattern with the highest processing performance from a plurality of parallel processing patterns based on the performance measurement results repeated a predetermined number of times, and compiles the selected pattern to create an execution file.

[0070] <Step S23: Setting resource amount according to user operation conditions> In step S23, the control unit 11 sets the resource amount according to the user operation conditions. That is, the resource ratio determination unit 115 of the control unit 11 determines the resource ratio between the CPU and the offload device. Then, the resource amount setting unit 116 refers to the information in the facility resource DB 132 based on the determined resource ratio, and sets the resource amount of the CPU and the offload device so as to satisfy the user operation conditions (described later with reference to FIG. 5).

[0071] <Step S24: Deploy final binary files to production environment> In step S24, the production environment deployment unit 120 determines a pattern that specifies the final offload area, and deploys it to the production environment for the user.

[0072] <Step S25: Extract performance test cases and run automatically> In step S25, after arranging the executable file, the performance measurement test extraction execution unit 121 extracts performance test items from the test case DB 131 and automatically executes the extracted performance tests in order to show the performance to the user.

[0073] <Step S26: Provide price and performance to a user to judge> In step S26, the user providing unit 122 presents information such as price and performance based on the performance test results to the user. The user decides whether to start using the service for which a fee is charged based on the presented information such as price and performance.

[0074] The above steps S11 to S26 are assumed to be performed, for example, in the background of the user's use of the service, for example, during the first day of temporary use.

[0075] As described above, when applied to the elemental technology of the environment adaptive software, the control unit (automatic offload function unit) 11 of the offload server 1 extracts an area to be offloaded from the source code of the application program used by the user and outputs an intermediate language in order to offload functional processing (steps S11 to S15). The control unit 11 places and executes an executable file derived from the intermediate language on the verification machine 14, and verifies the offload effect (steps S21 to S22). After repeating the verification and determining an appropriate offload area, the control unit 11 deploys the executable file in the production environment that is actually provided to the user, and provides it as a service (steps S23 to S26).

[0076] [Automatic GPU offloading using GA] The GPU automatic offload is a process in which steps S12 to S22 in FIG. 2 are repeated for the GPU to obtain the offload code to be finally deployed in step S23.

[0077] GPUs generally do not guarantee latency, but are devices that are suited to increasing throughput through parallel processing. Typical applications include encryption processing, image processing for camera image analysis, and machine learning processing for analyzing large amounts of sensor data, which involve a lot of repetitive processing. Therefore, the aim is to speed up applications by automatically offloading repetitive statements to the GPU.

[0078] However, as described in the section on prior art, appropriate parallel processing is necessary to increase speed. In particular, when using a GPU, due to memory transfer between the CPU and GPU, performance is often not achieved unless the data size and number of loops are large. Also, depending on the timing of memory data transfer, the combination of individual loop statements (repetitive statements) that can be accelerated in parallel may not be the fastest. For example, if there are 10 "for" statements (repetitive statements), and numbers 1, 5, and 10 can be accelerated compared to the CPU, the combination of numbers 1, 5, and 10 will not necessarily be the fastest.

[0079] In order to specify appropriate parallel regions, there are attempts to optimize parallel execution of for statements through trial and error using the PGI compiler. However, trial and error requires a lot of work, and when providing such a service, it slows down the start of user use and increases costs.

[0080] Therefore, in this embodiment, an appropriate offload area is automatically extracted from a general-purpose program that does not assume parallelization. For this purpose, parallelizable for statements are checked first, and then performance verification trials are repeated in a verification environment using GA for the parallelizable for statements to search for an appropriate area. By narrowing down to parallelizable for statements and then retaining and recombining parallel processing patterns that can be accelerated in the form of gene parts, it is possible to efficiently search for patterns that can be accelerated from a huge number of possible parallel processing patterns.

[0081] [Search image of control unit (automatic offload function unit) 11 using Simple GA] FIG. 3 is a diagram showing a search image of the process of the control unit (automatic offload function unit) 11 by the Simple GA and a gene sequence mapping of a for statement. GA is a combinatorial optimization method that mimics the evolutionary process of living organisms. The GA flowchart is as follows: Initialization → Evaluation → Selection → Crossover → Mutation → Termination decision. In this embodiment, we use Simple GA, which is a simplified version of GA. Simple GA is a simplified GA that uses only 1 and 0 as genes, roulette wheel selection, one-point crossover, and mutation by reversing the value of one gene.

[0082] <Initialization> In the initialization, after checking whether all for statements in the application code can be parallelized, parallelizable for statements are mapped to gene arrays. If GPU processing is used, the value is set to 1, and if not, the value is set to 0. A specified number of individuals M is prepared for genes, and 1 or 0 is randomly assigned to each for statement. Specifically, the control unit (automatic offload function unit) 11 (see Fig. 1) obtains the application code 125 (see Fig. 2) used by the user, and checks whether or not for statements can be executed in parallel from the code patterns 141 of the application code 125, as shown in Fig. 3. As shown in Fig. 3, if three for statements are found from the code pattern 141 (see symbol b in Fig. 3), one digit is assigned to each for statement, in this case three digits of 1 or 0 are assigned to the three for statements. For example, 0 is used for processing by the CPU, and 1 is used for output to the GPU. However, at this stage, 1 or 0 is assigned randomly. The code corresponding to the gene length is three digits, and the three-digit code for gene length is 2 3 The pattern is, for example, 100, 101, .... In Fig. 3, circles (○ marks) in the code pattern 141 are shown as an image of the code.

[0083] <Evaluation> In the evaluation, deployment and performance measurement are performed (see symbol c in FIG. 3). That is, the performance measurement unit 118 (see FIG. 1) compiles the code corresponding to the gene, deploys it to the verification machine 14, and executes it. The performance measurement unit 118 performs benchmark performance measurement. The fitness of genes of patterns with good performance (parallel processing patterns) is increased.

[0084] <Select> In the selection, high performance code patterns are selected based on the fitness (see symbol d in FIG. 3). The performance measurement unit 118 (see FIG. 1) selects a specified number of genes with high fitness based on the fitness. In this embodiment, roulette selection according to the fitness and elite selection of the genes with the highest fitness are performed. FIG. 3 shows, as a search image, that the number of circles (◯) in Select code patterns 142 has been reduced to three.

[0085] <Crossover> In crossover, some genes are exchanged at a certain point between selected individuals at a certain crossover rate Pc to create offspring individuals. The genes of a roulette-selected pattern (parallel processing pattern) are crossed with those of other patterns. The position of the one-point crossover is arbitrary. For example, crossover is performed at the second digit of the above three-digit code.

[0086] <Mutation> In order to avoid local solutions, mutation is introduced. However, in order to reduce the amount of calculation, mutation may not be performed. In mutation, each value of an individual's genes is changed from 0 to 1 or from 1 to 0 at a certain mutation rate Pm.

[0087] <End Judgment> As shown in Figure 3, generate next generation code patterns after crossover & mutation (see symbol e in Figure 3). In the termination judgment, the process is terminated after repeating the process for a specified number of generations T, and the gene with the highest fitness is taken as the solution. For example, performance is measured and the three fastest ones, 101, 010, and 001, are selected. These three are then recombined using GA in the next generation to create a new pattern (parallel processing pattern), for example 101 (one example). At this point, a mutation is automatically introduced into the recombined pattern, such as changing 0 to 1. The above is repeated to find the fastest pattern. A designated generation (for example, the 20th generation) is decided, and the pattern remaining in the final generation is designated as the final solution.

[0088] <Deployment> The parallel processing pattern with the highest processing performance that corresponds to the gene with the highest fitness is then redeployed into a production environment and provided to the user.

[0089] This section explains the case where there are a significant number of "for" statements (loop statements; repetitive statements) that cannot be offloaded to the GPU. For example, even if there are 200 "for" statements, only about 30 can be offloaded to the GPU. Here, we will exclude those that will result in an error, and perform GA on these 30 statements.

[0090] For example, OpenACC, a specification for GPU processing of C / C++ code, has compilers that allow you to specify the directive #pragma acc kernels to extract bytecode for the GPU and execute it to enable GPU offloading. For Python and Java, you can specify GPU processing using CUDA or Java Lambda.

[0091] Also, when C / C++ is used, the C / C++ code is analyzed to find for statements. When a for statement is found, it is written to the for statement using #pragma acc kernels, which is a parallel processing syntax in OpenACC. In detail, for statements are inserted one by one into an empty #pragma acc kernels and compiled. If an error occurs, that for statement is excluded as it cannot be processed by the GPU in the first place. In this way, the remaining for statements are found. The one that does not produce an error is then taken as the length (gene length). If there are five for statements without errors, the gene length is 5, and if there are 10 for statements without errors, the gene length is 10. Note that parallel processing is not possible when there is a data dependency such that the previous processing is used for the next processing. The above is the preparation stage. Next, GA processing will be performed.

[0092] A code pattern with a gene length corresponding to the number of for statements is obtained. First, parallel processing patterns 100, 010, 001, ... are randomly assigned. Then, GA processing is performed and compilation is performed. At this time, an error may occur even though the for statements can be offloaded. This is the case when the for statements are hierarchical (GPU processing is possible if either one is specified). In this case, the for statement that caused the error can be left. Specifically, there is a method to make it take longer to process, causing a timeout.

[0093] Deploy it on the verification machine 14 and benchmark it - for example, if it is image processing, benchmark it with that image processing, and evaluate the fitness as higher as the processing time is shorter. For example, the inverse of the processing time - 1 is assigned to a processing time of 10 seconds, 0.1 to a processing time of 100 seconds, and 10 to a processing time of 1 second. Those with high adaptability are selected, for example, 3 to 5 are selected from 10, and a new code pattern is created by rearranging them. During the creation process, the same code pattern as before may be created. In this case, since it is not necessary to perform the same benchmark, the same data as before is used. In this embodiment, the code pattern and its processing time are stored in the storage unit 13.

[0094] The above describes the search image of the control unit (automatic offload function unit) 11 using the Simple GA.

[0095] Below, we will explain a method for offloading loop statements in application software to a GPU. [Flowchart for offloading loop statements] 4A-B are flowcharts of the offloading of loop statements by the offload server 1, and FIG. 4A and FIG. 4B are connected by a connector.

[0096] <Receive application code and operating conditions> In step S100, the control unit 11 (see FIG. 1) receives an application code and an operation condition. The operation condition is, for example, a user operation condition, and the control unit 11 (see FIG. 1) acquires the operation condition by referring to information in the facility resource DB 132 (see FIG. 1).

[0097] <Code Analysis> In step S101, the application code analysis unit 112 (see FIG. 1) performs a code analysis of an application program.

[0098] <Loop statement identification> In step S102, the parallel processing specification unit 114 (see FIG. 1) identifies loop statements and reference relationships in the application program.

[0099] <Loop statement loop count> In step S103, the parallel processing specification unit 114 runs a benchmark tool to grasp the number of times the loop statement is looped and allocates a threshold value.

[0100] <Parallel processing of loop statements> In step S104, the parallel processing specification unit 114 checks whether each loop statement can be processed in parallel.

[0101] <Repeat loop statement> The control unit (automatic offload function unit) 11 repeats the processes of steps S106-S107 between the loop start point of step S105 and the loop end point of step S108 for the number of loop statements. In step S106, the parallel processing specification unit 114 specifies GPU processing for each loop statement using a language-specific method, and compiles or interprets the loop statement. In step S107, if an error occurs, the parallel processing designation unit 114 deletes the GPU processing designation from the corresponding for statement. In step S109, the parallel processing specification unit 114 counts the number of "for" statements for which no compilation error occurs, and sets the count as the gene length.

[0102] <Preparation of designated population patterns> Next, the parallel processing designation unit 114 prepares a designated number of gene sequences as initial values. Here, they are created by randomly allocating 0 and 1. In step S110, the parallel processing designation unit 114 maps the code of the application program to genes. A designated population pattern is prepared by mapping a gene sequence in which 0s and 1s are randomly assigned to genes. According to the prepared gene sequence, a directive that specifies parallel processing when the gene value is 1 is inserted into the code of the application program (see, for example, the #pragma directive in Figure 3).

[0103] The control unit (automatic offload function unit) 11 repeats the processing of steps S112-S119 for a designated number of generations between the loop start point of step S111 and the loop end point of step S120. In addition, in the above-mentioned repetition of the specified number of generations, the processing of steps S113-S116 is further repeated a specified number of individuals between the loop start point of step S112 and the loop end point of step S117. That is, within the repetition of the specified number of generations, the repetition of the specified number of individuals is processed in a nested state.

[0104] <Data transfer specification> In step S113, the data transfer designation unit 113 designates a data transfer based on the variable reference relationship using a method appropriate for the language.

[0105] <Compile> In step S114, the parallel processing pattern creation unit 117 (see FIG. 1) compiles or interprets the code specified by the directive according to the gene pattern on the GPU processing platform. That is, the parallel processing pattern creation unit 117 compiles or interprets the created application program code with a PGI compiler on the verification machine 14 equipped with a GPU. Here, a compilation error may occur when multiple nested for statements are specified in parallel, etc. In this case, it is treated the same as when the processing time during performance measurement times out.

[0106] In step S115, the performance measurement unit 118 (see FIG. 1) deploys the executable file to the verification machine 14 equipped with a CPU-GPU. In step S116, the performance measurement unit 118 executes the arranged binary file and measures the benchmark performance when offloaded.

[0107] Here, in the intermediate generation, genes with the same pattern as before are not measured, and the same value is used. In other words, if a gene with the same pattern as before is generated during the GA process, compilation or performance measurement is not performed for that individual, and the same measured value as before is used. In step S118, the executable file creation unit 119 (see FIG. 1) evaluates the individuals with shorter processing times so that they have a higher fitness, and selects the individuals with the highest performance.

[0108] In step S119, the executable file creation unit 119 performs crossover and mutation processes on the selected individuals to create the next generation individuals. The next generation individuals are subjected to compilation, performance measurement, fitness setting, selection, crossover, and mutation processes. That is, after benchmark performance is measured for all individuals, the fitness of each gene sequence is set according to the benchmark processing time.The individuals to be kept are selected according to the fitness set.The selected individuals are subjected to GA processing including crossover, mutation, and direct copying to create the next generation population.

[0109] In step S121, the executable file creation unit 119 determines, after the GA process for the designated number of generations is completed, the C / C++ code corresponding to the gene sequence with the highest performance (parallel processing pattern with the highest performance) as a solution.

[0110] <GAのパラメータ> The above-mentioned number of individuals, number of generations, crossover rate, mutation rate, fitness setting, and selection method are parameters of the GA. The parameters of the GA may be set, for example, as follows. The parameters and conditions for the Simple GA to be executed can be, for example, as follows: Gene length: Number of parallelizable loop statements Number of individuals M: gene length or less Number of generations T: gene length or less Conformity: (Processing time) -1 / 2 With this setting, the shorter the benchmark processing time, the higher the compatibility. -1 / 2 By doing so, it is possible to prevent the fitness of a specific individual with a short processing time from becoming too high, narrowing the search range. Also, if the performance measurement does not end within a certain time, a timeout is set and the fitness is calculated assuming a processing time of 1000 seconds or the like (long time). This timeout time can be changed according to the performance measurement characteristics. Selection: Roulette selection However, elite preservation is also performed in which the genes with the highest fitness in one generation are preserved in the next generation without undergoing crossover or mutation. Crossover rate Pc:0.9 Mutation rate Pm: 0.05

[0111] In this embodiment, applications that have many loops and take a long time to execute are identified in advance using gcov, gprof, etc., and offloading is attempted. This makes it possible to find applications that can be efficiently accelerated.

[0112] In order to search for the offload part in a shorter time, it is possible to measure the performance in parallel for the number of individuals on multiple verification machines. Adjusting the timeout time according to the application program can also shorten the time. For example, if the offload process takes twice as long as the execution time on the CPU, it can be set as a timeout. In addition, the more individuals and the number of generations, the higher the possibility of finding a high-performance solution. However, when maximizing each parameter, it is necessary to compile and perform performance benchmarking for the number of individuals x the number of generations. For this reason, it takes time to start using the production service. In this embodiment, the GA is performed with a small number of individuals and the number of generations, but by setting the crossover rate Pc to a high value of 0.9 and searching a wide range, a solution with a certain level of performance can be found quickly.

[0113] [Flowchart for setting resource ratios and resource amounts] Fig. 5 is a flowchart for setting the resource ratio and resource amount added after a GPU or FPGA offload attempt. The flowchart shown in Fig. 5 is executed after the GPU offload attempt shown in Fig. 4A-B, and also after the GPU and FPGA offload attempts shown in Fig. 7 and Fig. 8 described later.

[0114] In step S51, the resource ratio determination unit 115 acquires the user operation conditions, the test case CPU processing time, and the offload device processing time. The user operation conditions are specified by the user when the user specifies the code to be offloaded. The resource amount setting unit 116 uses the user operation conditions when determining the resource amount by referring to the information in the facility resource DB 132.

[0115] <Processing of resource ratio determination unit 115> In step S52, the resource ratio determination unit 115 determines the ratio between the processing time of the CPU and the offload device (the test case CPU processing time and the offload device processing time) as the resource ratio based on the performance measurement result.

[0116] As described in Fig. 3 and Fig. 4, by this automatic offloading, the performance measurement result in the verification environment is already obtained at the time of code conversion. Using this performance measurement result, the resource ratio determination unit 115 determines the resource ratio between the CPU and the offload device. Specifically, it determines an appropriate resource ratio for the ratio of the processing time of the CPU and the offload device in the verification environment. For example, if the test case processing time in the verification environment is CPU processing: 10 seconds, GPU processing: 5 seconds, the resource ratio is CPU:GPU = 2:1.

[0117] The resource ratio determination unit 115 determines a resource ratio so that the processing times of the CPU and the offload device are of the same order. By determining the resource ratio so that the processing times of the CPU and the offload device are of the same order, the processing times of the CPU and the offload device can be made uniform, and the resource amount can be appropriately set even in a mixed environment where the CPU and accelerator are GPU, FPGA, many-core CPU, etc.

[0118] When the difference in processing time between the CPU and the offload device is equal to or greater than a predetermined threshold, the resource ratio determination unit 115 sets the resource ratio to a predetermined upper limit value. In other words, when the difference between the processing time of the CPU and the offload device in the verification environment is, for example, 10 times or more, setting the resource ratio to 10 times or more leads to a deterioration in cost performance. In this case, for example, the resource ratio is set to an upper limit of 5:1 (the upper limit value is a resource ratio of 5:1 in processing time). By setting an upper limit on the resource ratio, a significant increase in the number of VMs can be prevented.

[0119] <Processing of resource amount setting unit 116> In step S53, the resource amount setting unit 116 sets the resource amount based on the user operation conditions and the appropriate resource ratio. That is, the resource amount setting unit 116 determines the resource amount while keeping the resource ratio as much as possible so as to satisfy the cost conditions specified by the user.

[0120] The resource amount setting unit 116 maintains an appropriate resource ratio and sets the maximum resource amount that satisfies the user's operational conditions. As a specific example, it is assumed that the appropriate resource ratio is 2:1, with 1000 yen / month for CPU1VM and 4000 yen / month for GPU, and the user has a monthly budget of 10000 yen or less. In this case, 2 CPUs and 1 GPU are secured and placed in the commercial environment.

[0121] If the user operation conditions are not satisfied even with the minimum resource amount while maintaining the resource ratio, the resource amount setting unit 116 breaks the resource ratio and sets the resource amount of the CPU and offload device so as to satisfy the cost conditions. As a specific example, it is assumed that the appropriate resource ratio is 2:1, with 1000 yen / month for the CPU1VM and 4000 yen / month for the GPU, and the user has a monthly budget of 5000 yen or less. In this case, since the user budget is insufficient, the resource ratio cannot be maintained, but the resource amount of the CPU and offload device is set smaller, that is, 1 CPU and 1 GPU are secured and arranged.

[0122] After completing the process of step S53 above and reserving and allocating resources in the commercial environment, the automatic verification described in Fig. 2 is executed to check the performance and cost before the user uses it. This makes it possible to reserve resources in the commercial environment, and after automatic verification, present the performance and cost to the user.

[0123] <Summary of resource ratio and resource amount settings> In order to optimize the resource ratio, the performance measurement results when determining the offload pattern solution are used. For implementation, the resource ratio is determined based on the test case processing time so that the CPU and GPU processing times are of the same order of magnitude. For example, if the test case processing time is CPU processing: 10 seconds, GPU processing: 5 seconds, the CPU resources are considered to be double the processing time, so the resource ratio is 2:1. Note that since the number of virtual machines, etc. is an integer, the resource ratio is rounded off to an integer ratio when calculating from the processing time.

[0124] Once the resource ratio has been determined, the next step is to set the amount of resources to be used when placing applications in a commercial environment. In the implementation, the resource amount is determined by keeping the resource ratio as much as possible and determining the number of VMs, etc., so as to satisfy the cost requirements specified by the user when requesting offloading. Specifically, the number of VMs, etc. is selected to be the maximum value while keeping the resource ratio within the cost range.

[0125] For example, for CPU, 1 VM costs 1,000 yen / month and 4,000 yen / month for GPU, with a resource ratio of 2:1, and if the user has a monthly budget of less than 10,000 yen, 2 CPUs and 1 GPU are secured. Also, if the resource ratio cannot be kept within the cost range, start with 1 CPU and 1 GPU, and set the resource amount to get as close to the appropriate resource ratio as possible. For example, if the monthly budget is less than 5,000 yen, the resource ratio cannot be kept, but 1 CPU and 1 GPU are secured. Once the resource amount is set, the implementation allocates CPU and GPU resources, for example using the virtualization features of Xen Server.

[0126] Second Embodiment The present invention is characterized by the setting of resource ratios and resource amounts in automatic offloading. In the second embodiment, the setting of the resource ratio and the resource amount in the function block offloading will be described. First, the function block offloading will be described. The overall configuration and operation of the functional block offload will be described with reference to FIGS.

[0127] 6 is a functional block diagram showing a configuration example of an offload server 200 according to the second embodiment of the present invention. The same components as those in FIG. 1 are given the same reference numerals and the description of the overlapping parts will be omitted. The offload server 200 is a device that automatically offloads specific processing of an application program to an accelerator.

[0128] As shown in FIG. 6, the offload server 200 includes a control unit 210, an input / output unit 12, a storage unit 130, and a verification machine 14 (accelerator verification device).

[0129] The input / output unit 12 is composed of a communication interface for transmitting and receiving information between each device, etc., and an input / output interface for transmitting and receiving information between input devices such as a touch panel and a keyboard, and output devices such as a monitor.

[0130] The storage unit 130 is composed of a hard disk, flash memory, RAM, etc., and temporarily stores programs (offload programs) for executing each function of the control unit 210, and information necessary for processing by the control unit 210 (e.g., intermediate language file 133).

[0131] The storage unit 13 includes a code pattern database (DB) 230 (described later), a test case DB 131, a facility resource DB 132, and an intermediate language file 133.

[0132] The test case DB 131 stores performance test items. The test case DB 131 stores information for performing tests to measure the performance of applications to be accelerated. For example, in the case of a deep learning application for image analysis processing, the test items are sample images and the test items for executing the images.

[0133] The verification machine 14 includes a CPU (Central Processing Unit), a GPU, and an FPGA as a verification environment for the environment adaptive software.

[0134] <Code pattern DB230> GPU library, IP core storage The code pattern DB 230 stores libraries and IP cores (described later) that can be offloaded to a GPU, FPGA, etc. That is, for <Process B-1> described later, the code pattern DB 230 holds a specific library, a library for a GPU (GPU library) that accelerates a function block, an IP core for an FPGA (IP core), and related information. For example, the code pattern DB 230 holds a library list (external library list) for arithmetic calculations such as FFT, etc.

[0135] · CUDA library storage The code pattern DB230 stores, as a GPU library, for example, a CUDA library and a library usage procedure for using the CUDA library. That is, in <Process C-1> described later, when a library or IP core to be replaced is implemented in a GPU or FPGA and connected to a host side (CPU) program, the library usage procedure is also registered and used according to the procedure. For example, in the CUDA library, the procedure for using the CUDA library from a C language code is published together with the library, so the library usage procedure is also registered in the code pattern DB230.

[0136] - Class and structure memory The code pattern DB 230 stores classes or structures of processes that will be written in a similar manner when calculations are performed on the host. That is, in <Process B-2> described later, in order to detect functional processes other than unregistered library calls, classes, structures, etc. are detected from the definition description of the source code by syntax analysis. For <Process B-2> described later, the code pattern DB 230 registers classes or structures of processes that will be written in a similar manner when calculations are performed on the host. The existence of libraries or IP cores that speed up the functional processes of the classes or structures is detected by a similarity detection tool (described later).

[0137] · OpenCL code storage The code pattern DB 230 stores OpenCL code as IP core-related information. By storing the OpenCL code in the code pattern DB 230, the connection between the CPU and the FPGA using the OpenCL interface and the implementation of the IP core in the FPGA can be performed from the OpenCL code via a high-level synthesis tool (described later) of an FPGA vendor such as Xilinx or Intel.

[0138] <Control unit 210> The control unit 210 is an automatic offloading function that controls the entire offload server 200, and is realized by a CPU (not shown) expanding a program (offload program) stored in the storage unit 130 into a RAM and executing it.

[0139] In particular, the control unit 210 detects functional blocks within existing program code for a CPU that can be offloaded to an FPGA or GPU to speed up processing, and performs offload processing of the functional blocks to speed up processing by replacing the detected functional blocks with libraries for a GPU or IP cores for an FPGA, etc.

[0140] The control unit 210 includes an application code specification unit 111, an application code analysis unit 112, a replacement function detection unit 213, a replacement processing unit 214, a resource ratio determination unit 115, a resource amount setting unit 116, an offload pattern creation unit 215, a performance measurement unit 118, an executable file creation unit 119, a production environment deployment unit 120, a performance measurement test extraction and execution unit 121, and a user provision unit 122.

[0141] <Application code designation section 111> The application code designation unit 111 designates the input application code. Specifically, the application code designation unit 111 passes the application code described in the received file to the application code analysis unit 112.

[0142] <Application Code Analysis Unit 112> In <Process A-1> described later, the application code analysis unit 112 analyzes the source code of the application program and detects calls to external libraries contained in the source code. Specifically, the application code analysis unit 112 uses a syntax analysis tool such as Clang to analyze the source code to analyze library calls and functional processing contained in the code, along with loop statement structures, etc.

[0143] The code analysis described above is difficult to generalize because it requires analysis that assumes the device to be offloaded. However, it is possible to grasp the code structure, such as loop statements and variable reference relationships, and to determine that a function block performs FFT processing and that it calls a library that performs FFT processing. It is difficult for the offload server to automatically determine the function block. This can also be grasped by using a similarity detection tool such as Deckard to determine the similarity. Here, Clang is a tool for C / C++, but it is necessary to choose a tool that suits the language to be analyzed.

[0144] Furthermore, the application code analysis unit 112 detects class or structure code from the source code in <Process A-2> described later.

[0145] <Replacement function detection unit 213> In <Process B-1> described later, the replacement function detection unit 213 uses the detected call as a key to acquire a GPU library and an IP core from the code pattern DB 230. Specifically, the replacement function detection unit 213 uses the library name as a key to compare the detected library call with the code pattern DB 230, thereby extracting offloadable processes that can be offloaded to a GPU or FPGA.

[0146] Here, the code pattern DB 230 stores, as a GPU library, for example, a CUDA library and a library usage procedure for using the CUDA library. Then, the replacement function detection unit 213 acquires the CUDA library from the code pattern DB 230 based on the library usage procedure.

[0147] In <Process B-2> described later, the replacement function detection unit 213 uses the definition description code of the detected class or structure (described later) as a key to acquire a GPU library and an IP core from the code pattern DB 230. Specifically, the replacement function detection unit 213 uses a similarity detection tool that detects copied code and definition description code that has been changed after copying to extract, for a class or structure included in the replacement source code, a GPU library and an IP core that can be offloaded to a GPU or FPGA that are linked to a similar class or structure and managed from the code pattern DB 230.

[0148] <Replacement processing unit 214> In <Process C-1> described later, the replacement processing unit 214 replaces the processing description of the source of the application program source code with the processing description of the library and IP core of the replacement destination acquired by the replacement function detection unit 213. Specifically, the replacement processing unit 214 replaces the extracted offloadable processing with a library for GPU, an IP core for FPGA, or the like. The replacement processor 214 also offloads the processing descriptions of the replaced libraries and IP cores to a GPU, FPGA, or the like as functional blocks to be offloaded. Specifically, the replacement processor 214 offloads the functional blocks replaced by libraries for GPUs or IP cores for FPGAs by creating an interface with the CPU program. The replacement processor 214 outputs an intermediate language file 133 such as CUDA or OpenCL.

[0149] In the process C-2 described below, the replacement processing unit 214 replaces the processing description of the source code of the application program with the processing description of the acquired library and IP core, and notifies the user of the number or type of arguments or return values ​​if the source and destination differ.

[0150] <Offload pattern creation unit 215> The offload pattern creation unit 215 creates one or more offloading patterns. Specifically, it creates an interface with the host program, and tries whether or not to offload through performance measurement in a verification environment, thereby extracting an offloading pattern that provides higher speed.

[0151] Here, the code pattern DB 230 stores OpenCL code as information related to the IP core. When offloading to a PLD such as an FPGA, the offload pattern creation unit 215 connects the host and the PLD using an OpenCL interface based on the OpenCL code, and implements the IP core in the PLD based on the OpenCL code.

[0152] This section describes the interface description between the kernel program and the host program in accordance with the OpenCL API. Note that the following explanation corresponds to a specific example of <Process C-1> in [Process C] (matching the interface with the host side) described later.

[0153] A kernel created according to the OpenCL C language syntax is executed on a device (e.g., FPGA) by a host (e.g., CPU) program created using the OpenCL C language runtime API. The part where the kernel function hello() is called from the host side is a call to clEnqueueTask(), one of the OpenCL runtime APIs. The basic flow of OpenCL initialization, execution, and termination described in the host code is the following steps 1 to 13. Among these steps 1 to 13, steps 1 to 10 are the procedure (preparation) until the kernel function hello() is called from the host side, and step 11 is the execution of the kernel.

[0154] 1. Platform Specific The platform on which OpenCL runs is identified using the function clGetPlatformIDs(), which provides platform identification functionality defined in the OpenCL runtime API.

[0155] 2. Device Identification The device such as the GPU to be used on the platform is identified using the function clGetDeviceIDs() that provides a device identification function defined in the OpenCL runtime API.

[0156] 3. Creating a context An OpenCL context, which serves as the execution environment for running OpenCL, is created using the function clCreateContext(), which provides a context creation function defined in the OpenCL runtime API.

[0157] 4. Create a command queue A command queue is created in preparation for controlling the device using the clCreateCommandQueue() function, which provides command queue creation functionality defined in the OpenCL runtime API. In OpenCL, the host issues commands to the device (such as issuing kernel execution commands and memory copy commands between the host and device) through the command queue.

[0158] 5. Creating a memory object A memory object that allows the host to reference the memory object is created using the function clCreateBuffer(), which provides the functionality to allocate memory on the device defined in the OpenCL runtime API.

[0159] 6. Loading the kernel file The execution of the kernel executed on the device is controlled by the program on the host side. For this reason, the host program must first load the kernel program. A kernel program can be binary data created by the OpenCL compiler or source code written in the OpenCL C language. This kernel file is loaded (description omitted). Note that the OpenCL runtime API is not used when loading the kernel file.

[0160] 7. Creating a program object In OpenCL, a kernel program is recognized as a program object. This procedure is called program object creation. Create a program object that allows the host to reference the memory object using clCreateProgramWithSource(), a function defined in the OpenCL runtime API that provides the program object creation function. To create a program object from a compiled binary sequence of a kernel program, use clCreateProgramWithBinary().

[0161] 8. Build The program object registered as source code is built using the OpenCL C compiler and linker. Build a program object using the function clBuildProgram(), which executes the build by the OpenCL C compiler and linker defined in the OpenCL runtime API. Note that if you create a program object from a compiled binary string using clCreateProgramWithBinary(), this compilation step is not necessary.

[0162] 9. Creating a kernel object Create a kernel object using the function clCreateKernel(), which provides the kernel object creation function defined in the OpenCL runtime API. Since one kernel object corresponds to one kernel function, specify the name of the kernel function (hello) when creating the kernel object. Also, if multiple kernel functions are written as one program object, one kernel object corresponds one-to-one to one kernel function, so call clCreateKernel() multiple times.

[0163] 10. Kernel arguments setting The kernel arguments are set using the clSetKernel() function, which provides the ability to provide arguments to the kernel defined in the OpenCL runtime API (pass values ​​to arguments held by the kernel function). Now that steps 1 to 10 above are complete, we move on to step 11, where the kernel is executed on the device from the host side.

[0164] 11. Kernel execution Kernel execution (submission to the command queue) acts on the device, and therefore is a queuing function for the command queue. Queue a command to execute the kernel hello on the device using the function clEnqueueTask(), which provides the kernel execution functionality defined in the OpenCL runtime API. After the command to execute the kernel hello is queued, it will be executed on an executable compute unit on the device.

[0165] 12. Reading from a memory object Data is copied from the device memory area to the host memory area using the function clEnqueueReadBuffer(), which provides the functionality for copying data from device memory to host memory defined in the OpenCL runtime API. Data is also copied from the host memory area to the device memory area using the function clEnqueueWrightBuffer(), which provides the functionality for copying data from the host to device memory. Note that these functions act on the device, so the copy command is queued in the command queue once before data copying begins.

[0166] 13. Releasing Objects Finally, release the various objects that you have created so far. Above, we have explained device execution of kernels written in accordance with the OpenCL C language.

[0167] <Performance measurement section 118> The performance measurement unit 118 compiles an application program of the created processing pattern, places it in the verification machine 14, and executes processing for performance measurement when offloaded to a GPU, FPGA, or the like. The performance measurement unit 118 includes a binary file deployment unit (Deploy binary files) 118a. The binary file deployment unit 118a deploys (places) binary files derived from the intermediate language in the verification machine 14 including a GPU and / or an FPGA.

[0168] The performance measurement unit 118 executes the placed binary file, measures the performance when offloaded, and returns the performance measurement result to the binary file placement unit 118a. In this case, the performance measurement unit 118 attempts to measure performance based on the extracted intermediate language using the extracted different processing pattern.

[0169] A specific example of performance measurement will be described. The offload pattern creation unit 215 creates a processing pattern for offloading a functional block that can be offloaded to a GPU or FPGA, and the intermediate language of the created processing pattern is compiled by the executable file creation unit 119. The performance measurement unit 118 measures the performance of the compiled program ("first performance measurement").

[0170] The offload pattern creation unit 215 then creates a list of processing patterns that have been measured and have higher performance than the CPU. The offload pattern creation unit 215 creates a new processing pattern for offloading by combining the processing patterns in the list. The offload pattern creation unit 215 creates the combined offload processing pattern and an intermediate language, and the executable file creation unit 119 compiles the intermediate language. The performance measurement unit 118 measures the performance of the compiled program ("second performance measurement").

[0171] <Executable File Creation Section 119> The executable file creation unit 119 compiles the intermediate language of the processing pattern to be offloaded to create an executable file. Based on the performance measurement results obtained by repeating a certain number of times, the executable file creation unit 119 selects the processing pattern with the highest processing performance from one or more processing patterns, compiles the processing pattern with the highest processing performance, and creates the final executable file.

[0172] The function block offload processing of the offload server 200 configured as above will be described below.

[0173] The outline of the above-mentioned offloading process of the functional blocks and points to consider will be described below. With regards to FPGAs, hardware circuit design can take a great deal of time, so functions that have already been designed are often made reusable in the form of IP cores (Intellectual Property Cores). IP cores are partial circuit information for constructing semiconductors such as FPGAs, ICs, and LSIs, and are organized by function. Typical examples of IP core functions include encryption / decryption processing, arithmetic operations such as FFT (Fast Fourier Transform), image processing, and audio processing. Many IP cores require a license fee, but some are provided free of charge.

[0174] In the second embodiment, for FPGA, IP cores are used for automatic offloading. For GPU, although they are not called IP cores, FFT, linear algebra operations, etc. are typical functions, and cuFFT, cuBLAS, etc. implemented using CUDA are provided free of charge as libraries for GPU. In the second embodiment, these libraries are used for GPU.

[0175] In the second embodiment, when existing program code created for a CPU contains functional blocks such as FFT processing that can be accelerated by offloading them to a GPU or FPGA, the code is accelerated by replacing them with a library for a GPU or an IP core for an FPGA.

[0176] [Function block offload processing details] For offloading of function blocks, three elements must be considered: detection of function blocks (hereinafter referred to as "Process A"), detection of whether the function block has an existing library / IP core, etc. for offloading (hereinafter referred to as "Process B"), and consistency of the interface with the host side when replacing the function block with the library / IP core, etc. (hereinafter referred to as "Process C"). Following the considerations of the above three elements, the offloading process of function blocks will be described in detail.

[0177] [Process A] (detection of function blocks) "Processing A" (detection of function blocks) is divided into <Processing A-1>, which calls a function in a library and regards the function call in the library as a function block, and <Processing A-2>, which detects a class, structure, etc. and regards it as a function block if the function call is in an unregistered library. That is, <Processing A-1> detects a function call in an existing library and regards it as a function block, and <Processing A-2> extracts a function block from a class or structure if a function block is not detected in <Processing A-1>.

[0178] <Process A-1> The application code analysis unit 112 uses syntax analysis to detect whether a function call is made from the source code to an external library. The details are as follows. The code pattern DB 230 holds a library list for arithmetic calculations such as FFT. The application code analysis unit 112 performs syntax analysis on the source code, and compares it with the library list held by the code pattern DB 230 to detect whether a function call is made to an external library.

[0179] <Process A-2> In order to detect functional processes other than unregistered library calls as functional blocks, the application code analysis unit 112 detects functional processes of classes or structures from the definition description of the source code using syntax analysis. For example, the application code analysis unit 112 detects structures that are types that group together several variables defined using the struct of the C language, and classes in which the type of an instantiated object is a reference type for a structure that is a value type. The application code analysis unit 112 also detects classes that are used as substitutes for structures in Java (registered trademark), for example.

[0180] [Process B] (Detection of offloadable functions) [Processing B] (detection of offloadable functions) is divided into <Processing B-1>, which receives <Processing A-1> and refers to the code pattern DB 230 to obtain replaceable GPU libraries and IP cores, and <Processing B-2>, which receives <Processing A-2> and replaces the processing description of the application code to be replaced with the GPU library and IP core processing description to be replaced. That is, <Processing B-1> obtains replaceable GPU libraries and IP cores from the code pattern DB 230 using the library name as a key. <Processing B-2> detects replaceable GPU libraries and IP cores using codes such as classes and structures as a key, and replaces the processing description of the application code to be replaced with the GPU library and IP core processing description to be replaced.

[0181] As a prerequisite for process B, the code pattern DB 230 holds a library for GPUs and an IP core for FPGAs that accelerate specific libraries and function blocks, and related information. In addition, the code pattern DB 230 registers codes and executable files along with function names for the libraries and function blocks to be replaced.

[0182] <Process B-1> For the library call detected by the application code analysis unit 112 in <Process A-1>, the replacement function detection unit 213 searches the code pattern DB 230 using the library name as a key, and obtains a replaceable GPU library (a library for GPUs that can be accelerated) and an IP core for FPGA from the code pattern DB 230.

[0183] An example of <Process B-1> is given below. For example, if the processing to be replaced is 2D FFT processing, the replacement function detection unit 213 detects OpenCL code as FPGA processing for processing 2D FFT using the external library name as a key (host program, kernel program, etc.). The OpenCL code is stored in the code pattern DB 230.

[0184] For example, when the processing to be substituted is a 2D FFT processing, the substitution function detection unit 213 substitutes the function call in the cuFFT detected as the GPU library. The GPU library is stored in the code pattern DB 230.

[0185] <Process B-2> The replacement function detection unit 213 searches the code pattern DB 230 using the codes of classes, structures, etc. detected by the application code analysis unit 112 in <Process A-2> as a key, and acquires replaceable GPU libraries (libraries for GPUs that can be accelerated) and IP cores for FPGAs from the code pattern DB 230 using a similarity detection tool. The similarity detection tool is a tool that targets detection of copied code and code that has been modified after copying, such as Deckard. By using the similarity detection tool, the replacement function detection unit 213 can detect some processes that are written in a similar manner when calculated by a CPU, such as matrix calculation code, and processes that have been copied and modified by others. Note that the similarity detection tool does not target classes that have been newly created independently, as it is difficult to detect such classes.

[0186] An example of <Process B-2> is given below. The replacement function detection unit 213 searches for a similar class or structure registered in the code pattern DB 230 for a class or structure detected in the source CPU code by using a similarity detection tool such as Deckard. For example, if the source process (whose code is in Non-Patent Document 4, etc.) is a 2D FFT class, the class registered in the code pattern DB 230 as its similar class is the 2D FFT class. The code pattern DB 230 has registered therein IP cores and GPU libraries capable of offloading 2D FFT. Therefore, as in <Process B-1>, OpenCL code (host program, kernel program, etc.) and GPU libraries are detected for 2D FFT.

[0187] [Process C] (Interface matching with the host side) [Processing C] (matching the interface with the host side) includes <Processing C-1> and <Processing C-2>. <Processing C-1> receives <Processing B-1>, and replaces the processing description of the application code to be replaced with the GPU library and IP core processing description of the replacement destination, and also describes the interface processing for calling the GPU library and IP core. <Processing C-2> receives <Processing B-2>, and replaces the processing description of the application code to be replaced with the GPU library and IP core processing description of the replacement destination, and also describes the interface processing for calling the GPU library and IP core. Here, the description of the interface processing for calling the GPU library and IP core corresponds to "matching the interface with the host side".

[0188] <Process C-1> The replacement processor 214 replaces the source processing description of the application code with the destination GPU library and IP core processing description. The replacement processor 214 then writes interface processing for calling the GPU library and IP core (OpenCL API, etc.) and compiles the created pattern.

[0189] <Process C-1> will now be described in more detail. The replacement function detection unit 213 searches for a corresponding library or IP core in <Process B-1> for the library call detected in <Process A-1>. For this reason, the replacement processing unit 214 implements the library or IP core to be replaced in a GPU or FPGA, and performs interface processing to connect it to the host side (CPU) program.

[0190] Here, in the case of a library for GPU, a library such as CUDA is assumed, and a method for using the CUDA library from C language code is published together with the library. Therefore, the library usage method is also registered in the code pattern DB 230, and the replacement processing unit 214 replaces the processing description of the application code to be replaced with the GPU library to be replaced according to the library usage method registered in the code pattern DB 230, and performs a predetermined description such as calling a function to be used in the GPU library.

[0191] In the case of an IP core for FPGA, HDL (Hardware Description Language) and the like are assumed. In this case, OpenCL code is also held in the code pattern DB 230 as information related to the IP core. The replacement processing unit 214 can perform interface processing with the FPGA via a high-level synthesis tool (e.g., Xilinx Vivado, Intel HLS Compiler, etc.). For example, the replacement processing unit 214 connects a CPU and an FPGA using an OpenCL interface from the OpenCL code via the high-level synthesis tool. Similarly, the replacement processing unit 214 implements an IP core in an FPGA via a high-level synthesis tool of an FPGA vendor such as Xilinx or Intel.

[0192] <Process C-2> The replacement processing unit 214 replaces the processing description of the application code to be replaced with the GPU library and IP core processing description of the replacement destination. If the number and type of arguments and return values ​​are different between the replacement source and the replacement destination, the replacement processing unit 214 checks with the user, describes interface processing for calling the GPU library and IP core (OpenCL API, etc.), and compiles the created pattern. That is, in <Process C-2>, the replacement processing unit 214 searches for libraries and IP cores that can be accelerated in <Process B-2> for the classes, structures, etc. detected in <Process A-2>. Therefore, in <Process C-2>, the replacement processing unit 214 implements the corresponding libraries and IP cores in the GPU or FPGA.

[0193] <Process C-2> will now be described in more detail. In <Process C-1>, because it is a library or IP core that accelerates a specific library call, it is necessary to generate the interface part, but the number and type of arguments and return values ​​expected by the GPU, FPGA, and the host program match. However, in <Process B-2>, since it is judged based on similarity, there is no guarantee that basic parts such as the number and type of arguments and return values ​​match. Libraries and IP cores are existing know-how, and even if the number and type of arguments and return values ​​do not match, they cannot be changed frequently. For this reason, the user who requests offloading is asked whether the number and type of arguments and return values ​​of the original code will be changed to match the library or IP core. After confirmation and approval, an offload performance test is attempted.

[0194] Regarding type differences, if casting between float and double, etc. is all that is required, a process for casting can be added when creating a processing pattern, and performance measurement trials can begin without user confirmation. Also, if the number of arguments or return values ​​differs between the original program and the library or IP core, for example, arguments 1 and 2 are required in the CPU program and argument 3 is optional, and arguments 1 and 2 are required in the library or IP core, there is no problem with omitting optional argument 3. In such cases, the optional arguments may be automatically treated as absent when creating a processing pattern, without user confirmation. Note that if the number and types of arguments and return values ​​match exactly, processing similar to <Process C-1> may be performed.

[0195] [Function block offloading flowchart] Next, an outline of the operation of the offload server 200 for <<functional block offloading>> will be described with reference to FIG. 7 and FIG.

[0196] Flowcharts for <Process A-1>, <Process B-1>, and <Process C-1> FIG. 7 is a flowchart when the control unit (automatic offload function unit) 210 of the offload server 200 executes <Process A-1>, <Process B-1>, and <Process C-1> in the offload processing of <<Function block offload: common>>.

[0197] In step S200, the control unit 210 (see FIG. 6) receives an application code and an operating condition.

[0198] In step S201, the application code analysis unit 112 (see FIG. 6) analyzes the source code of the application program to be offloaded. Specifically, the application code analysis unit 112 uses a syntax analysis tool such as Clang to analyze the source code, including the loop statement structure and the like, as well as library calls and functional processing included in the code.

[0199] In step S202, the replacement function detection unit 213 (see FIG. 6) detects an external library call of the application program.

[0200] In step S203, the replacement function detection unit 213 acquires replaceable GPU libraries and FPGA IP cores using the library names as keys from the code pattern DB 230. Specifically, the replacement function detection unit 213 compares the recognized external library calls with the code pattern DB 230, and acquires the detected replaceable GPU libraries and IP cores as offloadable function blocks that can be offloaded to the GPU and FPGA.

[0201] In step S204, the replacement processing unit 214 replaces the processing description of the source of replacement in the source code of the application with the processing description of the GPU library and FPGA IP core of the replacement destination.

[0202] In step S205, the replacement processing unit 214 offloads the replaced processing descriptions of the GPU library and FPGA IP core to the GPU and FPGA as functional blocks to be offloaded.

[0203] In step S206, the replacement processing unit 214 describes interface processing for calling the GPU library and the FPGA IP core. In step S207, the execution file creation unit 119 compiles or interprets the created pattern.

[0204] In step S208, performance measurement unit 118 measures the performance of the created pattern in a verification environment ("first performance measurement"). In step S209, the execution file creation unit 119 creates a combination pattern for the pattern that was able to increase the speed during the first measurement.

[0205] In step S210, the execution file creation unit 119 compiles or interprets the created combination pattern. In step S211, the performance measurement unit 118 measures the performance of the created combination pattern in a verification environment ("second performance measurement").

[0206] In step S212, the production environment deployment unit 120 selects the pattern with the highest performance from the first and second measurements, and ends the processing of this flow.

[0207] Flowcharts for <Process A-2>, <Process B-2>, and <Process C-2> 8 is a flowchart when the control unit (automatic offload function unit) 210 of the offload server 200 executes <Process A-2>, <Process B-2>, and <Process C-2> in the offload process of the function block. Note that the processes from <Process A-2> may be performed in parallel with the processes from <Process A-1>.

[0208] In step S300, the control unit 210 (see FIG. 6) receives the application code and the operating conditions.

[0209] In step S301, the application code analysis unit 112 (see FIG. 6) analyzes the source code of the application to be offloaded. Specifically, the application code analysis unit 112 uses a syntax analysis tool such as Clang to analyze the source code to analyze the library calls and functional processing included in the code, together with the loop statement structure, etc.

[0210] In step S302, the replacement function detection unit 213 (see FIG. 6) detects a definition description code of a class or structure from the source code.

[0211] In step S303, the replacement function detection unit 213 uses a similarity detection tool to obtain replaceable GPU libraries and FPGA IP cores from the code pattern DB 230 using the definition description code of a class or structure as a key.

[0212] In step S304, the replacement processing unit 214 replaces the processing description of the source of replacement in the source code of the application with the processing description of the GPU library and FPGA IP core of the replacement destination.

[0213] In step S305, the replacement processing unit 214 prompts the user for confirmation if the number or type of arguments or return values ​​differs between the source and destination.

[0214] In step S306, the replaced function detection unit 213 offloads the replaced processing descriptions of the GPU library and FPGA IP core to the GPU and FPGA as functional blocks to be offloaded.

[0215] In step S307, the replacement processing unit 214 describes interface processing for calling the GPU library and the FPGA IP core.

[0216] In step S308, the execution file creation unit 119 compiles or interprets the created pattern. In step S309, performance measurement unit 118 measures the performance of the created pattern in a verification environment ("first performance measurement").

[0217] In step S310, the execution file creation unit 119 creates a combination pattern for the pattern that was able to increase the speed during the first measurement.

[0218] In step S311, the execution file creation unit 119 compiles or interprets the created combination pattern. In step S312, performance measurement unit 118 measures the performance of the created combination pattern in a verification environment ("second performance measurement").

[0219] In step S313, the production environment deployment unit 120 selects the pattern with the highest performance from the first and second measurements, and ends the processing of this flow.

[0220] After the GPU and FPGA offloading attempts shown in FIGS. 7 and 8 have been performed, the resource ratio and resource amount setting flowchart shown in FIG. 5 is executed.

[0221] [Hardware configuration] The offload server according to the first and second embodiments is realized by a computer 900, which is a physical device having a configuration as shown in FIG. 9 is a hardware configuration diagram showing an example of a computer that realizes the functions of the offload server 1,200. The computer 900 has a CPU (Central Processing Unit) 901, a ROM (Read Only Memory) 902, a RAM 903, an HDD (Hard Disk Drive) 904, an input / output I / F (Interface) 905, a communication I / F 906, and a media I / F 907.

[0222] The CPU 901 operates based on a program stored in the ROM 902 or the HDD 904, and controls each processing unit of the offload server 1, 200 shown in Figures 1 and 6. The ROM 902 stores a boot program executed by the CPU 901 when the computer 900 is started, programs related to the hardware of the computer 900, and the like.

[0223] The CPU 901 controls an input device 910 such as a mouse or a keyboard, and an output device 911 such as a display, via an input / output I / F 905. The CPU 901 acquires data from the input device 910 via the input / output I / F 905, and outputs generated data to the output device 911.

[0224] The HDD 904 stores programs executed by the CPU 901 and data used by the programs, etc. The communication I / F 906 receives data from other devices via a communication network (e.g., NW (Network) 920) and outputs the data to the CPU 901, and also transmits data generated by the CPU 901 to other devices via the communication network.

[0225] The media I / F 907 reads a program or data stored in the recording medium 912 and outputs it to the CPU 901 via the RAM 903. The CPU 901 loads a program related to a target process from the recording medium 912 onto the RAM 903 via the media I / F 907, and executes the loaded program. The recording medium 912 is an optical recording medium such as a DVD (Digital Versatile Disc) or a PD (Phase change rewritable Disc), a magneto-optical recording medium such as an MO (Magneto Optical disk), a magnetic recording medium, a conductive memory tape medium, a semiconductor memory, or the like.

[0226] For example, when the computer 900 functions as the offload server 1,200 according to the first and second embodiments, the CPU 901 of the computer 900 executes a program loaded onto the RAM 903 to realize the functions of the offload server 1,200. In addition, the HDD 904 stores data in the RAM 903. The CPU 901 reads and executes a program related to a target process from a recording medium 912. In addition, the CPU 901 may read a program related to a target process from another device via a communication network (NW 920).

[0227] [effect] The effects of the offload server and the like according to the present invention will be described below. The offload server 1 (see FIG. 1) according to the first embodiment is an offload server that offloads specific processing of an application program from a CPU to an offload device, and includes an application code analysis unit 112 that analyzes the source code of the application program, a data transfer specification unit 113 that analyzes the reference relationships of variables used in loop statements of the application program, and for data that may be transferred outside the loop, specifies data transfer using an explicit specification line that explicitly specifies data transfer outside the loop, a parallel processing specification unit 114 that identifies loop statements of the application program and compiles each identified loop statement by specifying a parallel processing specification statement in the offload device, and a parallel processing pattern creation unit 117 that creates a parallel processing pattern that excludes repetitive statements that produce a compilation error from being offloaded, and specifies whether or not to perform parallel processing for loop statements that do not produce a compilation error. The system also includes a performance measurement unit 118 that compiles an application program of a parallel processing pattern, places it on the verification machine 14, and executes processing for measuring performance when offloaded to the offload device, a resource ratio determination unit 115 that determines the ratio of processing times between the CPU and the offload device as a resource ratio based on the performance measurement results, and a resource amount setting unit 116 that sets the resource amounts of the CPU and the offload device based on the determined resource ratio so as to satisfy specified cost conditions.

[0228] By doing so, appropriate resource amounts for the CPU and offload device can be set in the automatic offload of loop statements, allowing efficient setting of server resource amounts and reducing equipment costs.

[0229] An offload server 200 (see FIG. 6 ) according to the second embodiment is an offload server that offloads specific processing of an application program from a CPU to an offload device including a GPU or a PLD, and includes a code pattern DB 230 (storage unit) that stores libraries and IP cores that can be offloaded to the GPU or the PLD, an application code analysis unit 112 that analyzes source code of the application program and detects external library calls contained in the source code, a replacement function detection unit 213 that acquires libraries and IP cores from the code pattern DB 230 using the detected external library calls as keys, and a replacement function detection unit 213 that replaces a source process description of the source code of the application program with a destination process description of the library and IP core acquired by the replacement function detection unit 213, and detects the processing descriptions of the replaced library and IP core as the offload process description. The target functional blocks include a replacement processing unit 214 that offloads to a GPU or PLD, an offload pattern creation unit 215 that creates an interface with a host program and extracts an offload pattern that will be faster by trying whether to offload through performance measurement in a verification environment, an executable file creation unit 119 that compiles the application of the created GPU or PLD processing pattern to create an executable file, a performance measurement unit 118 that places the created executable file in an accelerator verification device and executes processing for performance measurement when offloaded to a GPU or PLD, a resource ratio determination unit 115 that determines the ratio of processing times between the CPU and the offload device as a resource ratio based on the performance measurement results, and a resource amount setting unit 116 that sets the resource amounts of the CPU and the offload device based on the determined resource ratio so as to satisfy specified cost conditions.

[0230] In this way, appropriate resource amounts for the CPU and offload device can be set in the automatic offload of the functional block, which allows efficient setting of server resource amounts and reduces equipment costs.

[0231] In the offload server 1,200 according to the first and second embodiments, the resource ratio determination unit 115 is characterized in that it determines the resource ratio so that the processing times of the CPU and the offload device are of the same order.

[0232] In this way, tasks can be normalized by aligning the processing times of the CPU and offload device to the same order, and the amount of resources can be set appropriately even in a mixed environment of CPUs and accelerators such as GPUs, FPGAs, many-core CPUs, etc. Also, by setting the amount of resources appropriately, slowdowns can be prevented and applications can be run with high cost performance.

[0233] In the offload server 1,200 according to the first and second embodiments, the resource ratio determination unit 115 is characterized in that, when the difference in processing time between the CPU and the offload device is equal to or greater than a predetermined threshold, the resource ratio is set to a predetermined upper limit value.

[0234] In this way, a large increase in the number of VMs can be prevented by setting an upper limit on the resource ratio.

[0235] In the offload server 1,200 according to the first and second embodiments, the resource amount setting unit 116 is characterized in that it maintains the determined resource ratio and sets the maximum resource amount that satisfies a predetermined cost condition.

[0236] In this way, an appropriate resource amount that satisfies the user's operational conditions can be set.

[0237] In the offload server 1,200 according to the first and second embodiments, if the specified cost condition is not satisfied by setting the minimum resource amount while maintaining the determined resource ratio, the resource amount setting unit 116 sets the resource amount starting from the minimum for the CPU and offload device and approaching the set resource ratio while satisfying the cost condition.

[0238] In this way, an appropriate amount of resources can be set while satisfying the user's operational conditions.

[0239] The present invention provides an offload program for causing a computer to function as the offload server.

[0240] In this way, each function of the offload server 1 can be realized using a general computer.

[0241] Furthermore, among the processes described in the above embodiments, all or part of the processes described as being performed automatically can be performed manually, or all or part of the processes described as being performed manually can be performed automatically by a known method. In addition, the information including the processing procedures, control procedures, specific names, various data and parameters shown in the above documents and drawings can be changed arbitrarily unless otherwise specified. In addition, each component of each device shown in the figure is a functional concept, and does not necessarily have to be physically configured as shown in the figure. In other words, the specific form of distribution and integration of each device is not limited to that shown in the figure, and all or part of them can be functionally or physically distributed and integrated in any unit according to various loads, usage conditions, etc. [Explanation of symbols]

[0242] 1,200 offload servers 11,210 Control section 12 Input / output section 13,130 storage section 14 Verification machine (accelerator verification device) 15 Commercial environment 111 Application code designation section 112 Application Code Analysis Unit 113 Data transfer specification section 114 Parallel processing specification section 114a Off-road range extraction section 114b Intermediate language file output section 115 Resource Ratio Determination Unit 116 Resource amount setting section 117 Parallel Processing Pattern Creation Unit 118 Performance measurement section 118a Binary file placement section 119 Executable File Creation Department 120 Production Environment Deployment Department 121 Performance Measurement Test Extraction Execution Department 122 User Provision Department 125 Application Code 131 Test Case DB 132 Facility Resource DB 133 Intermediate language files 151 Various Devices 152 CPU-GPU devices 153 Device with CPU-FPGA 154 Devices with CPU 213 Replacement Function Detection Unit 214 Replacement Processing Unit 215 Off-road pattern creation section 230 Code Pattern DB

Claims

1. An offload server that offloads a specific process of an application program from a CPU to an offload device, an application code analysis unit that analyzes a source code of the application program; a data transfer specification unit that analyzes reference relationships between variables used in a loop statement of the application program, and specifies data transfer that may be performed outside the loop using an explicit specification line that explicitly specifies data transfer outside the loop; a parallel processing specification unit that specifies loop statements of the application program, and specifies a parallel processing specification statement in the offload device for each of the specified loop statements to compile the loop statements; a parallel processing pattern creation unit that creates a parallel processing pattern that excludes a loop statement that generates a compilation error from being subject to offloading and specifies whether or not a loop statement that does not generate a compilation error should be processed in parallel; a performance measurement unit that compiles the application program of the parallel processing pattern, places it in an accelerator verification device, and executes a process for measuring performance when the application program is offloaded to the offload device; a resource ratio determination unit that determines a ratio of processing times of the CPU and the offload device as a resource ratio based on a performance measurement result; a resource amount setting unit that sets resource amounts of the CPU and the offload device based on the determined resource ratio so as to satisfy a predetermined cost condition; The resource amount setting unit, If the predetermined cost condition is not satisfied by setting the minimum resource amount while maintaining the determined resource ratio, the resource amount of the CPU and the offload device is set so as to approach the set resource ratio starting from the minimum while satisfying the cost condition.

13. An offload server comprising:

2. An offload server that offloads a specific process of an application program from a CPU to an offload device including a GPU (Graphics Processing Unit) or a PLD (Programmable Logic Device), A storage unit that stores libraries and IP cores that can be offloaded to the GPU or the PLD; an application code analysis unit that analyzes a source code of the application program and detects an external library call included in the source code; a replacement function detection unit that acquires the library and the IP core from the storage unit using the detected external library call as a key; a replacement processing unit that replaces a processing description of a source of replacement in the source code of the application program with a processing description of a replacement destination of the library and the IP core acquired by the replacement function detection unit, and offloads the replaced processing descriptions of the library and the IP core to the GPU or the PLD as functional blocks to be offloaded; an offload pattern creation unit that creates an interface with a host program, and tries whether or not to offload through performance measurement in a verification environment to extract an offload pattern that will be faster; an execution file creation unit that compiles the application program of the created GPU or PLD processing pattern to create an execution file; a performance measurement unit that places the created executable file in an accelerator verification device and executes a process for measuring performance when the executable file is offloaded to the GPU or the PLD; a resource ratio determination unit that determines a ratio of processing times of the CPU and the offload device as a resource ratio based on a performance measurement result; a resource amount setting unit that sets resource amounts of the CPU and the offload device based on the determined resource ratio so as to satisfy a predetermined cost condition; The resource amount setting unit, If the predetermined cost condition is not satisfied by setting the minimum resource amount while maintaining the determined resource ratio, the resource amount of the CPU and the offload device is set so as to approach the set resource ratio starting from the minimum while satisfying the cost condition.

13. An offload server comprising:

3. The resource ratio determination unit is The resource ratio is determined so that the processing times of the CPU and the offload device are of the same order.

3. The offload server according to claim 1 or 2.

4. The resource ratio determination unit is When the difference between the processing times of the CPU and the offload device is equal to or greater than a predetermined threshold, the resource ratio is set to a predetermined upper limit value.

3. The offload server according to claim 1 or 2.

5. The resource amount setting unit, The determined resource ratio is maintained, and a maximum resource amount that satisfies the predetermined cost condition is set.

3. The offload server according to claim 1 or 2.

6. An offload control method for an offload server that offloads a specific process of an application program from a CPU to an offload device, comprising: The offload server includes: analyzing the source code of the application program; a step of analyzing reference relationships of variables used in a loop statement of the application program, and for data that may be transferred outside the loop, specifying data transfer using an explicit specification line that explicitly specifies data transfer outside the loop; identifying loop statements of the application program, and for each of the identified loop statements, specifying a parallel processing specification statement for the offload device and compiling the loop statements; creating a parallel processing pattern for specifying that a loop statement that generates a compilation error is not to be offloaded and that a loop statement that does not generate a compilation error is to be processed in parallel or not; A step of compiling the application program of the parallel processing pattern, disposing the application program in an accelerator verification device, and executing a process for measuring performance when the application program is offloaded to the offload device; determining a ratio of processing times of the CPU and the offload device as a resource ratio based on a performance measurement result; setting the resource amounts of the CPU and the offload device based on the determined resource ratio so as to satisfy a predetermined cost condition, and if the predetermined cost condition is not satisfied by setting the minimum resource amount while maintaining the determined resource ratio, setting the resource amounts of the CPU and the offload device starting from the minimum so as to approach the set resource ratio while satisfying the cost condition. An off-load control method comprising:

7. An offload program for causing a computer to function as the offload server according to any one of claims 1 to 5.

Citation Information

Patent Citations

  • Device cooperation server and device cooperation program

    JP2019049905A

  • Optimum arrangement method for software of off-road server, and program

    JP2020137017A