WO2022097245A1 - オフロードサーバ、オフロード制御方法およびオフロードプログラム - Google Patents

オフロードサーバ、オフロード制御方法およびオフロードプログラム Download PDF

Info

Publication number
WO2022097245A1
WO2022097245A1 PCT/JP2020/041413 JP2020041413W WO2022097245A1 WO 2022097245 A1 WO2022097245 A1 WO 2022097245A1 JP 2020041413 W JP2020041413 W JP 2020041413W WO 2022097245 A1 WO2022097245 A1 WO 2022097245A1
Authority
WO
WIPO (PCT)
Prior art keywords
processing
offload
gpu
unit
performance
Prior art date
Application number
PCT/JP2020/041413
Other languages
English (en)
French (fr)
Inventor
庸次 山登
Original Assignee
日本電信電話株式会社
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 日本電信電話株式会社 filed Critical 日本電信電話株式会社
Priority to JP2022560579A priority Critical patent/JPWO2022097245A1/ja
Priority to PCT/JP2020/041413 priority patent/WO2022097245A1/ja
Publication of WO2022097245A1 publication Critical patent/WO2022097245A1/ja

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/12Computing arrangements based on biological models using genetic models

Definitions

  • the present invention relates to an offload server, an offload control method, and an offload program that automatically offloads functional processing to an accelerator such as a GPU (Graphics Processing Unit).
  • an accelerator such as a GPU (Graphics Processing Unit).
  • Non-Patent Document 1 the code once described is automatically converted, resource setting, etc. are performed so that the GPU, FPGA, manycore CPU, etc. existing in the environment of the placement destination can be used, and the application is operated with high performance. Environmentally adaptable software for this purpose is described.
  • Non-Patent Documents 2, 3 and 4 describe a method of automatically offloading a loop statement and a functional block of an application code to an FPGA or GPU as an element of environment-adaptive software.
  • CUDA is widespread as an environment for performing GPGPU (General Purpose GPU) that uses the parallel computing power of GPU for non-image processing.
  • CUDA is an NVIDIA® environment for GPGPU.
  • OpenCL is a specification for handling heterogeneous devices such as FPGA, manycore CPU, GPU in the same way, and its development environment is being prepared.
  • CUDA and OpenCL are forms that extend the C language and program, and the difficulty of the program is high (explicitly describe the copy and release of memory data between the kernel such as FPGA and the host of the CPU, etc. ).
  • Non-Patent Documents 1 to 4 are offloading of C language programs to GPU and FPGA, and various source languages such as Python (registered trademark) and Java (registered trademark) are not assumed. It is required to automatically offload application programs not only in C language but also in Python, Java and other migration source languages.
  • the present invention has been made in view of these points, eliminating the need to study and implement processing according to the migration source language, and automatically turning off the application program even when the migration source language becomes diverse.
  • the challenge is to load.
  • An offload server that offloads a specific process of an application program to an accelerator in order to solve the above-mentioned problem.
  • the application program is at least one selected from C language, Python, and Java, and the application.
  • the application code analysis unit that analyzes the source code of the program and the reference relationship of the variables used in the loop statement of the application program are analyzed, and the data that may be transferred outside the loop is transferred outside the loop.
  • the data transfer specification unit that explicitly specifies the data transfer using the explicitly specified line and the loop statement of the application program are specified, and the parallel processing specification in the accelerator is specified for each specified loop statement.
  • the parallel processing pattern creation unit that creates the parallel processing pattern and the application program of the parallel processing pattern are compiled, placed in the accelerator verification device, and the performance measurement processing when offloaded to the accelerator is executed. Based on the performance measurement unit and the performance measurement result, a plurality of high-performance parallel processing patterns are selected from the plurality of parallel processing patterns, the high-performance parallel processing patterns are crossed, and another is performed by mutation processing.
  • the offload server is characterized by including an execution file creation unit that compiles the parallel processing pattern with the highest processing performance and creates an execution file.
  • the application program can be automatically offloaded even when the migration source language becomes diverse.
  • ⁇ loop statement offload common >> of the offload server which concerns on 1st Embodiment of this invention. It is a flowchart of ⁇ loop statement offload: common >> of the offload server which concerns on 1st Embodiment of this invention. It is a flowchart of ⁇ loop statement offload: C language >> of the offload server which concerns on 1st Embodiment of this invention. It is a flowchart of ⁇ loop statement offload: C language >> of the offload server which concerns on 1st Embodiment of this invention.
  • the control unit (automatic offload function unit) of the offload server according to the second embodiment of the present invention performs ⁇ process A-2>, ⁇ process B-2>, and ⁇ process C- in the offload process of the functional block. It is a flowchart when 2> and is executed.
  • the control unit (automatic offload function unit) of the offload server according to the second embodiment of the present invention performs ⁇ process A-1> and ⁇ process B- in the offload process of ⁇ functional block offload: C language >>. It is a flowchart when 1> and ⁇ process C-1> are executed.
  • the control unit (automatic offload function unit) of the offload server according to the second embodiment of the present invention performs ⁇ process A-2>, ⁇ process B-2>, and ⁇ process C- in the offload process of the functional block. It is a flowchart when 2> and is executed.
  • the control unit (automatic offload function unit) of the offload server according to the second embodiment of the present invention performs ⁇ process A-1> and ⁇ process B-1> in the offload process of ⁇ functional block: Python >>. It is a flowchart in the case of executing ⁇ process C-1>.
  • the control unit (automatic offload function unit) of the offload server according to the second embodiment of the present invention performs ⁇ process A-2>, ⁇ process B-2>, and ⁇ process C- in the offload process of the functional block. It is a flowchart when 2> and is executed.
  • the control unit (automatic offload function unit) of the offload server according to the second embodiment of the present invention performs ⁇ process A-1> and ⁇ process B-1> in the offload process of ⁇ functional block: Java >>. It is a flowchart in the case of executing ⁇ process C-1>.
  • the control unit (automatic offload function unit) of the offload server according to the second embodiment of the present invention performs ⁇ process A-2>, ⁇ process B-2>, and ⁇ process C- in the offload process of the functional block. It is a flowchart when 2> and is executed. It is a hardware block diagram which shows an example of the computer which realizes the function of the offload server which concerns on embodiment of this invention.
  • C language (Basic concept of supporting various migration source languages)
  • Python (Basic concept of supporting various migration source languages)
  • Java There are three migration source languages targeted in this embodiment: C language, Python, and Java. These three languages are the top three in the popularity ranking of programming languages announced by TIOBE (registered trademark) every month, and have a large programmer population.
  • C language is a compiled type
  • Python is an interpreted type
  • Java is an intermediate method, and the variety of methods is covered by three. Therefore, if the method can be used in common with these three methods, it will be easy to support more languages.
  • performance measurement is performed on an actual machine in the verification environment and combined with a method such as an evolutionary computation method in order to automatically and quickly offload various migration source language programs. Then, gradually take the approach of finding a fast off-road pattern. The reason is that performance is difficult to predict statically because it varies greatly depending not only on the code structure but also on the specifications of the hardware to be processed, the compiler and interpreter, the data size, the number of loops, etc. This is because it is necessary to make a specific measurement. Actually, there is an automatic parallelization compiler in the market that finds loop statements and parallelizes them at the compilation stage, but parallelization of loop statements that can be parallelized is often slow when measuring performance. , Performance measurement is necessary.
  • the migration destination environment GPU, FPGA, and manycore CPU are assumed, and the offload of the C language program in the environment where these are mixed is also disclosed. Since the solution problem of the present invention is the automatic offloading of the application when the migration source language is diversified, the migration destination environment to be evaluated is not limited.
  • the migration destination environment is GPU as an example, and FPGA and manycore CPU can be realized by expansion if a common method can be confirmed by GPU.
  • the first embodiment describes a loop statement offload.
  • the offload server 1 according to the first embodiment performs an offload process executed in the background of service use for users in the environment-adaptive software system.
  • the service is provided to the user in the form of trial use on the first day, offload processing such as image analysis is performed in the background, and image analysis is offloaded to FPGA from the next day at a reasonable price. It is assumed that the monitoring service can be provided at.
  • FIG. 1 is a functional block diagram showing a configuration example of the 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.
  • 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).
  • a control unit 11 an input / output unit 12
  • a storage unit 13 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).
  • the input / output unit 12 comprises a communication interface for transmitting / receiving information to / from each device belonging to the cloud layer, the network layer, the device layer, and the like, an input device such as a touch panel and a keyboard, and an output device such as a monitor. It consists of an input / output interface for sending and receiving information between.
  • the storage unit 13 is composed of a hard disk, a flash memory, a RAM (Random Access Memory), and the like.
  • the storage unit 13 stores a test case database 131, a program (offload program) for executing each function of the control unit 11, and information necessary for processing of the control unit 11. (For example, an Intermediate file 132) is temporarily stored.
  • the test case DB 131 stores the data of the test items corresponding to the software to be verified.
  • the test item data is, for example, transaction test data such as TPC-C in the case of a database system such as MySQL.
  • the control unit 11 is an automatic offloading function unit that controls the entire offload server 1.
  • the control unit 11 is realized, for example, by a CPU (Central Processing Unit) (not shown) deploying and executing an application program (offload program) stored in the storage unit 13 in a RAM.
  • a CPU Central Processing Unit
  • application program offload program
  • the application program includes at least one selected from C language, Python, and Java.
  • 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, and a parallel processing pattern creation unit 115. , Performance measurement unit 116, executable file creation unit 117, production environment placement unit (Deploy final binary files to production environment) 118, performance measurement test extraction execution unit (Extract performance test cases and run automatically) 119, provided by the user. It is equipped with a unit (Provide price and performance to a user to judge) 120.
  • the application code specification unit 111 specifies 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.
  • the application code analysis unit 112 analyzes the source code of the processing function and grasps the structure of the loop statement, the FFT library call, and the like.
  • the data transfer specification unit 113 analyzes the reference relationship of variables used in the loop statement of the application program, and explicitly specifies the data transfer outside the loop for the data that may be transferred outside the loop. Specify the data transfer using the specified line.
  • the data transfer specification unit 113 includes an explicitly specified line that explicitly specifies data transfer from the CPU to the GPU, an explicitly specified line that explicitly specifies the data transfer from the GPU to the CPU, and the same variable from the CPU.
  • an explicitly specified line that explicitly specifies the round trip of the data copy collectively is specified using an explicitly specified line that explicitly specifies the round trip of the data copy collectively.
  • the data transfer designation unit 113 gives an instruction to transfer data from the CPU to the GPU, and performs GPU processing at the position where the data transfer is specified. It is a statement or a loop statement higher than it, and it is the top-level loop that does not include the setting and definition of the corresponding variable. Further, when the variable set on the GPU program side and the variable referred to on the CPU program side overlap, the data transfer designation unit 113 gives an instruction to transfer data from the GPU to the CPU, and sets the position where the data transfer is specified to the GPU. It is a loop statement to be processed or a loop statement higher than it, and it is a top-level loop that does not include the reference, setting, and definition of the corresponding variable.
  • the parallel processing specification unit 114 specifies a loop statement (repeated statement) of the application program, specifies a parallel processing specification statement in the accelerator for each loop statement, and compiles the loop statement.
  • the parallel processing designation unit 114 includes an extract offloadable area 114a and an output intermediate file 114b.
  • the offload range extraction unit 114a identifies processes that can be offloaded to the GPU / FPGA, such as loop statements and FFTs, and extracts intermediate languages according to the offload processes.
  • the intermediate language file output unit 114b outputs the extracted intermediate language file 132.
  • Intermediate language extraction is not a one-time process, it is repeated to try and optimize execution for proper offload area search.
  • the parallel processing pattern creation unit 115 excludes the loop statement (repeated statement) in which a compile error occurs from the offload target, and specifies whether to perform parallel processing for the repeated statement in which a compile error does not occur. Create a parallel processing pattern to be performed.
  • the performance measurement unit 116 compiles the application program of the parallel processing pattern, arranges it on the verification machine 14, and executes the performance measurement processing when it is offloaded to the accelerator.
  • the performance measurement unit 116 includes a binary file arrangement unit (Deploy binary files) 116a.
  • the binary file placement unit 116a deploys (places) an executable file derived from an intermediate language on a verification machine 14 equipped with a GPU / FPGA.
  • the performance measurement unit 116 executes the placed binary file, measures the performance when offloaded, and returns the performance measurement result to the offload range extraction unit 114a.
  • the offload range extraction unit 114a extracts another parallel processing pattern, and the intermediate language file output unit 114b tries to measure the performance based on the extracted intermediate language (reference numeral a in FIG. 2 below). reference).
  • Executable file creation unit 117 selects a plurality of high-performance parallel processing patterns from the plurality of parallel processing patterns based on the performance measurement results repeated a predetermined number of times, and crosses the high-performance parallel processing patterns. Create another plurality of parallel processing patterns by mutation processing, perform new performance measurement, and after the specified number of performance measurements, based on the performance measurement results, the highest processing performance from the multiple parallel processing patterns Select a parallel processing pattern, compile the parallel processing pattern with the highest processing performance, and create an executable file.
  • the production environment placement unit 118 places the created executable file in the production environment for the user (“placement of the final binary file in the production environment”).
  • the production environment placement unit 118 determines a pattern that specifies the final offload area, and deploys it to the production environment for users.
  • the performance measurement test extraction execution unit 119 After arranging the execution file, the performance measurement test extraction execution unit 119 extracts the performance test item from the test case DB 131 and executes the performance test (“arrangement of the final binary file in the production environment”). After arranging the execution file, the performance measurement test extraction execution unit 119 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.
  • the user providing unit 120 presents information such as price and performance to the user based on the performance test result (“Providing information such as price and performance to the user”). Performance test items are stored in the test case DB 131.
  • the user providing unit 120 presents data such as price and performance to the user together with the performance test result based on the execution result of the performance test corresponding to the test item stored in the test case DB 131.
  • the user determines to start charging for the service based on the presented information such as price and performance.
  • non-patent literature Y. Yamato, M. Muroi, K. Tanaka and M.
  • the offload server 1 can use GA for offload optimization.
  • the configuration of the offload server 1 when GA is used is as follows. That is, the parallel processing designation unit 114 sets the number of loop statements (repeated statements) in which no compilation error occurs as the gene length based on the genetic algorithm.
  • the parallel processing pattern creation unit 115 maps the possibility of accelerator processing to the gene pattern, with either 1 or 0 when the accelerator processing is performed and 0 or 1 of the other when the accelerator processing is not performed.
  • the parallel processing pattern creation unit 115 prepares a gene pattern of a specified number of individuals in which each value of the gene is randomly created to 1 or 0, and the performance measurement unit 116 prepares a parallel processing designation statement in the accelerator according to each individual. Compile the specified application code and place it on the verification machine 14. The performance measurement unit 116 executes the performance measurement process on the verification machine 14.
  • the performance measuring unit 116 measures the performance without compiling the application code corresponding to the parallel processing pattern and measuring the performance. Use the same value as the value. Further, the performance measurement unit 116 sets the performance measurement value to a predetermined time (long time) as a time-out treatment for the application code in which a compilation error occurs and the application code in which the performance measurement does not end in a predetermined time.
  • the executable file creation unit 117 measures the performance of all individuals and evaluates them so that the shorter the processing time, the higher the goodness of fit.
  • the executable file creation unit 117 selects from all the individuals those having a goodness of fit higher than a predetermined value (for example, the upper n% of all the numbers, or the upper m of all the numbers, n and m are natural numbers) as high-performance individuals. , Crossover and mutation processing are performed on the selected individual to create a next-generation individual.
  • the executable file creation unit 117 selects the highest-performance parallel processing pattern as a solution after the processing of the specified number of generations is completed.
  • FIG. 2 is a diagram showing an automatic offload process using the GA of the offload server 1.
  • the offload server 1 is applied to the elemental techniques of environment-adaptive software.
  • the offload server 1 has a control unit (automatic offload function unit) 11, a test case DB 131, an intermediate language file 132, and a verification machine 14.
  • the offload server 1 acquires the application code 125 used by the user.
  • the user is, for example, a person who has contracted to use various devices (Device 151, a device 152 having a CPU-GPU, a device 153 having a CPU-FPGA, and a device 154 having a CPU).
  • the offload server 1 automatically offloads the functional processing to the accelerator of the device 152 having the CPU-GPU and the device 153 having the CPU-FPGA.
  • step S11 Specify application code>
  • the application code designation unit 111 passes the application code described in the received file to the application code analysis unit 112.
  • Step S12 Analyze application code>
  • the application code analysis unit 112 analyzes the source code of the processing function and grasps the structure of the loop statement, the FFT library call, and the like.
  • Step S13 Extract offloadable area>
  • the parallel processing specification unit 114 specifies a loop statement (repetition statement) of the application, specifies a parallel processing specification statement in the accelerator for each repetition statement, and compiles it.
  • the offload range extraction unit 114a identifies a process that can be offloaded to the GPU / FPGA, such as a loop statement or FFT, and extracts an intermediate language corresponding to the offload process.
  • Step S14 Output intermediate file>
  • the intermediate language file output unit 114b (see FIG. 1) outputs the intermediate language file 132.
  • Intermediate language extraction is not a one-time process, it is repeated to try and optimize execution for proper offload area search.
  • Step S15 Compile error>
  • the parallel processing pattern creation unit 115 excludes the loop statement in which a compile error occurs from the offload target and performs parallel processing in the repeated statement in which no compile error occurs. Create a parallel processing pattern that specifies whether or not to use it.
  • Step S21 Deploy binary files>
  • the binary file arrangement unit 116a (see FIG. 1) deploys an executable file derived from an intermediate language on the verification machine 14 equipped with the GPU / FPGA.
  • Step S22 Measure performances>
  • the performance measuring unit 116 executes the placed file and measures the performance when offloaded. In order to make the area to be offloaded more appropriate, this performance measurement result is returned to the offload range extraction unit 114a, and the offload range extraction unit 114a extracts another pattern. Then, the intermediate language file output unit 114b tries to measure the performance based on the extracted intermediate language (see reference numeral a in FIG. 2).
  • the control unit 11 repeatedly executes the steps S12 to S22.
  • the automatic offload function of the control unit 11 is summarized below. That is, the parallel processing specification unit 114 specifies the loop statement (repetition statement) of the application program, specifies the parallel processing specification statement in the GPU for each repetition statement, and compiles it. Then, the parallel processing pattern creation unit 115 creates a parallel processing pattern that excludes the loop statement that causes a compile error from the offload target and specifies whether or not to perform parallel processing for the loop statement that does not cause a compile error. do.
  • the binary file arrangement unit 116a compiles the application program of the corresponding parallel processing pattern and arranges it on the verification machine 14, and the performance measurement unit 116 executes the performance measurement processing on the verification machine 14.
  • the execution file creation unit 117 selects the 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, compiles the selection patterns, and creates an execution file.
  • Step S23 Deploy final binary files to production environment>
  • the production environment placement unit 118 determines a pattern in which the final offload area is specified and deploys it in the production environment for users.
  • Step S24 Extract performance test cases and run automatically>
  • the performance measurement test extraction execution unit 119 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 after the execution file is arranged.
  • Step S25 Provide price and performance to a user to judge>
  • the user providing unit 120 presents information such as price and performance to the user based on the performance test result.
  • the user determines to start charging for the service based on the presented information such as price and performance.
  • steps S11 to S25 are performed, for example, in the background of the user's service use, and are assumed to be performed, for example, during the first day of temporary use. Further, the processing performed in the background for cost reduction may be targeted only at the function allocation optimization and the GPU / FPGA offload.
  • control unit (automatic offload function unit) 11 of the offload server 1 is the source code of the application program used by the user for offloading the function processing when applied to the elemental technology of the environment adaptation software.
  • the area to be offloaded is extracted from, and the intermediate language is output (steps S11 to S15).
  • the control unit 11 arranges and executes an executable file derived from the intermediate language on the verification machine 14 to verify 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 actually provided to the user and provides it as a service (steps S23 to S25).
  • the GPU automatic offload is a process for repeating steps S12 to S22 of FIG. 2 for the GPU and finally obtaining an offload code to be deployed in step S23.
  • GPU is a device that generally does not guarantee latency, but is suitable for increasing throughput by parallel processing.
  • Typical examples are encryption processing of environment-adaptive software, image processing for camera image analysis, machine learning processing for mass sensor data analysis, etc., and many of them are repetitive processing. Therefore, we aim to speed up by automatically offloading the repeated statements of the application to the GPU.
  • an appropriate offload area is automatically extracted from a general-purpose program that is not supposed to be parallelized. Therefore, it is possible to first check the parallelizable for statement and then repeat the performance verification trial in the verification environment using GA for the parallelizable for statement group to search for an appropriate area.
  • parallel processing for statements holding and recombining parallel processing patterns that can be accelerated in the form of gene parts, patterns that can be efficiently accelerated from the huge number of parallel processing patterns that can be taken. Can be searched.
  • FIG. 3 is a diagram showing a search image of processing of the control unit (automatic offload function unit) 11 by Simple GA and gene sequence mapping of a for statement.
  • GA is one of the combinatorial optimization methods that imitates the evolutionary process of living organisms.
  • the flow chart of GA is initialization->evaluation->selection->crossover->mutation-> end determination.
  • Simple GA which is a simplified process, is used in GA.
  • Simple GA is a simplified GA in which genes are only 1 and 0, roulette selection, one-point crossover, and mutation reverse the value of one gene.
  • ⁇ Initialization> After checking whether all for statements in the application code can be parallelized, the parallelizable for statements are mapped to the gene sequence. 1 for GPU processing, 0 for no GPU processing. For the gene, a designated number of individuals M is prepared, and 1 or 0 is randomly assigned to one for statement. Specifically, the control unit (automatic offload function unit) 11 (see FIG. 1) acquires the application code 130 (see FIG. 2) used by the user, and as shown in FIG. 3, the application. Check whether the for statement can be parallelized from the code patterns 141 of the code 130. As shown in FIG. 3, when three for statements are found from the code pattern 141 (see the reference numeral b in FIG.
  • one digit is used for each for statement, and here, one digit or one of three digits is found for the three for statements. Assign 0. For example, it is set to 0 when it is processed by the CPU and 1 when it is sent to the GPU. However, at this stage, 1 or 0 is randomly assigned.
  • the code corresponding to the gene length is 3 digits, and the code of the 3 digit gene length is 23 patterns, for example, 100, 101, .... In FIG. 3, the circles ( ⁇ ) in the code pattern 141 are shown as an image of the code.
  • ⁇ Evaluation> In the evaluation, deployment and performance measurement are performed (see reference numeral c in FIG. 3). That is, the performance measurement unit 116 (see FIG. 1) compiles the code corresponding to the gene, deploys it to the verification machine 14, and executes it. The performance measurement unit 116 measures the benchmark performance. Increase the goodness of fit of genes in patterns with good performance (parallel processing pattern).
  • ⁇ Selection> high performance code patterns are selected based on the goodness of fit (see reference numeral d in FIG. 3).
  • the performance measuring unit 116 selects a gene having a high fitness for a specified number of individuals based on the fitness. In this embodiment, roulette selection and elite selection of the highest fitness gene are performed according to the fitness. In FIG. 3, it is shown as a search image that the number of circles (circle) in the selected code patterns 142 is reduced to three.
  • ⁇ Mutation> Introduce mutations to avoid local solutions.
  • a mode in which mutation is not performed may be used.
  • mutation each value of an individual's gene is changed from 0 to 1 or 1 to 0 at a constant mutation rate Pm.
  • ⁇ Deployment (deployment)> The parallel processing pattern with the highest processing performance, which corresponds to the gene with the highest goodness of fit, is redeployed to the production environment and provided to the user.
  • OpenACC which is a specification that processes GPU for C / C ++ code
  • compiler that enables GPU offload by specifying bytecode for GPU by specifying it with the directive #pragmaacckernels.
  • GPU processing may be specified by CUDA or Java Lambda expression.
  • a code pattern having a gene length corresponding to the number of for sentences has been obtained.
  • parallel processing patterns 100, 010, 001, ... are randomly assigned.
  • GA processing is performed and the compilation is performed.
  • an error may occur even though the for statement can be offloaded.
  • the for statement is hierarchical (GPU processing can be performed if either is specified).
  • the for statement that caused the error may be left.
  • the verification machine 14 It is deployed on the verification machine 14, and benchmarked, for example, if it is image processing, it is benchmarked by the image processing.
  • the reciprocal of the processing time the processing time of 10 seconds is 1, 100 seconds, 0.1, and 1 second is 10.
  • Select the one with high fitness for example, select 3 to 5 out of 10 and rearrange them to create a new code pattern. In the middle of creation, you may be able to do the same thing as before. In this case, we don't need to do the same benchmark, so we use the same data as before.
  • the code pattern and its processing time are stored in the storage unit 13.
  • Explicit instruction line In specifications such as OpenACC, in addition to the instruction line that specifies parallel processing on the GPU, there is an instruction line that explicitly specifies data transfer from the CPU to the GPU and vice versa (hereinafter referred to as “explicit instruction line”). It is defined. Explicit instruction lines such as OpenACC are "#pragma acc data copyin”, which is a directive for data transfer from the CPU to the GPU (directive: an instruction / specification command in which a special symbol is described at the beginning of the line), and data from the GPU to the CPU. The transfer directive is "#pragma acc data copyout", the data transfer command from the CPU to the GPU to the CPU is “#pragma acc data copy", and the like.
  • data transfer designation using an explicit instruction line is performed together with extraction of parallel processing in GA.
  • the reference relationship of the variable data used in the loop statement is analyzed, and the data may be transferred outside the loop instead of transferring the data every time. Explicitly specify data transfer outside the loop.
  • the types of data transfer include data transfer from the CPU to the GPU and data transfer from the GPU to the CPU.
  • FIG. 4 is a diagram showing a loop statement (repeated statement) of the source code of the application program processed by the automatic offload function unit of the specific example, in which the variable defined on the CPU program side and the variable referred to on the GPU program side overlap. This is an example of the case.
  • the automatic offload function unit of a specific example is an example in which the data transfer designation unit 113 is removed from the control unit (automatic offload function unit) 11 of FIG. 1 or the data transfer designation unit 113 is not executed.
  • FIG. 4 is an example in which a variable defined on the CPU program side and a variable referenced on the GPU program side overlap in a loop statement when data is transferred from the CPU to the GPU in a specific example.
  • the following description and ⁇ 1> to ⁇ 4> at the beginning of the loop sentence in FIG. 4 are added for convenience of explanation (the same applies to other figures and their explanations).
  • the loop statement of the specific example shown in FIG. 4 is described on the CPU program side.
  • while] ⁇ ⁇ The variable a is set, and the ⁇ 4> loop [for
  • the number of loops is investigated using a profiling tool as a preliminary step to a full-scale offload processing search. Since the profiling tool can be used to investigate the number of executions of each row, it is possible to sort programs in advance, for example, targeting a program having a loop of 50 million times or more as an offload processing search.
  • a specific description will be given (partially overlaps with the content described in FIG. 3).
  • control unit 11 analyzes the application program and grasps loop statements such as for, do, and while.
  • execute sample processing use a profiling tool to investigate the number of loops in each loop statement, and determine whether or not to perform a full-scale search based on whether or not there are loops with a certain value or more. conduct.
  • the GA processing is started (see Fig. 3 above).
  • the initialization step after checking whether or not all loop statements of the application code can be parallelized, the parallelizable loop statement is mapped to the gene sequence as 1 when GPU processing is performed and 0 when not. A specified number of individuals is prepared for the gene, and 1,0 is randomly assigned to each value of the gene.
  • the code corresponding to the gene is compiled, deployed on the verification machine, executed, and the benchmark performance is measured. Increase the goodness of fit of genes with good performance patterns.
  • the code corresponding to the gene has a parallel processing instruction line (see, for example, reference numeral f in FIG. 4) inserted.
  • a gene with a high fitness is selected for a specified number of individuals based on the fitness.
  • roulette selection and elite selection of the highest fitness gene are performed according to the fitness.
  • the crossover step at a constant crossover rate Pc, some genes are exchanged between selected individuals at a certain point to create an individual offspring.
  • each value of an individual's gene is changed from 0 to 1 or 1 to 0 at a constant mutation rate Pm.
  • the process is terminated after the specified number of generations and repetition, and the gene with the highest fitness is used as the solution. With the highest performance code pattern corresponding to the gene with the highest goodness of fit, it will be redeployed to the production environment and provided to the user.
  • the implementation of the offload server 1 will be described. This implementation is for confirming the effectiveness of this embodiment.
  • An implementation that automatically offloads a C / C ++ application using a general-purpose PGI compiler will be described. Since the purpose of this implementation is to confirm the validity of GPU automatic offload, the target application is a C / C ++ language application, and the GPU processing itself uses a conventional PGI compiler for explanation.
  • the C / C ++ language is the most popular in the development of OSS (Open Source Software) and proprietary software, and many applications are being developed in the C / C ++ language.
  • OSS Open Source Software
  • applications are being developed in the C / C ++ language.
  • a general-purpose application of OSS such as encryption processing and image processing is used.
  • the GPU processing is performed by the PGI compiler.
  • the PGI compiler is a compiler for C / C ++ / Fortran that interprets OpenACC.
  • the parallelizable processing unit such as a for statement is specified by the OpenACC directive #pragma acc kernels (parallel processing specification statement).
  • #pragma acc kernels parallel processing specification statement
  • the bytecode for the GPU is extracted, and the GPU can be offloaded by executing the bytecode.
  • an error is issued when the data in the for statement is dependent on each other and cannot be processed in parallel, or when multiple layers with different nested for statements are specified.
  • directives such as #pragmaaccdatacopyin/copyout/copy enable explicit data transfer instructions.
  • Examplementation operation overview> The operation outline of the implementation will be explained. Prepare a C / C ++ application program to accelerate and a benchmark tool to measure its performance.
  • the benchmark is executed and the number of loops of the for statement grasped by the above parsing is grasped.
  • GNU coverage gcov etc. is used to grasp the number of loops.
  • profiling tools "GNU profiler (gprof)” and “GNU coverage (gcov)” are known. Either can be used because both can investigate the number of executions of each line.
  • the number of executions can be, for example, targeted only at an application program having a loop count of 10 million times or more, but this value can be changed.
  • the general-purpose application program for CPU is not implemented assuming parallelization. Therefore, first, it is necessary to eliminate the for statement for which GPU processing itself is not possible. Therefore, for each for statement, try inserting the #pragma acc kernels directive for parallel processing, and determine whether an error will occur at compile time.
  • Compile errors are difficult to deal with automatically, and even if they are dealt with, they often have no effect.
  • an external routine call it may be avoided by #pragmaaccroutine, but many external calls are libraries, and even if GPU processing including them is performed, the call becomes a bottleneck and performance does not come out. Since the for statement is tried one by one, no compile error occurs for nesting errors.
  • a is the gene length. 1 of the gene corresponds to the presence of the parallel processing directive and 0 corresponds to the absence of the parallel processing directive, and the application code is mapped to the gene of length a.
  • a gene sequence of a specified number of individuals is prepared. As described in FIG. 3, each value of the gene is created by randomly assigning 0 and 1. Depending on the prepared gene sequence, if the gene value is 1, insert the directive #pragma acc kernels that specifies parallel processing into the C / C ++ code. At this stage, the part of the code corresponding to a certain gene to be processed by the GPU is determined. Based on the reference relationship of the variable data in the for statement analyzed by the above Clang, data transfer from the CPU to the GPU and vice versa, the directive is specified based on the above rule.
  • variables that require data transfer from the CPU to the GPU are specified by #pragma acc data copyin (not shown), and variables that require data transfer from the GPU to the CPU are specified by #pragma acc data copyout. Specify (not shown). If copyin and copyout overlap for the same variable, use #pragma acc data copy to simplify the description.
  • Directive insertion, compilation, performance measurement, fitness setting, selection, crossover, and mutation processing are performed for next-generation individuals.
  • the same measured value as before is used without compiling or measuring the performance of the individual.
  • the C / C ++ code with directives corresponding to the highest performance gene sequence is used as the solution.
  • the number of individuals, the number of generations, the crossover rate, the mutation rate, the fitness setting, and the selection method are GA parameters and are specified separately.
  • step S101 the application code analysis unit 112 (see FIG. 1) analyzes the code of the application program.
  • step S102 the parallel processing designation unit 114 (see FIG. 1) specifies a loop statement and a reference relationship of the application program.
  • step S103 the parallel processing designation unit 114 operates the benchmark tool, grasps the number of loop statement loops, and distributes the threshold value.
  • step S104 the parallel processing designation unit 114 checks the parallel processing possibility of each loop statement.
  • the control unit (automatic offload function unit) 11 repeats the processing of steps S106 to S107 for the number of loop statements between the loop start end of step S105 and the loop end of step S108.
  • the parallel processing designation unit 114 compiles or interprets each loop statement by designating the GPU processing by a method according to the language.
  • the parallel processing designation unit 114 deletes the GPU processing designation from the corresponding for statement when an error occurs.
  • the parallel processing designation unit 114 counts the number of for statements that do not generate a compile error and sets the gene length.
  • the parallel processing designation unit 114 prepares a gene sequence of a designated number of individuals. Here, 0 and 1 are randomly assigned and created.
  • the parallel processing designation unit 114 maps the code of the application program to the gene.
  • a designated population pattern is prepared by mapping a gene sequence in which 0 and 1 are randomly assigned to a gene.
  • a directive that specifies parallel processing is inserted into the code of the application program (see, for example, the #pragma directive in FIG. 3).
  • the control unit (automatic offload function unit) 11 repeats the processing of steps S112 to S119 for a specified number of generations between the loop start end of step S111 and the loop end of step S120. Further, in the repetition of the designated number of generations, the designated number of individuals is further repeated for the processing of steps S113-S116 between the loop start end of step S112 and the loop end of step S117. That is, in the repetition of the specified number of generations, the repetition of the specified number of individuals is processed in a nested state.
  • step S113 the data transfer designation unit 113 designates data transfer by a method according to the language from the variable reference relationship.
  • step S114 the parallel processing pattern creation unit 115 (see FIG. 1) compiles or interprets on the GPU processing platform according to the gene pattern. That is, the parallel processing pattern creation unit 115 compiles or interprets the code of the created application program with the PGI compiler on the verification machine 14 equipped with the GPU.
  • a compile error may occur when multiple nested for statements are specified in parallel. In this case, it is treated in the same way as when the processing time at the time of performance measurement has timed out.
  • step S115 the performance measurement unit 116 (see FIG. 1) deploys the executable file on the verification machine 14 equipped with the CPU-GPU.
  • step S116 the performance measuring unit 116 executes the arranged binary file and measures the benchmark performance when offloaded.
  • step S118 the executable file creation unit 117 (see FIG. 1) evaluates the individual having a shorter processing time so that the degree of conformity is higher, and selects an individual having higher performance.
  • step S119 the executable file creation unit 117 performs crossover and mutation processing on the selected individual to create a next-generation individual.
  • the selected individuals are subjected to GA treatment of crossover treatment, mutation treatment, and copy treatment as they are to create a next-generation population.
  • step S121 the executable file creation unit 117 solves the C / C ++ code (highest-performance parallel processing pattern) corresponding to the highest-performance gene sequence after the GA processing for the specified number of generations is completed.
  • the above-mentioned number of individuals, number of generations, crossover rate, mutation rate, fitness setting, and selection method are parameters of GA.
  • the GA parameter may be set as follows, for example.
  • the parameters and conditions of Simple GA to be executed can be as follows, for example. Gene length: Number of loop sentences that can be paralleled Number of individuals M: Number of generations below gene length T: Below gene length Compatibility: (Processing time) -1/2 With this setting, the shorter the benchmark processing time, the higher the goodness of fit. Further, by setting the goodness of fit to (processing time) -1 / 2 , it is possible to prevent the goodness of fit of a specific individual having a short processing time from becoming too high and narrowing the search range.
  • time-out is performed and the goodness of fit is calculated assuming that the processing time is a time (long time) such as 1000 seconds. This time-out time may be changed according to the performance measurement characteristics. Selection: Roulette selection However, the highest fitness gene in the generation is not crossed or mutated, and elite preservation is also performed to preserve it in the next generation. Crossover rate Pc: 0.9 Mutation rate Pm: 0.05
  • gcov, gprof, etc. are used to specify in advance an application that has many loops and takes a long time to execute, and an offload trial is performed. This makes it possible to find applications that can be speeded up efficiently.
  • Loop statement offload For C language, the basic flow is the same as the above ⁇ Loop statement offload: common >>, and it can be language-independent.
  • the C language-dependent / independent processing will be described in detail.
  • the syntax is analyzed using a parsing tool such as Clang that analyzes the C language.
  • Clang As for understanding loops and variables, when managing the results of parsing tools, language-independent and abstract management can be performed.
  • the geneticization of the loop with and without GPU processing is also language-independent.
  • OpenACC is an extended grammar of C language, and variable transfer is specified.
  • FIGS. 6A-B is a flowchart of ⁇ Loop statement offload: C language >>, and FIGS. 6A and 6B are connected by a combiner. Perform the following processing using the OpenACC compiler for C / C ++.
  • step S201 the application code analysis unit 112 (see FIG. 1) analyzes the code of the C / C ++ application program.
  • step S202 the parallel processing designation unit 114 (see FIG. 1) specifies a loop statement and a reference relationship of the C / C ++ application program.
  • step S203 the parallel processing designation unit 114 operates the benchmark tool, grasps the number of loop statement loops, and distributes the threshold value.
  • step S204 the parallel processing designation unit 114 checks the parallel processing possibility of each loop statement.
  • the control unit (automatic offload function unit) 11 repeats the processing of steps S206 to S207 for the number of loop statements between the loop start end of step S205 and the loop end of step S208.
  • the parallel processing specification unit 114 compiles each loop statement by specifying GPU processing with #pragma acc kernels using the OpenACC syntax.
  • the parallel processing specification unit 114 deletes #pragma acc kernels from the corresponding for statement when an error occurs.
  • the parallel processing designation unit 114 counts the number of for statements that do not generate a compilation error and sets the gene length.
  • the parallel processing designation unit 114 prepares a gene sequence of a designated number of individuals. Here, 0 and 1 are randomly assigned and created.
  • the parallel processing designation unit 114 maps the C / C ++ application code to the gene.
  • a designated population pattern is prepared by mapping a gene sequence of a designated population to which 0 and 1 are randomly assigned to a gene.
  • the gene value is 1, insert a directive that specifies parallel processing into the C / C ++ app code (see, for example, the #pragma directive in Figure 3).
  • the control unit (automatic offload function unit) 11 repeats the processing of steps S212 to S219 for a specified number of generations between the loop start end of step S211 and the loop end of step S220. Further, in the repetition of the designated number of generations, the designated number of individuals is further repeated for the processing of steps S213-S216 between the loop start end of step S212 and the loop end of step S217. That is, in the repetition of the specified number of generations, the repetition of the specified number of individuals is processed in a nested state.
  • step S213 the data transfer designation unit 113 makes a data transfer designation using an explicit instruction line (#pragma acc data copy / in / out) from the variable reference relationship.
  • the data transfer designation using the explicit instruction line (#pragma acc data copy / in / out) was described with reference to FIG.
  • step S214 the parallel processing pattern creation unit 115 (see FIG. 1) compiles the C / C ++ code specified by the directive according to the gene pattern with the PGI compiler. That is, the parallel processing pattern creation unit 115 compiles the created C / C ++ application code with the PGI compiler on the verification machine 14 equipped with the GPU.
  • a compile error may occur when multiple nested for statements are specified in parallel. In this case, it is treated in the same way as when the processing time at the time of performance measurement has timed out.
  • step S215 the performance measurement unit 116 (see FIG. 1) deploys the executable file on the verification machine 14 equipped with the CPU-GPU.
  • step S216 the performance measuring unit 116 executes the arranged binary file and measures the benchmark performance when offloaded.
  • the same value is used instead of measuring the gene with the same pattern as before.
  • the same measured value as before is used without compiling or measuring the performance of the individual.
  • the executable file creation unit 117 evaluates the individual having a shorter processing time so that the degree of conformity is higher, and selects an individual having higher performance.
  • step S219 the executable file creation unit 117 performs crossover and mutation processing on the selected individual to create a next-generation individual.
  • the selected individuals are subjected to GA treatment of crossover treatment, mutation treatment, and copy treatment as they are to create a next-generation population.
  • step S221 the executable file creation unit 117 solves the C / C ++ code (highest performance parallel processing pattern) corresponding to the highest performance gene sequence after the completion of GA processing for the specified number of generations.
  • Loop statement offload Python >>] Loop statement offload: Python has a method of interpreting Python code with pyCUDA (see Fig. 7A-B) and a method of using the interpreter pyACC to interpret OpenACC (see Fig. 8A-B and Fig. 9A-B). .. Hereinafter, they will be described in order.
  • the interpreter interprets the Python code with the instructions in CUDA added in pyCUDA. Performance measurement is also performed using an automatic measurement tool such as Jenkins according to the language. In the next-generation gene creation, the fitness is set according to the performance measurement results and processing such as crossover is performed, but it is language-independent. Iterative execution and final solution determination are also language independent.
  • an interpreter called pyACC that interprets OpenACC may be used. In that case, the GPU processing of the loop statement may be specified in the OpenACC grammar as in the C language (described later).
  • GPU processing is selected by a genetic algorithm for Python loop statements, and an appropriate offload pattern is found.
  • FIG. 7A-B are diagrams illustrating a method of interpreting Python code with pyCUDA
  • FIG. 7A shows a conversion source example
  • FIG. 7B shows a conversion example (the top of a three-layer for statement).
  • the Python for statement is specified as a matrix operation.
  • Cupy calls the CUDA command, and CUDA executes the GPU.
  • Loop statement offload Python may use pyACC, an interpreter that interprets OpenACC, instead of pyCUDA above. In that case, GPU processing of the loop statement is specified by the OpenACC grammar as in C language.
  • OpenACC grammar as in C language.
  • FIG. 8A-B are diagrams showing a code pattern when pyACC is used, FIG. 8A shows a for statement when pyACC is used, and FIG. 8B shows a code pattern created from the for statement of FIG. 8A.
  • the code pattern shown in FIG. 8B is used in place of the code pattern of FIG.
  • FIG. 9A-B is a flowchart of ⁇ Loop statement offload: Python >>, and FIGS. 9A and 9B are connected by a combiner. Further, the code pattern shown in FIG. 8B is replaced with the code pattern of FIG. 3 and used. Perform the following processing using the OpenACC compiler for C / C ++.
  • step S301 the application code analysis unit 112 (see FIG. 1) analyzes the code of the Python application program.
  • step S302 the parallel processing designation unit 114 (see FIG. 1) specifies a loop statement and a reference relationship of the Python application program.
  • step S303 the parallel processing designation unit 114 operates the benchmark tool, grasps the number of loop statement loops, and distributes the threshold value.
  • step S304 the parallel processing designation unit 114 checks the parallel processing possibility of each loop statement.
  • the control unit (automatic offload function unit) 11 repeats the processing of steps S306-S307 for the number of loop statements between the loop start end of step S305 and the loop end of step S108.
  • the parallel processing designation unit 114 specifies and interprets GPU processing for each loop statement by a method according to the GPU processing platform. For example, when using pyACC, ⁇ pragmaacckernels of OpenACC is used, when using Cupy, the calculation of the target loop is converted to matrix calculation and specified, and when using pyCUDA directly, CUDA grammar is used.
  • step S307 the parallel processing designation unit 114 deletes the GPU processing from the corresponding for statement when an error occurs.
  • step S309 the parallel processing designation unit 114 counts the number of for statements that do not generate a compilation error and sets the gene length.
  • the parallel processing designation unit 114 prepares a gene sequence of a designated number of individuals. Here, 0 and 1 are randomly assigned and created.
  • the parallel processing designation unit 114 maps the Python application code to the gene and prepares the designated population pattern. According to the prepared gene sequence, if the gene value is 1, insert a directive to specify parallel processing in the Python application code.
  • the control unit (automatic offload function unit) 11 repeats the processing of steps S312-S319 for a specified number of generations between the loop start end of step S311 and the loop end of step S320. Further, in the repetition of the designated number of generations, the designated number of individuals is further repeated for the processing of steps S313-S316 between the loop start end of step S312 and the loop end of step S317. That is, in the repetition of the specified number of generations, the repetition of the specified number of individuals is processed in a nested state.
  • step S313 the data transfer designation unit 113 designates data transfer by a method according to the GPU processing platform from the variable reference relationship.
  • step S314 the parallel processing pattern creation unit 115 (see FIG. 1) interprets the Python application code in which the directive is specified according to the gene pattern on the GPU processing platform.
  • a compile error may occur when multiple nested for statements are specified in parallel. In this case, it is treated in the same way as when the processing time at the time of performance measurement has timed out.
  • step S315 the performance measurement unit 116 (see FIG. 1) deploys the executable file on the verification machine 14 equipped with the CPU-GPU.
  • step S316 the performance measuring unit 116 executes the arranged binary file and measures the benchmark performance when offloaded.
  • step S3108 the executable file creation unit 117 (see FIG. 1) evaluates the individual having a shorter processing time so that the degree of conformity is higher, and selects an individual having higher performance.
  • step S319 the executable file creation unit 117 performs crossover and mutation processing on the selected individual to create a next-generation individual.
  • the selected individuals are subjected to GA treatment of crossover treatment, mutation treatment, and copy treatment as they are to create a next-generation population.
  • step S321 the executable file creation unit 117 solves the Python application code (highest-performance parallel processing pattern) corresponding to the highest-performance gene sequence after the GA processing for the specified number of generations is completed.
  • Python highest-performance parallel processing pattern
  • Loop statement offload In Java, parsing is performed using a parsing tool such as JavaParser, which analyzes Java by analyzing the code of the loop statement offload. As for understanding loops and variables, when managing the results of parsing tools, language-independent and abstract management can be performed. The geneticization of the loop with and without GPU processing is also language-independent. In the coding of gene information, GPU processing is specified in Java lambda description or variable transfer is specified in order to create a code to be executed on the GPU according to the gene information.
  • the execution environment uses IBM JDK (registered trademark) that can perform parallelization in Java lambda description for GPU.
  • IBM JDK is a virtual machine that executes parallel processing to GPU according to Java lambda description.
  • Performance measurement is also performed using an automatic measurement tool such as Jenkins (registered trademark) according to the language.
  • Jenkins registered trademark
  • the fitness is set according to the performance measurement results and processing such as crossover is performed, but it is language-independent. Iterative execution and final solution determination are also language independent.
  • FIG. 10A-B are diagrams showing a code pattern when using IBM JDK
  • FIG. 10A shows a for statement when using IBM JDK
  • FIG. 10B shows a code pattern created from the for statement of FIG. 10A. ..
  • the code pattern shown in FIG. 10B is used in place of the code pattern of FIG.
  • FIG. 11A-B is a flowchart of ⁇ Loop statement offload: Java >>, and FIGS. 11A and 11B are connected by a combiner. Further, the code pattern shown in FIG. 10B is replaced with the code pattern of FIG. 3 and used.
  • step S401 the application code analysis unit 112 (see FIG. 1) analyzes the code of the Java application program.
  • step S402 the parallel processing designation unit 114 (see FIG. 1) specifies a loop statement and a reference relationship of the Java application program.
  • step S403 the parallel processing designation unit 114 operates the benchmark tool, grasps the number of loop statement loops, and distributes the threshold value.
  • step S404 the parallel processing designation unit 114 checks the parallel processing possibility of each loop statement.
  • the control unit (automatic offload function unit) 11 repeats the processing of steps S406-S407 for the number of loop statements between the loop start end of step S405 and the loop end of step S408.
  • the parallel processing specification unit 114 uses a Java lambda expression for each loop statement to java.util.Stream.IntStream.range (0, n) .parallel () forEach (i-> ⁇ Specify GPU processing with ⁇ ); and compile.
  • step S407 the parallel processing specification unit 114 deletes java.util.Stream.IntStream.range (0, n) .parallel () forEach (i-> ⁇ ); from the corresponding for statement when an error occurs. do.
  • step S409 the parallel processing designation unit 114 counts the number of for statements that do not generate a compilation error and sets the gene length.
  • the parallel processing designation unit 114 prepares a gene sequence of a designated number of individuals. Here, 0 and 1 are randomly assigned and created.
  • the parallel processing designation unit 114 maps the Java application code to the gene.
  • a designated population pattern is prepared by mapping a gene sequence of a designated population to which 0 and 1 are randomly assigned to a gene. According to the prepared gene sequence, if the gene value is 1, insert a directive to specify parallel processing in the Java application code.
  • the control unit (automatic offload function unit) 11 repeats the processing of steps S421-S419 for a specified number of generations between the loop start end of step S411 and the loop end of step S420. Further, in the repetition of the designated number of generations, the designated number of individuals is further repeated for the processing of steps S413-S416 between the loop start end of step S412 and the loop end of step S417. That is, in the repetition of the specified number of generations, the repetition of the specified number of individuals is processed in a nested state.
  • step S413 the data transfer designation unit 113 designates the data transfer in the Java description from the variable reference relationship.
  • step S414 the parallel processing pattern creation unit 115 (see FIG. 1) builds the Java application code in which the directive is specified according to the gene pattern with the IBM JDK.
  • a compile error may occur when multiple nested for statements are specified in parallel. In this case, it is treated in the same way as when the processing time at the time of performance measurement has timed out.
  • step S415 the performance measurement unit 116 (see FIG. 1) deploys the executable file on the verification machine 14 equipped with the CPU-GPU.
  • step S416 the performance measuring unit 116 executes the arranged binary file and measures the benchmark performance when offloaded.
  • step S4108 the executable file creation unit 117 (see FIG. 1) evaluates the individual having a shorter processing time so that the degree of suitability is higher, and selects an individual having higher performance.
  • step S419 the executable file creation unit 117 performs crossover and mutation processing on the selected individual to create a next-generation individual.
  • the selected individuals are subjected to GA treatment of crossover treatment, mutation treatment, and copy treatment as they are to create a next-generation population.
  • step S421 the executable file creation unit 117 solves the Java application code (highest-performance parallel processing pattern) corresponding to the highest-performance gene sequence after the GA processing for the specified number of generations is completed.
  • the first embodiment (“loop statement offload”) has been described above.
  • a second embodiment describes a functional block offload.
  • the overall configuration and operation of the functional block offload will be described with reference to FIGS. 12 to 13, and the functional block offload: common (FIGS. 14 and 15) and the functional block offload: C language (FIG. 16, FIG. FIG. 17), functional block offload: Python (FIG. 18, FIG. 19), functional block offload: Java (FIG. 20, FIG. 21) will be described in order.
  • FIG. 13 is a functional block diagram showing a configuration example of the offload server 200 according to the second embodiment of the present invention.
  • the same components as those in FIG. 2 are designated by the same reference numerals, and the description of overlapping portions will be omitted.
  • the offload server 200 is a device that automatically offloads the specific processing of the application program to the accelerator.
  • the application program includes at least one selected from C language, Python, and Java.
  • 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).
  • the input / output unit 12 is an input / output unit for transmitting / receiving information between a communication interface for transmitting / receiving information with each device and the like, an input device such as a touch panel and a keyboard, and an output device such as a monitor. It consists of an output interface.
  • the storage unit 130 is composed of a hard disk, a flash memory, a RAM (RandomAccessMemory), etc., and is a program (offload program) for executing each function of the control unit 210 and information necessary for processing of the control unit 210 (information required for processing of the control unit 210). For example, an intermediate language file (Intermediate file) 132) is temporarily stored.
  • an intermediate language file (Intermediate file) 132) is temporarily stored.
  • the storage unit 13 includes a code pattern DB (Code pattern database) 230 (described later) and a test case DB (Test case database) 131.
  • code pattern DB Code pattern database
  • test case DB Test case database
  • Performance test items are stored in the test case DB 131.
  • the test case DB 131 stores information for performing a test such as measuring the performance of a high-speed application. For example, in the case of a deep learning application for image analysis processing, it is a sample image and a test item for executing it.
  • the verification machine 14 includes a CPU (Central Processing Unit), a GPU, and an FPGA as a verification environment for environment-adaptive software.
  • a CPU Central Processing Unit
  • GPU GPU
  • FPGA field-programmable gate array
  • the code pattern DB 230 stores a library and IP core (described later) that can be offloaded to a GPU, FPGA, or the like. That is, the code pattern DB 230 provides a specific library, a GPU library (GPU library) for accelerating functional blocks, an FPGA IP core (IP core), and related information for the purpose of ⁇ Process B-1> described later. Hold.
  • the code pattern DB 230 holds a library list (external library list) for arithmetic calculations such as FFT.
  • the code pattern DB 230 stores, for example, a CUDA library and a library usage procedure for using the CUDA library as a GPU library. That is, in the following ⁇ Process C-1>, when the library or IP core to be replaced is mounted on the GPU or FPGA and connected to the host side (CPU) program, the library usage procedure is also registered and used according to the procedure. do. For example, in the CUDA library, since the procedure for using the CUDA library from the C language code is published together with the library, the procedure for using the library is also registered in the code pattern DB 230.
  • the code pattern DB 230 stores a class or structure of processing having the same description when calculated by the host. That is, in the following ⁇ Process B-2>, in order to detect a functional process other than a library call that has not been registered, a class, a structure, etc. are detected from the definition description of the source code by parsing.
  • the code pattern DB 230 registers a class or structure of a process having the same description when calculated by the host for the purpose of ⁇ Process B-2> described later. It should be noted that the similarity detection tool (described later) detects that there is a library or IP core that speeds up the functional processing of the class or structure.
  • the code pattern DB 230 stores the OpenCL code as information related to the IP core.
  • the connection between the CPU and FPGA using the OpenCL interface and the implementation of the IP core in the FPGA can be performed from the OpenCL code as a high-level synthesis tool of FPGA vendors such as Xilinx and Intel. It can be done via (see below).
  • the control unit 210 is an automatic offloading function unit that controls the entire offload server 200, and a CPU (not shown) expands the program (offload program) stored in the storage unit 130 to the RAM. It is realized by executing it.
  • control unit 210 detects a functional block that can speed up processing by offloading to the FPGA or GPU in the existing program code for the CPU, and the detected functional block is used as a library for GPU, an IP core for FPGA, or the like. Performs offload processing of functional blocks that speed up by replacing with.
  • the control unit 210 includes an application code specification unit (Specify application code) 111, an application code analysis unit (Analyze application code) 112, a replacement function detection unit 213, a replacement processing unit 214, an offload pattern creation unit 215, and the like.
  • Performance measurement unit 116 executable file creation unit 117, production environment placement unit (Deploy final binary files to production environment) 118, performance measurement test extraction execution unit (Extract performance test cases and run automatically) 119, and user provision unit. (Provide price and performance to a user to judge) 120 and.
  • the application code specification unit 111 specifies 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.
  • the application code analysis unit 112 analyzes the source code of the application program and detects the call of the external library included in the source code. Specifically, the application code analysis unit 112 uses a syntax analysis tool such as Clang to analyze the library call included in the code and the source code for analyzing the functional processing, together with the loop statement structure and the like.
  • a syntax analysis tool such as Clang
  • the application code analysis unit 112 detects the code of the class or the structure from the source code in the following ⁇ Process A-2>.
  • the replacement function detection unit 213 acquires the GPU library and the IP core from the code pattern DB 230 using the detected call as a key in the later ⁇ Process B-1>. Specifically, the replacement function detection unit 213 extracts an offloadable process that can be offloaded to the GPU or FPGA by collating the detected library call with the code pattern DB 230 using the library name as a key.
  • the code pattern DB 230 stores, for example, a CUDA library and a library usage procedure for using the CUDA library as the GPU library. Then, the replacement function detection unit 213 acquires the CUDA library from the code pattern DB 230 based on the library usage procedure.
  • the replacement function detection unit 213 acquires the GPU library and IP core from the code pattern DB 230 using the definition description code of the detected class or structure (described later) as a key in the postscript ⁇ Process B-2>. Specifically, the replacement function detection unit 213 uses a similarity detection tool that detects the copy code and the definition description code changed after copying, and the code pattern DB 230 is applied to the class or structure included in the replacement source code. Extract GPU libraries and IP cores that can be offloaded to GPUs, FPGAs that are managed in association with similar classes or structures.
  • the replacement processing unit 214 replaces the processing description of the replacement source of the source code of the application program with the processing description of the replacement destination library and IP core 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. Further, the replacement processing unit 214 offloads the processing description of the replaced library and IP core to the GPU, FPGA, or the like as a functional block to be offloaded. Specifically, the replacement processing unit 214 offloads a functional block replaced with a library for GPU, an IP core for FPGA, or the like by creating an interface with a CPU program. The replacement processing unit 214 outputs an intermediate language file 132 such as CUDA or OpenCL.
  • an intermediate language file 132 such as CUDA or OpenCL.
  • the replacement processing unit 214 replaces the processing description of the replacement source of the source code of the application program with the processing description of the acquired library and the IP core, and at the same time, the argument at the replacement source and the replacement destination. If the number or type of return values is different, notify the confirmation.
  • the replacement processing unit 214 specifies a CUDA library call to the PGI compiler in ⁇ Functional block offload: C language >>.
  • the offload pattern creation unit 215 creates one or more offload patterns. Specifically, by creating an interface with the host program and trying not to offload through performance measurement in the verification environment, an offload pattern that becomes faster is extracted.
  • the code pattern DB 230 stores the OpenCL code as information related to the IP core.
  • the offload pattern creation unit 215 connects the host and the PLD using the OpenCL interface based on the OpenCL code, and the IP core to the PLD based on the OpenCL code. Is implemented.
  • a kernel created according to the OpenCL C language syntax is executed on a device (for example, FPGA) by a program on the host (for example, CPU) side to be created by using the OpenCL C language runtime API.
  • the part that calls the kernel function hello () from the host side is to call clEnqueueTask (), which is one of the OpenCL runtime APIs.
  • the basic flow of initialization, execution, and termination of OpenCL described by the host code is the following steps 1 to 13. Of steps 1 to 13, steps 1 to 10 are procedures (preparations) until the kernel function hello () is called from the host side, and step 11 is the execution of the kernel.
  • Command queue creation Use the function clCreateCommandQueue () that provides the command queue creation function defined in the OpenCL runtime API to create a command queue that is ready to control the device.
  • the host issues an action to the device (issue a kernel execution command or a memory copy command between the host and the device) through the command queue.
  • Memory object creation Create a memory object that allows the host side to refer to the memory object by using the function clCreateBuffer () that provides the function to allocate the memory on the device defined by the OpenCL runtime API.
  • Kernel file reading The kernel executed on the device controls its execution itself by a program on the host side. Therefore, the host program must first load the kernel program. Kernel programs include binary data created by the OpenCL compiler and source code written in the OpenCL C language. Read this kernel file (description omitted). The OpenCL runtime API is not used when reading the kernel file.
  • OpenCL recognizes a kernel program as a program object. This procedure is the creation of a program object.
  • This procedure is the creation of a program object.
  • Kernel object creation Create a kernel object using the function clCreateKernel () that provides the kernel object creation function defined in the OpenCL runtime API. Since one kernel object corresponds to one kernel function, the name of the kernel function (hello) is specified when the kernel object is created. Further, when a plurality of kernel functions are described as one program object, one kernel object has a one-to-one correspondence with one kernel function, so clCreateKernel () is called multiple times.
  • Kernel argument setting Set the kernel argument using the function clSetKernel () that provides the function of giving an argument to the kernel defined by the OpenCL runtime API (passing the value to the argument of the kernel function).
  • clSetKernel that provides the function of giving an argument to the kernel defined by the OpenCL runtime API (passing the value to the argument of the kernel function).
  • Kernel execution Kernel execution (putting it in the command queue) works on the device, so it is a queuing function to the command queue.
  • the function clEnqueueTask () that provides the kernel execution function defined in the OpenCL runtime API is used to queue the command to execute the kernel hello on the device. After the command to execute the kernel hello has been queued, it will be executed in an executable arithmetic unit on the device.
  • Reading from a memory object The memory area on the device side to the memory area on the host side is used by using the function clEnqueueReadBuffer () that provides the function to copy data from the memory on the device side to the memory on the host side as defined in the OpenCL runtime API. Copy the data to.
  • the function clEnqueueWrightBuffer () that provides the function of copying data from the host side to the memory on the device side is used to copy the data from the memory area on the host side to the memory area on the device side. Since these functions work on the device, the copy command is queued to the command queue once, and then the data copy starts.
  • the performance measurement unit 116 compiles the application program of the created processing pattern, arranges it on the verification machine 14, and executes the performance measurement processing when it is offloaded to the GPU, FPGA, or the like.
  • the performance measurement unit 116 includes a binary file arrangement unit (Deploy binary files) 116a.
  • the binary file placement unit 116a deploys (places) a binary file derived from an intermediate language on a verification machine 14 equipped with a GPU or FPGA.
  • the performance measurement unit 116 executes the placed binary file, measures the performance when offloaded, and returns the performance measurement result to the binary file placement unit 116a. In this case, the performance measurement unit 116 tries to measure the performance based on the extracted intermediate language by using another extracted processing pattern (see the reference numeral g in FIG. 13 below).
  • the offload pattern creation unit 215 creates a processing pattern that offloads functional blocks that can be offloaded to the GPU or FPGA, and the executable file creation unit 117 compiles the intermediate language of the created processing pattern.
  • the performance measurement unit 116 measures the performance of the compiled program (“first performance measurement”).
  • the offload pattern creation unit 215 lists the processing patterns whose performance is higher than that of the CPU in the performance measurement.
  • the offload pattern creation unit 215 creates a new processing pattern for offloading by combining the processing patterns of the list.
  • the offload pattern creation unit 215 creates the combined offload processing pattern and the intermediate language, and the executable file creation unit 117 compiles the intermediate language.
  • the performance measurement unit 116 measures the performance of the compiled program (“second performance measurement”).
  • Executable file creation unit 117 compiles the intermediate language of the processing pattern to be offloaded and creates an executable file. Based on the performance measurement results repeated for a certain number of times, the processing pattern with the highest processing performance is selected from one or more processing patterns, the processing pattern with the highest processing performance is compiled, and the final executable file is created.
  • the production environment placement unit 118 places the created executable file in the production environment for the user (“placement of the final binary file in the production environment”).
  • the production environment placement unit 118 determines a pattern that specifies the final offload area, and deploys it to the production environment for users.
  • the performance measurement test extraction execution unit 119 extracts performance test items from the test case DB 131 after arranging the execution file, and executes the performance test. After arranging the execution file, the performance measurement test extraction execution unit 119 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.
  • the user providing unit 120 presents information such as price and performance to the user based on the performance test result (“Providing information such as price and performance to the user”).
  • the test case DB 131 stores data for automatically performing a test for measuring the performance of the application.
  • the user providing unit 120 presents to the user the price of the entire system determined by the result of executing the test data of the test case DB 131 and the unit price of each resource (virtual machine, FPGA instance, GPU instance, etc.) used in the system.
  • the user determines to start charging for the service based on the presented information such as price and performance.
  • IP core Intelligent Property Core
  • the IP core is partial circuit information for constituting a semiconductor such as FPGA, IC, and LSI, and is particularly organized in functional units.
  • Typical functional examples of the IP core are encryption / decryption processing, arithmetic operations such as FFT (Fast Fourier Transform), image processing, and voice processing.
  • FFT Fast Fourier Transform
  • voice processing Many IP cores pay a license fee, but some are provided free of charge.
  • the IP core is used for automatic offload.
  • GPU although it is not called an IP core, FFT, linear algebra, etc. are typical functional examples, and cuFFT, cuBLAS, etc. implemented using CUDA are provided free of charge as a library for GPU. There is. In the second embodiment, these libraries are utilized for the GPU.
  • the existing program code created for the CPU includes a functional block such as FFT processing that can be accelerated by offloading to the GPU or FPGA
  • the library for the GPU is included. By replacing it with an IP core for FPGA or FPGA, the speed will be increased.
  • the offload server 200 of the second embodiment is an example applied to GPU and FPGA automatic offload of user application logic as an elemental technique of environment adaptation software.
  • FIG. 13 is a diagram showing offload processing of the functional block of the offload server 200. As shown in FIG. 13, the offload server 200 is applied to the elemental techniques of environment-adaptive software.
  • the offload server 200 has a control unit (automatic offload function unit) 11, a code pattern DB 230, a test case DB 131, an intermediate language file 132, and a verification machine 14.
  • the offload server 200 acquires the application code 130 used by the user.
  • the user uses, for example, various devices 151, a device 152 having a CPU-GPU, a device 153 having a CPU-FPGA, and a device 154 having a CPU.
  • the offload server 200 automatically offloads the functional processing to the accelerator of the device 152 having the CPU-GPU and the device 153 having the CPU-FPGA.
  • step S31 Specify application code>
  • the application code designation unit 111 passes the application code described in the received file to the application code analysis unit 112.
  • Step S32 Analyze application code> (code analysis)
  • the application code analysis unit 112 uses a syntax analysis tool such as Clang to analyze the library call included in the code and the source code for analyzing the functional processing together with the loop statement structure and the like. conduct.
  • Step S33 Extract offloadable area> (Extraction of offloadable processing)
  • the replacement function detection unit 213 extracts the offloadable processing that can be offloaded to the GPU and FPGA by collating the grasped library call and function processing with the code pattern DB 230.
  • Step S34 Output intermediate file> (output intermediate file for offload)
  • 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 processing unit 214 offloads a functional block replaced with a library for GPU, an IP core for FPGA, or the like by creating an interface with a CPU program.
  • the replacement processing unit 214 outputs an intermediate language file 132 such as CUDA or OpenCL.
  • Intermediate language extraction is not a one-time process, it is repeated to try and optimize execution for proper offload area search.
  • the offload pattern creation unit 215 does not offload through the performance measurement in the verification environment described later. By trying, the faster offload pattern is extracted.
  • Step S21 Deploy binary files> (Deployment, performance measurement trial)
  • the binary file arrangement unit 116a (see FIG. 12) deploys an executable file derived from an intermediate language on the verification machine 14 equipped with the GPU and FPGA.
  • the binary file placement unit 116a starts the placed file, executes an assumed test case, and measures the performance when offloaded.
  • Step S22 Measure performances>
  • the performance measuring unit 116 executes the placed file and measures the performance when offloaded.
  • the control unit 210 repeatedly executes the steps S12 to S22.
  • the automatic offload function of the control unit 210 is summarized below. That is, the application code analysis unit 112 uses a syntax analysis tool such as Clang to analyze the library call included in the code and the source code for analyzing the functional processing together with the loop sentence structure and the like.
  • the replacement function detection unit 213 extracts the offloadable processing that can be offloaded to the GPU or FPGA by collating the detected library call or function processing with the code pattern DB 230.
  • the replacement processing unit 214 replaces the extracted offloadable processing with a library for GPU, an IP core for FPGA, or the like.
  • the offload pattern creation unit 215 offloads the functional block replaced with the library for GPU, the IP core for FPGA, or the like by creating an interface with the CPU program.
  • Step S23 Deploy final binary files to production environment>
  • the production environment placement unit 118 determines a pattern in which the final offload area is specified and deploys it in the production environment for users.
  • Step S24 Extract performance test cases and run automatically>
  • the performance measurement test extraction execution unit 119 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 after the execution file is arranged.
  • Step S25 Provide price and performance to a user to judge>
  • the user providing unit 120 presents information such as price and performance to the user based on the performance test result.
  • the user determines to start charging for the service based on the presented information such as price and performance.
  • steps S11 to S25 are performed in the background of the user's service use, and are assumed to be performed, for example, during the first day of temporary use.
  • control unit (automatic offload function unit) 210 of the offload server 200 is the source code of the application program used by the user for offloading the function processing when applied to the elemental technology of the environment adaptation software.
  • the area to be offloaded is extracted from, and the intermediate language is output (step S31 to step S34).
  • the control unit 210 arranges 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 210 deploys the executable file in the production environment actually provided to the user and provides it as a service (steps S23 to S25).
  • process A detection of functional blocks
  • process B detection of whether the functional blocks have existing libraries / IP cores for offload
  • process C three elements of interface matching with the host side
  • Process A detection of functional block
  • Process A detection of a functional block
  • ⁇ Process A-2> which detects a structure and makes it a functional block. That is, ⁇ Process A-1> detects a function call of an existing library and makes it a functional block, and ⁇ Process A-2> does not detect a functional block in ⁇ Process A-1>.
  • the application code analysis unit 112 detects that the function call of the external library is performed from the source code by using the syntax analysis.
  • 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 parses the source code, collates it with the library list held by the code pattern DB 230, and detects that a function call of an external library is being performed.
  • the application code analysis unit 112 detects the functional processing of the class or structure from the definition description of the source code by using the syntactic analysis in order to detect the functional processing other than the unregistered library call as the functional block.
  • the application code analysis unit 112 is, for example, a structure in which some variables defined by using a C language struct are grouped together, or a structure in which the type of an instantiated object is a value type. Detects a class that is a reference type for a body. Further, the application code analysis unit 112 detects a class that is used as an alternative to the structure in Java (registered trademark), for example.
  • Process B receives ⁇ Process A-1>, refers to the code pattern DB230, acquires a replaceable GPU library, and IP core ⁇ Process B-1>, and ⁇ Process B-1>.
  • A-2> the processing description of the replacement source of the application code is divided into the GPU library of the replacement destination and ⁇ processing B-2> of replacing the IP core processing description. That is, ⁇ Process B-1> acquires the replaceable GPU library and IP core from the code pattern DB 230 using the library name as a key.
  • ⁇ Process B-2> detects the replaceable GPU library / IP core using the code of the class, structure, etc. as a key, and describes the process description of the replacement source of the application code in the GPU library / IP core process description of the replacement destination. It replaces with.
  • the code pattern DB 230 holds a specific library, a GPU library for speeding up a functional block, an FPGA IP core, and related information. Further, in the code pattern DB 230, the code and the execution file are registered together with the function name for the library and the function block of the replacement source.
  • the replacement function detection unit 213 searches for the code pattern DB 230 using the library name as a key for the library call detected by the application code analysis unit 112 in ⁇ Process A-1>, and replaces the code pattern DB 230 with the replaceable GPU library. (Library for GPU that can speed up) and IP core for FPGA are acquired.
  • ⁇ Process B-1> An example of ⁇ Process B-1> is described.
  • the replacement source processing is 2D FFT processing (the code is in Non-Patent Document 4 or the like)
  • the replacement function detection unit 213 uses the external library name as a key to perform 2D FFT processing. Detects OpenCL code (host program, kernel program), etc.).
  • the OpenCL code is stored in the code pattern DB 230.
  • the GPU library is stored in the code pattern DB 230.
  • the replacement function detection unit 213 searches for the code pattern DB 230 using the code of the class, structure, etc. detected by the application code analysis unit 112 in ⁇ Process A-2> as a key, and uses the code pattern DB 230 to obtain a similarity detection tool.
  • a similarity detection tool Use to acquire a replaceable GPU library (a library for GPU that can speed up) and an IP core for FPGA.
  • the similarity detection tool is a tool such as Deckard that targets the detection of copy code and code changed after copying.
  • the replacement function detection unit 213 performs processing such as matrix calculation code, which has the same description when calculated by the CPU, and processing in which another person's code is copied and changed. The part can be detected. It should be noted that the similarity detection tool is out of scope because it is difficult to detect a newly independently created class or the like.
  • the replacement function detection unit 213 searches for a similar class or structure registered in the code pattern DB 230 by using a similarity detection tool such as Deckard for the class or structure detected by the replacement source CPU code.
  • a similarity detection tool such as Deckard for the class or structure detected by the replacement source CPU code.
  • the processing of the substitution source is a 2D FFT class
  • the class registered in the code pattern DB 230 as a similar class is detected as a 2D FFT class.
  • An IP core or GPU library capable of offloading a 2D FFT is registered in the code pattern DB 230. Therefore, as in ⁇ Process B-1>, the OpenCL code (host program, kernel program, etc.) and GPU library are detected for the 2D FFT.
  • [Process C] (Alignment of interface with host side)
  • [Process C] (matching of the interface with the host side) has ⁇ process C-1> and ⁇ process C-2>.
  • ⁇ Process C-1> receives ⁇ Process B-1> and replaces the process description of the replacement source of the application code with the GPU library and IP core process description of the replacement destination, and also for calling the GPU library and IP core.
  • ⁇ Process C-2> receives ⁇ Process B-2> and replaces the process description of the replacement source of the application code with the GPU library and IP core process description of the replacement destination, and also for calling the GPU library and IP core.
  • the description of the interface process for calling the GPU library and the IP core corresponds to "matching the interface with the host side".
  • the replacement processing unit 214 replaces the processing description of the replacement source of the application code with the GPU library and IP core processing description of the replacement destination. Then, the replacement processing unit 214 describes the GPU library and the interface processing for calling the IP core (OpenCL API, etc.), and compiles the created pattern.
  • IP core OpenCL API, etc.
  • the replacement function detection unit 213 searches for the corresponding library or IP core in ⁇ process B-1> in response to the library call detected in ⁇ process A-1>. Therefore, the replacement processing unit 214 implements the library or IP core to be replaced on the GPU or FPGA, and performs interface processing for connecting to the host side (CPU) program.
  • the replacement processing unit 214 describes the processing description of the replacement source of the application code in the GPU of the replacement destination according to the library usage method registered in the code pattern DB 230.
  • a predetermined description such as calling a function used in the GPU library is performed.
  • the replacement processing unit 214 can perform interface processing with the FPGA via a high-level synthesis tool (for example, Xilinx Vivado, Intel HLS Compiler, etc.).
  • the replacement processing unit 214 connects the CPU and the FPGA using the OpenCL interface from the OpenCL code, for example, via the high-level synthesis tool.
  • the replacement processing unit 214 implements the IP core in the FPGA via a high-level synthesis tool of the FPGA vendor such as Xilinx or Intel.
  • the replacement processing unit 214 replaces the processing description of the replacement source of the application code with the GPU library and IP core processing description of the replacement destination. Then, the replacement processing unit 214 confirms with the user when the number and type of arguments and return values are different between the replacement source and the replacement destination, and describes the interface processing for calling the GPU library and IP core (OpenCL API, etc.). And compile the created pattern. That is, in ⁇ Process C-2>, the replacement processing unit 214 searches for libraries and IP cores that can be accelerated by ⁇ Process B-2> for the classes, structures, etc. detected in ⁇ Process A-2>. are doing. Therefore, the replacement processing unit 214 mounts the corresponding library or IP core on the GPU or FPGA in ⁇ Processing C-2>.
  • ⁇ Process C-2> will be described in more detail.
  • ⁇ Process C-1> since it is a library or IP core that speeds up for a specific library call, it is necessary to generate an interface part, but the arguments assumed by the GPU, FPGA and the host side program, return. The number and type of values were correct.
  • ⁇ Process B-2> is judged by similarity, there is no guarantee that the basic parts such as the number and type of arguments and return values are correct. 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. Therefore, ask the user who requests offload whether to change the number and type of arguments and return values of the original code according to the library and IP core. Then, after confirming and approving, the off-road performance test will be tried.
  • arguments 1 and 2 are required in the CPU program and argument 3 is optional, and arguments 1 and 2 in the library and IP core. If is required, there is no problem even if the option argument 3 is omitted. In such a case, the option argument may be automatically treated as none when creating the processing pattern without confirming with the user. If the number and type of arguments and return values match perfectly, the same process as ⁇ Process C-1> may be used.
  • the control unit (automatic offload function unit) 210 of the offload server 200 indicates ⁇ functional block offload: It is a flowchart when ⁇ process A-1>, ⁇ process B-1>, and ⁇ process C-1> are executed in the offload process of "common”.
  • the application code analysis unit 112 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 library call included in the code and the source code for analyzing the functional processing, together with the loop statement structure and the like.
  • step S502 the replacement function detection unit 213 (see FIG. 12) detects an external library call of the application program.
  • the replacement function detection unit 213 acquires a replaceable GPU library from the code pattern DB 230 using the library name as a key. Specifically, the replacement function detection unit 213 can offload the detected replaceable GPU library / IP core to the GPU or FPGA by collating the grasped external library call with the code pattern DB 230. Get as a functional block.
  • step S504 the replacement processing unit 214 replaces the processing description of the replacement source of the application source code with the processing description of the GPU library of the replacement destination.
  • step S505 the replacement processing unit 214 offloads the processing description of the replaced GPU library to the GPU as a functional block to be offloaded.
  • step S506 the replacement processing unit 214 describes the interface processing for calling the GPU library.
  • step S507 the executable file creation unit 117 compiles or interprets the created pattern.
  • step S508 the performance measurement unit 116 measures the performance of the created pattern in the verification environment (“first performance measurement”).
  • step S509 the executable file creation unit 117 creates a combination pattern for the pattern that can be speeded up at the time of the first measurement.
  • the executable file creation unit 117 in step S510 compiles or interprets the combination pattern created.
  • the performance measurement unit 116 measures the performance of the created combination pattern in the verification environment (“second performance measurement”).
  • step S512 the production environment placement unit 118 selects the pattern with the highest performance among the first and second measurements and ends the processing of this flow.
  • the control unit (automatic offload function unit) 210 of the offload server 200 performs the offload process of the functional block. It is a flowchart when ⁇ process A-2>, ⁇ process B-2>, and ⁇ process C-2> are executed in. The process from ⁇ Process A-2> may be performed in parallel with the process from ⁇ Process A-1>.
  • the application code analysis unit 112 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 library call included in the code and the source code for analyzing the functional processing, together with the loop statement structure and the like.
  • step S602 the replacement function detection unit 213 (see FIG. 12) detects the definition description code of the class or structure from the source code.
  • step S603 the replacement function detection unit 213 acquires a replaceable GPU library from the code pattern DB 230 by using the similarity detection tool and using the definition description code of the class or structure as a key.
  • step S604 the replacement processing unit 214 replaces the processing description of the replacement source of the application source code with the GPU library processing description of the replacement destination.
  • step S605 the replacement processing unit 214 confirms with the user when the number and type of arguments and return values are different between the replacement source and the replacement destination.
  • the replacement function detection unit 213 offloads the replaced or confirmed processing description of the GPU library to the GPU as a functional block to be offloaded in step S606.
  • step S607 the replacement processing unit 214 describes the interface processing for calling the GPU library.
  • step S608 the executable file creation unit 117 compiles or interprets the created pattern.
  • step S609 the performance measurement unit 116 measures the performance of the created pattern in the verification environment (“first performance measurement”).
  • step S610 the executable file creation unit 117 creates a combination pattern for the pattern that can be speeded up at the time of the first measurement.
  • the executable file creation unit 117 in step S611 compiles or interprets the combination pattern created.
  • the performance measurement unit 116 measures the performance of the created combination pattern in the verification environment (“second performance measurement”).
  • step S613 the production environment arrangement unit 118 selects the highest performance pattern in the first and second measurements, and the production environment arrangement unit 118 ends the processing of this flow.
  • Functional block offload In C language code analysis, parsing is performed using a parsing tool such as Clang (registered trademark) that analyzes C language. Regarding the grasp of the functional block, the result of the parsing tool is used and it is managed as a language-independent functional block because it is used for the matching search of the next process.
  • Clang registered trademark
  • the search is performed by matching by name matching of libraries and the like, and by similarity detection using a similarity detection tool for C language functional blocks such as Deckard (registered trademark).
  • Deckard registered trademark
  • the replacement with the offload function block needs to be replaced with the processing according to the use of the offload function from the language such as calling the CUDA library.
  • compile C language code such as CUDA library call with PGI compiler or the like.
  • Performance measurement is also performed using an automatic measurement tool such as Jenkins (registered trademark) according to the language.
  • Jenkins registered trademark
  • the processing can be applied independently of the language for the management of the functional block and the matching by the name matching of the functional block.
  • the control unit (automatic offload function unit) 210 of the offload server 200 indicates ⁇ functional block offload: It is a flowchart in the case of executing ⁇ process A-1>, ⁇ process B-1>, and ⁇ process C-1> in the offload process of "C language".
  • the application code analysis unit 112 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 library call included in the code and the source code for analyzing the functional processing, together with the loop statement structure and the like.
  • step S702 the replacement function detection unit 213 (see FIG. 12) detects the application's external library call.
  • step S703 the replacement function detection unit 213 acquires a replaceable GPU library from the code pattern DB 230 using the library name as a key. Specifically, the replacement function detection unit 213 collates the grasped external library call with the code pattern DB 230, and the detected replaceable GPU library is used as an offloadable functional block that can be offloaded to the GPU and FPGA. get.
  • step S704 the replacement processing unit 214 replaces the processing description of the replacement source of the application code with the processing description of the GPU library of the replacement destination.
  • step S705 the replacement processing unit 214 offloads the processing description of the replaced GPU library to the GPU as a functional block to be offloaded.
  • step S706 the replacement processing unit 214 describes the interface processing for calling the GPU library.
  • step S707 the replacement processing unit 214 specifies the CUDA library call to the PGI compiler.
  • the executable file creation unit 117 in step S708 compiles the created pattern with the PGI compiler.
  • step S709 the performance measurement unit 116 measures the performance of the created pattern in the verification environment (“first performance measurement”).
  • step S710 the executable file creation unit 117 creates a combination pattern for the pattern that can be speeded up at the time of the first measurement.
  • the executable file creation unit 117 in step S711 compiles the combination pattern created by the PGI compiler.
  • step S712 the performance measurement unit 116 measures the performance of the created combination pattern in the verification environment (“second performance measurement”).
  • step S713 the production environment placement unit 118 selects the pattern with the highest performance among the first and second measurements and ends the processing of this flow.
  • the control unit (automatic offload function unit) 210 of the offload server 200 performs the offload process of the functional block. It is a flowchart when ⁇ process A-2>, ⁇ process B-2>, and ⁇ process C-2> are executed in. The process from ⁇ Process A-2> may be performed in parallel with the process from ⁇ Process A-1>.
  • the application code analysis unit 112 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 library call included in the code and the source code for analyzing the functional processing, together with the loop statement structure and the like.
  • step S802 the replacement function detection unit 213 (see FIG. 12) detects the definition description code of the class or structure from the source code.
  • step S803 the replacement function detection unit 213 acquires a replaceable GPU library from the code pattern DB 230 by using the similarity detection tool and using the definition description code of the class or structure as a key.
  • step S804 the replacement processing unit 214 replaces the processing description of the replacement source of the application source code with the processing description of the GPU library of the replacement destination.
  • step S805 the replacement processing unit 214 confirms with the user when the number and type of arguments and return values are different between the replacement source and the replacement destination.
  • the replacement function detection unit 213 in step S806 offloads the processing description of the replacement source of the GPU library replaced or confirmed to the GPU as a functional block to be offloaded.
  • step S807 the replacement processing unit 214 describes the interface processing for calling the GPU library.
  • step S808 the replacement processing unit 214 specifies the CUDA library call to the PGI compiler.
  • the executable file creation unit 117 in step S809 compiles the created pattern with the PGI compiler.
  • step S810 the performance measurement unit 116 measures the performance of the created pattern in the verification environment (“first performance measurement”).
  • step S811 the executable file creation unit 117 creates a combination pattern for the pattern that can be speeded up at the time of the first measurement.
  • the executable file creation unit 117 in step S812 compiles the combination pattern created by the PGI compiler.
  • step S813 the performance measurement unit 116 measures the performance of the created combination pattern in the verification environment (“second performance measurement”).
  • step S814 the production environment arrangement unit 118 selects the highest performance pattern in the first and second measurements, and the production environment arrangement unit 118 ends the processing of this flow.
  • Functional block offload Python is parsed using a parsing tool such as ast (registered trademark) that analyzes Python in the code analysis of functional block offload. Regarding the grasp of the functional block, the result of the parsing tool is used and it is managed as a language-independent functional block because it is used for the matching search of the next process.
  • ast registered trademark
  • the search is performed by matching by name matching of libraries, etc., and by similarity detection using a Python functional block similarity detection tool such as CloneDigger (registered trademark).
  • Replacement with the offload function block needs to be replaced with processing according to the use of the offload function from that language, such as calling GPU processing with pyCUDA.
  • the interpreter interprets the Python code for CUDA with pyCUDA.
  • Performance measurement is also performed using an automatic measurement tool such as Jenkins (registered trademark) according to the language.
  • Jenkins registered trademark
  • the control unit (automatic offload function unit) 210 of the offload server 200 is ⁇ functional block: Python >>. It is a flowchart when ⁇ process A-1>, ⁇ process B-1>, and ⁇ process C-1> are executed in the offload process of.
  • the application code analysis unit 112 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 library call included in the code and the source code for analyzing the functional processing, together with the loop statement structure and the like.
  • step S902 the replacement function detection unit 213 (see FIG. 12) detects the application's external library call.
  • step S903 the replacement function detection unit 213 acquires a replaceable GPU library from the code pattern DB 230 using the library name as a key. Specifically, the replacement function detection unit 213 collates the grasped external library call with the code pattern DB 230, and the detected replaceable GPU library is used as an offloadable functional block that can be offloaded to the GPU and FPGA. get.
  • step S904 the replacement processing unit 214 replaces the processing description of the replacement source of the application source code with the processing description of the GPU library of the replacement destination.
  • step S905 the replacement processing unit 214 offloads the processing description of the replaced GPU library to the GPU as a functional block to be offloaded.
  • step S906 the replacement processing unit 214 describes the interface processing for calling the GPU library.
  • step S907 the replacement processing unit 214 specifies a CUDA library call with pyCuda.
  • the executable file creation unit 117 in step S908 interprets the created pattern with pyCuda.
  • step S909 the performance measurement unit 116 measures the performance of the created pattern in the verification environment (“first performance measurement”).
  • step S910 the executable file creation unit 117 creates a combination pattern for the pattern that can be speeded up at the time of the first measurement.
  • the executable file creation unit 117 in step S911 interprets with the combination pattern pyCuda created.
  • the performance measurement unit 116 measures the performance of the created combination pattern in the verification environment (“second performance measurement”).
  • step S913 the production environment placement unit 118 selects the pattern with the highest performance among the first and second measurements and ends the processing of this flow.
  • the control unit (automatic offload function unit) 210 of the offload server 200 performs the offload process of the functional block. It is a flowchart when ⁇ process A-2>, ⁇ process B-2>, and ⁇ process C-2> are executed in. The process from ⁇ Process A-2> may be performed in parallel with the process from ⁇ Process A-1>.
  • the application code analysis unit 112 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 library call included in the code and the source code for analyzing the functional processing, together with the loop statement structure and the like.
  • step S1002 the replacement function detection unit 213 (see FIG. 12) detects the definition description code of the class or structure from the source code.
  • step S1003 the replacement function detection unit 213 acquires a replaceable GPU library from the code pattern DB 230 using the similarity detection tool and using the definition description code of the class or structure as a key.
  • step S1004 the replacement processing unit 214 replaces the processing description of the replacement source of the application source code with the GPU library processing description of the replacement destination.
  • step S1005 the replacement processing unit 214 confirms with the user when the number and type of arguments and return values are different between the replacement source and the replacement destination.
  • the replacement function detection unit 213 offloads the replaced or confirmed processing description of the GPU library to the GPU as a functional block to be offloaded in step S1006.
  • step S1007 the replacement processing unit 214 describes the interface processing for calling the GPU library.
  • step S1008 the replacement processing unit 214 specifies a CUDA library call with pyCuda.
  • the executable file creation unit 117 in step S1009 interprets the created pattern with pyCuda.
  • step S1010 the performance measurement unit 116 measures the performance of the created pattern in the verification environment (“first performance measurement”).
  • step S1011 the executable file creation unit 117 creates a combination pattern for the pattern that can be speeded up at the time of the first measurement.
  • the executable file creation unit 117 in step S1012 interprets the combination pattern created by pyCuda.
  • the performance measurement unit 116 measures the performance of the created combination pattern in the verification environment (“second performance measurement”).
  • step S1014 the production environment arrangement unit 118 selects the highest performance pattern in the first and second measurements, and the production environment arrangement unit 118 ends the processing of this flow.
  • Functional block offload In Java code analysis, parsing is performed using a parsing tool such as JavaParser (registered trademark) that analyzes Java. Regarding the grasp of the functional block, the result of the parsing tool is used and it is managed as a language-independent functional block because it is used for the matching search of the next process.
  • JavaParser registered trademark
  • the search is performed by matching by name matching of libraries, etc., and by similarity detection using a Java functional block similarity detection tool such as Deckard (registered trademark). Substitution to the offload function block needs to be replaced with processing according to the use of the offload function from the language, such as calling the CUDA library of GPU processing.
  • a Java functional block similarity detection tool such as Deckard (registered trademark).
  • the execution environment uses IBM JDK (registered trademark), which can perform processing in Java lambda description for GPU. Performance measurement is also performed using an automatic measurement tool such as Jenkins (registered trademark) according to the language. When there are multiple offloadable functional blocks, they are executed repeatedly, and the pattern with the highest performance is determined as the final solution.
  • IBM JDK registered trademark
  • Performance measurement is also performed using an automatic measurement tool such as Jenkins (registered trademark) according to the language.
  • the control unit (automatic offload function unit) 210 of the offload server 200 is ⁇ functional block: Java >>. It is a flowchart when ⁇ process A-1>, ⁇ process B-1>, and ⁇ process C-1> are executed in the offload process of.
  • the application code analysis unit 112 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 library call included in the code and the source code for analyzing the functional processing, together with the loop statement structure and the like.
  • step S1102 the replacement function detection unit 213 (see FIG. 12) detects an external library call of the application program.
  • step S1103 the replacement function detection unit 213 acquires a replaceable GPU library from the code pattern DB 230 using the library name as a key. Specifically, the replacement function detection unit 213 collates the grasped external library call with the code pattern DB 230, and the detected replaceable GPU library is used as an offloadable functional block that can be offloaded to the GPU and FPGA. get.
  • step S1104 the replacement processing unit 214 replaces the processing description of the replacement source of the application source code with the processing description of the GPU library and IP core of the replacement destination.
  • step S1105 the replacement processing unit 214 offloads the processing description of the replaced GPU library to the GPU as a functional block to be offloaded.
  • step S1106 the replacement processing unit 214 describes the interface processing for calling the GPU library.
  • step S1107 the replacement processing unit 214 specifies a CUDA library call in Jcuda.
  • the executable file creation unit 117 in step S1108 builds the created pattern with Jcuda.
  • step S1109 the performance measurement unit 116 measures the performance of the created pattern in the verification environment (“first performance measurement”).
  • step S1110 the executable file creation unit 117 creates a combination pattern for the pattern that can be speeded up at the time of the first measurement.
  • the executable file creation unit 117 in step S1111 builds the combination pattern created by Jcuda.
  • the performance measurement unit 116 measures the performance of the created combination pattern in the verification environment (“second performance measurement”).
  • step S1113 the production environment placement unit 118 selects the pattern with the highest performance among the first and second measurements and ends the processing of this flow.
  • the control unit (automatic offload function unit) 210 of the offload server 200 performs the offload process of the functional block. It is a flowchart when ⁇ process A-2>, ⁇ process B-2>, and ⁇ process C-2> are executed in. The process from ⁇ Process A-2> may be performed in parallel with the process from ⁇ Process A-1>.
  • the application code analysis unit 112 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 library call included in the code and the source code for analyzing the functional processing, together with the loop statement structure and the like.
  • step S1202 the replacement function detection unit 213 (see FIG. 12) detects the definition description code of the class or structure from the source code.
  • step S1203 the replacement function detection unit 213 acquires a replaceable GPU library from the code pattern DB 230 by using the similarity detection tool and using the definition description code of the class or structure as a key.
  • step S1204 the replacement processing unit 214 replaces the processing description of the replacement source of the application source code with the GPU library processing description of the replacement destination.
  • step S1205 the replacement processing unit 214 confirms with the user when the number and type of arguments and return values are different between the replacement source and the replacement destination.
  • the replacement function detection unit 213 offloads the replaced or confirmed processing description of the GPU library to the GPU as a functional block to be offloaded in step S1206.
  • step S1207 the replacement processing unit 214 describes the interface processing for calling the GPU library.
  • step S1108 the replacement processing unit 214 specifies a CUDA library call in Jcuda.
  • the executable file creation unit 117 in step S1209 builds the created pattern with Jcuda.
  • step S1210 the performance measurement unit 116 measures the performance of the created pattern in the verification environment (“first performance measurement”).
  • step S1211 the executable file creation unit 117 creates a combination pattern for the pattern that can be speeded up at the time of the first measurement.
  • the executable file creation unit 117 in step S1212 builds the combination pattern created by Jcuda.
  • step S1213 the performance measurement unit 116 measures the performance of the created combination pattern in the verification environment (“second performance measurement”).
  • step S1214 the production environment arrangement unit 118 selects the highest performance pattern in the first and second measurements, and the production environment arrangement unit 118 ends the processing of this flow.
  • the target application program is a C / C ++ language, Python, or Java application.
  • the PGI compiler 19.10 is used for the C / C ++ language.
  • the PGI compiler is a compiler for C / C ++ that interprets OpenACC.
  • the PGI compiler can also process calls to CUDA libraries such as cuFFT.
  • Python uses pyCUDA 2019.1.2.
  • pyCUDA is an interpreter for processing and executing from Python to GPU.
  • PyACC is an interpreter for interpreting and executing OpenACC from Python.
  • IBM JDK registered trademark
  • IBM JDK is a virtual machine that executes parallel processing to GPU according to Java lambda description.
  • LLVM / Clang 6.0 parsing library libClang® python binding
  • libClang® python binding Use ast for Python parsing
  • Java Parser® is used for Java parsing.
  • ⁇ Similarity detection tool> The C / C ++ language is used for the similarity detection tool, and Deckard v2.0 (registered trademark) is used for Java.
  • Deckard In order to expand the application area of the offload of the functional block, Deckard has the partial code to be collated and the code registered in the DB in order to realize the offload of the function copied and changed in addition to the library call.
  • Judge the similarity of. CloneDigger® is used for Python.
  • MySQL 8 is used as the code pattern DB 230 (see FIG. 12) used for collation.
  • the record for searching the library etc. that can be accelerated is held by using the calling library name as a key.
  • the name, code, and executable file associated with it are stored in the library.
  • the usage method of the executable file is also registered.
  • the code pattern DB 230 also holds a correspondence with a comparison code for detecting a library or the like by a similarity detection technique.
  • Examplementation operation The operation outline of the implementation is described.
  • the implementation performs code analysis using the syntax analysis library when there is a request to use the application.
  • the functional block offload and the loop statement offload are tried in this order. This is because the loop statement and the functional block can be faster than the functional block offload, which offloads according to the processing content including the algorithm. If functional block offload is possible, the loop statement offload in the latter half is tried for the code without the functional block part that was offloadable. As a result of performance measurement, the pattern with the highest performance is solved.
  • the replacement function detection unit 213 performs similarity detection using the similarity detection tool.
  • processing is performed in parallel with the above substitution description. That is, when the replacement function detection unit 213 performs similarity detection, in the implementation example, the detected partial code of the class, structure, etc. and the code pattern DB 230 are registered using Deckard in ⁇ Process B-2>. The similarity with the comparison code is detected. Then, the replacement function detection unit 213 detects the functional block exceeding the threshold value and the corresponding GPU library or FPGA IP core. The replacement function detection unit 213 acquires an executable file and OpenCL as in the case of ⁇ Process B-1>.
  • the execution file is created next as in the case of C-1, but it is turned off especially when the interface such as the argument, return value, type, etc. of the library or IP core to be replaced is different from the code of the replacement source. Ask the user who requested the load whether the interface can be changed according to the replacement destination library or IP core, and create an execution file after confirmation.
  • an execution file that can measure performance with the GPU or FPGA in the verification environment is created.
  • For functional block offload if there is only one functional block to replace, it is only necessary to offload one of them or not. If there are multiple, create a verification pattern of offloading / not offloading one by one, measure the performance, and detect a high-speed solution. This is because even if it is possible to increase the speed, it is not possible to know whether the speed will increase under that condition unless the actual measurement is performed. For example, if there are 5 functional blocks that can be offloaded and the offload of No. 2 and No. 4 can be accelerated as a result of the first measurement, the second measurement is performed with the pattern of offloading both No. 2 and No. 4. If the speed is faster than when offloading No. 2 and No. 4 alone, select it as the solution.
  • 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. 22, for example.
  • FIG. 22 is a hardware configuration diagram showing an example of a computer that realizes the functions of the offload servers 1,200.
  • the computer 900 includes 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. Have.
  • the CPU 901 operates based on the program stored in the ROM 902 or the HDD 904, and is controlled by each processing unit of the offload servers 1 and 200 shown in FIGS. 1 and 12.
  • the ROM 902 stores a boot program executed by the CPU 901 when the computer 900 is started, a program related to the hardware of the computer 900, and the like.
  • the CPU 901 controls an input device 910 such as a mouse and a keyboard and an output device 911 such as a display via the input / output I / F 905.
  • the CPU 901 acquires data from the input device 910 and outputs the generated data to the output device 911 via the input / output I / F 905.
  • the HDD 904 stores a program executed by the CPU 901, data used by the program, and the like.
  • the communication I / F906 receives data from another device via a communication network (for example, NW (Network) 920) and outputs the data to the CPU 901, and the communication I / F 906 transfers the data generated by the CPU 901 to another device via the communication network. Send to the device.
  • NW Network
  • the media I / F907 reads the program or data stored in the recording medium 912 and outputs the program or data to the CPU 901 via the RAM 903.
  • the CPU 901 loads the program related to the target processing 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 PD (Phase change rewritable Disk), a magneto-optical recording medium such as MO (Magneto Optical disk), a magnetic recording medium, a conductor memory tape medium, a semiconductor memory, or the like. Is.
  • the CPU 901 of the computer 900 executes the program loaded on the RAM 903 to execute the offload server 1,200.
  • the data in the RAM 903 is stored in the HDD 904.
  • the CPU 901 reads the program related to the target processing from the recording medium 912 and executes it.
  • the CPU 901 may read a program related to the target processing from another device via the communication network (NW920).
  • the offload server 1 (see FIG. 1) according to the first embodiment is an offload server that offloads the specific processing of the application program to the accelerator, and the application program is selected from C language, Python, and Java.
  • the offload server 1 analyzes the reference relationship between the application code analysis unit 112 that analyzes the source code of the application program and the variables used in the loop statement of the application program, and the data is out of the loop.
  • the data transfer specification unit 113 that specifies the data transfer using an explicitly specified line that explicitly specifies the data transfer outside the loop and the loop statement of the application program are specified and specified.
  • the parallel processing specification unit 114 that compiles by specifying the parallel processing specification statement in the accelerator, and the loop that does not generate a compile error while excluding the offload target for the repeated statement that causes a compile error.
  • a parallel processing pattern creation unit 115 for creating a parallel processing pattern that specifies whether or not to perform parallel processing for a statement is provided.
  • a plurality of performance measurement units 116 that compile an application program of a parallel processing pattern, place it on the verification machine 14, and execute performance measurement processing when offloaded to an accelerator, and a plurality of performance measurement results. Select multiple parallel processing patterns with high processing performance from the above parallel processing patterns, cross the parallel processing patterns with high processing performance, create another multiple parallel processing patterns by mutation processing, and perform new performance measurement.
  • the offload server 1 can automatically offload to the GPU by a common method even when the migration source language is various languages including C language, Python, and Java. As a result, it is not necessary to consider or implement the process according to the migration source language, and the cost can be reduced.
  • the offload server 1 automatically performs specific processing of the application program to the accelerator while reducing the number of data transfers between the CPU and GPU regardless of whether the migration source language is C language, Python, or Java. By offloading with, the overall processing capacity can be improved. As a result, even users without skills such as CUDA can perform high-performance processing using the GPU. In addition, it is possible to improve the performance of general-purpose CPU applications for which performance has not been studied in the GPU in the past. It can also be offloaded to the GPU of a general-purpose machine that is not a high-performance computing server.
  • the offload server 200 (see FIG. 12) according to the second embodiment is an offload server that offloads the specific processing of the application program to the GPU or PLD, and the application program is from C language, Python, and Java.
  • the offload server 200 which is at least one selected, analyzes the code pattern DB 230 for storing the offloadable library and IP core in the GPU or PLD, and the source code of the application program, and includes the source code in the source code.
  • the application code analysis unit 112 that detects the external library call, the replacement function detection unit 213 that acquires the library and IP core from the code pattern DB 230 using the detected external library call as a key, and the replacement of the source code of the application program.
  • the original processing description is replaced as the replacement destination library and IP core replacement destination processing description acquired by the replacement function detection unit 213, and the replaced library and IP core processing description is used as the offload target functional block.
  • the replacement processing unit 214 that offloads to the GPU or PLD, the offload pattern creation unit 215 that creates an interface with the host program, and the application of the created GPU or PLD processing pattern are compiled to create an execution file.
  • the execution file creation unit 117 and the performance measurement unit 116 that arranges the created execution file in the accelerator verification device and executes the performance measurement processing when offloaded to the GPU or PLD are provided to create the execution file.
  • Part 117 selects the GPU or PLD processing pattern with the highest processing performance from a plurality of GPU or PLD processing patterns based on the performance measurement results of the performance measurement processing, and compiles the GPU or PLD processing pattern with the highest processing performance. And create the final executable file.
  • the offload server 200 can automatically offload to the GPU by a common method even when the migration source language is various languages including C language, Python, and Java. As a result, it is necessary to consider and implement the process according to the migration source language, and it is possible to reduce the cost.
  • the offload server 200 replaces the processing description of the replacement source of the application code with the library of the replacement destination and the IP core processing description regardless of whether the migration source language is C language, Python, or Java. Then, as a functional block that can be offloaded, it is offloaded to a GPU or PLD (FPGA, etc.). That is, instead of individual loop statements, the functional blocks implemented including algorithms for hardware such as FPGA and GPU are offloaded in larger units such as matrix integration and Fourier transform. As a result, in the automatic offload to the GPU or PLD (FPGA, etc.), the offload processing can be speeded up by offloading in units of functional blocks. As a result, while the environment such as GPU, FPGA, and IoT device is diversified, the application can be adapted according to the environment, and the application can be operated with high performance.
  • a functional block that can be offloaded it is offloaded to a GPU or PLD (FPGA, etc.). That is, instead of individual loop statements, the functional blocks implemented including algorithms for hardware such as F
  • the GPU processing of the loop statement is specified by the OpenACC syntax, and the GPU processing of the functional block is called the CUDA library. It is characterized by GPU offload using a C language compiler.
  • the GPU processing of the loop statement is specified by the CUDA syntax, and the GPU processing of the functional block is called the CUDA library. It is characterized by GPU offload using pyCUDA.
  • the GPU processing of the loop statement is specified by the OpenACC syntax, and the GPU processing of the functional block is called the CUDA library. It is characterized by GPU offload using pyACC.
  • the migration source language is Python
  • it can be automatically offloaded to the GPU by a common method as in the case of C language.
  • the GPU processing of the loop statement is specified by the Java lambda syntax, and the GPU processing of the functional block is called the CUDA library. It is characterized by GPU offload using a Java virtual machine.
  • the present invention is an offload program for making a computer function as the above offload server.
  • each function of the offload server 200 can be realized by using a general computer.
  • the data transfer designation unit 113 is the code analysis result performed by the application code analysis unit 112. Based on the above, data transfer is performed so that the functional block offload and the loop statement offload are tried in this order, and if the functional block offload is possible, the functional block part that could be offloaded is removed.
  • the code may be configured to perform data transfer in which a loop statement offload is attempted.
  • the offload server first performs code analysis using the syntax analysis library when there is a request to use the application program, and then attempts functional block offload and loop statement offload in that order. If the functional block can be offloaded, the loop statement offload is tried for the code without the functional block that could be offloaded, and as a result of the performance measurement, the highest performance pattern is solved. .. As a result, regarding the loop statement and the functional block, the functional block offload that offloads according to the processing content including the algorithm can be faster. By trying in the order of functional block offload and loop statement offload, the processing speed can be increased and the overall processing capacity can be improved.
  • each of the illustrated devices is a functional concept, and does not necessarily have to be physically configured as shown in the figure. That is, the specific form of distribution / integration of each device is not limited to the one shown in the figure, and all or part of them may be functionally or physically distributed / physically in arbitrary units according to various loads and usage conditions. Can be integrated and configured.

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Health & Medical Sciences (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Software Systems (AREA)
  • Biophysics (AREA)
  • General Physics & Mathematics (AREA)
  • Biomedical Technology (AREA)
  • Computing Systems (AREA)
  • Computational Linguistics (AREA)
  • Data Mining & Analysis (AREA)
  • Evolutionary Computation (AREA)
  • General Health & Medical Sciences (AREA)
  • Molecular Biology (AREA)
  • Artificial Intelligence (AREA)
  • Genetics & Genomics (AREA)
  • Evolutionary Biology (AREA)
  • Mathematical Physics (AREA)
  • Bioinformatics & Computational Biology (AREA)
  • Bioinformatics & Cheminformatics (AREA)
  • Devices For Executing Special Programs (AREA)

Abstract

オフロードサーバ(1)は、アプリケーションプログラムの特定処理をアクセラレータにオフロードするオフロードサーバであって、アプリケーションプログラムは、C言語、Python、およびJavaより選択される少なくとも一つであり、オフロードサーバ(1)は、アプリケーションプログラムのループ文の中で用いられる変数の参照関係を分析し、ループ外でデータ転送してよいデータについては、ループ外でのデータ転送を明示的に指定する明示的指定行を用いたデータ転送指定を行うデータ転送指定部(113)と、アプリケーションプログラムのループ文を特定し、特定した各ループ文に対して、アクセラレータにおける並列処理指定文を指定してコンパイルする並列処理指定部(114)と、を備える。

Description

オフロードサーバ、オフロード制御方法およびオフロードプログラム
 本発明は、機能処理をGPU(Graphics Processing Unit)等のアクセラレータに自動オフロードするオフロードサーバ、オフロード制御方法およびオフロードプログラムに関する。
 近年、CPUの半導体集積度が1.5年で2倍になるというムーアの法則が減速するのではないかと言われている。そのような状況から、少コアのCPUだけでなく、FPGA(Field Programmable Gate Array)やGPU(Graphics Processing Unit)等のデバイスの活用が増えている。例えば、Microsoft(登録商標)社はFPGAを使ってBingの検索効率を高めるといった取り組みをしており、Amazon(登録商標)社は、FPGA, GPU等をクラウドのインスタンスとして提供している。
 少コアのCPU以外のデバイスをシステムで適切に活用するためには、デバイス特性を意識した設定やプログラム作成が必要であり、OpenMP(Open Multi-Processing)、OpenCL(Open Computing Language)、CUDA(Compute Unified Device Architecture)といった知識が必要になるため、大半のプログラマにとっては、スキルの壁が高い。
 少コアのCPU以外のGPUやFPGA、メニーコアCPU等のデバイスを活用するシステムは今後ますます増えていくと予想されるが、それらを最大限活用するには、技術的壁が高い。そこで、そのような壁を取り払い、少コアのCPU以外のデバイスを十分利用できるようにするため、プログラマが処理ロジックを記述したソフトウェアを、配置先の環境(FPGA、GPU、メニーコアCPU等)にあわせて、適応的に変換、設定し、環境に適合した動作をさせるような、プラットフォームが求められている。
 非特許文献1には、一度記述したコードを、配置先の環境に存在するGPUやFPGA、メニーコアCPU等を利用できるように、変換、リソース設定等を自動で行い、アプリケーションを高性能に動作させることを目的とした、環境適応ソフトウェアが記載されている。
 非特許文献2、3、4には、環境適応ソフトウェアの要素として、アプリケーションコードのループ文および機能ブロックを、FPGA、GPUに自動オフロードする方式が記載されている。
 GPUの並列計算パワーを画像処理でないものにも使うGPGPU(General Purpose GPU)を行うための環境としてCUDAが普及している。CUDAは、GPGPU向けのNVIDIA(登録商標)社の環境である。また、FPGA、メニーコアCPU、GPU等のヘテロなデバイスを同じように扱うための仕様としてOpenCLがあり、その開発環境も整いつつある。CUDA、OpenCLは、C言語の拡張を行いプログラムを行う形であり、プログラムの難度は高い(FPGA等のカーネルとCPUのホストとの間のメモリデータのコピーや解放の記述を明示的に行う等)。
 また、CUDAやOpenCLに比べて、より簡易にヘテロなデバイスを利用するための技術として、OpenACCやOpenMP等、コンパイラとしてPGIコンパイラやgcc(登録商標)等がある。このコンパイラは、指示行ベースで、並列処理等を行う箇所を指定して、指示行に従って、GPU、メニーコアCPU等に向けて実行ファイルを作成する。
 上記、CUDA、OpenCL、OpenACC、OpenMP等の技術仕様を用いることで、FPGAやGPU、メニーコアCPUへオフロードすることは可能になっている。しかしながら、デバイス処理自体は行えるようになっても、高速化することには課題がある。例えば、マルチコアCPU向けに自動並列化機能を持つコンパイラとして、Intelコンパイラ(登録商標)等がある。これらは、自動並列化時に、コードの中のループ文中で並列処理可能な部分を抽出して、並列化している。しかし、メモリ処理等の影響で単に並列化可能ループ文を並列化しても性能がでないことも多い。FPGAやGPU等で高速化する際には、OpenCLやCUDAの技術者がチューニングを繰り返したり、OpenACCコンパイラ等を用いて適切な並列処理範囲を探索し試行することがされている。
 このため、技術スキルが乏しいプログラマが、FPGAやGPU、メニーコアCPUを活用してアプリケーションを高速化することは難しいし、自動並列化技術等を使う場合も並列処理箇所探索の試行錯誤等の稼働が必要だった。現状、ヘテロなデバイスに対するオフロードは手動での取組みが主流である。
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. 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. 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. 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.
 非特許文献1~4に記載の技術は、C言語プログラムのGPUやFPGAへのオフロードであり、Python(登録商標)、Java(登録商標)等の多様な移行元言語は想定されていない。
 C言語だけでなく、Python、Javaと移行元言語が多様となった場合でも、アプリケーションプログラムを自動オフロードすることが要請されている。
 このような点に鑑みて本発明がなされたのであり、移行元言語に合わせて、処理を検討したり実装する必要をなくし、移行元言語が多様となった場合でも、アプリケーションプログラムを自動でオフロードすることを課題とする。
 前記した課題を解決するため、アプリケーションプログラムの特定処理をアクセラレータにオフロードするオフロードサーバであって、前記アプリケーションプログラムは、C言語、Python、およびJavaより選択される少なくとも一つであり、前記アプリケーションプログラムのソースコードを分析するアプリケーションコード分析部と、前記アプリケーションプログラムのループ文の中で用いられる変数の参照関係を分析し、ループ外でデータ転送してよいデータについては、ループ外でのデータ転送を明示的に指定する明示的指定行を用いたデータ転送指定を行うデータ転送指定部と、前記アプリケーションプログラムのループ文を特定し、特定した各前記ループ文に対して、前記アクセラレータにおける並列処理指定文を指定してコンパイルする並列処理指定部と、コンパイルエラーが出るループ文に対して、オフロード対象外とするとともに、コンパイルエラーが出ないループ文に対して、並列処理するかしないかの指定を行う並列処理パターンを作成する並列処理パターン作成部と、前記並列処理パターンの前記アプリケーションプログラムをコンパイルして、アクセラレータ検証用装置に配置し、前記アクセラレータにオフロードした際の性能測定用処理を実行する性能測定部と、性能測定結果をもとに、複数の前記並列処理パターンから高処理性能の並列処理パターンを複数選択し、高処理性能の前記並列処理パターンを交叉、突然変異処理により別の複数の並列処理パターンを作成して、新たに性能測定までを行い、指定回数の性能測定後に、性能測定結果をもとに、複数の前記並列処理パターンから最高処理性能の並列処理パターンを選択し、最高処理性能の前記並列処理パターンをコンパイルして実行ファイルを作成する実行ファイル作成部と、を備えることを特徴とするオフロードサーバとした。
 本発明によれば、移行元言語に合わせて、処理を検討したり実装する必要をなくし、移行元言語が多様となった場合でも、アプリケーションプログラムを自動でオフロードすることができる。
本発明の第1の実施形態に係るオフロードサーバの構成例を示す機能ブロック図である。 本発明の第1の実施形態に係るオフロードサーバのGAを用いた自動オフロード処理を示す図である。 本発明の第1の実施形態に係るオフロードサーバのSimple GAによる制御部(自動オフロード機能部)の処理の探索イメージとfor文の遺伝子配列マッピングを示す図である。 本発明の第1実施形態に係るオフロードサーバの自動オフロード機能部が処理するアプリケーションプログラムのソースコードのループ文(繰り返し文)を示す図である。 本発明の第1の実施形態に係るオフロードサーバの《ループ文オフロード:共通》のフローチャートである。 本発明の第1の実施形態に係るオフロードサーバの《ループ文オフロード:共通》のフローチャートである。 本発明の第1の実施形態に係るオフロードサーバの《ループ文オフロード:C言語》のフローチャートである。 本発明の第1の実施形態に係るオフロードサーバの《ループ文オフロード:C言語》のフローチャートである。 本発明の第1の実施形態に係るオフロードサーバのPythonコードをpyCUDAでインタプリットする方法による《ループ文オフロード:Python》のフローチャートである。 本発明の第1の実施形態に係るオフロードサーバのPythonコードをpyCUDAでインタプリットする方法による《ループ文オフロード:Python》のフローチャートである。 本発明の第1の実施形態に係るオフロードサーバのpyACC利用時のfor文を示す図である。 図8Aのfor文から作成されるコードパターンを示す図である。 本発明の第1の実施形態に係るオフロードサーバのpyACCを用いる方法による《ループ文オフロード:Python》のフローチャートである。 本発明の第1の実施形態に係るオフロードサーバのpyACCを用いる方法によるループ文オフロード:Python》のフローチャートである。 本発明の第1の実施形態に係るオフロードサーバのIBM JDK 利用時のfor文を示す図である。 図8Aのfor文から作成されるコードパターンを示す図である。 本発明の第1の実施形態に係るオフロードサーバのpyACCを用いる方法による《ループ文オフロード:Java》のフローチャートである。 本発明の第1の実施形態に係るオフロードサーバのpyACCを用いる方法による《ループ文オフロード:Java》のフローチャートである。 本発明の第2の実施形態に係るオフロードサーバの構成例を示す機能ブロック図である。 本発明の第2の実施形態に係るオフロードサーバの機能ブロックのオフロード処理を示す図である。 本発明の第2の実施形態に係るオフロードサーバの制御部(自動オフロード機能部)が、《機能ブロックオフロード:共通》のオフロード処理において<処理A-1>と<処理B-1>と<処理C-1>とを実行する場合のフローチャートである。 本発明の第2の実施形態に係るオフロードサーバの制御部(自動オフロード機能部)が、機能ブロックのオフロード処理において<処理A-2>と<処理B-2>と<処理C-2>とを実行する場合のフローチャートである。 本発明の第2の実施形態に係るオフロードサーバの制御部(自動オフロード機能部)が、《機能ブロックオフロード:C言語》のオフロード処理において<処理A-1>と<処理B-1>と<処理C-1>とを実行する場合のフローチャートである。 本発明の第2の実施形態に係るオフロードサーバの制御部(自動オフロード機能部)が、機能ブロックのオフロード処理において<処理A-2>と<処理B-2>と<処理C-2>とを実行する場合のフローチャートである。 本発明の第2の実施形態に係るオフロードサーバの制御部(自動オフロード機能部)が、《機能ブロック:Python》のオフロード処理において<処理A-1>と<処理B-1>と<処理C-1>とを実行する場合のフローチャートである。 本発明の第2の実施形態に係るオフロードサーバの制御部(自動オフロード機能部)が、機能ブロックのオフロード処理において<処理A-2>と<処理B-2>と<処理C-2>とを実行する場合のフローチャートである。 本発明の第2の実施形態に係るオフロードサーバの制御部(自動オフロード機能部)が、《機能ブロック:Java》のオフロード処理において<処理A-1>と<処理B-1>と<処理C-1>とを実行する場合のフローチャートである。 本発明の第2の実施形態に係るオフロードサーバの制御部(自動オフロード機能部)が、機能ブロックのオフロード処理において<処理A-2>と<処理B-2>と<処理C-2>とを実行する場合のフローチャートである。 本発明の実施形態に係るオフロードサーバの機能を実現するコンピュータの一例を示すハードウェア構成図である。
 次に、本発明を実施するための形態における、オフロードサーバ等について説明する。
 以下、明細書の説明において、移行先環境としては、GPU、FPGA、メニーコアCPUの3つを想定した例について説明する。本発明は、プログラマブルロジックデバイス全般に適用可能である。
(多様移行元言語対応の基本的な考え方)
・移行元言語
 本実施形態で対象とする多様な移行元言語としては、C言語、Python、Javaの3つとする。これら3つの言語は、毎月TIOBE(登録商標)が発表するプログラム言語の人気ランキングの上位3つであり、プログラマ人口が多い。また、C言語はコンパイル型、Pythonはインタプリタ型、Javaはその中間的方式と、方式上の多様性も3つでカバーされている。そのため、これら3つで共通的に利用できる方式であれば、より多くの言語への対応も容易と考える。
 本実施形態では、移行先環境が単なるCPUでない場合で、多様な移行元言語プログラムを、自動で高速にオフロードするために、検証環境の実機で性能測定し、進化計算手法等の手法と組み合わせて、徐々に高速なオフロードパターンを見つけるアプローチをとる。理由として、性能に関しては、コード構造だけでなく、処理するハードウェアのスペック、コンパイラやインタプリタ、データサイズ、ループ回数等の処理内容によって大きく変わるため、静的に予測する事が困難であり、動的な測定が必要だからである。実際に、市中には、ループ文を見つけコンパイル段階で並列化する自動並列化コンパイラがあるが、並列化可能ループ文の並列化だけでは性能を測定してみると低速になる場合も多いため、性能測定は必要である。
・オフロードする対象
 また、オフロードする対象については、アプリケーションプログラムのループ文および機能ブロックとするアプローチをとる。ループ文については、処理時間がかかるプログラムの処理の大半はループで費やされているという現状から、ループ文がオフロードのターゲットとして考えられる。一方、機能ブロックについては、特定処理を高速化する際に、処理内容や処理ハードウェアに適したアルゴリズムを用いることが多いため、個々のループ文の並列処理等に比べ、大きく高速化できる場合がある。行列積算やフーリエ変換等の頻繁に使われる機能ブロック単位で、GPU等の処理デバイスに応じたアルゴリズムで実装された処理(CUDAライブラリ等)に置換することで高速化する。
・移行先環境
 移行先環境としては、GPU、FPGA、メニーコアCPUの3つを想定し、これらが混在した環境でのC言語プログラムのオフロードも開示する。本発明の解決課題は、移行元言語が多様となった場合のアプリケーションの自動オフロードであるため、評価する移行先環境は限定されない。移行先環境は、一例としてGPUとし、FPGAやメニーコアCPUについては、GPUで共通的方式を確認できれば、その拡張で実現できる。
・共通的なGPUオフロード手法
 共通的なGPUオフロード手法は、「ループ文のGPU自動オフロード(以下、ループ文オフロードという)」と「機能ブロックの自動オフロード(以下、機能ブロックオフロードという)」とに分けられ、それぞれ手法が異なる。
 以下の説明において、第1の実施形態で「ループ文オフロード」を記載し、第2の実施形態で「機能ブロックの自動オフロード」を記載する。そして、第1の実施形態(「ループ文のGPU自動オフロード」)と第2の実施形態(「機能ブロックオフロード」)のそれぞれにおいて、構成と、共通処理とC言語とPythonとJavaとを説明する。目次で示すと下記である。
(目次)
・第1の実施形態(「ループ文オフロード」)の構成(図1)
 共通(移行元言語において共通)処理(図2-図4)
 共通フローチャート(図5A,図5B)
 C言語の場合のフローチャート(図6A,図6B)
 Pythonの場合の説明図(図7A,図7B,図8A,図8B)
 Pythonの場合のフローチャート(図9A,図9B)
 Javaの場合の説明図(図10A,図10B)
 Javaの場合のフローチャート(図11A,図11B)
・第2の実施形態(「機能ブロックオフロード」)の構成(図12,図13)
 共通フローチャート(図14,図15)
 C言語の場合のフローチャート(図16,図17)
 Pythonの場合のフローチャート(図18,図19)
 Javaの場合のフローチャート(図20,図21)
(第1の実施形態)
 第1の実施形態は、ループ文オフロードについて記載する。
 以下、第1の実施形態に係るオフロードサーバ1が、環境適応ソフトウェアシステムにおけるユーザ向けサービス利用のバックグラウンドで実行するオフロード処理を行う際の構成例について説明する。
 サービスを提供する際は、初日は試し利用等の形でユーザにサービス提供し、そのバックグラウンドで画像分析等のオフロード処理を行い、翌日以降は画像分析をFPGAにオフロードしてリーズナブルな価格で見守りサービスを提供できるようにすることを想定する。
 図1は、本発明の第1の実施形態に係るオフロードサーバ1の構成例を示す機能ブロック図である。
 オフロードサーバ1は、アプリケーションの特定処理をアクセラレータに自動的にオフロードする装置である。
 図1に示すように、オフロードサーバ1は、制御部11と、入出力部12と、記憶部13と、検証用マシン14(Verification machine)(アクセラレータ検証用装置)と、を含んで構成される。
 入出力部12は、クラウドレイヤ、ネットワークレイヤおよびデバイスレイヤに属する各デバイス等との間で情報の送受信を行うための通信インタフェースと、タッチパネルやキーボード等の入力装置や、モニタ等の出力装置との間で情報の送受信を行うための入出力インタフェースとから構成される。
 記憶部13は、ハードディスクやフラッシュメモリ、RAM(Random Access Memory)等により構成される。
 この記憶部13には、テストケースDB(Test case database)131が記憶されるとともに、制御部11の各機能を実行させるためのプログラム(オフロードプログラム)や、制御部11の処理に必要な情報(例えば、中間言語ファイル(Intermediate file)132)が一時的に記憶される。
 テストケースDB131は、検証対象ソフトに対応した試験項目のデータを格納する。試験項目のデータは、例えばMySQL等のデータベースシステムの場合、TPC-C等のトランザクション試験のデータである。
 制御部11は、オフロードサーバ1全体の制御を司る自動オフロード機能部(Automatic Offloading function)である。制御部11は、例えば、記憶部13に格納されたアプリケーションプログラム(オフロードプログラム)を不図示のCPU(Central Processing Unit)が、RAMに展開し実行することにより実現される。
 アプリケーションプログラムは、C言語、Python、およびJavaより選択される少なくとも一つを含む。
 制御部11は、アプリケーションコード指定部(Specify application code)111と、アプリケーションコード分析部(Analyze application code)112と、データ転送指定部113と、並列処理指定部114と、並列処理パターン作成部115と、性能測定部116と、実行ファイル作成部117と、本番環境配置部(Deploy final binary files to production environment)118と、性能測定テスト抽出実行部(Extract performance test cases and  run automatically)119と、ユーザ提供部(Provide price and performance to a user to judge)120と、を備える。
 <アプリケーションコード指定部111>
 アプリケーションコード指定部111は、入力されたアプリケーションコードの指定を行う。具体的には、アプリケーションコード指定部111は、受信したファイルに記載されたアプリケーションコードを、アプリケーションコード分析部112に渡す。
 <アプリケーションコード分析部112>
 アプリケーションコード分析部112は、処理機能のソースコードを分析し、ループ文やFFTライブラリ呼び出し等の構造を把握する。
 <データ転送指定部113>
 データ転送指定部113は、アプリケーションプログラムのループ文の中で用いられる変数の参照関係を分析し、ループ外でデータ転送してよいデータについては、ループ外でのデータ転送を明示的に指定する明示的指定行を用いたデータ転送指定を行う。
 データ転送指定部113は、CPUからGPUへのデータ転送を明示的に指定する明示的指定行と、GPUからCPUへのデータ転送を明示的に指定する明示的指定行と、同じ変数に関してCPUからGPUへの転送とGPUからCPUへの転送とが重なる場合、データコピーの往復をまとめて明示的に指定する明示的指定行と、を用いたデータ転送指定を行う。
 データ転送指定部113は、CPUプログラム側で定義した変数とGPUプログラム側で参照する変数が重なる場合、CPUからGPUへのデータ転送の指示を行い、データ転送を指定する位置を、GPU処理するループ文かそれより上位のループ文で、該当変数の設定、定義を含まない最上位のループとする。また、データ転送指定部113は、GPUプログラム側で設定した変数とCPUプログラム側で参照する変数とが重なる場合、GPUからCPUへのデータ転送の指示を行い、データ転送を指定する位置を、GPU処理するループ文か、それより上位のループ文で、該当変数の参照、設定、定義を含まない最上位のループとする。
 <並列処理指定部114>
 並列処理指定部114は、アプリケーションプログラムのループ文(繰り返し文)を特定し、各ループ文に対して、アクセラレータにおける並列処理指定文を指定してコンパイルする。
 並列処理指定部114は、オフロード範囲抽出部(Extract offloadable area)114aと、中間言語ファイル出力部(Output intermediate file)114bと、を備える。
 オフロード範囲抽出部114aは、ループ文やFFT等、GPU・FPGAにオフロード可能な処理を特定し、オフロード処理に応じた中間言語を抽出する。
 中間言語ファイル出力部114bは、抽出した中間言語ファイル132を出力する。中間言語抽出は、一度で終わりでなく、適切なオフロード領域探索のため、実行を試行して最適化するため反復される。
 <並列処理パターン作成部115>
 並列処理パターン作成部115は、コンパイルエラーが出るループ文(繰り返し文)に対して、オフロード対象外とするとともに、コンパイルエラーが出ない繰り返し文に対して、並列処理するかしないかの指定を行う並列処理パターンを作成する。
 <性能測定部116>
 性能測定部116は、並列処理パターンのアプリケーションプログラムをコンパイルして、検証用マシン14に配置し、アクセラレータにオフロードした際の性能測定用処理を実行する。
 性能測定部116は、バイナリファイル配置部(Deploy binary files)116aを備える。バイナリファイル配置部116aは、GPU・FPGAを備えた検証用マシン14に、中間言語から導かれる実行ファイルをデプロイ(配置)する。
 性能測定部116は、配置したバイナリファイルを実行し、オフロードした際の性能を測定するとともに、性能測定結果を、オフロード範囲抽出部114aに戻す。この場合、オフロード範囲抽出部114aは、別の並列処理パターン抽出を行い、中間言語ファイル出力部114bは、抽出された中間言語をもとに、性能測定を試行する(後記図2の符号a参照)。
 <実行ファイル作成部117>
 実行ファイル作成部117は、所定回数繰り返された、性能測定結果をもとに、複数の前記並列処理パターンから高処理性能の並列処理パターンを複数選択し、高処理性能の並列処理パターンを交叉、突然変異処理により別の複数の並列処理パターンを作成して、新たに性能測定までを行い、指定回数の性能測定後に、性能測定結果をもとに、複数の前記並列処理パターンから最高処理性能の並列処理パターンを選択し、最高処理性能の前記並列処理パターンをコンパイルして実行ファイルを作成する。
 <本番環境配置部118> 
 本番環境配置部118は、作成した実行ファイルを、ユーザ向けの本番環境に配置する(「最終バイナリファイルの本番環境への配置」)。本番環境配置部118は、最終的なオフロード領域を指定したパターンを決定し、ユーザ向けの本番環境にデプロイする。
 <性能測定テスト抽出実行部119>
 性能測定テスト抽出実行部119は、実行ファイル配置後、テストケースDB131から性能試験項目を抽出し、性能試験を実行する(「最終バイナリファイルの本番環境への配置」)。
 性能測定テスト抽出実行部119は、実行ファイル配置後、ユーザに性能を示すため、性能試験項目をテストケースDB131から抽出し、抽出した性能試験を自動実行する。
 <ユーザ提供部120>
 ユーザ提供部120は、性能試験結果を踏まえた、価格・性能等の情報をユーザに提示する(「価格・性能等の情報のユーザへの提供」)。テストケースDB131には、性能試験項目が格納されている。ユーザ提供部120は、テストケースDB131に格納された試験項目に対応した性能試験の実施結果に基づいて、価格、性能等のデータを、上記性能試験結果と共にユーザに提示する。ユーザは、提示された価格・性能等の情報をもとに、サービスの課金利用開始を判断する。ここで、本番環境への一括デプロイには、非特許文献(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.1186/s13677-014-0007-3, 12 pages, June 2014.)の技術を、また、性能自動試験には、非特許文献(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.1186/s13677-015-0028-6, 14 pages, Feb. 2015.)の技術を用いればよい。
[遺伝的アルゴリズムの適用]
 オフロードサーバ1は、オフロードの最適化にGAを用いることができる。GAを用いた場合のオフロードサーバ1の構成は下記の通りである。
 すなわち、並列処理指定部114は、遺伝的アルゴリズムに基づき、コンパイルエラーが出ないループ文(繰り返し文)の数を遺伝子長とする。並列処理パターン作成部115は、アクセラレータ処理をする場合を1または0のいずれか一方、しない場合を他方の0または1として、アクセラレータ処理可否を遺伝子パターンにマッピングする。
 並列処理パターン作成部115は、遺伝子の各値を1か0にランダムに作成した指定個体数の遺伝子パターンを準備し、性能測定部116は、各個体に応じて、アクセラレータにおける並列処理指定文を指定したアプリケーションコードをコンパイルして、検証用マシン14に配置する。性能測定部116は、検証用マシン14において性能測定用処理を実行する。
 ここで、性能測定部116は、途中世代で、以前と同じ並列処理パターンの遺伝子が生じた場合は、当該並列処理パターンに該当するアプリケーションコードのコンパイル、および、性能測定はせずに、性能測定値としては同じ値を使う。
 また、性能測定部116は、コンパイルエラーが生じるアプリケーションコード、および、性能測定が所定時間で終了しないアプリケーションコードについては、タイムアウトの扱いとして、性能測定値を所定の時間(長時間)に設定する。
 実行ファイル作成部117は、全個体に対して、性能測定を行い、処理時間の短い個体ほど適合度が高くなるように評価する。実行ファイル作成部117は、全個体から、適合度が所定値(例えば、全個数の上位n%、または全個数の上位m個 n,mは自然数)より高いものを性能の高い個体として選択し、選択された個体に対して、交叉、突然変異の処理を行い、次世代の個体を作成する。実行ファイル作成部117は、指定世代数の処理終了後、最高性能の並列処理パターンを解として選択する。
 以下、上述のように構成されたオフロードサーバ1の自動オフロード動作について説明する。
[自動オフロード動作]
 図2は、オフロードサーバ1のGAを用いた自動オフロード処理を示す図である。
 図2に示すように、オフロードサーバ1は、環境適応ソフトウェアの要素技術に適用される。オフロードサーバ1は、制御部(自動オフロード機能部)11と、テストケースDB131と、中間言語ファイル132と、検証用マシン14と、を有している。
 オフロードサーバ1は、ユーザが利用するアプリケーションコード(Application code)125を取得する。
 ユーザは、例えば、各種デバイス(Device151、CPU-GPUを有する装置152、CPU-FPGAを有する装置153、CPUを有する装置154)の利用を契約した人である。
 オフロードサーバ1は、機能処理をCPU-GPUを有する装置152、CPU-FPGAを有する装置153のアクセラレータに自動オフロードする。
 以下、図2のステップ番号を参照して各部の動作を説明する。
 <ステップS11:Specify application code>
 ステップS11において、アプリケーションコード指定部111(図1参照)は、受信したファイルに記載されたアプリケーションコードを、アプリケーションコード分析部112に渡す。
 <ステップS12:Analyze application code>
 ステップS12において、アプリケーションコード分析部112(図1参照)は、処理機能のソースコードを分析し、ループ文やFFTライブラリ呼び出し等の構造を把握する。
 <ステップS13:Extract offloadable area>
 ステップS13において、並列処理指定部114(図1参照)は、アプリケーションのループ文(繰り返し文)を特定し、各繰り返し文に対して、アクセラレータにおける並列処理指定文を指定してコンパイルする。具体的には、オフロード範囲抽出部114a(図1参照)は、ループ文やFFT等、GPU・FPGAにオフロード可能な処理を特定し、オフロード処理に応じた中間言語を抽出する。
 <ステップS14:Output intermediate file>
 ステップS14において、中間言語ファイル出力部114b(図1参照)は、中間言語ファイル132を出力する。中間言語抽出は、一度で終わりでなく、適切なオフロード領域探索のため、実行を試行して最適化するため反復される。
 <ステップS15:Compile error>
 ステップS15において、並列処理パターン作成部115(図1参照)は、コンパイルエラーが出るループ文に対して、オフロード対象外とするとともに、コンパイルエラーが出ない繰り返し文に対して、並列処理するかしないかの指定を行う並列処理パターンを作成する。
 <ステップS21:Deploy binary files>
 ステップS21において、バイナリファイル配置部116a(図1参照)は、GPU・FPGAを備えた検証用マシン14に、中間言語から導かれる実行ファイルをデプロイする。
 <ステップS22:Measure performances>
 ステップS22において、性能測定部116(図1参照)は、配置したファイルを実行し、オフロードした際の性能を測定する。
 オフロードする領域をより適切にするため、この性能測定結果は、オフロード範囲抽出部114aに戻され、オフロード範囲抽出部114aが、別パターンの抽出を行う。そして、中間言語ファイル出力部114bは、抽出された中間言語をもとに、性能測定を試行する(図2の符号a参照)。
 図2の符号aに示すように、制御部11は、上記ステップS12乃至ステップS22を繰り返し実行する。制御部11の自動オフロード機能をまとめると、下記である。すなわち、並列処理指定部114は、アプリケーションプログラムのループ文(繰り返し文)を特定し、各繰返し文に対して、GPUでの並列処理指定文を指定して、コンパイルする。そして、並列処理パターン作成部115は、コンパイルエラーが出るループ文を、オフロード対象外とし、コンパイルエラーが出ないループ文に対して、並列処理するかしないかの指定を行う並列処理パターンを作成する。そして、バイナリファイル配置部116aは、該当並列処理パターンのアプリケーションプログラムをコンパイルして、検証用マシン14に配置し、性能測定部116が、検証用マシン14で性能測定用処理を実行する。実行ファイル作成部117は、所定回数繰り返された、性能測定結果をもとに、複数の並列処理パターンから最高処理性能のパターンを選択し、選択パターンをコンパイルして実行ファイルを作成する。
 <ステップS23:Deploy final binary files to production environment>
 ステップS23において、本番環境配置部118は、最終的なオフロード領域を指定したパターンを決定し、ユーザ向けの本番環境にデプロイする。
 <ステップS24:Extract performance test cases and  run automatically>
 ステップS24において、性能測定テスト抽出実行部119は、実行ファイル配置後、ユーザに性能を示すため、性能試験項目をテストケースDB131から抽出し、抽出した性能試験を自動実行する。
 <ステップS25:Provide price and performance to a user to judge>
 ステップS25において、ユーザ提供部120は、性能試験結果を踏まえた、価格・性能等の情報をユーザに提示する。ユーザは、提示された価格・性能等の情報をもとに、サービスの課金利用開始を判断する。
 上記ステップS11~ステップS25は、例えばユーザのサービス利用のバックグラウンドで行われ、例えば、仮利用の初日の間に行う等を想定している。また、コスト低減のためにバックグラウンドで行う処理は、機能配置最適化とGPU・FPGAオフロードのみを対象としてもよい。
 上記したように、オフロードサーバ1の制御部(自動オフロード機能部)11は、環境適応ソフトウェアの要素技術に適用した場合、機能処理のオフロードのため、ユーザが利用するアプリケーションプログラムのソースコードから、オフロードする領域を抽出して中間言語を出力する(ステップS11~ステップS15)。制御部11は、中間言語から導かれる実行ファイルを、検証用マシン14に配置実行し、オフロード効果を検証する(ステップS21~ステップS22)。検証を繰り返し、適切なオフロード領域を定めたのち、制御部11は、実際にユーザに提供する本番環境に、実行ファイルをデプロイし、サービスとして提供する(ステップS23~ステップS25)。
[GAを用いたGPU自動オフロード]
 GPU自動オフロードは、GPUに対して、図2のステップS12~ステップS22を繰り返し、最終的にステップS23でデプロイするオフロードコードを得るための処理である。
 GPUは、一般的にレイテンシーは保証しないが、並列処理によりスループットを高めることに向いたデバイスである。環境適応ソフトウェアの暗号化処理や、カメラ映像分析のための画像処理、大量センサデータ分析のための機械学習処理等が代表的であり、それらは、繰り返し処理が多い。そこで、アプリケーションの繰り返し文をGPUに自動でオフロードすることでの高速化を狙う。
 しかし、従来技術で記載の通り、高速化には適切な並列処理が必要である。特に、GPUを使う場合は、CPUとGPU間のメモリ転送のため、データサイズやループ回数が多くないと性能が出ないことが多い。また、メモリデータ転送のタイミング等により、並列高速化できる個々のループ文(繰り返し文)の組み合わせが、最速とならない場合等がある。例えば、10個のfor文(繰り返し文)で、1番、5番、10番の3つがCPUに比べて高速化できる場合に、1番、5番、10番の3つの組み合わせが最速になるとは限らない等である。
 適切な並列領域指定のため、PGIコンパイラを用いて、for文の並列可否を試行錯誤して最適化する試みがある。しかし、試行錯誤には多くの稼働がかかり、サービスとして提供する際に、ユーザの利用開始が遅くなり、コストも上がってしまう問題がある。
 そこで、本実施形態では、並列化を想定していない汎用プログラムから、自動で適切なオフロード領域を抽出する。このため、最初に並列可能for文のチェックを行い、次に並列可能for文群に対してGAを用いて検証環境で性能検証試行を反復し適切な領域を探索すること、を実現する。並列可能for文に絞った上で、遺伝子の部分の形で、高速化可能な並列処理パターンを保持し組み換えていくことで、取り得る膨大な並列処理パターンから、効率的に高速化可能なパターンを探索できる。
[Simple GAによる制御部(自動オフロード機能部)11の探索イメージ]
 図3は、Simple GAによる制御部(自動オフロード機能部)11の処理の探索イメージとfor文の遺伝子配列マッピングを示す図である。
 GAは、生物の進化過程を模倣した組合せ最適化手法の一つである。GAのフローチャートは、初期化→評価→選択→交叉→突然変異→終了判定となっている。
 本実施形態では、GAの中で、処理を単純にしたSimple GAを用いる。Simple GAは、遺伝子は1、0のみとし、ルーレット選択、一点交叉、突然変異は1箇所の遺伝子の値を逆にする等、単純化されたGAである。
 <初期化>
 初期化では、アプリケーションコードの全for文の並列可否をチェック後、並列可能for文を遺伝子配列にマッピングする。GPU処理する場合は1、GPU処理しない場合は0とする。遺伝子は、指定の個体数Mを準備し、1つのfor文にランダムに1、0の割り当てを行う。
 具体的には、制御部(自動オフロード機能部)11(図1参照)は、ユーザが利用するアプリケーションコード(Application code)130(図2参照)を取得し、図3に示すように、アプリケーションコード130のコードパターン(Code patterns)141からfor文の並列可否をチェックする。図3に示すように、コードパターン141から3つのfor文が見つかった場合(図3の符号b参照)、各for文に対して1桁、ここでは3つのfor文に対し3桁の1または0を割り当てる。例えば、CPUで処理する場合0、GPUに出す場合1とする。ただし、この段階では1または0をランダムに割り当てる。
 遺伝子長に該当するコードが3桁であり、3桁の遺伝子長のコードは2パターン、例えば100、101、…となる。なお、図3では、コードパターン141中の丸印(○印)をコードのイメージとして示している。
 <評価>
 評価では、デプロイとパフォーマンスの測定(Deploy & performance measurement)を行う(図3の符号c参照)。すなわち、性能測定部116(図1参照)は、遺伝子に該当するコードをコンパイルして検証用マシン14にデプロイして実行する。性能測定部116は、ベンチマーク性能測定を行う。性能が良いパターン(並列処理パターン)の遺伝子の適合度を高くする。
 <選択>
 選択では、適合度に基づいて、高性能コードパターンを選択(Select high performance code patterns)する(図3の符号d参照)。性能測定部116(図1参照)は、適合度に基づいて、高適合度の遺伝子を、指定の個体数選択する。本実施形態では、適合度に応じたルーレット選択および最高適合度遺伝子のエリート選択を行う。
 図3では、選択されたコードパターン(Select code patterns)142の中の丸印(○印)が、3つに減ったことを探索イメージとして示している。
 <交叉>
 交叉では、一定の交叉率Pcで、選択された個体間で一部の遺伝子をある一点で交換し、子の個体を作成する。
 ルーレット選択された、あるパターン(並列処理パターン)と他のパターンとの遺伝子を交叉させる。一点交叉の位置は任意であり、例えば上記3桁のコードのうち2桁目で交叉させる。
 <突然変異>
 局所解を避けるため、突然変異を導入する。なお、演算量を削減するために突然変異を行わない態様でもよい。突然変異では、一定の突然変異率Pmで、個体の遺伝子の各値を0から1または1から0に変更する。
 <終了判定>
 図3に示すように、交叉と突然変異後の次世代コードパターンの生成(Generate next generation code patterns after crossover & mutation)を行う(図3の符号e参照)。
 終了判定では、指定の世代数T回、繰り返しを行った後に処理を終了し、最高適合度の遺伝子を解とする。
 例えば、性能測定して、速い3つ101、010、001を選ぶ。この3つをGAにより、次の世代は、組み換えをして、例えば新しいパターン(並列処理パターン)101(一例)を作っていく。このとき、組み換えをしたパターンに、勝手に0を1にするなどの突然変異を入れる。上記を繰り返して、一番早いパターンを見付ける。指定世代(例えば、20世代)などを決めて、最終世代で残ったパターンを、最後の解とする。
 <デプロイ(配置)>
 最高適合度の遺伝子に該当する、最高処理性能の並列処理パターンで、本番環境に改めてデプロイして、ユーザに提供する。
 GPUにオフロードできないfor文(ループ文;繰り返し文)が相当数存在する場合について説明する。例えば、for文が200個あっても、GPUにオフロードできるものは30個くらいである。ここでは、エラーになるものを除外し、この30個について、GAを行う。
 例えば、C/C++コードに対するGPUの処理を行う仕様であるOpenACCには、ディレクティブ #pragma acc kernelsで指定して、GPU向けバイトコードを抽出し、実行によりGPUオフロードを可能とするコンパイラがある。Python, Javaの場合は、CUDAやJava Lambda式などでGPU処理を指定すればよい。
 また、C/C++を使った場合、C/C++のコードを分析し、for文を見付ける。for文を見付けると、OpenACCで並列処理の文法である #pragma acc kernelsを使ってfor文に対して書き込む。詳細には、何も入っていない #pragma acc kernels に、一つ一つfor文を入れてコンパイルして、エラーであれば、そのfor文はそもそも、GPU処理できないので、除外する。このようにして、残るfor文を見付ける。そして、エラーが出ないものを、長さ(遺伝子長)とする。エラーのないfor文が5つであれば、遺伝子長は5であり、エラーのないfor文が10であれば、遺伝子長は10である。なお、並列処理できないものは、前の処理を次の処理に使うようなデータに依存がある場合である。
 以上が準備段階である。次にGA処理を行う。
 for文の数に対応する遺伝子長を有するコードパターンが得られている。始めはランダムに並列処理パターン100、010、001、…を割り当てる。そして、GA処理を行い、コンパイルする。その時に、オフロードできるfor文であるにもかかわらず、エラーがでることがある。for文が階層になっている(どちらか指定すればGPU処理できる)場合である。この場合は、エラーとなったfor文は、残してもよい。具体的には、処理時間が多くなった形にして、タイムアウトさせる方法がある。
 検証用マシン14でデプロイして、ベンチマーク、例えば画像処理であればその画像処理でベンチマークする、その処理時間が短い程、適応度が高いと評価する。例えば、処理時間の逆数、処理時間10秒かかるものは1、100秒かかるものは0.1、1秒のものは10とする。
 適応度が高いものを選択して、例えば10個のなかから、3~5個を選択して、それを組み替えて新しいコードパターンを作る。作成途中で、前と同じものができる場合がある。この場合、同じベンチマークを行う必要はないので、前と同じデータを使う。本実施形態では、コードパターンと、その処理時間は記憶部13に保存しておく。
 以上で、Simple GAによる制御部(自動オフロード機能部)11の探索イメージについて説明した。次に、データ転送の一括処理手法について述べる。
[データ転送の一括処理手法]
 上述したように、遺伝的アルゴリズムを用いることで、GPU処理で効果のある並列処理部を自動チューニングしている。しかしながら、CPU-GPUメモリ間のデータ転送によっては高性能化できないアプリケーションもあった。このため、スキルが無いユーザがGPUを使ってアプリケーションを高性能化することは難しいし、自動並列化技術等を使う場合も並列処理可否の試行錯誤が必要であり、高速化できない場合があった。
 そこで、本実施形態では、より多くのアプリケーションを、自動でGPUを用いて高性能化することを狙うとともに、GPUへのデータ転送回数を低減できる技術を提供する。
 <基本的な考え方>
 OpenACC等の仕様では、GPUでの並列処理を指定する指示行に加えて、CPUからGPUへのデータ転送やその逆を明示的に指定する指示行(以下、「明示的指示行」という)が定義されている。OpenACC等の明示的指示行は、CPUからGPUへのデータ転送のディレクティブ(directive:行頭に特殊な記号を記述した指示・指定コマンド)である「#pragma acc data copyin」、GPUからCPUへのデータ転送のディレクティブである「#pragma acc data copyout」、CPUからGPUへ再びCPUへのデータ転送のディレクティブである「#pragma acc data copy」等である。
 本実施形態は、非効率なデータ転送を低減するため、明示的指示行を用いたデータ転送指定を、GAでの並列処理の抽出と合わせて行う。
 本実施形態では、GAで生成された各個体について、ループ文の中で利用される変数データの参照関係を分析し、ループ毎に毎回データ転送するのではなくループ外でデータ転送してよいデータについては、ループ外でのデータ転送を明示的に指定する。
 <具体例>
 以下、具体的に処理を説明する。
 データ転送の種類は、CPUからGPUへのデータ転送、および、GPUからCPUへのデータ転送がある。
 図4は、具体例の自動オフロード機能部が処理するアプリケーションプログラムのソースコードのループ文(繰り返し文)を示す図であり、CPUプログラム側で定義した変数とGPUプログラム側で参照する変数が重なる場合の例である。
 具体例の自動オフロード機能部は、図1の制御部(自動オフロード機能部)11からデータ転送指定部113を取り去る、またはデータ転送指定部113を実行しない場合の例である。
 具体例のCPUからGPUへのデータ転送を例に採る。
 図4は、具体例のCPUからGPUへデータ転送する場合のループ文において、CPUプログラム側で定義した変数とGPUプログラム側で参照する変数が重なる場合の例である。なお、以下の記載および図4中のループ文の文頭の<1>~<4> は、説明の便宜上で付したものである(他図およびその説明においても同様)。
 図4に示す具体例のループ文は、CPUプログラム側で記述され、
<1> ループ〔 for|do|while 〕 {
}
の中に、
 <2> ループ〔 for|do|while 〕 {
 }
があり、さらにその中に、
  <3> ループ〔 for|do|while 〕 {
  }
があり、さらにその中に、
   <4> ループ〔 for〕{
   }
がある。
 また、<1> ループ〔 for|do|while 〕 {
}で、変数aが設定され、<4> ループ〔 for|do|while 〕 {
}で、変数aが参照される。
 さらに、<3> ループ〔 for|do|while 〕 {
}で、PGIコンパイラによるfor文等の並列処理可能処理部を、OpenACCのディレクティブ #pragma acc kernels(並列処理指定文)で指定している(詳細後記)。
 図4に示す比較例のループ文では、図4の符号fに示すタイミングで毎回CPUからGPUにデータ転送する。このため、GPUへのデータ転送回数を低減することが求められる。
 なお、GPUからCPUへのデータ転送も同様であり説明を省略する。
 以上述べたように、本実施形態では、できるだけ上位のループでデータ転送を一括して行うように、データ転送を明示的に指示することで、ループ毎に毎回データを転送する非効率な転送を避けることができる。
[GPUオフロード処理]
 上述したデータ転送の一括処理手法により、オフロードに適切なループ文を抽出し、非効率なデータ転送を避けることができる。
 ただし、上記データ転送の一括処理手法を用いても、GPUオフロードに向いていないプログラムも存在する。効果的なGPUオフロードには、オフロードする処理のループ回数が多いことが必要である。
 そこで、本実施形態では、本格的なオフロード処理探索の前段階として、プロファイリングツールを用いて、ループ回数を調査する。プロファイリングツールを用いると、各行の実行回数を調査できるため、例えば、5000万回以上のループを持つプログラムをオフロード処理探索の対象とする等、事前に振り分けることができる。以下、具体的に説明する(前記図3で述べた内容と一部重複する)。
 本実施形態では、まず、制御部(自動オフロード機能部)11(図1参照)が、アプリケーションプログラムを分析し、for,do,while等のループ文を把握する。次に、サンプル処理を実行し、プロファイリングツールを用いて、各ループ文のループ回数を調査し、一定の値以上のループがあるか否かで、探索を本格的に行うか否かの判定を行う。
 探索を本格的に行うと決まった場合は、GAの処理に入る(前記図3参照)。初期化ステップでは、アプリケーションコードの全ループ文の並列可否をチェックした後、並列可能ループ文をGPU処理する場合は1、しない場合は0として遺伝子配列にマッピングする。遺伝子は、指定の個体数が準備されるが、遺伝子の各値にはランダムに1,0の割り当てをする。
 ここで、遺伝子に該当するコードでは、GPU処理すると指定されたループ文内の変数データ参照関係から、データ転送の明示的指示(OpenACCで指定するならば#pragma acc data copyin/copyout/copy)を追加する。
 評価ステップでは、遺伝子に該当するコードをコンパイルして検証用マシンにデプロイして実行し、ベンチマーク性能測定を行う。性能が良いパターンの遺伝子の適合度を高くする。遺伝子に該当するコードは、上述のように、並列処理指示行(例えば、図4の符号f参照)が挿入されている。
 選択ステップでは、適合度に基づいて、高適合度の遺伝子を、指定の個体数選択する。本実施形態では、適合度に応じたルーレット選択および最高適合度遺伝子のエリート選択を行う。交叉ステップでは、一定の交叉率Pcで、選択された個体間で一部の遺伝子をある一点で交換し、子の個体を作成する。突然変異ステップでは、一定の突然変異率Pmで、個体の遺伝子の各値を0から1または1から0に変更する。
 突然変異ステップまで終わり、次の世代の遺伝子が指定個体数作成されると、初期化ステップと同様に、データ転送の明示的指示を追加し、評価、選択、交叉、突然変異ステップを繰り返す。
 最後に、終了判定ステップでは、指定の世代数、繰り返しを行った後に処理を終了し、最高適合度の遺伝子を解とする。最高適合度の遺伝子に該当する、最高性能のコードパターンで、本番環境に改めてデプロイして、ユーザに提供する。
 以下、オフロードサーバ1の実装を説明する。本実装は、本実施形態の有効性を確認するためのものである。
[実装]
 C/C++アプリケーションを汎用のPGIコンパイラを用いて自動オフロードする実装を説明する。
 本実装では、GPU自動オフロードの有効性確認が目的であるため、対象アプリケーションはC/C++言語のアプリケーションとし、GPU処理自体は、従来のPGIコンパイラを説明に用いる。
 C/C++言語は、OSS(Open Source Software)およびproprietaryソフトウェアの開発で、上位の人気を誇り、数多くのアプリケーションがC/C++言語で開発されている。一般ユーザが用いるアプリケーションプログラムのオフロードを確認するため、暗号処理や画像処理等のOSSの汎用アプリケーションを利用する。
 GPU処理は、PGIコンパイラにより行う。PGIコンパイラは、OpenACCを解釈するC/C++/Fortran向けコンパイラである。本実施形態では、for文等の並列可能処理部を、OpenACCのディレクティブ #pragma acc kernels(並列処理指定文)で指定する。これにより、GPU向けバイトコードを抽出し、その実行によりGPUオフロードを可能としている。さらに、for文内のデータ同士に依存性があり並列処理できない処理やネストのfor文の異なる複数の階層を指定されている場合等の際に、エラーを出す。合わせて、#pragma acc data copyin/copyout/copy 等のディレクティブにより、明示的なデータ転送の指示が可能とする。
 上記 #pragma acc kernels(並列処理指定文)での指定に合わせて、OpenACCのcopyin 節の #pragma acc data copyout(a[…])の、上述した位置への挿入により、明示的なデータ転送の指示を行う。
<実装の動作概要>
 実装の動作概要を説明する。
 高速化するC/C++アプリケーションプログラムとそれを性能測定するベンチマークツールを準備する。
 実装では、C/C++アプリケーションプログラムの利用依頼があると、まず、C/C++アプリケーションのコードを解析して、for文を発見するとともに、for文内で使われる変数データ等の、プログラム構造を把握する。構文解析には、LLVM/Clangの構文解析ライブラリ(libClangのpython binding)等を使用する。
 実装では、最初に、そのアプリケーションがGPUオフロード効果があるかの見込みを得るため、ベンチマークを実行し、上記構文解析で把握したfor文のループ回数を把握する。ループ回数把握には、GNUカバレッジのgcov等を用いる。プロファイリングツールとしては、「GNUプロファイラ(gprof)」、「GNUカバレッジ(gcov)」が知られている。双方とも各行の実行回数を調査できるため、どちらを用いてもよい。実行回数は、例えば、1000万回以上のループ回数を持つアプリケーションプログラムのみ対象とするようにできるが、この値は変更可能である。
 CPU向け汎用アプリケーションプログラムは、並列化を想定して実装されているわけではない。そのため、まず、GPU処理自体が不可なfor文は排除する必要がある。そこで、各for文一つずつに対して、並列処理の#pragma acc kernels ディレクティブ挿入を試行し、コンパイル時にエラーが出るかの判定を行う。コンパイルエラーに関しては、幾つかの種類がある。for文の中で外部ルーチンが呼ばれている場合、ネストfor文で異なる階層が重複指定されている場合、break等でfor文を途中で抜ける処理がある場合、for文のデータにデータ依存性がある場合等がある。アプリケーションプログラムによって、コンパイル時エラーの種類は多彩であり、これ以外の場合もあるが、コンパイルエラーは処理対象外とし、#pragmaディレクティブは挿入しない。
 コンパイルエラーは自動対処が難しく、また対処しても効果が出ないことも多い。外部ルーチンコールの場合は、#pragma acc routineにより回避できる場合があるが、多くの外部コールはライブラリであり、それを含めてGPU処理してもそのコールがネックとなり性能が出ない。for文一つずつを試行するため、ネストのエラーに関しては、コンパイルエラーは生じない。また、break等で途中で抜ける場合は、並列処理にはループ回数を固定化する必要があり、プログラム改造が必要となる。データ依存が有る場合はそもそも並列処理自体ができない。
 ここで、並列処理してもエラーが出ないループ文の数がaの場合、aが遺伝子長となる。遺伝子の1は並列処理ディレクティブ有、0は無に対応させ、長さaの遺伝子に、アプリケーションコードをマッピングする。
 次に、初期値として、指定個体数の遺伝子配列を準備する。遺伝子の各値は、図3で説明したように、0と1をランダムに割当てて作成する。準備された遺伝子配列に応じて、遺伝子の値が1の場合は並列処理を指定するディレクティブ #pragma acc kernels をC/C++コードに挿入する。この段階で、ある遺伝子に該当するコードの中で、GPUで処理させる部分が決まる。上記Clangで解析した、for文内の変数データの参照関係をもとに、上述したルールに基づいて、CPUからGPUへのデータ転送、その逆の場合のディレクティブ指定を行う。
 具体的には、CPUからGPUへのデータ転送が必要な変数は、 #pragma acc data copyinで指定し(図示省略)、GPUからCPUへのデータ転送が必要な変数は、 #pragma acc data copyoutで指定する(図示省略)。同じ変数に関して、copyinとcopyoutが重なる場合は、#pragma acc data copyで纏め、記述をシンプルにする。
 並列処理およびデータ転送のディレクティブを挿入されたC/C++コードを、GPUを備えたマシン上のPGIコンパイラでコンパイルを行う。コンパイルした実行ファイルをデプロイし、ベンチマークツールで性能を測定する。
 全個体数に対して、ベンチマーク性能測定後、ベンチマーク処理時間に応じて、各遺伝子配列の適合度を設定する。設定された適合度に応じて、残す個体の選択を行う。選択された個体に対して、交叉処理、突然変異処理、そのままコピー処理のGA処理を行い、次世代の個体群を作成する。
 次世代の個体に対して、ディレクティブ挿入、コンパイル、性能測定、適合度設定、選択、交叉、突然変異処理を行う。ここで、GA処理の中で、以前と同じパターンの遺伝子が生じた場合は、その個体についてはコンパイル、性能測定をせず、以前と同じ測定値を用いる。
 指定世代数のGA処理終了後、最高性能の遺伝子配列に該当する、ディレクティブ付きC/C++コードを解とする。
 この中で、個体数、世代数、交叉率、突然変異率、適合度設定、選択方法は、GAのパラメータであり、別途指定する。提案技術は、上記処理を自動化することで、従来、専門技術者の時間とスキルが必要だった、GPUオフロードの自動化を可能にする。
[《ループ文オフロード:共通》フローチャート]
 図5A-Bは、《ループ文オフロード:共通》フローチャートであり、図5Aと図5Bは、結合子で繋がれる。
 <コード解析>
 ステップS101で、アプリケーションコード分析部112(図1参照)は、アプリケーションプログラムのコード解析を行う。
 <ループ文特定>
 ステップS102で、並列処理指定部114(図1参照)は、アプリケーションプログラムのループ文、参照関係を特定する。
 <ループ文ループ回数>
 ステップS103で、並列処理指定部114は、ベンチマークツールを動作させ、ループ文ループ回数を把握し、閾値振分けする。
 <ループ文の並列処理可能性>
 ステップS104で、並列処理指定部114は、各ループ文の並列処理可能性をチェックする。
 <ループ文の繰り返し>
 制御部(自動オフロード機能部)11は、ステップS105のループ始端とステップS108のループ終端間で、ステップS106-S107の処理についてループ文の数だけ繰り返す。
 ステップS106で、並列処理指定部114は、各ループ文に対して、言語に応じた手法でGPU処理を指定してコンパイルまたはインタプリットする。
 ステップS107で、並列処理指定部114は、エラー時は、該当for文からは、GPU処理指定を削除する。
 ステップS109で、並列処理指定部114は、コンパイルエラーが出ないfor文の数をカウントし、遺伝子長とする。
 <指定個体数パターン準備>
 次に、初期値として、並列処理指定部114は、指定個体数の遺伝子配列を準備する。ここでは、0と1をランダムに割当てて作成する。
 ステップS110で、並列処理指定部114は、アプリケーションプログラムのコードを、遺伝子にマッピングする。0と1がランダムに割当てられた遺伝子配列を遺伝子にマッピングすることで、指定個体数パターンを準備する。
 準備された遺伝子配列に応じて、遺伝子の値が1の場合は並列処理を指定するディレクティブをアプリケーションプログラムのコードに挿入する(例えば図3の#pragmaディレクティブ参照)。
 制御部(自動オフロード機能部)11は、ステップS111のループ始端とステップS120のループ終端間で、ステップS112-S119の処理について指定世代数繰り返す。
 また、上記指定世代数繰り返しにおいて、さらにステップS112のループ始端とステップS117のループ終端間で、ステップS113-S116の処理について指定個体数繰り返す。すなわち、指定世代数繰り返しの中で、指定個体数の繰り返しが入れ子状態で処理される。
 <データ転送指定>
 ステップS113で、データ転送指定部113は、変数参照関係から、言語に応じた手法でデータ転送を指定する。
 <コンパイル>
 ステップS114で、並列処理パターン作成部115(図1参照)は、遺伝子パターンに応じてGPU処理基盤でコンパイルまたはインタプリットする。すなわち、並列処理パターン作成部115は、作成したアプリケーションプログラムのコードを、GPUを備えた検証用マシン14上のPGIコンパイラでコンパイルまたはインタプリットを行う。
 ここで、ネストfor文を複数並列指定する場合等でコンパイルエラーとなることがある。この場合は、性能測定時の処理時間がタイムアウトした場合と同様に扱う。
 ステップS115で、性能測定部116(図1参照)は、CPU-GPU搭載の検証用マシン14に、実行ファイルをデプロイする。
 ステップS116で、性能測定部116は、配置したバイナリファイルを実行し、オフロードした際のベンチマーク性能を測定する。
 ここで、途中世代で、以前と同じパターンの遺伝子については測定せず、同じ値を使う。つまり、GA処理の中で、以前と同じパターンの遺伝子が生じた場合は、その個体についてはコンパイルや性能測定をせず、以前と同じ測定値を用いる。
 ステップS118で、実行ファイル作成部117(図1参照)は、処理時間が短い個体ほど適合度が高くなるように評価し、性能の高い個体を選択する。
 ステップS119で、実行ファイル作成部117は、選択された個体に対して、交叉、突然変異の処理を行い、次世代の個体を作成する。次世代の個体に対して、コンパイル、性能測定、適合度設定、選択、交叉、突然変異処理を行う。
 すなわち、全個体に対して、ベンチマーク性能測定後、ベンチマーク処理時間に応じて、各遺伝子配列の適合度を設定する。設定された適合度に応じて、残す個体の選択を行う。選択された個体に対して、交叉処理、突然変異処理、そのままコピー処理のGA処理を行い、次世代の個体群を作成する。
 ステップS121で、実行ファイル作成部117は、指定世代数のGA処理終了後、最高性能の遺伝子配列に該当するC/C++コード(最高性能の並列処理パターン)を解とする。
 <GAのパラメータ>
 上記、個体数、世代数、交叉率、突然変異率、適合度設定、選択方法は、GAのパラメータである。GAのパラメータは、例えば、以下のように設定してもよい。
 実行するSimple GAの、パラメータ、条件は例えば以下のようにできる。
 遺伝子長:並列可能ループ文数
 個体数M:遺伝子長以下
 世代数T:遺伝子長以下
 適合度:(処理時間)-1/2
 この設定により、ベンチマーク処理時間が短い程、高適合度になる。また、適合度を、(処理時間)-1/2とすることで、処理時間が短い特定の個体の適合度が高くなり過ぎて、探索範囲が狭くなるのを防ぐことができる。また、性能測定が一定時間で終わらない場合は、タイムアウトさせ、処理時間1000秒等の時間(長時間)であるとして、適合度を計算する。このタイムアウト時間は、性能測定特性に応じて変更させればよい。
 選択:ルーレット選択
 ただし、世代での最高適合度遺伝子は交叉も突然変異もせず次世代に保存するエリート保存も合わせて行う。
 交叉率Pc:0.9
 突然変異率Pm:0.05
 本実施形態では、gcov,gprof等を用いて、ループが多く実行時間がかかっているアプリケーションを事前に特定して、オフロード試行をする。これにより、効率的に高速化できるアプリケーションを見つけることができる。
 より短時間でオフロード部分を探索するためには、複数の検証用マシンで個体数分並列で性能測定することが考えられる。アプリケーションプログラムに応じて、タイムアウト時間を調整することも短時間化に繋がる。例えば、オフロード処理がCPUでの実行時間の2倍かかる場合はタイムアウトとする等である。また、個体数、世代数が多い方が、高性能な解を発見できる可能性が高まる。しかし、各パラメータを最大にする場合、個体数×世代数だけコンパイル、および性能ベンチマークを行う必要がある。このため、本番サービス利用開始までの時間がかかる。本実施形態では、GAとしては少ない個体数、世代数で行っているが、交叉率Pcを0.9と高い値にして広範囲を探索することで、ある程度の性能の解を早く発見するようにしている。
 以上、《ループ文オフロード:共通》について説明した、次に、《ループ文オフロード:C言語》について説明する。
[《ループ文オフロード:C言語》]
 ループ文オフロード:C言語について、基本的フローは、上記《ループ文オフロード:共通》と同様であり、言語非依存にできる。C言語に依存・非依存の処理について詳細に述べる。
 ループ文オフロードの、コードの分析では、C言語を解析するClang等の構文解析ツールを用いて構文解析する。ループと変数の把握については、構文解析ツールの結果を管理する際は、言語に非依存に抽象的に管理できる。ループのGPU処理有無の遺伝子化についても、言語に非依存である。遺伝子情報のコード化では、遺伝子情報に合わせてGPUで実行するためのコードを作成するため、C言語の拡張文法であるOpenACCでGPU処理を指定したり、変数転送を指定したりする。
 コンパイルは、OpenACCコードをPGIコンパイラ等でコンパイルする。性能測定は、言語に合わせて、Jenkins、Selenium等の自動測定ツールも用いて行う。次世代の遺伝子作成は、性能測定結果に合わせて適合度を設定し交叉等の処理を行うが、言語に非依存である。反復実行と最終解の決定も、言語に非依存である。
 以上のように、ループ文オフロードでは、処理に関しては、ループと変数の管理とGAの遺伝子処理については言語に非依存に適用できる。
 図6A-Bは、《ループ文オフロード:C言語》のフローチャートであり、図6Aと図6Bは、結合子で繋がれる。
 C/C++向けOpenACCコンパイラを用いて以下の処理を行う。
 <コード解析>
 ステップS201で、アプリケーションコード分析部112(図1参照)は、C/C++アプリケーションプログラムのコード解析を行う。
 <ループ文特定>
 ステップS202で、並列処理指定部114(図1参照)は、C/C++アプリケーションプログラムのループ文、参照関係を特定する。
 <ループ文ループ回数>
 ステップS203で、並列処理指定部114は、ベンチマークツールを動作させ、ループ文ループ回数を把握し、閾値振分けする。
 <ループ文の並列処理可能性>
 ステップS204で、並列処理指定部114は、各ループ文の並列処理可能性をチェックする。
 <ループ文の繰り返し>
 制御部(自動オフロード機能部)11は、ステップS205のループ始端とステップS208のループ終端間で、ステップS206-S207の処理についてループ文の数だけ繰り返す。
 ステップS206で、並列処理指定部114は、各ループ文に対して、OpenACC文法を用いて、#pragma acc kernelsでGPU処理を指定してコンパイルする。
 ステップS207で、並列処理指定部114は、エラー時は、該当for文からは、#pragma acc kernelsを削除する。
 ステップS209で、並列処理指定部114は、コンパイルエラーが出ないfor文の数をカウントし、遺伝子長とする。
 <指定個体数パターン準備>
 次に、初期値として、並列処理指定部114は、指定個体数の遺伝子配列を準備する。ここでは、0と1をランダムに割当てて作成する。
 ステップS210で、並列処理指定部114は、C/C++アプリコードを、遺伝子にマッピングする。0と1がランダムに割当てられた指定個体数の遺伝子配列を遺伝子にマッピングするすることで、指定個体数パターンを準備する。
 準備された遺伝子配列に応じて、遺伝子の値が1の場合は並列処理を指定するディレクティブをC/C++アプリコードに挿入する(例えば図3の#pragmaディレクティブ参照)。
 制御部(自動オフロード機能部)11は、ステップS211のループ始端とステップS220のループ終端間で、ステップS212-S219の処理について指定世代数繰り返す。
 また、上記指定世代数繰り返しにおいて、さらにステップS212のループ始端とステップS217のループ終端間で、ステップS213-S216の処理について指定個体数繰り返す。すなわち、指定世代数繰り返しの中で、指定個体数の繰り返しが入れ子状態で処理される。
 <データ転送指定>
 ステップS213で、データ転送指定部113は、変数参照関係から、明示的指示行(#pragma acc data copy/in/out)を用いたデータ転送指定を行う。明示的指示行(#pragma acc data copy/in/out)を用いたデータ転送指定については、図4により説明した。
 <コンパイル>
 ステップS214で、並列処理パターン作成部115(図1参照)は、遺伝子パターンに応じてディレクティブ指定したC/C++コードをPGIコンパイラでコンパイルする。すなわち、並列処理パターン作成部115は、作成したC/C++アプリコードを、GPUを備えた検証用マシン14上のPGIコンパイラでコンパイルする。
 ここで、ネストfor文を複数並列指定する場合等でコンパイルエラーとなることがある。この場合は、性能測定時の処理時間がタイムアウトした場合と同様に扱う。
 ステップS215で、性能測定部116(図1参照)は、CPU-GPU搭載の検証用マシン14に、実行ファイルをデプロイする。
 ステップS216で、性能測定部116は、配置したバイナリファイルを実行し、オフロードした際のベンチマーク性能を測定する。
 ここで、途中世代で、以前と同じパターンの遺伝子については測定せず、同じ値を使う。つまり、GA処理の中で、以前と同じパターンの遺伝子が生じた場合は、その個体についてはコンパイルや性能測定をせず、以前と同じ測定値を用いる。
 ステップS218で、実行ファイル作成部117(図1参照)は、処理時間が短い個体ほど適合度が高くなるように評価し、性能の高い個体を選択する。
 ステップS219で、実行ファイル作成部117は、選択された個体に対して、交叉、突然変異の処理を行い、次世代の個体を作成する。次世代の個体に対して、コンパイル、性能測定、適合度設定、選択、交叉、突然変異処理を行う。
 すなわち、全個体に対して、ベンチマーク性能測定後、ベンチマーク処理時間に応じて、各遺伝子配列の適合度を設定する。設定された適合度に応じて、残す個体の選択を行う。選択された個体に対して、交叉処理、突然変異処理、そのままコピー処理のGA処理を行い、次世代の個体群を作成する。
 ステップS221で、実行ファイル作成部117は、指定世代数のGA処理終了後、最高性能の遺伝子配列に該当するC/C++コード(最高性能の並列処理パターン)を解とする。
 以上、《ループ文オフロード:C言語》について説明した、次に、《ループ文オフロード:Python》について説明する。
[《ループ文オフロード:Python》]
 ループ文オフロード:Pythonは、PythonコードをpyCUDAでインタプリットする方法(図7A-B参照)と、OpenACCを解釈するインタプリタpyACCを用いる方法(図8A-B、図9A-B参照)とがある。以下、順に説明する。
 <PythonコードをpyCUDAでインタプリットする方法>
 ループ文オフロードの、コードの分析では、Pythonを解析するast等の構文解析ツールを用いて構文解析する。ループと変数の把握については、構文解析ツールの結果を管理する際は、言語に非依存で、抽象的に管理できる。
 ループのGPU処理有無の遺伝子化についても、言語に非依存である。遺伝子情報のコード化では、遺伝子情報に合わせてGPUで実行するためのコードを作成するため、CUDA文法でGPU処理を指定したり、変数転送を指定したりする。
 インタプリタは、CUDAでの指示を追加したPythonコードをpyCUDAでインタプリットする。性能測定は、言語に合わせて、Jenkins等の自動測定ツールも用いて行う。次世代の遺伝子作成は、性能測定結果に合わせて適合度を設定し交叉等の処理を行うが、言語に非依存である。反復実行と最終解の決定も、言語に非依存である。ここで、pyCUDAでなくpyACCというOpenACCを解釈するインタプリタを用いてもよい。その場合は、C言語と同様にOpenACC文法でループ文のGPU処理を指定すればよい(後記)。
 Python では、GPU処理指定したコードは実装によるが、CupyというオープンソースでNVIDIA GPUを利用するライブラリを用いた実装を説明する。
 動作としては、PythonのコードでGPU処理を指定されるループ文はCupyライブラリを介して、NVIDIAのCUDAコマンドが実行され、NVIDIAのGPUで処理がされる。
 本実施形態では、C言語同様、Pythonのループ文に対して、GPU処理可否を遺伝的アルゴリズムにより選択し、適切なオフロードパターンを見つける。
 以下、Cupyを用いた例を記載する。
 図7A-Bは、PythonコードをpyCUDAでインタプリットする方法を説明する図であり、図7Aは、変換元例を示し、図7Bは、変換後例(3階層のfor文の一番上をGPU処理指定する場合)を示す。
 図7Aに示すように、Pythonのfor文は行列演算として指定される。Cupyは、CUDAコマンドを呼び、CUDAがGPUを実行する。
 Cupyを用いる場合、C言語のOpenACCの\pragmaのようにオフロードするfor文を記載する形ではない。
 CupyからCUDAを介してGPU処理する際は、GPUでの並列演算は行列演算である。GPU処理する箇所は、図7Bに示すように、
〔1~多重 for文の内側にある『配列[添字]』を右辺・左辺に持つ演算式〕は、
"[添字1][添字2]…" の部分を"[範囲開始1:範囲終了1,範囲開始2:範囲終了2, …]" 表現に書き換える。
《添字》が《範囲》に置き換わることによって、式全体が行列演算の式になる。
 以上、<PythonコードをpyCUDAでインタプリットする方法>について説明した。次に、<pyACCを用いる方法>について説明する。
 <pyACCを用いる方法>
 ループ文オフロード:Pythonは、上記pyCUDAでなくpyACCというOpenACCを解釈するインタプリタを用いてもよい。その場合は、C言語と同様にOpenACC文法でループ文のGPU処理を指定する。以下、pyACCを用いる方法について説明する。
 図8A-Bは、pyACC利用時のコードパターンを示す図であり、図8Aは、pyACC利用時のfor文を示し、図8Bは、図8Aのfor文から作成されるコードパターンを示す。
 図8Bに示すコードパターンは、図3のコードパターンに置き換えて用いられる。
 図9A-Bは、《ループ文オフロード:Python》のフローチャートであり、図9Aと図9Bは、結合子で繋がれる。また、図8Bに示すコードパターンを、図3のコードパターンに置き換えて用いる。
 C/C++向けOpenACCコンパイラを用いて以下の処理を行う。
 <コード解析>
 ステップS301で、アプリケーションコード分析部112(図1参照)は、Pythonアプリケーションプログラムのコード解析を行う。
 <ループ文特定>
 ステップS302で、並列処理指定部114(図1参照)は、Pythonアプリケーションプログラムのループ文、参照関係を特定する。
 <ループ文ループ回数>
 ステップS303で、並列処理指定部114は、ベンチマークツールを動作させ、ループ文ループ回数を把握し、閾値振分けする。
 <ループ文の並列処理可能性>
 ステップS304で、並列処理指定部114は、各ループ文の並列処理可能性をチェックする。
 <ループ文の繰り返し>
 制御部(自動オフロード機能部)11は、ステップS305のループ始端とステップS108のループ終端間で、ステップS306-S307の処理についてループ文の数だけ繰り返す。
 ステップS306で、並列処理指定部114は、各ループ文に対して、GPU処理基盤に応じた手法でGPU処理を指定してインタプリットする。例えば、pyACC利用時はOpenACCの\pragmaacckernels、Cupy利用時は対象ループの計算を行列計算に変換して指定、pyCUDA直接利用時はCUDA文法等を用いる、が挙げられる。
 ステップS307で、並列処理指定部114は、エラー時は、該当for文からは、GPU処理を削除する。
 ステップS309で、並列処理指定部114は、コンパイルエラーが出ないfor文の数をカウントし、遺伝子長とする。
 <指定個体数パターン準備>
 次に、初期値として、並列処理指定部114は、指定個体数の遺伝子配列を準備する。ここでは、0と1をランダムに割当てて作成する。
 ステップS310で、並列処理指定部114は、Pythonアプリコードを、遺伝子にマッピングし、指定個体数パターン準備を行う。
 準備された遺伝子配列に応じて、遺伝子の値が1の場合は並列処理を指定するディレクティブをPythonアプリコードに挿入する。
 制御部(自動オフロード機能部)11は、ステップS311のループ始端とステップS320のループ終端間で、ステップS312-S319の処理について指定世代数繰り返す。
 また、上記指定世代数繰り返しにおいて、さらにステップS312のループ始端とステップS317のループ終端間で、ステップS313-S316の処理について指定個体数繰り返す。すなわち、指定世代数繰り返しの中で、指定個体数の繰り返しが入れ子状態で処理される。
 <データ転送指定>
 ステップS313で、データ転送指定部113は、変数参照関係から、GPU処理基盤に応じた手法でデータ転送を指定する。
 <コンパイル>
 ステップS314で、並列処理パターン作成部115(図1参照)は、遺伝子パターンに応じてディレクティブ指定したPythonアプリコードをGPU処理基盤でインタプリットする。
 ここで、ネストfor文を複数並列指定する場合等でコンパイルエラーとなることがある。この場合は、性能測定時の処理時間がタイムアウトした場合と同様に扱う。
 ステップS315で、性能測定部116(図1参照)は、CPU-GPU搭載の検証用マシン14に、実行ファイルをデプロイする。
 ステップS316で、性能測定部116は、配置したバイナリファイルを実行し、オフロードした際のベンチマーク性能を測定する。
 ここで、途中世代で、以前と同じパターンの遺伝子については測定せず、同じ値を使う。つまり、GA処理の中で、以前と同じパターンの遺伝子が生じた場合は、その個体についてはコンパイルや性能測定をせず、以前と同じ測定値を用いる。
 ステップS318で、実行ファイル作成部117(図1参照)は、処理時間が短い個体ほど適合度が高くなるように評価し、性能の高い個体を選択する。
 ステップS319で、実行ファイル作成部117は、選択された個体に対して、交叉、突然変異の処理を行い、次世代の個体を作成する。次世代の個体に対して、コンパイル、性能測定、適合度設定、選択、交叉、突然変異処理を行う。
 すなわち、全個体に対して、ベンチマーク性能測定後、ベンチマーク処理時間に応じて、各遺伝子配列の適合度を設定する。設定された適合度に応じて、残す個体の選択を行う。選択された個体に対して、交叉処理、突然変異処理、そのままコピー処理のGA処理を行い、次世代の個体群を作成する。
 ステップS321で、実行ファイル作成部117は、指定世代数のGA処理終了後、最高性能の遺伝子配列に該当するPythonアプリコード(最高性能の並列処理パターン)を解とする。
 以上、《ループ文オフロード:Python》について説明した、次に、《ループ文オフロード:Java》について説明する。
[《ループ文オフロード:Java》]
 ループ文オフロード:Java では、ループ文オフロードの、コードの分析でJavaを解析するJavaParser等の構文解析ツールを用いて構文解析する。ループと変数の把握については、構文解析ツールの結果を管理する際は、言語に非依存に抽象的に管理できる。ループのGPU処理有無の遺伝子化についても、言語に非依存である。遺伝子情報のコード化では、遺伝子情報に合わせてGPUで実行するためのコードを作成するため、Javaのラムダ記述でGPU処理を指定する、あるいは変数転送を指定する。
 実行環境は、Javaのラムダ記述での並列化をGPUに対して行うことができるIBM JDK(登録商標)を用いる。IBM JDKはJavaのラムダ記述に従って並列処理をGPUに対して実行する仮想マシンである。
 性能測定は、言語に合わせて、Jenkins(登録商標)等の自動測定ツールも用いて行う。次世代の遺伝子作成は、性能測定結果に合わせて適合度を設定し交叉等の処理を行うが、言語に非依存である。反復実行と最終解の決定も、言語に非依存である。
 図10A-Bは、IBM JDK 利用時のコードパターンを示す図であり、図10Aは、IBM JDK 利用時のfor文を示し、図10Bは、図10Aのfor文から作成されるコードパターンを示す。
 図10Bに示すコードパターンは、図3のコードパターンに置き換えて用いられる。
 図11A-Bは、《ループ文オフロード:Java》のフローチャートであり、図11Aと図11Bは、結合子で繋がれる。また、図10Bに示すコードパターンを、図3のコードパターンに置き換えて用いる。
 <コード解析>
 ステップS401で、アプリケーションコード分析部112(図1参照)は、Javaアプリケーションプログラムのコード解析を行う。
 <ループ文特定>
 ステップS402で、並列処理指定部114(図1参照)は、Javaアプリケーションプログラムのループ文、参照関係を特定する。
 <ループ文ループ回数>
 ステップS403で、並列処理指定部114は、ベンチマークツールを動作させ、ループ文ループ回数を把握し、閾値振分けする。
 <ループ文の並列処理可能性>
 ステップS404で、並列処理指定部114は、各ループ文の並列処理可能性をチェックする。
 <ループ文の繰り返し>
 制御部(自動オフロード機能部)11は、ステップS405のループ始端とステップS408のループ終端間で、ステップS406-S407の処理についてループ文の数だけ繰り返す。
 ステップS406で、並列処理指定部114は、各ループ文に対して、Javaのlambda式を用いて、java.util.Stream.IntStream.range(0,n).parallel()forEach(i -> {});でGPU処理を指定してコンパイルする。
 ステップS407で、並列処理指定部114は、エラー時は、該当for文からは、java.util.Stream.IntStream.range(0,n).parallel()forEach(i -> {});を削除する。
 ステップS409で、並列処理指定部114は、コンパイルエラーが出ないfor文の数をカウントし、遺伝子長とする。
 <指定個体数パターン準備>
 次に、初期値として、並列処理指定部114は、指定個体数の遺伝子配列を準備する。ここでは、0と1をランダムに割当てて作成する。
 ステップS410で、並列処理指定部114は、Javaアプリコードを、遺伝子にマッピングする。0と1がランダムに割当てられた指定個体数の遺伝子配列を遺伝子にマッピングするすることで、指定個体数パターンを準備する。
 準備された遺伝子配列に応じて、遺伝子の値が1の場合は並列処理を指定するディレクティブをJavaアプリコードに挿入する。
 制御部(自動オフロード機能部)11は、ステップS411のループ始端とステップS420のループ終端間で、ステップS412-S419の処理について指定世代数繰り返す。
 また、上記指定世代数繰り返しにおいて、さらにステップS412のループ始端とステップS417のループ終端間で、ステップS413-S416の処理について指定個体数繰り返す。すなわち、指定世代数繰り返しの中で、指定個体数の繰り返しが入れ子状態で処理される。
 <データ転送指定>
 ステップS413で、データ転送指定部113は、変数参照関係から、Javaの記述でデータ転送を指定する。
 <コンパイル>
 ステップS414で、並列処理パターン作成部115(図1参照)は、遺伝子パターンに応じてディレクティブ指定したJavaアプリコードをIBM JDKでビルドする。
 ここで、ネストfor文を複数並列指定する場合等でコンパイルエラーとなることがある。この場合は、性能測定時の処理時間がタイムアウトした場合と同様に扱う。
 ステップS415で、性能測定部116(図1参照)は、CPU-GPU搭載の検証用マシン14に、実行ファイルをデプロイする。
 ステップS416で、性能測定部116は、配置したバイナリファイルを実行し、オフロードした際のベンチマーク性能を測定する。
 ここで、途中世代で、以前と同じパターンの遺伝子については測定せず、同じ値を使う。つまり、GA処理の中で、以前と同じパターンの遺伝子が生じた場合は、その個体についてはコンパイルや性能測定をせず、以前と同じ測定値を用いる。
 ステップS418で、実行ファイル作成部117(図1参照)は、処理時間が短い個体ほど適合度が高くなるように評価し、性能の高い個体を選択する。
 ステップS419で、実行ファイル作成部117は、選択された個体に対して、交叉、突然変異の処理を行い、次世代の個体を作成する。次世代の個体に対して、コンパイル、性能測定、適合度設定、選択、交叉、突然変異処理を行う。
 すなわち、全個体に対して、ベンチマーク性能測定後、ベンチマーク処理時間に応じて、各遺伝子配列の適合度を設定する。設定された適合度に応じて、残す個体の選択を行う。選択された個体に対して、交叉処理、突然変異処理、そのままコピー処理のGA処理を行い、次世代の個体群を作成する。
 ステップS421で、実行ファイル作成部117は、指定世代数のGA処理終了後、最高性能の遺伝子配列に該当するJavaアプリコード(最高性能の並列処理パターン)を解とする。
 以上、第1の実施形態(「ループ文オフロード」)について説明した。
(第2の実施形態)
 第2の実施形態は、機能ブロックオフロードについて記載する。
 図12~図13を参照して、機能ブロックオフロードの全体構成および動作を説明し、以下、機能ブロックオフロード:共通(図14,図15)、機能ブロックオフロード:C言語(図16,図17)、機能ブロックオフロード:Python(図18,図19)、機能ブロックオフロード:Java(図20,図21)を順に説明する。
 図13は、本発明の第2の実施形態に係るオフロードサーバ200の構成例を示す機能ブロック図である。図2と同一構成部分には、同一符号を付して重複箇所の説明を省略する。
 オフロードサーバ200は、アプリケーションプログラムの特定処理をアクセラレータに自動的にオフロードする装置である。
 アプリケーションプログラムは、C言語、Python、およびJavaより選択される少なくとも一つを含む。
 図12に示すように、オフロードサーバ200は、制御部210と、入出力部12と、記憶部130と、検証用マシン14 (アクセラレータ検証用装置)と、を含んで構成される。
 入出力部12は、各機器等との間で情報の送受信を行うための通信インタフェースと、タッチパネルやキーボード等の入力装置や、モニタ等の出力装置との間で情報の送受信を行うための入出力インタフェースとから構成される。
 記憶部130は、ハードディスクやフラッシュメモリ、RAM(Random Access Memory)等により構成され、制御部210の各機能を実行させるためのプログラム(オフロードプログラム)や、制御部210の処理に必要な情報(例えば、中間言語ファイル(Intermediate file)132)が一時的に記憶される。
 記憶部13は、コードパターンDB(Code pattern database)230(後記)、テストケースDB(Test case database)131を備える。
 テストケースDB131には、性能試験項目が格納される。テストケースDB131は、高速化するアプリケーションの性能を測定するような試験を行うための情報が格納される。例えば、画像分析処理の深層学習アプリケーションであれば、サンプルの画像とそれを実行する試験項目である。
 検証用マシン14は、環境適応ソフトウェアの検証用環境として、CPU(Central Processing Unit)、GPU、FPGAを備える。
 <コードパターンDB230>
・GPUライブラリ、IPコアの記憶
 コードパターンDB230は、GPUやFPGA等にオフロード可能なライブラリおよびIPコア(後記)を記憶する。すなわち、コードパターンDB230は、後記<処理B-1>のために、特定のライブラリ、機能ブロックを高速化するGPU用ライブラリ(GPUライブラリ)やFPGA用IPコア(IPコア)とそれに関連する情報を保持する。例えば、コードパターンDB230は、FFT等算術計算等のライブラリリスト(外部ライブラリリスト)を保持する。
・CUDAライブラリの記憶
 コードパターンDB230は、GPUライブラリとして、例えばCUDAライブラリと当該CUDAライブラリを利用するためのライブラリ利用手順とを記憶する。すなわち、後記<処理C-1>において、置換するライブラリやIPコアをGPUやFPGAに実装し、ホスト側(CPU)プログラムと繋ぐ場合、ライブラリ利用手順も含めて登録しておき、その手順に従って利用する。例えば、CUDAライブラリでは、C言語コードからCUDAライブラリを利用する手順がライブラリとともに公開されているため、コードパターンDB230にライブラリ利用手順も含めて登録しておく。
・クラス、構造体の記憶
 コードパターンDB230は、ホストで計算する場合に記述が同様になる処理のクラスまたは構造体を記憶する。すなわち、後記<処理B-2>において、登録されていないライブラリ呼び出し以外の機能処理を検出するため、構文解析にてソースコードの定義記述からクラス、構造体等を検出する。コードパターンDB230は、後記<処理B-2>のために、ホストで計算する場合に記述が同様になる処理のクラスまたは構造体を登録しておく。なお、クラスまたは構造体の機能処理に対して、高速化するライブラリやIPコアがあることは、類似性検出ツール(後記)で検出する。
・OpenCLコードの記憶
 コードパターンDB230は、IPコア関連の情報としてOpenCLコードを記憶する。コードパターンDB230に、OpenCLコードを記憶しておくことで、OpenCLコードから、OpenCLインタフェースを用いたCPUとFPGAの接続および、FPGAへのIPコア実装が、XilinxやIntel等のFPGAベンダの高位合成ツール(後記)を介して行うことができる。
 <制御部210>
 制御部210は、オフロードサーバ200全体の制御を司る自動オフロード機能部(Automatic Offloading function)であり、記憶部130に格納されたプログラム(オフロードプログラム)を不図示のCPUが、RAMに展開し実行することにより実現される。
 特に、制御部210は、CPU向けの既存プログラムコードの中にFPGAやGPUへオフロードすることで処理を高速化できる機能ブロックを検出し、検出した機能ブロックをGPU向けライブラリやFPGA向けIPコア等に置き換えることで高速化をする機能ブロックのオフロード処理を行う。
 制御部210は、アプリケーションコード指定部(Specify application code)111と、アプリケーションコード分析部(Analyze application code)112と、置換機能検出部213と、置換処理部214と、オフロードパターン作成部215と、性能測定部116と、実行ファイル作成部117と、本番環境配置部(Deploy final binary files to production environment)118と、性能測定テスト抽出実行部(Extract performance test cases and  run automatically)119と、ユーザ提供部(Provide price and performance to a user to judge)120と、を備える。
 <アプリケーションコード指定部111>
 アプリケーションコード指定部111は、入力されたアプリケーションコードの指定を行う。具体的には、アプリケーションコード指定部111は、受信したファイルに記載されたアプリケーションコードを、アプリケーションコード分析部112に渡す。
 <アプリケーションコード分析部112>
 アプリケーションコード分析部112は、後記<処理A-1>において、アプリケーションプログラムのソースコードを分析して、当該ソースコードに含まれる外部ライブラリの呼び出しを検出する。具体的には、アプリケーションコード分析部112は、Clang等の構文解析ツールを用いて、ループ文構造等とともに、コードに含まれるライブラリ呼び出しや、機能処理を分析するソースコードの分析を行う。
 上述したコード分析は、オフロードするデバイスを想定した分析が必要になるため、一般化は難しい。ただし、ループ文や変数の参照関係等のコードの構造を把握したり、機能ブロックとしてFFT処理を行う機能ブロックであることや、FFT処理を行うライブラリを呼び出している等を把握することは可能である。機能ブロックの判断は、オフロードサーバが自動判断することは難しい。これもDeckard等の類似性検出ツールを用いて類似度判定等で把握することは可能である。ここで、Clangは、C/C++向けツールであるが、解析する言語に合わせたツールを選ぶ必要がある。
 また、アプリケーションコード分析部112は、後記<処理A-2>において、ソースコードからクラスまたは構造体のコードを検出する。
 <置換機能検出部213>
 置換機能検出部213は、後記<処理B-1>において、検出された呼び出しをキーにして、コードパターンDB230からGPUライブラリおよびIPコアを取得する。具体的には、置換機能検出部213は、検出したライブラリ呼び出しに対して、ライブラリ名をキーとして、コードパターンDB230と照合することで、GPU、FPGAにオフロードできるオフロード可能処理を抽出する。
 ここで、コードパターンDB230は、GPUライブラリとして、例えばCUDAライブラリと当該CUDAライブラリを利用するためのライブラリ利用手順とを記憶している。そして、置換機能検出部213は、ライブラリ利用手順をもとに、コードパターンDB230からCUDAライブラリを取得する。
 置換機能検出部213は、後記<処理B-2>において、検出されたクラスまたは構造体(後記)の定義記述コードをキーにして、コードパターンDB230からGPUライブラリおよびIPコアを取得する。具体的には、置換機能検出部213は、コピーコードやコピー後変更した定義記述コードを検出する類似性検出ツールを用いて、置換元コードに含まれるクラスや構造体に対して、コードパターンDB230から類似のクラスまたは構造体に紐づいて管理されているGPU、FPGAにオフロードできるGPUライブラリおよびIPコアを抽出する。
 <置換処理部214>
 置換処理部214は、後記<処理C-1>において、アプリケーションプログラムのソースコードの置換元の処理記述を、置換機能検出部213が取得した置換先のライブラリおよびIPコアの処理記述に置換する。具体的には、置換処理部214は、抽出したオフロード可能処理を、GPU向けのライブラリやFPGA向けのIPコア等に置換する。
 また、置換処理部214は、置換したライブラリおよびIPコアの処理記述を、オフロード対象の機能ブロックとして、GPUやFPGA等にオフロードする。具体的には、置換処理部214は、GPU向けのライブラリやFPGA向けのIPコア等に置換した機能ブロックを、CPUプログラムとのインタフェースを作成することでオフロードする。置換処理部214は、CUDA,OpenCL等の中間言語ファイル132を出力する。
 置換処理部214は、後記<処理C-2>において、アプリケーションプログラムのソースコードの置換元の処理記述を、取得したライブラリおよびIPコアの処理記述に置換するとともに、置換元と置換先で引数、戻り値の数または型が異なる場合に、その確認を通知する。
 置換処理部214は、《機能ブロックオフロード:C言語》では、CUDAのライブラリ呼び出しを、PGIコンパイラに指定する。
 置換処理部214は、《機能ブロックオフロード:Python》では、CUDAのライブラリ呼び出しを、pyCudaで指定する。
 置換処理部214は、《機能ブロックオフロード:Java》では、CUDAのライブラリ呼び出しを、Jcudaで指定する。
 <オフロードパターン作成部215>
 オフロードパターン作成部215は、1以上のオフロードするパターンを作成する。具体的には、ホストプログラムとのインタフェースを作成し、検証環境での性能測定を通じて、オフロードするしないを試行することで、より高速となるオフロードパターンを抽出する。
 ここで、コードパターンDB230は、IPコア関連の情報としてOpenCLコードを記憶している。オフロードパターン作成部215は、FPGA等のPLDにオフロードする場合は、OpenCLコードをもとにOpenCLインタフェースを用いてホストとPLDとを接続するとともに、OpenCLコードをもとにPLDへのIPコアの実装を行う。
 OpenCLのAPIに沿う、カーネルプログラムとホストプログラムのインタフェース記述について述べる。なお、下記説明は、後記[処理C](ホスト側とのインタフェースの整合)の<処理C-1>の具体例に対応する。
 OpenCLのC言語の文法に沿って作成したカーネルは、OpenCLのC言語のランタイムAPIを利用して、作成するホスト(例えば、CPU)側のプログラムによりデバイス(例えば、FPGA)で実行される。カーネル関数hello()をホスト側から呼び出す部分は、OpenCLランタイムAPIの一つであるclEnqueueTask()を呼び出すことである。
 ホストコードで記述するOpenCLの初期化、実行、終了の基本フローは、下記ステップ1~13である。このステップ1~13のうち、ステップ1~10がカーネル関数hello()をホスト側から呼び出すまでの手続(準備)であり、ステップ11でカーネルの実行となる。
1.プラットフォーム特定
 OpenCLランタイムAPIで定義されているプラットフォーム特定機能を提供する関数clGetPlatformIDs()を用いて、OpenCLが動作するプラットフォームを特定する。
2.デバイス特定
 OpenCLランタイムAPIで定義されているデバイス特定機能を提供する関数clGetDeviceIDs()を用いて、プラットフォームで使用するGPU等のデバイスを特定する。
3.コンテキスト作成
 OpenCLランタイムAPIで定義されているコンテキスト作成機能を提供する関数clCreateContext()を用いて、OpenCLを動作させる実行環境となるOpenCLコンテキストを作成する。
4.コマンドキュー作成
 OpenCLランタイムAPIで定義されているコマンドキュー作成機能を提供する関数clCreateCommandQueue()を用いて、デバイスを制御する準備であるコマンドキューを作成する。OpenCLでは、コマンドキューを通して、ホストからデバイスに対する働きかけ(カーネル実行コマンドやホスト-デバイス間のメモリコピーコマンドの発行)を実行する。
5.メモリオブジェクト作成
 OpenCLランタイムAPIで定義されているデバイス上にメモリを確保する機能を提供する関数clCreateBuffer()を用いて、ホスト側からメモリオブジェクトを参照できるようにするメモリオブジェクトを作成する。
6.カーネルファイル読み込み
 デバイスで実行するカーネルは、その実行自体をホスト側のプログラムで制御する。このため、ホストプログラムは、まずカーネルプログラムを読み込む必要がある。カーネルプログラムには、OpenCLコンパイラで作成したバイナリデータや、OpenCL C言語で記述されたソースコードがある。このカーネルファイルを読み込む(記述省略)。なお、カーネルファイル読み込みでは、OpenCLランタイムAPIは使用しない。
7.プログラムオブジェクト作成
 OpenCLでは、カーネルプログラムをプログラムオブジェクトとして認識する。この手続きがプログラムオブジェクト作成である。
 OpenCLランタイムAPIで定義されているプログラムオブジェクト作成機能を提供する関数clCreateProgramWithSource()を用いて、ホスト側からメモリオブジェクトを参照できるようにするプログラムオブジェクトを作成する。カーネルプログラムのコンパイル済みバイナリ列から作成する場合は、clCreateProgramWithBinary()を使用する。
8.ビルド
 ソースコードとして登録したプログラムオブジェクトを OpenCL Cコンパイラ・リンカを使いビルドする。
 OpenCLランタイムAPIで定義されているOpenCL Cコンパイラ・リンカによるビルドを実行する関数clBuildProgram()を用いて、プログラムオブジェクトをビルドする。なお、clCreateProgramWithBinary()でコンパイル済みのバイナリ列からプログラムオブジェクトを生成した場合、このコンパイル手続は不要である。
9.カーネルオブジェクト作成
 OpenCLランタイムAPIで定義されているカーネルオブジェクト作成機能を提供する関数clCreateKernel()を用いて、カーネルオブジェクトを作成する。1つのカーネルオブジェクトは、1つのカーネル関数に対応するので、カーネルオブジェクト作成時には、カーネル関数の名前(hello)を指定する。また、複数のカーネル関数を1つのプログラムオブジェクトとして記述した場合、1つのカーネルオブジェクトは、1つのカーネル関数に1対1で対応するので、clCreateKernel()を複数回呼び出す。
10.カーネル引数設定
 OpenCLランタイムAPIで定義されているカーネルへ引数を与える(カーネル関数が持つ引数へ値を渡す)機能を提供する関数clSetKernel()を用いて、カーネル引数を設定する。
 以上、上記ステップ1~10で準備が整い、ホスト側からデバイスでカーネルを実行するステップ11に入る。
11.カーネル実行
 カーネル実行(コマンドキューへ投入)は、デバイスに対する働きかけとなるので、コマンドキューへのキューイング関数となる。
 OpenCLランタイムAPIで定義されているカーネル実行機能を提供する関数clEnqueueTask()を用いて、カーネルhelloをデバイスで実行するコマンドをキューイングする。カーネルhelloを実行するコマンドがキューイングされた後、デバイス上の実行可能な演算ユニットで実行されることになる。
12.メモリオブジェクトからの読み込み
 OpenCLランタイムAPIで定義されているデバイス側のメモリからホスト側のメモリへデータをコピーする機能を提供する関数clEnqueueReadBuffer()を用いて、デバイス側のメモリ領域からホスト側のメモリ領域にデータをコピーする。また、ホスト側からデバイス側のメモリへデータをコピーする機能を提供する関数clEnqueueWrightBuffer()を用いて、ホスト側のメモリ領域からデバイス側のメモリ領域にデータをコピーする。なお、これらの関数は、デバイスに対する働きかけとなるので、一度コマンドキューへコピーコマンドがキューイングされてからデータコピーが始まることになる。
13.オブジェクト解放
 最後に、ここまでに作成してきた各種オブジェクトを解放する。
 以上、OpenCL C言語に沿って作成されたカーネルの、デバイス実行について説明した。
 <性能測定部116>
 性能測定部116は、作成された処理パターンのアプリケーションプログラムをコンパイルして、検証用マシン14に配置し、GPUやFPGA等にオフロードした際の性能測定用処理を実行する。
 性能測定部116は、バイナリファイル配置部(Deploy binary files)116aを備える。バイナリファイル配置部116aは、GPUやFPGAを備えた検証用マシン14に、中間言語から導かれるバイナリファイルをデプロイ(配置)する。
 性能測定部116は、配置したバイナリファイルを実行し、オフロードした際の性能を測定するとともに、性能測定結果を、バイナリファイル配置部116aに戻す。この場合、性能測定部116は、抽出された別の処理パターンを用いて、抽出された中間言語をもとに、性能測定を試行する(後記図13の符号g参照)。
 性能測定の具体例について述べる。
 オフロードパターン作成部215は、GPUやFPGAにオフロード可能な機能ブロックをオフロードする処理パターンを作成し、作成された処理パターンの中間言語を、実行ファイル作成部117がコンパイルする。性能測定部116は、コンパイルされたプログラムの性能を測定する(「1回目の性能測定」)。
 そして、オフロードパターン作成部215は、性能測定された中でCPUに比べ高性能化された処理パターンをリスト化する。オフロードパターン作成部215は、リストの処理パターンを組み合わせてオフロードする新たな処理パターンを作成する。オフロードパターン作成部215は、組み合わせたオフロード処理パターンと中間言語を作成し、中間言語を、実行ファイル作成部117がコンパイルする。
 性能測定部116は、コンパイルされたプログラムの性能を測定する(「2回目の性能測定」)。
 <実行ファイル作成部117>
 実行ファイル作成部117は、オフロードする処理パターンの中間言語をコンパイルして実行ファイルを作成する。一定数繰り返された、性能測定結果をもとに、1以上の処理パターンから最高処理性能の処理パターンを選択し、最高処理性能の処理パターンをコンパイルして最終実行ファイルを作成する。
 <本番環境配置部118> 
 本番環境配置部118は、作成した実行ファイルを、ユーザ向けの本番環境に配置する(「最終バイナリファイルの本番環境への配置」)。本番環境配置部118は、最終的なオフロード領域を指定したパターンを決定し、ユーザ向けの本番環境にデプロイする。
 <性能測定テスト抽出実行部119>
 性能測定テスト抽出実行部119は、実行ファイル配置後、テストケースDB131から性能試験項目を抽出し、性能試験を実行する。
 性能測定テスト抽出実行部119は、実行ファイル配置後、ユーザに性能を示すため、性能試験項目をテストケースDB131から抽出し、抽出した性能試験を自動実行する。
 <ユーザ提供部120>
 ユーザ提供部120は、性能試験結果を踏まえた、価格・性能等の情報をユーザに提示する(「価格・性能等の情報のユーザへの提供」)。テストケースDB131には、アプリケーションの性能を測定する試験を自動で行うためのデータが格納されている。ユーザ提供部120は、テストケースDB131の試験データを実行した結果と、システムに用いられるリソース(仮想マシンや、FPGAインスタンス、GPUインスタンス等)の各単価から決まるシステム全体の価格をユーザに提示する。ユーザは、提示された価格・性能等の情報をもとに、サービスの課金利用開始を判断する。
 以下、上述のように構成されたオフロードサーバ200の機能ブロックオフロード処理について説明する。
 上記、機能ブロックのオフロードの処理の概要と考慮点について説明する。
 FPGAに関しては、ハードウェア回路設計に多大な時間がかかることもあり、一度設計した機能を、IPコア(Intellectual Property Core)という形で再利用可能にすることが多い。IPコアとは、FPGA、IC、LSIなどの半導体を構成するための部分的な回路情報であり、特に機能単位でまとめられている。IPコアは、暗号化/復号化処理、FFT(Fast Fourier Transform)等の算術演算、画像処理、音声処理等が代表的な機能例である。IPコアは、ライセンス料を支払うものが多いが、一部はフリーで提供されているものもある。
 第2の実施形態では、FPGAに関しては、IPコアを自動オフロードに利用する。また、GPUに関しては、IPコアという言い方ではないものの、FFT、線形代数演算等が代表的な機能例であり、CUDAを用いて実装されたcuFFTやcuBLAS等がGPU向けライブラリとしてフリーで提供されている。本第2の実施形態では、GPUに関してこれらのライブラリを活用する。
 本第2の実施形態では、CPU向けに作られた既存プログラムコードの中で、FFT処理等、GPU、FPGAにオフロードすることで高速化できるような機能ブロックが含まれる場合に、GPU向けライブラリやFPGA向けIPコア等に置き換えることでの高速化を図る。
[機能ブロックのオフロード処理概要]
 第2の実施形態のオフロードサーバ200は、環境適応ソフトウェアの要素技術としてユーザアプリケーションロジックのGPU、FPGA自動オフロードに適用した例である。
 図13は、オフロードサーバ200の機能ブロックのオフロード処理を示す図である。
 図13に示すように、オフロードサーバ200は、環境適応ソフトウェアの要素技術に適用される。オフロードサーバ200は、制御部(自動オフロード機能部)11と、コードパターンDB230、テストケースDB131と、中間言語ファイル132と、検証用マシン14と、を有している。
 オフロードサーバ200は、ユーザが利用するアプリケーションコード(Application code)130を取得する。
 ユーザは、例えば、各種デバイス(Device)151、CPU-GPUを有する装置152、CPU-FPGAを有する装置153、CPUを有する装置154を利用する。オフロードサーバ200は、機能処理をCPU-GPUを有する装置152、CPU-FPGAを有する装置153のアクセラレータに自動オフロードする。
 以下、図13のステップ番号を参照して各部の動作を説明する。
 <ステップS31:Specify application code>
 ステップS31において、アプリケーションコード指定部111(図12参照)は、受信したファイルに記載されたアプリケーションコードを、アプリケーションコード分析部112に渡す。
 <ステップS32:Analyze application code>(コード分析)
 ステップS32において、アプリケーションコード分析部112(図12参照)は、Clang等の構文解析ツールを用いて、ループ文構造等とともに、コードに含まれるライブラリ呼び出しや、機能処理を分析するソースコードの分析を行う。
 <ステップS33:Extract offloadable area>(オフロード可能処理抽出)
 ステップS33において、置換機能検出部213(図12参照)は、把握したライブラリ呼び出しや機能処理について、コードパターンDB230と照合することで、GPU、FPGAにオフロードできるオフロード可能処理を抽出する。
 <ステップS34:Output intermediate file>(オフロード用中間ファイル出力)
 ステップS34において、置換処理部214(図12参照)は、抽出したオフロード可能処理を、GPU向けのライブラリやFPGA向けのIPコア等に置換する。置換処理部214は、GPU向けのライブラリやFPGA向けのIPコア等に置換した機能ブロックを、CPUプログラムとのインタフェースを作成することでオフロードする。置換処理部214は、CUDA,OpenCL等の中間言語ファイル132を出力する。中間言語抽出は、一度で終わりでなく、適切なオフロード領域探索のため、実行を試行して最適化するため反復される。
 ここで、オフロード可能処理が直ちに高速化につながるか、またコスト効果が十分であるかは分からないので、オフロードパターン作成部215は、後述する検証環境での性能測定を通じて、オフロードするしないを試行することで、より高速となるオフロードパターンを抽出する。
 <ステップS21:Deploy binary files>(デプロイ、性能測定試行)
 ステップS21において、バイナリファイル配置部116a(図12参照)は、GPU、FPGAを備えた検証用マシン14に、中間言語から導かれる実行ファイルをデプロイする。バイナリファイル配置部116aは、配置したファイルを起動し、想定するテストケースを実行して、オフロードした際の性能を測定する。
 <ステップS22:Measure performances>
 ステップS22において、性能測定部116(図12参照)は、配置したファイルを実行し、オフロードした際の性能を測定する。
 図13の符号gに示すように、制御部210は、上記ステップS12乃至ステップS22を繰り返し実行する。制御部210の自動オフロード機能をまとめると、下記である。すなわち、アプリケーションコード分析部112は、Clang等の構文解析ツールを用いて、ループ文構造等とともに、コードに含まれるライブラリ呼び出しや、機能処理を分析するソースコードの分析を行う。置換機能検出部213は、検出したライブラリ呼び出しや機能処理について、コードパターンDB230と照合することで、GPU、FPGAにオフロードできるオフロード可能処理を抽出する。置換処理部214は、抽出したオフロード可能処理を、GPU向けのライブラリやFPGA向けのIPコア等に置換する。そして、オフロードパターン作成部215は、GPU向けのライブラリやFPGA向けのIPコア等に置換した機能ブロックを、CPUプログラムとのインタフェースを作成することでオフロードする。
 <ステップS23:Deploy final binary files to production environment>
 ステップS23において、本番環境配置部118は、最終的なオフロード領域を指定したパターンを決定し、ユーザ向けの本番環境にデプロイする。
 <ステップS24:Extract performance test cases and  run automatically>
 ステップS24において、性能測定テスト抽出実行部119は、実行ファイル配置後、ユーザに性能を示すため、性能試験項目をテストケースDB131から抽出し、抽出した性能試験を自動実行する。
 <ステップS25:Provide price and performance to a user to judge>
 ステップS25において、ユーザ提供部120は、性能試験結果を踏まえた、価格・性能等の情報をユーザに提示する。ユーザは、提示された価格・性能等の情報をもとに、サービスの課金利用開始を判断する。
 上記ステップS11~ステップS25は、ユーザのサービス利用のバックグラウンドで行われ、例えば、仮利用の初日の間に行う等を想定している。
 上記したように、オフロードサーバ200の制御部(自動オフロード機能部)210は、環境適応ソフトウェアの要素技術に適用した場合、機能処理のオフロードのため、ユーザが利用するアプリケーションプログラムのソースコードから、オフロードする領域を抽出して中間言語を出力する(ステップS31~ステップS34)。制御部210は、中間言語から導かれる実行ファイルを、検証用マシン14に配置実行し、オフロード効果を検証する(ステップS21~ステップS22)。検証を繰り返し、適切なオフロード領域を定めたのち、制御部210は、実際にユーザに提供する本番環境に、実行ファイルをデプロイし、サービスとして提供する(ステップS23~ステップS25)。
 一般に、性能に関しては、最大性能になる設定を一回で自動発見するのは難しい。このため、オフロードパターンを、性能測定を検証環境で何度か繰り返すことにより試行し、高速化できるパターンを見つけることが本発明の特徴である。
[機能ブロックのオフロード処理詳細]
 機能ブロックのオフロードについては、機能ブロックの検出(以下、「処理A」という)、その機能ブロックがオフロード用の既存ライブラリ/IPコア等があるかを検出(以下、「処理B」という)、機能ブロックをライブラリ/IPコア等と置換した際にホスト側とのインタフェースの整合(以下、「処理C」という)、の3つ要素を考慮する必要がある。上記3つ要素の考慮点に従い、機能ブロックのオフロード処理について詳細に述べる。
[処理A](機能ブロックの検出)
 「処理A」(機能ブロックの検出)は、ライブラリの関数呼び出しを行い、ライブラリの関数呼び出しを機能ブロックとする<処理A-1>と、登録されていないライブラリの関数呼び出しである場合、クラス、構造体等を検出して機能ブロックとする<処理A-2>と、に分けられる。すなわち、<処理A-1>は、既存のライブラリの関数呼び出しを検出して機能ブロックとするものであり、<処理A-2>は、<処理A-1>において機能ブロックを検出しない場合に、クラスまたは構造体から機能ブロックを抽出するものである。
  <処理A-1>
 アプリケーションコード分析部112は、構文解析を用いて、ソースコードから外部のライブラリの関数呼び出しを行っていることを検知する。詳細には、下記の通りである。コードパターンDB230は、FFT等算術計算等のライブラリリストを保持している。アプリケーションコード分析部112は、ソースコードを構文解析し、コードパターンDB230が保持しているライブラリリストと照合して、外部のライブラリの関数呼び出しを行っていることを検知する。
  <処理A-2>
 アプリケーションコード分析部112は、登録されていないライブラリ呼び出し以外の機能処理を機能ブロックとして検出するため、構文解析を用いて、ソースコードの定義記述からクラスまたは構造体の機能処理を検出する。アプリケーションコード分析部112は、例えば、C言語のstructを使って定義されるいくつかの変数をひとまとまりにした型である構造体(structure)や、インスタンス化したオブジェクトの型が値型である構造体に対して参照型であるクラス(class)を検出する。また、アプリケーションコード分析部112は、例えばJava(登録商標)において構造体に代替使用されるクラスを検出する。
[処理B](オフロード可能機能の検出)
 [処理B](オフロード可能機能の検出)は、<処理A-1>を受け、コードパターンDB230を参照して置換可能GPUライブラリ、IPコアを取得する<処理B-1>と、<処理A-2>を受け、アプリコードの置換元の処理記述を、置換先のGPUライブラリ、IPコア処理記述に置換する<処理B-2>と、に分けられる。すなわち、<処理B-1>は、ライブラリ名をキーに、コードパターンDB230から置換可能GPUライブラリ、IPコアを取得するものである。<処理B-2>は、クラス、構造体等のコードをキーに、置換可能GPUライブラリ・IPコアを検出し、アプリコードの置換元の処理記述を、置換先のGPUライブラリ、IPコア処理記述に置換するものである。
 処理Bの前提として、コードパターンDB230には、特定のライブラリ、機能ブロックを高速化するGPU用ライブラリやFPGA用IPコアとそれに関連する情報が保持されている。また、コードパターンDB230には、置換元のライブラリ、機能ブロックについては、機能名とともにコードや実行ファイルが登録されている。
  <処理B-1>
 置換機能検出部213は、<処理A-1>でアプリケーションコード分析部112が検出したライブラリ呼び出しに対して、ライブラリ名をキーに、コードパターンDB230を検索し、コードパターンDB230から、置換可能GPUライブラリ(高速化できるGPU用ライブラリ)やFPGA用IPコアを取得する。
 <処理B-1>の例を記載する。
 置換機能検出部213は、例えば、置換元の処理が2D FFTの処理(非特許文献4等にコードがある)であった場合は、その外部ライブラリ名をキーに、2D FFTを処理するFPGA処理として、OpenCLコードを検出する(ホストプログラム、カーネルプログラム)等)。なお、OpenCLコードは、コードパターンDB230に記憶されている。
 置換機能検出部213は、例えば、置換元の処理が2D FFTの処理であった場合は、GPUライブラリとして検出されたcuFFTの中の関数呼び出しに置換する。なお、GPUライブラリは、コードパターンDB230に記憶されている。
  <処理B-2>
 置換機能検出部213は、<処理A-2>でアプリケーションコード分析部112が検出したクラス、構造体等のコードをキーに、コードパターンDB230を検索し、コードパターンDB230から、類似性検出ツールを用いて置換可能GPUライブラリ(高速化できるGPU用ライブラリ)やFPGA用IPコアを取得する。類似性検出ツールとは、Deckard等、コピーコードやコピー後変更したコードの検出を対象とするツールである。置換機能検出部213が、類似性検出ツールを用いることで、行列計算のコード等、CPUで計算する場合は記述が同様になる処理や、他者のコードをコピーして変更した処理等を一部検出できる。なお、類似性検出ツールは、新規に独立に作成したようなクラス等については検出が困難となるため対象外である。
 <処理B-2>の例を記載する。
 置換機能検出部213は、置換元CPUコードに検知されたクラスや構造体に対して、Deckard等の類似性検知ツールを用いて、コードパターンDB230に登録された類似クラスや構造体を検索する。例えば、置換元の処理(非特許文献4等にコードがある)が2D FFTのクラスであった場合は、その類似クラスとしてコードパターンDB230に登録されたクラスが2D FFTのクラスが検出される。コードパターンDB230には、2D FFTをオフロード可能なIPコアやGPUライブラリが登録されている。そのため、<処理B-1>と同様に、2D FFTに対して、OpenCLコード(ホストプログラム、カーネルプログラム等)やGPUライブラリを検出する。
[処理C](ホスト側とのインタフェースの整合)
 [処理C](ホスト側とのインタフェースの整合)は、<処理C-1>と、<処理C-2>とを有する。<処理C-1>は、<処理B-1>を受け、アプリコードの置換元の処理記述を、置換先のGPUライブラリ、IPコア処理記述に置換するとともに、GPUライブラリ、IPコア呼び出しのためのインタフェース処理を記述する。<処理C-2>は、<処理B-2>を受け、アプリコードの置換元の処理記述を、置換先のGPUライブラリ、IPコア処理記述に置換するとともに、GPUライブラリ、IPコア呼び出しのためのインタフェース処理を記述する。ここで、上記GPUライブラリ、IPコア呼び出しのためのインタフェース処理の記述が、「ホスト側とのインタフェースの整合」に対応する。
 <処理C-1>
 置換処理部214は、アプリコードの置換元の処理記述を、置換先のGPUライブラリ、IPコア処理記述に置換する。そして、置換処理部214は、GPUライブラリ、IPコア呼び出しのためのインタフェース処理を記述し(OpenCL API等)、作成したパターンをコンパイルする。
 <処理C-1>について、より詳細に説明する。
 置換機能検出部213は、<処理A-1>で検出したライブラリ呼び出しに対して、<処理B-1>で該当するライブラリやIPコアを検索している。このため、置換処理部214は、置換するライブラリやIPコアをGPUやFPGAに実装し、ホスト側(CPU)プログラムと繋ぐインタフェース処理を行う。
 ここで、GPU用ライブラリの場合は、CUDA等のライブラリを想定しており、C言語コードからCUDAライブラリを利用する手法がライブラリとともに公開されている。そこで、コードパターンDB230に、ライブラリ利用手法も含めて登録しておき、置換処理部214は、コードパターンDB230に登録されたライブラリ利用手法に従って、アプリコードの置換元の処理記述を、置換先のGPUライブラリに置換するとともに、GPUライブラリで利用する関数の呼び出し等の所定記述を行う。
 FPGA用IPコアの場合は、HDL(Hardware Description Language)等が想定される。この場合、IPコア関連の情報としてOpenCLコードもコードパターンDB230に保持されている。置換処理部214は、FPGAとのインタフェース処理を、高位合成ツール(例えば、Xilinx Vivado, Intel HLS Compiler等)を介して行うことができる。置換処理部214は、例えば、OpenCLコードから、OpenCLインタフェースを用いたCPUとFPGAの接続を、高位合成ツールを介して行う。同様に、置換処理部214は、FPGAへのIPコア実装を、XilinxやIntel等のFPGAベンダの高位合成ツールを介して行う。
 <処理C-2>
 置換処理部214は、アプリコードの置換元の処理記述を、置換先のGPUライブラリ、IPコア処理記述に置換する。そして、置換処理部214は、置換元と置換先で引数や戻り値の数や型が異なる場合に、ユーザに確認し、GPUライブラリ、IPコア呼び出しのためのインタフェース処理を記述(OpenCL API等)するとともに、作成したパターンをコンパイルする。すなわち、<処理C-2>では、置換処理部214は、<処理A-2>で検出したクラス、構造体等に対して、<処理B-2>で高速化できるライブラリやIPコアを検索している。このため、置換処理部214は、<処理C-2>では該当するライブラリやIPコアをGPUやFPGAに実装する。
 <処理C-2>について、より詳細に説明する。
 <処理C-1>では、特定のライブラリ呼び出しに対して高速化するライブラリやIPコアであるため、インタフェース部分の生成等は必要になるものの、GPU、FPGAとホスト側プログラムの想定する引数、戻り値の数や型は合っていた。しかし、<処理B-2>は、類似性等で判断しているため、引数や戻り値の数や型等の基本的な部分が合っている保証はない。ライブラリやIPコアは、既存ノウハウであり、引数、戻り値の数や型が合っていない場合であっても、変更が頻繁にできるものではない。このため、オフロードを依頼するユーザに対して、元のコードの引数や戻り値の数や型について、ライブラリやIPコアに合わせて変更するか否かを確認する。そして、確認了承後にオフロード性能試験を試行する。
 型の違いについて、floatとdouble等キャストすればよいだけであれば、処理パターン作成時にキャストする処理を追加し、特にユーザ確認せずに性能測定試行に入ってもよい。また、引数や戻り値で、元のプログラムとライブラリやIPコアで数が異なる場合、例えば、CPUプログラムで引数1,2が必須で引数3がオプションであり、ライブラリやIPコアで引数1,2が必須の場合等は、オプション引数3は省略しても問題はない。このような場合は、ユーザに確認せず、処理パターン作成時にオプション引数は自動で無しとして扱うなどしてもよい。なお、引数や戻り値の数や型が完全に合っている場合は、<処理C-1>と同様の処理でよい。
[《機能ブロックオフロード:共通》フローチャート]
 次に、図14および図15を参照してオフロードサーバ200の《機能ブロックオフロード:共通》の動作概要を説明する。
・<処理A-1>と<処理B-1>と<処理C-1>のフローチャート
 図14は、オフロードサーバ200の制御部(自動オフロード機能部)210が、《機能ブロックオフロード:共通》のオフロード処理において<処理A-1>と<処理B-1>と<処理C-1>とを実行する場合のフローチャートである。
 ステップS501でアプリケーションコード分析部112(図12参照)は、アプリケーションプログラムのオフロードしたいソースコードの分析を行う。具体的には、アプリケーションコード分析部112は、Clang等の構文解析ツールを用いて、ループ文構造等とともに、コードに含まれるライブラリ呼び出しや、機能処理を分析するソースコードの分析を行う。
 ステップS502で置換機能検出部213(図12参照)は、アプリケーションプログラムの外部ライブラリ呼び出しを検出する。
 ステップS503で置換機能検出部213は、コードパターンDB230から、ライブラリ名をキーに、置換可能GPUライブラリを取得する。具体的には、置換機能検出部213は、把握した外部ライブラリ呼び出しについて、コードパターンDB230と照合することで、検出した置換可能GPUライブラリ・IPコアを、GPU、FPGAにオフロードできるオフロード可能な機能ブロックとして取得する。
 ステップS504で置換処理部214は、アプリケーションのソースコードの置換元の処理記述を、置換先のGPUライブラリの処理記述に置換する。
 ステップS505で置換処理部214は、置換したGPUライブラリの処理記述を、オフロード対象の機能ブロックとして、GPUにオフロードする。
 ステップS506で置換処理部214は、GPUライブラリ呼び出しのためのインタフェース処理を記述する。
 ステップS507で実行ファイル作成部117は、作成したパターンをコンパイルまたはインタプリットする。
 ステップS508で性能測定部116は、作成したパターンを検証環境で性能測定する(「1回目の性能測定」)。
 ステップS509で実行ファイル作成部117は、1回目測定時に高速化できたパターンについて組合せパターンを作成する。
 ステップS510で実行ファイル作成部117は、作成した組合せパターンをコンパイルまたはインタプリットする。
 ステップS511で性能測定部116は、作成した組合せパターンを検証環境で性能測定する(「2回目の性能測定」)。
 ステップS512で本番環境配置部118は、1回目と2回目の測定の中で最高性能のパターンを選択して本フローの処理を終了する。
・<処理A-2>と<処理B-2>と<処理C-2>のフローチャート
 図15は、オフロードサーバ200の制御部(自動オフロード機能部)210が、機能ブロックのオフロード処理において<処理A-2>と<処理B-2>と<処理C-2>とを実行する場合のフローチャートである。なお、<処理A-2>からの処理は、<処理A-1>からの処理と並行して行えばよい。
 ステップS601でアプリケーションコード分析部112(図12参照)は、アプリケーションのオフロードしたいソースコードの分析を行う。具体的には、アプリケーションコード分析部112は、Clang等の構文解析ツールを用いて、ループ文構造等とともに、コードに含まれるライブラリ呼び出しや、機能処理を分析するソースコードの分析を行う。
 ステップS602で置換機能検出部213(図12参照)は、ソースコードからクラスまたは構造体の定義記述コードを検出する。
 ステップS603で置換機能検出部213は、コードパターンDB230から、類似性検出ツールを用いて、クラスまたは構造体の定義記述コードをキーにして、置換可能GPUライブラリを取得する。
 ステップS604で置換処理部214は、アプリケーションのソースコードの置換元の処理記述を、置換先のGPUライブラリ処理記述に置換する。
 ステップS605で置換処理部214は、置換元と置換先で引数、戻り値の数や型が異なる場合に、ユーザに確認する。
 ステップS606で置換機能検出部213は、置換または確認したGPUライブラリの処理記述を、オフロード対象の機能ブロックとして、GPUにオフロードする。
 ステップS607で置換処理部214は、GPUライブラリ呼び出しのためのインタフェース処理を記述する。
 ステップS608で実行ファイル作成部117は、作成したパターンをコンパイルまたはインタプリットする。
 ステップS609で性能測定部116は、作成したパターンを検証環境で性能測定する(「1回目の性能測定」)。
 ステップS610で実行ファイル作成部117は、1回目測定時に高速化できたパターンについて組合せパターンを作成する。
 ステップS611で実行ファイル作成部117は、作成した組合せパターンをコンパイルまたはインタプリットする。
 ステップS612で性能測定部116は、作成した組合せパターンを検証環境で性能測定する(「2回目の性能測定」)。
 ステップS613で本番環境配置部118は、本番環境配置部118は、1回目と2回目の測定の中で最高性能のパターンを選択して本フローの処理を終了する。
[《機能ブロックオフロード:C言語》]
 機能ブロックオフロード:C言語の、コードの分析では、C言語を解析するClang(登録商標)等の構文解析ツールを用いて構文解析する。機能ブロックの把握については、構文解析ツールの結果を用いて、次処理のマッチング探索に用いるため、言語に非依存の機能ブロックとして管理する。
 オフロード可能機能ブロックの探索では、ライブラリ等の名前一致でのマッチングと、Deckard(登録商標)等のC言語機能ブロックの類似性検出ツールを用いた類似性検知による、探索が行われる。オフロード機能ブロックへの置換は、CUDAライブラリ呼び出し等、その言語からのオフロード機能利用に合わせた処理に置換する必要がある。
 コンパイルは、CUDAライブラリ呼び出し等のC言語コードをPGIコンパイラ等でコンパイルする。性能測定は、言語に合わせて、Jenkins(登録商標)等の自動測定ツールも用いて行う。オフロード可能機能ブロックが複数の際は反復実行され、最高性能のパターンが最終解として決定される。
 このように、機能ブロック文オフロードでは、処理に関しては、機能ブロックの管理と機能ブロックの名前一致でのマッチングについては言語に非依存に適用できる。
[《機能ブロックオフロード:C言語》フローチャート]
 次に、図16および図17を参照してオフロードサーバ200の《機能ブロックオフロード:C言語》の動作概要を説明する。
・<処理A-1>と<処理B-1>と<処理C-1>のフローチャート
 図16は、オフロードサーバ200の制御部(自動オフロード機能部)210が、《機能ブロックオフロード:C言語》のオフロード処理において<処理A-1>と<処理B-1>と<処理C-1>とを実行する場合のフローチャートである。
 ステップS701でアプリケーションコード分析部112(図12参照)は、アプリケーションプログラムのオフロードしたいソースコードの分析を行う。具体的には、アプリケーションコード分析部112は、Clang等の構文解析ツールを用いて、ループ文構造等とともに、コードに含まれるライブラリ呼び出しや、機能処理を分析するソースコードの分析を行う。
 ステップS702で置換機能検出部213(図12参照)は、アプリケーションの外部ライブラリ呼び出しを検出する。
 ステップS703で置換機能検出部213は、コードパターンDB230から、ライブラリ名をキーに、置換可能GPUライブラリを取得する。具体的には、置換機能検出部213は、把握した外部ライブラリ呼び出しについて、コードパターンDB230と照合することで、検出した置換可能GPUライブラリを、GPU、FPGAにオフロードできるオフロード可能な機能ブロックとして取得する。
 ステップS704で置換処理部214は、アプリケーションコードの置換元の処理記述を、置換先のGPUライブラリの処理記述に置換する。
 ステップS705で置換処理部214は、置換したGPUライブラリの処理記述を、オフロード対象の機能ブロックとして、GPUにオフロードする。
 ステップS706で置換処理部214は、GPUライブラリ呼び出しのためのインタフェース処理を記述する。
 ステップS707で置換処理部214は、CUDAのライブラリ呼び出しを、PGIコンパイラに指定する。
 ステップS708で実行ファイル作成部117は、作成したパターンをPGIコンパイラでコンパイルする。
 ステップS709で性能測定部116は、作成したパターンを検証環境で性能測定する(「1回目の性能測定」)。
 ステップS710で実行ファイル作成部117は、1回目測定時に高速化できたパターンについて組合せパターンを作成する。
 ステップS711で実行ファイル作成部117は、作成した組合せパターンをPGIコンパイラでコンパイルする。
 ステップS712で性能測定部116は、作成した組合せパターンを検証環境で性能測定する(「2回目の性能測定」)。
 ステップS713で本番環境配置部118は、1回目と2回目の測定の中で最高性能のパターンを選択して本フローの処理を終了する。
・<処理A-2>と<処理B-2>と<処理C-2>のフローチャート
 図17は、オフロードサーバ200の制御部(自動オフロード機能部)210が、機能ブロックのオフロード処理において<処理A-2>と<処理B-2>と<処理C-2>とを実行する場合のフローチャートである。なお、<処理A-2>からの処理は、<処理A-1>からの処理と並行して行えばよい。
 ステップS801でアプリケーションコード分析部112(図12参照)は、アプリケーションプログラムのオフロードしたいソースコードの分析を行う。具体的には、アプリケーションコード分析部112は、Clang等の構文解析ツールを用いて、ループ文構造等とともに、コードに含まれるライブラリ呼び出しや、機能処理を分析するソースコードの分析を行う。
 ステップS802で置換機能検出部213(図12参照)は、ソースコードからクラスまたは構造体の定義記述コードを検出する。
 ステップS803で置換機能検出部213は、コードパターンDB230から、類似性検出ツールを用いて、クラスまたは構造体の定義記述コードをキーにして、置換可能GPUライブラリを取得する。
 ステップS804で置換処理部214は、アプリケーションのソースコードの置換元の処理記述を、置換先のGPUライブラリの処理記述に置換する。
 ステップS805で置換処理部214は、置換元と置換先で引数、戻り値の数や型が異なる場合に、ユーザに確認する。
 ステップS806で置換機能検出部213は、置換または確認したGPUライブラリの置換元の処理記述を、オフロード対象の機能ブロックとして、GPUにオフロードする。
 ステップS807で置換処理部214は、GPUライブラリ呼び出しのためのインタフェース処理を記述する。
 ステップS808で置換処理部214は、CUDAのライブラリ呼び出しを、PGIコンパイラに指定する。
 ステップS809で実行ファイル作成部117は、作成したパターンをPGIコンパイラでコンパイルする。
 ステップS810で性能測定部116は、作成したパターンを検証環境で性能測定する(「1回目の性能測定」)。
 ステップS811で実行ファイル作成部117は、1回目測定時に高速化できたパターンについて組合せパターンを作成する。
 ステップS812で実行ファイル作成部117は、作成した組合せパターンをPGIコンパイラでコンパイルする。
 ステップS813で性能測定部116は、作成した組合せパターンを検証環境で性能測定する(「2回目の性能測定」)。
 ステップS814で本番環境配置部118は、本番環境配置部118は、1回目と2回目の測定の中で最高性能のパターンを選択して本フローの処理を終了する。
 以上、《機能ブロックオフロード:C言語》について説明した、次に、《機能ブロックオフロード:Python》について説明する。
[《機能ブロックオフロード:Python》]
 機能ブロックオフロード:Pythonは、機能ブロックオフロードの、コードの分析では、Pythonを解析するast(登録商標)等の構文解析ツールを用いて構文解析する。機能ブロックの把握については、構文解析ツールの結果を用いて、次処理のマッチング探索に用いるため、言語に非依存の機能ブロックとして管理する。
 オフロード可能機能ブロックの探索では、ライブラリ等の名前一致でのマッチングと、CloneDigger(登録商標)等のPython機能ブロックの類似性検出ツールを用いた類似性検知による、探索が行われる。
 オフロード機能ブロックへの置換は、GPU処理のpyCUDAでの呼び出し等、その言語からのオフロード機能利用に合わせた処理に置換する必要がある。インタプリタは、CUDAに合わせたPythonコードをpyCUDAでインタプリットする。
 性能測定は、言語に合わせて、Jenkins(登録商標)等の自動測定ツールも用いて行う。オフロード可能機能ブロックが複数の際は反復実行され、最高性能のパターンが最終解として決定される。
[《機能ブロックオフロード:Python》フローチャート]
 次に、図18および図19を参照してオフロードサーバ200の《機能ブロック:Python》の動作概要を説明する。
・<処理A-1>と<処理B-1>と<処理C-1>のフローチャート
 図18は、オフロードサーバ200の制御部(自動オフロード機能部)210が、《機能ブロック:Python》のオフロード処理において<処理A-1>と<処理B-1>と<処理C-1>とを実行する場合のフローチャートである。
 ステップS901でアプリケーションコード分析部112(図12参照)は、アプリケーションプログラムのオフロードしたいソースコードの分析を行う。具体的には、アプリケーションコード分析部112は、Clang等の構文解析ツールを用いて、ループ文構造等とともに、コードに含まれるライブラリ呼び出しや、機能処理を分析するソースコードの分析を行う。
 ステップS902で置換機能検出部213(図12参照)は、アプリケーションの外部ライブラリ呼び出しを検出する。
 ステップS903で置換機能検出部213は、コードパターンDB230から、ライブラリ名をキーに、置換可能GPUライブラリを取得する。具体的には、置換機能検出部213は、把握した外部ライブラリ呼び出しについて、コードパターンDB230と照合することで、検出した置換可能GPUライブラリを、GPU、FPGAにオフロードできるオフロード可能な機能ブロックとして取得する。
 ステップS904で置換処理部214は、アプリケーションのソースコードの置換元の処理記述を、置換先のGPUライブラリの処理記述に置換する。
 ステップS905で置換処理部214は、置換したGPUライブラリの処理記述を、オフロード対象の機能ブロックとして、GPUにオフロードする。
 ステップS906で置換処理部214は、GPUライブラリ呼び出しのためのインタフェース処理を記述する。
 ステップS907で置換処理部214は、CUDAのライブラリ呼び出しを、pyCudaで指定する。
 ステップS908で実行ファイル作成部117は、作成したパターンをpyCudaでインタプリットする。
 ステップS909で性能測定部116は、作成したパターンを検証環境で性能測定する(「1回目の性能測定」)。
 ステップS910で実行ファイル作成部117は、1回目測定時に高速化できたパターンについて組合せパターンを作成する。
 ステップS911で実行ファイル作成部117は、作成した組合せパターンpyCudaでインタプリットする。
 ステップS912で性能測定部116は、作成した組合せパターンを検証環境で性能測定する(「2回目の性能測定」)。
 ステップS913で本番環境配置部118は、1回目と2回目の測定の中で最高性能のパターンを選択して本フローの処理を終了する。
・<処理A-2>と<処理B-2>と<処理C-2>のフローチャート
 図19は、オフロードサーバ200の制御部(自動オフロード機能部)210が、機能ブロックのオフロード処理において<処理A-2>と<処理B-2>と<処理C-2>とを実行する場合のフローチャートである。なお、<処理A-2>からの処理は、<処理A-1>からの処理と並行して行えばよい。
 ステップS1001でアプリケーションコード分析部112(図12参照)は、アプリケーションプログラムのオフロードしたいソースコードの分析を行う。具体的には、アプリケーションコード分析部112は、Clang等の構文解析ツールを用いて、ループ文構造等とともに、コードに含まれるライブラリ呼び出しや、機能処理を分析するソースコードの分析を行う。
 ステップS1002で置換機能検出部213(図12参照)は、ソースコードからクラスまたは構造体の定義記述コードを検出する。
 ステップS1003で置換機能検出部213は、コードパターンDB230から、類似性検出ツールを用いて、クラスまたは構造体の定義記述コードをキーにして、置換可能GPUライブラリを取得する。
 ステップS1004で置換処理部214は、アプリケーションのソースコードの置換元の処理記述を、置換先のGPUライブラリ処理記述に置換する。
 ステップS1005で置換処理部214は、置換元と置換先で引数、戻り値の数や型が異なる場合に、ユーザに確認する。
 ステップS1006で置換機能検出部213は、置換または確認したGPUライブラリの処理記述を、オフロード対象の機能ブロックとして、GPUにオフロードする。
 ステップS1007で置換処理部214は、GPUライブラリ呼び出しのためのインタフェース処理を記述する。
 ステップS1008で置換処理部214は、CUDAのライブラリ呼び出しを、pyCudaで指定する。
 ステップS1009で実行ファイル作成部117は、作成したパターンをpyCudaでインタプリットする。
 ステップS1010で性能測定部116は、作成したパターンを検証環境で性能測定する(「1回目の性能測定」)。
 ステップS1011で実行ファイル作成部117は、1回目測定時に高速化できたパターンについて組合せパターンを作成する。
 ステップS1012で実行ファイル作成部117は、作成した組合せパターンをpyCudaでインタプリットする。
 ステップS1013で性能測定部116は、作成した組合せパターンを検証環境で性能測定する(「2回目の性能測定」)。
 ステップS1014で本番環境配置部118は、本番環境配置部118は、1回目と2回目の測定の中で最高性能のパターンを選択して本フローの処理を終了する。
 以上、《機能ブロックオフロード:Python》について説明した、次に、《機能ブロックオフロード:Java》について説明する。
[《機能ブロックオフロード:Java》]
 機能ブロックオフロード:Javaの、コードの分析では、Javaを解析するJavaParser(登録商標)等の構文解析ツールを用いて構文解析する。機能ブロックの把握については、構文解析ツールの結果を用いて、次処理のマッチング探索に用いるため、言語に非依存の機能ブロックとして管理する。
 オフロード可能機能ブロックの探索では、ライブラリ等の名前一致でのマッチングと、Deckard(登録商標)等のJava機能ブロックの類似性検出ツールを用いた類似性検知による、探索が行われる。オフロード機能ブロックへの置換は、GPU処理のCUDAライブラリの呼び出し等、その言語からのオフロード機能利用に合わせた処理に置換する必要がある。
 実行環境は、Javaのラムダ記述での処理をGPUに対して行うことができるIBM JDK(登録商標)を用いる。性能測定は、言語に合わせて、Jenkins(登録商標)等の自動測定ツールも用いて行う。オフロード可能機能ブロックが複数の際は反復実行され、最高性能のパターンが最終解として決定される。
[《機能ブロックオフロード:Java》フローチャート]
 次に、図20および図21を参照してオフロードサーバ200の《機能ブロック:Java》の動作概要を説明する。
・<処理A-1>と<処理B-1>と<処理C-1>のフローチャート
 図20は、オフロードサーバ200の制御部(自動オフロード機能部)210が、《機能ブロック:Java》のオフロード処理において<処理A-1>と<処理B-1>と<処理C-1>とを実行する場合のフローチャートである。
 ステップS1101でアプリケーションコード分析部112(図12参照)は、アプリケーションプログラムのオフロードしたいソースコードの分析を行う。具体的には、アプリケーションコード分析部112は、Clang等の構文解析ツールを用いて、ループ文構造等とともに、コードに含まれるライブラリ呼び出しや、機能処理を分析するソースコードの分析を行う。
 ステップS1102で置換機能検出部213(図12参照)は、アプリケーションプログラムの外部ライブラリ呼び出しを検出する。
 ステップS1103で置換機能検出部213は、コードパターンDB230から、ライブラリ名をキーに、置換可能GPUライブラリを取得する。具体的には、置換機能検出部213は、把握した外部ライブラリ呼び出しについて、コードパターンDB230と照合することで、検出した置換可能GPUライブラリを、GPU、FPGAにオフロードできるオフロード可能な機能ブロックとして取得する。
 ステップS1104で置換処理部214は、アプリケーションのソースコードの置換元の処理記述を、置換先のGPUライブラリ、IPコアの処理記述に置換する。
 ステップS1105で置換処理部214は、置換したGPUライブラリの処理記述を、オフロード対象の機能ブロックとして、GPUにオフロードする。
 ステップS1106で置換処理部214は、GPUライブラリ呼び出しのためのインタフェース処理を記述する。
 ステップS1107で置換処理部214は、CUDAのライブラリ呼び出しを、Jcudaで指定する。
 ステップS1108で実行ファイル作成部117は、作成したパターンをJcudaでビルドする。
 ステップS1109で性能測定部116は、作成したパターンを検証環境で性能測定する(「1回目の性能測定」)。
 ステップS1110で実行ファイル作成部117は、1回目測定時に高速化できたパターンについて組合せパターンを作成する。
 ステップS1111で実行ファイル作成部117は、作成した組合せパターンをJcudaでビルドする。
 ステップS1112で性能測定部116は、作成した組合せパターンを検証環境で性能測定する(「2回目の性能測定」)。
 ステップS1113で本番環境配置部118は、1回目と2回目の測定の中で最高性能のパターンを選択して本フローの処理を終了する。
・<処理A-2>と<処理B-2>と<処理C-2>のフローチャート
 図21は、オフロードサーバ200の制御部(自動オフロード機能部)210が、機能ブロックのオフロード処理において<処理A-2>と<処理B-2>と<処理C-2>とを実行する場合のフローチャートである。なお、<処理A-2>からの処理は、<処理A-1>からの処理と並行して行えばよい。
 ステップS1201でアプリケーションコード分析部112(図12参照)は、アプリケーションのオフロードしたいソースコードの分析を行う。具体的には、アプリケーションコード分析部112は、Clang等の構文解析ツールを用いて、ループ文構造等とともに、コードに含まれるライブラリ呼び出しや、機能処理を分析するソースコードの分析を行う。
 ステップS1202で置換機能検出部213(図12参照)は、ソースコードからクラスまたは構造体の定義記述コードを検出する。
 ステップS1203で置換機能検出部213は、コードパターンDB230から、類似性検出ツールを用いて、クラスまたは構造体の定義記述コードをキーにして、置換可能GPUライブラリを取得する。
 ステップS1204で置換処理部214は、アプリケーションのソースコードの置換元の処理記述を、置換先のGPUライブラリ処理記述に置換する。
 ステップS1205で置換処理部214は、置換元と置換先で引数、戻り値の数や型が異なる場合に、ユーザに確認する。
 ステップS1206で置換機能検出部213は、置換または確認したGPUライブラリの処理記述を、オフロード対象の機能ブロックとして、GPUにオフロードする。
 ステップS1207で置換処理部214は、GPUライブラリ呼び出しのためのインタフェース処理を記述する。
 ステップS1108で置換処理部214は、CUDAのライブラリ呼び出しを、Jcudaで指定する。
 ステップS1209で実行ファイル作成部117は、作成したパターンをJcudaでビルドする。
 ステップS1210で性能測定部116は、作成したパターンを検証環境で性能測定する(「1回目の性能測定」)。
 ステップS1211で実行ファイル作成部117は、1回目測定時に高速化できたパターンについて組合せパターンを作成する。
 ステップS1212で実行ファイル作成部117は、作成した組合せパターンをJcudaでビルドする。
 ステップS1213で性能測定部116は、作成した組合せパターンを検証環境で性能測定する(「2回目の性能測定」)。
 ステップS1214で本番環境配置部118は、本番環境配置部118は、1回目と2回目の測定の中で最高性能のパターンを選択して本フローの処理を終了する。
[実装例]
 第1の実施形態(「ループ文オフロード」)および第2の実施形態(「機能ブロックオフロード」)の実装例を説明する。
 <利用ツール>
 対象アプリケーションプログラムはC/C++言語、Python、Javaのアプリケーションとする。
 GPU処理は、C/C++言語はPGIコンパイラ19.10を用いる。PGIコンパイラは、OpenACCを解釈するC/C++向けコンパイラである。PGIコンパイラは、cuFFT等のCUDAライブラリの呼び出しも処理が可能である。
 Pythonは、pyCUDA 2019.1.2を用いる。pyCUDAは、PythonからGPUに処理実行するためのインタプリタである。あるいは、Pythonには、PyACCを用いる。PyACCは、PythonからOpenACCを解釈実行するためのインタプリタである。
 Javaは、IBM JDK(登録商標)を用いる。IBM JDKはJavaのラムダ記述に従って並列処理をGPUに対して実行する仮想マシンである。
 <構文解析>
 C/C++言語の構文解析には、LLVM/Clang 6.0の構文解析ライブラリ(libClang(登録商標)のpython binding) を用いる。Pythonの構文解析には、astを用いる。Javaの構文解析には、Java Parser(登録商標)を用いる。
 <類似性検出ツール>
 類似性検出ツールには、C/C++言語、Javaには、Deckard v2.0(登録商標)を用いる。Deckardは、機能ブロックのオフロードの適用領域拡大のため、ライブラリ呼び出し以外にも、コードコピーし変更した機能等のオフロードを実現するため、照合対象となる部分コードと、DBに登録されたコードの類似性を判定する。Pythonには、CloneDigger(登録商標)を用いる。
 <コードパターンDB>
 照合に用いるコードパターンDB230(図12参照)は、MySQL8を用いる。呼び出しているライブラリ名をキーに、高速化できるライブラリ等を検索するためのレコードを保持する。ライブラリには、それに紐づく名前やコードや実行ファイルが保持される。実行ファイルはその利用手法等も登録されている。コードパターンDB230には、ライブラリ等を類似性検出技術で検出するための、比較用コードとの対応関係も保持される。
 <実装動作>
 実装の動作概要について述べる。
 実装は、アプリケーションの利用依頼があると、構文解析ライブラリを用いてコード解析を行う。次に、機能ブロックオフロード、ループ文オフロードの順に試行を行う。これは、ループ文と機能ブロックに関しては、アルゴリズム含めて処理内容に合わせてオフロードする機能ブロックオフロードの方が高速化できるからである。機能ブロックオフロードが可能であった場合は、後半のループ文オフロードはオフロード可能であった機能ブロック部分を抜いたコードに対して試行する。
 性能測定の結果、最高性能のパターンを解とする。
 以上、ライブラリ呼び出しの場合について記載した。
 置換機能検出部213(図12参照)が、類似性検出ツールを用いて類似性検出を行う場合について説明する。類似性検出を行う場合には、上記置換記述と並行して処理がされる。すなわち、置換機能検出部213が、類似性検出を行う場合、実装例では、<処理B-2>でDeckardを用いて、検出されたクラス、構造体等の部分コードとコードパターンDB230に登録された比較用コードとの類似性検出を行う。そして、置換機能検出部213は、閾値超えの機能ブロックと該当するGPU用ライブラリやFPGA用IPコアを検出する。置換機能検出部213は、<処理B-1>の場合と同様に、実行ファイルやOpenCLを取得する。実装例では、次にC-1の場合と同様に実行用ファイルを作成するが、特に置換元のコードと置換するライブラリやIPコアの引数や戻り値、型等のインタフェースが異なる場合は、オフロードを依頼したユーザに対して、置換先ライブラリやIPコアに合わせて、インタフェースを変更してよいか確認し、確認後に実行用ファイルを作成する。
 この時点で、検証環境のGPUやFPGAで性能測定できる実行用ファイルが作成される。機能ブロックオフロードについては、置換する機能ブロックが一つの場合は、その一つをオフロードするかしないかだけである。複数ある場合は、一つずつオフロードする/しないを検証パターンとして作成し、性能を測定し高速な解を検出する。これは、高速化可能とされていても実測してみないとその条件で高速になるかわからないためである。例えば、5つオフロード可能な機能ブロックがあり、1回目測定の結果、2番と4番のオフロードが高速化できた場合は、2番と4番両方をオフロードするパターンで2回目測定を行い、2番と4番単独でオフロードする場合より高速となっている場合は、解として選択する。
[ハードウェア構成]
 第1および第2の実施形態に係るオフロードサーバは、例えば図22に示すような構成の物理装置であるコンピュータ900によって実現される。
 図22は、オフロードサーバ1,200の機能を実現するコンピュータの一例を示すハードウェア構成図である。コンピュータ900は、CPU(Central Processing Unit)901、ROM(Read Only Memory)902、RAM903、HDD(Hard Disk Drive)904、入出力I/F(Interface)905、通信I/F906およびメディアI/F907を有する。
 CPU901は、ROM902またはHDD904に記憶されたプログラムに基づき作動し、図1、図12に示すオフロードサーバ1,200の各処理部による制御を行う。ROM902は、コンピュータ900の起動時にCPU901により実行されるブートプログラムや、コンピュータ900のハードウェアに係るプログラム等を記憶する。
 CPU901は、入出力I/F905を介して、マウスやキーボード等の入力装置910、および、ディスプレイ等の出力装置911を制御する。CPU901は、入出力I/F905を介して、入力装置910からデータを取得するともに、生成したデータを出力装置911へ出力する。
 HDD904は、CPU901により実行されるプログラムおよび当該プログラムによって使用されるデータ等を記憶する。通信I/F906は、通信網(例えば、NW(Network)920)を介して他の装置からデータを受信してCPU901へ出力し、また、CPU901が生成したデータを、通信網を介して他の装置へ送信する。
 メディアI/F907は、記録媒体912に格納されたプログラムまたはデータを読み取り、RAM903を介してCPU901へ出力する。CPU901は、目的の処理に係るプログラムを、メディアI/F907を介して記録媒体912からRAM903上にロードし、ロードしたプログラムを実行する。記録媒体912は、DVD(Digital Versatile Disc)、PD(Phase change rewritable Disk)等の光学記録媒体、MO(Magneto Optical disk)等の光磁気記録媒体、磁気記録媒体、導体メモリテープ媒体又は半導体メモリ等である。
 例えば、コンピュータ900が第1および第2の実施形態に係るオフロードサーバ1,200として機能する場合、コンピュータ900のCPU901は、RAM903上にロードされたプログラムを実行することによりオフロードサーバ1,200の機能を実現する。また、HDD904には、RAM903内のデータが記憶される。CPU901は、目的の処理に係るプログラムを記録媒体912から読み取って実行する。この他、CPU901は、他の装置から通信網(NW920)を介して目的の処理に係るプログラムを読み込んでもよい。
[効果]
 以下、本発明に係るオフロードサーバ等の効果について説明する。
 第1の実施形態に係るオフロードサーバ1(図1参照)は、アプリケーションプログラムの特定処理をアクセラレータにオフロードするオフロードサーバであって、アプリケーションプログラムは、C言語、Python、およびJavaより選択される少なくとも一つであり、オフロードサーバ1は、アプリケーションプログラムのソースコードを分析するアプリケーションコード分析部112と、アプリケーションプログラムのループ文の中で用いられる変数の参照関係を分析し、ループ外でデータ転送してよいデータについては、ループ外でのデータ転送を明示的に指定する明示的指定行を用いたデータ転送指定を行うデータ転送指定部113と、アプリケーションプログラムのループ文を特定し、特定した各ループ文に対して、アクセラレータにおける並列処理指定文を指定してコンパイルする並列処理指定部114と、コンパイルエラーが出る繰り返し文に対して、オフロード対象外とするとともに、コンパイルエラーが出ないループ文に対して、並列処理するかしないかの指定を行う並列処理パターンを作成する並列処理パターン作成部115と、を備える。また、並列処理パターンのアプリケーションプログラムをコンパイルして、検証用マシン14に配置し、アクセラレータにオフロードした際の性能測定用処理を実行する性能測定部116と、性能測定結果をもとに、複数の前記並列処理パターンから高処理性能の並列処理パターンを複数選択し、高処理性能の並列処理パターンを交叉、突然変異処理により別の複数の並列処理パターンを作成して、新たに性能測定までを行い、指定回数の性能測定後に、性能測定結果をもとに、複数の前記並列処理パターンから最高処理性能の並列処理パターンを選択し、最高処理性能の前記並列処理パターンをコンパイルして実行ファイルを作成する実行ファイル作成部と、を備える。
 このようにすることにより、オフロードサーバ1は、移行元言語がC言語、Python、Javaを含む多様な言語の場合でも共通的な方式でGPUに自動オフロードすることができる。これにより、移行元言語に合わせて、処理を検討したり実装する必要がなくなり、コストダウンを図ることができる。
 さらに、オフロードサーバ1は、移行元言語がC言語、Python、またはJavaのいずれの場合であっても、CPU-GPU間のデータ転送回数を低減しつつ、アプリケーションプログラムの特定処理をアクセラレータに自動でオフロードすることで、全体の処理能力を向上させることができる。これにより、CUDA等のスキルが無いユーザでもGPUを使い高性能処理ができる。また、従来GPUでの高性能化が検討されていない汎用的なCPU向けアプリケーションを高性能化できる。また、高性能計算用サーバでない汎用的マシンのGPUにオフロードすることができる。
 第2の実施形態に係るオフロードサーバ200(図12参照)は、アプリケーションプログラムの特定処理をGPUまたはPLDにオフロードするオフロードサーバであって、アプリケーションプログラムは、C言語、Python、およびJavaより選択される少なくとも一つであり、オフロードサーバ200は、GPUまたはPLDにオフロード可能なライブラリおよびIPコアを記憶するコードパターンDB230と、アプリケーションプログラムのソースコードを分析して、当該ソースコードに含まれる外部ライブラリ呼び出しを検出するアプリケーションコード分析部112と、検出された外部ライブラリ呼び出しをキーにして、コードパターンDB230からライブラリおよびIPコアを取得する置換機能検出部213と、アプリケーションプログラムのソースコードの置換元の処理記述を、置換機能検出部213が取得した置換先のライブラリおよびIPコアの置換先の処理記述として置換するとともに、置換したライブラリおよびIPコアの処理記述を、オフロード対象の機能ブロックとして、GPUまたはPLDにオフロードする置換処理部214と、ホストプログラムとのインタフェースを作成するオフロードパターン作成部215と、作成されたGPUまたはPLD処理パターンの前記アプリケーションをコンパイルして、実行ファイルを作成する実行ファイル作成部117と、作成された実行ファイルをアクセラレータ検証用装置に配置し、GPUまたはPLDにオフロードした際の性能測定用処理を実行する性能測定部116と、を備え、実行ファイル作成部117は、性能測定用処理による性能測定結果をもとに、複数のGPUまたはPLD処理パターンから最高処理性能のGPUまたはPLD処理パターンを選択し、最高処理性能のGPUまたはPLD処理パターンをコンパイルして、最終実行ファイルを作成する。
 このようにすることにより、オフロードサーバ200は、移行元言語がC言語、Python、Javaを含む多様な言語の場合でも共通的な方式でGPUに自動オフロードすることができる。これにより、移行元言語に合わせて、処理を検討したり実装する必要をなり、コストダウンを図ることができる。
 さらに、オフロードサーバ200は、移行元言語がC言語、Python、またはJavaのいずれの場合であっても、アプリケーションコードの置換元の処理記述を、置換先のライブラリおよびIPコア処理記述に置換して、オフロード可能な機能ブロックとして、GPUやPLD(FPGA等)にオフロードする。すなわち、個々のループ文でなく、行列積算やフーリエ変換等のより大きな単位で、FPGAやGPU等ハードウェア向けのアルゴリズム含めて実装された機能ブロックをオフロードする。これにより、GPUやPLD(FPGA等)への自動オフロードにおいて、機能ブロックの単位でオフロードすることで、オフロード処理の高速化を図ることができる。その結果、GPU、FPGA、IoTデバイス等環境が多様になる中で、アプリケーションを環境に合わせて適応させることが可能になり、高性能にアプリケーションを動作させることができる。
 第1および第2の実施形態に係るオフロードサーバ1,200において、アプリケーションプログラムが、C言語の場合、ループ文のGPU処理をOpenACC文法で指定し、機能ブロックのGPU処理をCUDAライブラリ呼び出すようにしてC言語コンパイラを用いてGPUオフロードすることを特徴とする。
 このようにすることにより、移行元言語がC言語の場合に共通的な方式で、GPUに自動オフロードすることができる。
 第1および第2の実施形態に係るオフロードサーバ1,200において、アプリケーションプログラムが、Pythonの場合、ループ文のGPU処理をCUDA文法で指定し、機能ブロックのGPU処理をCUDAライブラリ呼び出すようにしてpyCUDAを用いてGPUオフロードすることを特徴とする。
 このようにすることにより、移行元言語がPythonの場合に共通的な方式で、GPUに自動オフロードすることができる。
 第1および第2の実施形態に係るオフロードサーバ1,200において、アプリケーションプログラムが、Pythonの場合、ループ文のGPU処理をOpenACC文法で指定し、機能ブロックのGPU処理をCUDAライブラリ呼び出すようにしてpyACCを用いてGPUオフロードすることを特徴とする。
 このようにすることにより、移行元言語がPythonの場合にC言語の場合と同様に、共通的な方式でGPUに自動オフロードすることができる。
 第1および第2の実施形態に係るオフロードサーバ1,200において、アプリケーションプログラムが、Javaの場合、ループ文のGPU処理をJavaのラムダ文法で指定し、機能ブロックのGPU処理をCUDAライブラリ呼び出すようにしてJava仮想マシンを用いてGPUオフロードすることを特徴とする。
 このようにすることにより、移行元言語がJavaの場合に共通的な方式でGPUに自動オフロードすることができる。
 本発明は、コンピュータを、上記オフロードサーバとして機能させるためのオフロードプログラムとした。
 このようにすることにより、一般的なコンピュータを用いて、上記オフロードサーバ200の各機能を実現させることができる。
[変形例]
 第1の実施形態に係るオフロードサーバ1と第2の実施形態に係るオフロードサーバ200とを組み合わせて、データ転送指定部113(図1参照)は、アプリケーションコード分析部112が行うコード解析結果をもとに、機能ブロックオフロード、ループ文オフロードの順に試行するようにデータ転送を行うととともに、機能ブロックオフロードが可能であった場合は、オフロード可能であった機能ブロック部分を抜いたコードに対して、ループ文オフロードを試行するデータ転送を行う構成としてもよい。
 この構成により、オフロードサーバは、まず、アプリケーションプログラムの利用依頼があると、構文解析ライブラリを用いてコード解析を行い、次に、機能ブロックオフロード、ループ文オフロードの順に試行を行う。機能ブロックオフロードが可能であった場合は、オフロード可能であった機能ブロック部分を抜いたコードに対して、ループ文オフロードを試行し、性能測定の結果、最高性能のパターンを解とする。これにより、ループ文と機能ブロックに関しては、アルゴリズム含めて処理内容に合わせてオフロードする機能ブロックオフロードの方が高速化できる。機能ブロックオフロード、ループ文オフロードの順に試行を行うことで、処理の高速化を図ることができ、全体の処理能力を向上させることができる。
 また、上記各実施形態において説明した各処理のうち、自動的に行われるものとして説明した処理の全部又は一部を手作業で行うこともでき、あるいは、手作業で行われるものとして説明した処理の全部又は一部を公知の方法で自動的に行うこともできる。この他、上述文書中や図面中に示した処理手順、制御手順、具体的名称、各種のデータやパラメータを含む情報については、特記する場合を除いて任意に変更することができる。
 また、図示した各装置の各構成要素は機能概念的なものであり、必ずしも物理的に図示の如く構成されていることを要しない。すなわち、各装置の分散・統合の具体的形態は図示のものに限られず、その全部又は一部を、各種の負荷や使用状況などに応じて、任意の単位で機能的又は物理的に分散・統合して構成することができる。
 1,200 オフロードサーバ
 11,210 制御部
 12 入出力部
 13,130 記憶部
 14 検証用マシン (アクセラレータ検証用装置)
 15 商用環境
 111 アプリケーションコード指定部
 112 アプリケーションコード分析部
 113 データ転送指定部
 114 並列処理指定部
 114a オフロード範囲抽出部
 114b 中間言語ファイル出力部
 115 並列処理パターン作成部
 116 性能測定部
 116a バイナリファイル配置部
 117 実行ファイル作成部
 118 本番環境配置部
 119 性能測定テスト抽出実行部
 120 ユーザ提供部
 125 アプリケーションコード
 131 テストケースDB
 132 中間言語ファイル
 151 各種デバイス
 152 CPU-GPUを有する装置
 153 CPU-FPGAを有する装置
 154 CPUを有する装置
 213 置換機能検出部
 214 置換処理部
 215 オフロードパターン作成部
 230 コードパターンDB

Claims (8)

  1.  アプリケーションプログラムの特定処理をアクセラレータにオフロードするオフロードサーバであって、
     前記アプリケーションプログラムは、C言語、Python、およびJavaより選択される少なくとも一つであり、
     前記アプリケーションプログラムのソースコードを分析するアプリケーションコード分析部と、
     前記アプリケーションプログラムのループ文の中で用いられる変数の参照関係を分析し、ループ外でデータ転送してよいデータについては、ループ外でのデータ転送を明示的に指定する明示的指定行を用いたデータ転送指定を行うデータ転送指定部と、
     前記アプリケーションプログラムのループ文を特定し、特定した各前記ループ文に対して、前記アクセラレータにおける並列処理指定文を指定してコンパイルする並列処理指定部と、
     コンパイルエラーが出るループ文に対して、オフロード対象外とするとともに、コンパイルエラーが出ないループ文に対して、並列処理するかしないかの指定を行う並列処理パターンを作成する並列処理パターン作成部と、
     前記並列処理パターンの前記アプリケーションプログラムをコンパイルして、アクセラレータ検証用装置に配置し、前記アクセラレータにオフロードした際の性能測定用処理を実行する性能測定部と、
     性能測定結果をもとに、複数の前記並列処理パターンから高処理性能の並列処理パターンを複数選択し、高処理性能の前記並列処理パターンを交叉、突然変異処理により別の複数の並列処理パターンを作成して、新たに性能測定までを行い、指定回数の性能測定後に、性能測定結果をもとに、複数の前記並列処理パターンから最高処理性能の並列処理パターンを選択し、最高処理性能の前記並列処理パターンをコンパイルして実行ファイルを作成する実行ファイル作成部と、
     を備えることを特徴とするオフロードサーバ。
  2.  アプリケーションプログラムの特定処理をGPU(Graphics Processing Unit)またはPLD(Programmable Logic Device)にオフロードするオフロードサーバであって、
     前記アプリケーションプログラムは、C言語、Python、およびJavaより選択される少なくとも一つであり、
     前記GPUまたは前記PLDにオフロード可能なライブラリおよびIPコアを記憶する記憶部と、
     前記アプリケーションプログラムのソースコードを分析して、当該ソースコードに含まれる外部ライブラリ呼び出しを検出するアプリケーションコード分析部と、
     検出された前記外部ライブラリ呼び出しをキーにして、前記記憶部から前記ライブラリおよび前記IPコアを取得する置換機能検出部と、
     前記アプリケーションプログラムのソースコードの置換元の処理記述を、前記置換機能検出部が取得した前記ライブラリおよび前記IPコアの置換先の処理記述として置換するとともに、
     置換した前記ライブラリおよび前記IPコアの処理記述を、オフロード対象の機能ブロックとして、前記GPUまたは前記PLDにオフロードする置換処理部と、
     ホストプログラムとのインタフェースを作成し、検証環境での性能測定を通じて、オフロードするしないを試行することで、より高速となるオフロードパターンを抽出するオフロードパターン作成部と、
     ホストプログラムとのインタフェースを作成するオフロードパターン作成部と、
     作成されたGPUまたはPLD処理パターンの前記アプリケーションプログラムをコンパイルして、実行ファイルを作成する実行ファイル作成部と、
     作成された前記実行ファイルをアクセラレータ検証用装置に配置し、前記GPUまたは前記PLDにオフロードした際の性能測定用処理を実行する性能測定部と、を備え、
     前記実行ファイル作成部は、前記性能測定用処理による性能測定結果をもとに、複数の前記GPUまたはPLD処理パターンから最高処理性能の前記GPUまたはPLD処理パターンを選択し、最高処理性能の前記GPUまたはPLD処理パターンをコンパイルして、最終実行ファイルを作成する
     ことを特徴とするオフロードサーバ。
  3.  前記アプリケーションプログラムが、C言語の場合、ループ文のGPU処理をOpenACC文法で指定し、機能ブロックのGPU処理をCUDAライブラリ呼び出すようにしてC言語コンパイラを用いてGPUオフロードする
     ことを特徴とする請求項1または請求項2に記載のオフロードサーバ。
  4.  前記アプリケーションプログラムが、Pythonの場合、ループ文のGPU処理をCUDA文法で指定し、機能ブロックのGPU処理をCUDAライブラリ呼び出すようにしてpyCUDAを用いてGPUオフロードする
     ことを特徴とする請求項1または請求項2に記載のオフロードサーバ。
  5.  前記アプリケーションプログラムが、Pythonの場合、ループ文のGPU処理をOpenACC文法で指定し、機能ブロックのGPU処理をCUDAライブラリ呼び出すようにしてpyACCを用いてGPUオフロードする
     ことを特徴とする請求項1または請求項2に記載のオフロードサーバ。
  6.  前記アプリケーションプログラムが、Javaの場合、ループ文のGPU処理をJavaのラムダ文法で指定し、機能ブロックのGPU処理をCUDAライブラリ呼び出すようにしてJava仮想マシンを用いてGPUオフロードする
     ことを特徴とする請求項1または請求項2に記載のオフロードサーバ。
  7.  アプリケーションプログラムの特定処理をアクセラレータにオフロードするオフロードサーバのオフロード制御方法であって、
     前記アプリケーションプログラムは、C言語、Python、およびJavaより選択される少なくとも一つであり、
     前記オフロードサーバは、
     前記アプリケーションプログラムのソースコードを分析するステップと、
     前記アプリケーションプログラムのループ文の中で用いられる変数の参照関係を分析し、ループ外でデータ転送してよいデータについては、ループ外でのデータ転送を明示的に指定する明示的指定行を用いたデータ転送指定を行うステップと、
     前記アプリケーションプログラムのループ文を特定し、特定した各前記ループ文に対して、前記アクセラレータにおける並列処理指定文を指定してコンパイルするステップと、
     コンパイルエラーが出るループ文に対して、オフロード対象外とするとともに、コンパイルエラーが出ないループ文に対して、並列処理するかしないかの指定を行う並列処理パターンを作成するステップと、
     前記並列処理パターンの前記アプリケーションプログラムをコンパイルして、アクセラレータ検証用装置に配置し、前記アクセラレータにオフロードした際の性能測定用処理を実行するステップと、
     性能測定結果をもとに、複数の前記並列処理パターンから高処理性能の並列処理パターンを複数選択し、高処理性能の前記並列処理パターンを交叉、突然変異処理により別の複数の並列処理パターンを作成して、新たに性能測定までを行い、指定回数の性能測定後に、性能測定結果をもとに、複数の前記並列処理パターンから最高処理性能の並列処理パターンを選択し、最高処理性能の前記並列処理パターンをコンパイルして実行ファイルを作成するステップと、を実行する
     ことを特徴とするオフロード制御方法。
  8.  コンピュータを、請求項1から請求項6のいずれか一項に記載のオフロードサーバとして機能させるためのオフロードプログラム。
PCT/JP2020/041413 2020-11-05 2020-11-05 オフロードサーバ、オフロード制御方法およびオフロードプログラム WO2022097245A1 (ja)

Priority Applications (2)

Application Number Priority Date Filing Date Title
JP2022560579A JPWO2022097245A1 (ja) 2020-11-05 2020-11-05
PCT/JP2020/041413 WO2022097245A1 (ja) 2020-11-05 2020-11-05 オフロードサーバ、オフロード制御方法およびオフロードプログラム

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/JP2020/041413 WO2022097245A1 (ja) 2020-11-05 2020-11-05 オフロードサーバ、オフロード制御方法およびオフロードプログラム

Publications (1)

Publication Number Publication Date
WO2022097245A1 true WO2022097245A1 (ja) 2022-05-12

Family

ID=81456976

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/JP2020/041413 WO2022097245A1 (ja) 2020-11-05 2020-11-05 オフロードサーバ、オフロード制御方法およびオフロードプログラム

Country Status (2)

Country Link
JP (1) JPWO2022097245A1 (ja)
WO (1) WO2022097245A1 (ja)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20230221932A1 (en) * 2022-01-12 2023-07-13 Vmware, Inc. Building a unified machine learning (ml)/ artificial intelligence (ai) acceleration framework across heterogeneous ai accelerators

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2020137017A (ja) * 2019-02-22 2020-08-31 日本電信電話株式会社 オフロードサーバのソフトウェア最適配置方法およびプログラム

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2020137017A (ja) * 2019-02-22 2020-08-31 日本電信電話株式会社 オフロードサーバのソフトウェア最適配置方法およびプログラム

Non-Patent Citations (4)

* Cited by examiner, † Cited by third party
Title
ALEKSANDROV DMITRY: "Programming the GPU in Java", ORACLE, 1 January 2020 (2020-01-01), XP055939241, Retrieved from the Internet <URL:https://blogs.oracle.com/javamagazine/programming-the-gpu-in-java> [retrieved on 20220706] *
ANONYMOUS: "Welcome to PyCUDA’s documentation!", PYCUDA 2020.1 DOCUMENTATION, 1 January 2020 (2020-01-01), XP055939232, Retrieved from the Internet <URL:https://documen.tician.de/pycuda> [retrieved on 20220706] *
STRANGE MAX: "pyACC", GITHUB, 17 July 2019 (2019-07-17), XP055939237, Retrieved from the Internet <URL:https://github.com/MaxStrange/pyACC/blob/master/README.md> [retrieved on 20220706] *
YOJI YAMATO: "Evaluation of Automatic GPU and FPGA Offloading for Function Blocks of Applications", IEICE TECHNICAL REPORT SC2019-44, 9 March 2020 (2020-03-09), pages 1 - 8, XP081662805 *

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20230221932A1 (en) * 2022-01-12 2023-07-13 Vmware, Inc. Building a unified machine learning (ml)/ artificial intelligence (ai) acceleration framework across heterogeneous ai accelerators

Also Published As

Publication number Publication date
JPWO2022097245A1 (ja) 2022-05-12

Similar Documents

Publication Publication Date Title
Abadi et al. Tensorflow: Large-scale machine learning on heterogeneous distributed systems
JP7063289B2 (ja) オフロードサーバのソフトウェア最適配置方法およびプログラム
Pérez et al. Simplifying programming and load balancing of data parallel applications on heterogeneous systems
Yamato Study and evaluation of automatic GPU offloading method from various language applications
WO2019216127A1 (ja) オフロードサーバおよびオフロードプログラム
CN115461763A (zh) 量子电路的有效量子适应性执行方法
JP5479942B2 (ja) 並列化方法、システム、及びプログラム
WO2021156956A1 (ja) オフロードサーバ、オフロード制御方法およびオフロードプログラム
WO2022097245A1 (ja) オフロードサーバ、オフロード制御方法およびオフロードプログラム
JP6992911B2 (ja) オフロードサーバおよびオフロードプログラム
Popov et al. Piecewise holistic autotuning of compiler and runtime parameters
Duff et al. Experiments with sparse Cholesky using a parametrized task graph implementation
WO2021156955A1 (ja) オフロードサーバ、オフロード制御方法およびオフロードプログラム
Yamato Proposal and evaluation of GPU offloading parts reconfiguration during applications operations for environment adaptation
Yamato Proposal and evaluation of adjusting resource amount for automatically offloaded applications
WO2021166031A1 (ja) オフロードサーバ、オフロード制御方法およびオフロードプログラム
WO2022102071A1 (ja) オフロードサーバ、オフロード制御方法およびオフロードプログラム
WO2023002546A1 (ja) オフロードサーバ、オフロード制御方法およびオフロードプログラム
JP7363930B2 (ja) オフロードサーバ、オフロード制御方法およびオフロードプログラム
JP7473003B2 (ja) オフロードサーバ、オフロード制御方法およびオフロードプログラム
JP7184180B2 (ja) オフロードサーバおよびオフロードプログラム
WO2024147197A1 (ja) オフロードサーバ、オフロード制御方法およびオフロードプログラム
WO2023144926A1 (ja) オフロードサーバ、オフロード制御方法およびオフロードプログラム
WO2023228369A1 (ja) オフロードサーバ、オフロード制御方法およびオフロードプログラム
WO2024079886A1 (ja) オフロードサーバ、オフロード制御方法およびオフロードプログラム

Legal Events

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

Ref document number: 20960798

Country of ref document: EP

Kind code of ref document: A1

ENP Entry into the national phase

Ref document number: 2022560579

Country of ref document: JP

Kind code of ref document: A

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 20960798

Country of ref document: EP

Kind code of ref document: A1