Execution time prediction device, execution time prediction method, and program
Patent Information
- Application Number
- PCT/JP2025/011745
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Filing Date
- 2025-03-25
- Publication Date
- 2026-10-01
Smart Images

Figure JP2025011745_01102026_PF_FP_ABST
Abstract
Description
Execution time prediction apparatus, execution time prediction method, and program
[0001] The present invention relates to an execution time prediction apparatus, an execution time prediction method, and a program.
[0002] In so-called cloud services, it is required to select optimal computing resources in order to quickly and efficiently respond to execution requests for application programs. Note that a cloud service is a mechanism that allows users to use services such as data and programs via the Internet.
[0003] Here, predicting the execution time of a program with high accuracy is important for ensuring quality of service (QoS) and reducing waste of computing resources.
[0004] In the technique described in Non-Patent Document 1, execution time is predicted by constructing a dedicated execution time prediction model for each program. When the technique described in Non-Patent Document 1 is used, there is a problem that in order to handle a new program, the execution time cannot be predicted unless a model for the program is reconstructed. To solve this problem, as one of highly versatile execution time prediction models, a method of predicting execution time by analyzing a program at the source code level has been studied.
[0005] In the technique described in Non-Patent Document 2, the structure and processing content of a program are specified by analyzing the source code of the program. Then, a single model for predicting the execution time of the entire program is constructed based on the number of occurrences of processing during execution and the total size of generated data. Once the model is constructed, it can be used to predict the execution time of a program. The technique described in Non-Patent Document 2 does not construct a dedicated model for a specific program, and has high versatility. That is, with the technique described in Non-Patent Document 2, it is possible to predict the execution time of a newly introduced program using a single model.
[0006] Chao Wu, Shingo Horiuchi, Kenichi Tayama, “A Resource Design Framework to Realize Intent-based Cloud Management”, 2019 IEEE International Conference on Cloud Computing Technology and Science, p.37-44, 2019. Weihua Liu, Erh-Wen Hu, Bogong Su, Jian Wang, “Using machine learning techniques for DSP software performance prediction at source code level”, Connection Science, 2021, Vol.33, No.1, pp26-41.
[0007] The conventional technologies described above also have their drawbacks. In the technology described in Non-Patent Literature 2, the prediction of execution time is based on the frequency of processing and the amount of data being processed. The prediction of execution time in the conventional technology does not take into account the specific content of the processing, the data type of the arguments, or the data size of the arguments. Therefore, the conventional technology has the problem of estimating execution time without distinguishing between differences in specific processing.
[0008] For example, conventional techniques predict execution time without distinguishing between simple arithmetic operations (e.g., addition) and computationally intensive operations (e.g., sorting within a loop). Furthermore, even for operations represented by the operator "+", the processing content can differ depending on the data type of the arguments being processed. The operator "+" represents arithmetic addition when the argument is an integer, and string concatenation when the argument is a string. In other words, operations represented by the same symbol can have different processing content. Because of these differences, prediction errors based on processing content can occur at the processing unit level. If these prediction errors accumulate, they can lead to large errors.
[0009] For example, if a 0.1 microsecond error occurs in a process that takes several microseconds (μs, 1 μs = 10^(-6) seconds), then 1 million calculations will accumulate an error of 100 milliseconds (m seconds, 1 m second = 10^(-3) seconds). Errors of this magnitude can impact the selection and scaling of cloud resources.
[0010] This invention has been made in consideration of the above circumstances, and aims to provide an execution time prediction device, execution time prediction method, and program that can select a type of machine learning model according to the content (type) of processing and the data size of the arguments, train the selected machine learning model, and construct a machine learning model for predicting execution time.
[0011] [1] To solve the above problems, an execution time prediction device according to one aspect of the present invention includes: a training data generation unit that generates training data which is a set of a type of process, the size of an argument passed to the process, and the execution time when the process is executed based on the size of the argument; a machine learning model selection function unit that selects a machine learning model from a plurality of candidate machine learning models based on the trend of variation in the execution time corresponding to the type of process and the size of the argument in the training data generated by the training data generation unit; and a machine learning model training function unit that constructs an execution time prediction model by training the machine learning model selected by the machine learning model selection function unit using the training data generated by the training data generation unit.
[0012] [2] In another embodiment, the execution time prediction device of [1] further comprises an execution time prediction unit that inputs the type of processing included in a given program and the size of the arguments passed to the processing to an execution time prediction model constructed by the machine learning model training function unit, thereby predicting the execution time of the processing corresponding to the type of processing and the size of the arguments.
[0013] [3] Another embodiment is an execution time prediction method that includes the process of a training data generation unit generating training data which is a set of a type of process, the size of an argument passed to the process, and the execution time when the process is executed based on the size of the argument; the process of a machine learning model selection function unit selecting a machine learning model from a plurality of candidate machine learning models based on the trend of variation in the execution time corresponding to the type of process and the size of the argument in the training data generated by the training data generation unit; and the process of a machine learning model training function unit constructing an execution time prediction model by training the machine learning model selected by the machine learning model selection function unit using the training data generated by the training data generation unit.
[0014] [4] Another embodiment is a program for causing a computer to execute the execution time prediction method described in [3] above.
[0015] According to the present invention, based on the training data generated by the training data generation unit, the machine learning model selection function unit can select a machine learning model suitable for the training data, and the machine learning model training function unit can train the selected machine learning model.
[0016] This is a block diagram showing the schematic functional configuration of the execution time prediction device according to the first embodiment. This is a schematic diagram showing examples of multiple types of machine learning models that can be selected by the machine learning model selection function unit according to the first embodiment. This is an example of a graph showing the relationship between parameter values (size of processing arguments) and the execution time of a predetermined process in the first embodiment. This is another example of a graph showing the relationship between parameter values (size of processing arguments) and the execution time of a predetermined process in the first embodiment. This is a schematic diagram showing an example of data representing the relationship between parameter size and measured execution time in the first embodiment. This is another schematic diagram showing another example of data representing the relationship between parameter size and measured execution time in the first embodiment. This is a schematic diagram showing the result of the machine learning model selection function unit selecting a machine learning model in the first embodiment. This is a schematic diagram showing an example of source code stored in the source code storage unit in the first embodiment. This is a schematic diagram showing an example of the result of source code analysis by the source code analysis unit of the execution time prediction unit in the first embodiment. This is a block diagram showing an example of the internal configuration of the execution time prediction device (computer) according to the first embodiment. This is a block diagram showing the schematic functional configuration of the execution time prediction device according to the second embodiment. This graph shows the relationship between the size of the arguments (number of elements in the array) and the execution time measured by the execution time measurement function unit when the process "sum" is executed using arguments of two different data types in the second embodiment. This schematic diagram shows the type of machine learning model selected by the machine learning model selection function unit according to the type of process and data type in the second embodiment. This block diagram shows the schematic functional configuration of the execution time prediction device according to the third embodiment.
[0017] Next, several embodiments of the present invention will be described with reference to the drawings. The embodiments described below are execution time prediction devices for predicting processing time on a computer. The execution time prediction device of the embodiments predicts execution time based on the type of processing and the size of the arguments in that processing. In other words, the basis for predicting execution time is the type of processing and the size of the arguments in that processing. Furthermore, the data type of the arguments and the performance of the processor that executes the processing may also be used as the basis for predicting execution time. The execution time prediction device of the embodiments predicts the execution time for a specific processing with a specific argument size using a machine learning model. The execution time prediction device of the embodiments has a function for training a machine learning model. In addition, the execution time prediction device of the embodiments generates training data and allows for the selection of a machine learning model that is suitable for the training data from among several types of machine learning models.
[0018] It should be noted that, as a prerequisite for the embodiment, the execution time differs depending on the arguments passed to the computer program. In general programming languages, multiple data types can be used as arguments to be processed. In this case, the amount of memory used differs depending on the data type. This difference in memory size can affect the execution time of the process. Furthermore, even within a specific data type, the amount of memory used differs depending on the size of the data (for example, the number of elements in an array). If the amount of memory used by the program differs, the time required for processing such as memory access and memory management may change.
[0019] In the embodiments described below, the target programming language is a dynamically typed language. Programming languages are broadly classified into statically typed languages such as C, C++, Java, and Pascal, and dynamically typed languages such as Python, JavaScript, Ruby, Perl, Lisp, and PHP.
[0020] In dynamically typed languages, even with the same code, the processing content differs depending on the data type of the arguments. In other words, even with the same code, the execution time of the processing differs depending on the data type of the arguments. In each embodiment described below, we take into account that the processing time differs depending on the data type of the arguments and attempt to make an accurate prediction of the execution time.
[0021] [First Embodiment] Figure 1 is a block diagram illustrating the schematic functional configuration of an execution time prediction device according to this embodiment. As shown in the figure, the execution time prediction device 1 includes a training data generation unit 11, an execution time prediction model construction unit 12, a source code storage unit 13, an execution time prediction unit 14, and a prediction result output unit 15. The execution time prediction device 1 performs the processing of an execution time prediction method, including the processing steps of each unit. The functions of the execution time prediction device 1 can be realized, for example, by a computer and a program. Each functional unit also has storage means as needed. The storage means are, for example, variables in the program or memory allocated by the execution of the program. Non-volatile storage means such as a magnetic hard disk drive or a solid-state drive (SSD) may also be used as needed. At least some of the functions of each functional unit may be realized as a dedicated electronic circuit instead of a program.
[0022] As shown in the figure, the training data generation unit 11 includes a sample data generation function unit 111 and an execution time measurement function unit 112. The execution time prediction model construction unit 12 includes a machine learning model selection function unit 121 and a machine learning model training function unit 122. The execution time prediction unit 14 includes a source code analysis unit 141 and an execution time calculation unit 142.
[0023] The training data generation unit 11 generates training data which is a set of the type of processing, the size of the argument passed to the processing, and the execution time when the processing is executed based on the size of the argument.
[0024] The sample data generation function unit 111 generates sample data for measuring the execution time of the process.
[0025] The sample data generation function unit 111 takes data type information as input and outputs that data type information and the generated sample data. The sample data generation function unit 111 passes the data type information and the generated sample data to the execution time measurement function unit 112. Specifically, the sample data generation function unit 111 uses the data type information to identify variable points and parameters for each data type and generates sample data. Parameters may be, for example, the number of elements in an array or the length of a string (number of characters). To identify variable points (points that can become parameters) for each data type, the sample data generation function unit 111 extracts data from usage examples (source code, etc.) to analyze the characteristics of the type or analyzes documentation.
[0026] Specifically, the sample data generation function unit 111 generates sample data by performing the following processing. The sample data generation function unit 111 acquires data type information. For example, the sample data generation function unit 111 reads data type information from internal memory, etc. The data types acquired by the sample data generation function unit 111 here are, for example, strings (str, string) and lists (list). Here, a list is an array of integer (int) type data.
[0027] The sample data generation function unit 111 then identifies variable parameters for each data type. For example, if the data type is a string (str), the variable parameter is the length of the string. For example, if the string is "Hello", the parameter, i.e., the length of the string, is 5. Also, for example, if the data type is a list (list), the variable parameter is the size of the array. For example, if the array of integers is [1, 2, 3, 4, 5, 6, 7, 8, 9, 10], the parameter, i.e., the size of the array, is 10.
[0028] The sample data generation function unit 111 generates sample data by increasing or decreasing the values of the above parameters according to the data type. In other words, if the data type is a string (str), the sample data generation function unit 111 generates strings of various lengths as sample data. If the data type is a list (list), the sample data generation function unit 111 generates arrays of integers of various sizes as sample data.
[0029] The sample data generation function 111 generates data of a predetermined parameter size by adding together the unit values of a data type, for example, in the Python language. For example, when the data type is a string (str), the unit data is "a" (a string with length 1). When the data type is a string (str), the sample data generation function 111 adds up multiple "a" units to generate sample data such as "aa", "aaa", ... and so on. Also, for example, when the data type is a list (list), the unit data is [1] (an array of integers with one element). When the data type is a list (list), the sample data generation function 111 adds up multiple [1] units to generate sample data such as [1,1], [1,1,1], ... and so on.
[0030] The sample data generation function unit 111 passes the generated sample data to the execution time measurement function unit 112. The sample data generation function unit 111 also passes the generated sample data to the machine learning model selection function unit 121 and the machine learning model training function unit 122 of the execution time prediction model construction unit 12.
[0031] The correspondence between data types and variable parameters may be stored in the internal memory of the sample data generation function unit 111 in advance, for example. Alternatively, the sample data generation function unit 111 may extract data from existing program source code (usage examples) to identify what the variable parameters are, by analyzing the characteristics of the data types or analyzing documentation.
[0032] The execution time measurement function unit 112 measures the execution time when a predetermined process is executed using the sample data generated by the sample data generation function unit 111.
[0033] The execution time measurement function unit 112 receives information on the type of process, data type information, and sample data as input. The execution time measurement function unit 112 then outputs a set of pairs of information on the type of process, data type information, sample data, and the measured execution time. The execution time measurement function unit 112 passes the output data to the machine learning model selection function unit 121 and the machine learning model training function unit 122. The execution time measurement function unit 112 has the processor execute a process using the sample data received as input data as arguments, and measures the execution time.
[0034] Specifically, the execution time measurement function unit 112 acquires information about the process. This information includes, for example, "sum" and "print". Here, "sum" is the process of calculating the sum of the integers contained in the list (list, the array of integers mentioned above) passed as an argument. In other words, the "sum" process calculates the sum of the elements of the array. "Print" is the process of outputting the string (str) passed as an argument to the screen (this can also be rephrased as the process of outputting to a predetermined output stream). The information about the process may be stored in the internal memory of the execution time measurement function unit 112 in advance.
[0035] The execution time measurement function unit 112 actually executes a predetermined process (for example, the "sum" or "print" commands mentioned above) and measures its execution time. Specifically, the execution time measurement function unit 112 executes a process using various sample data generated by the sample data generation function unit 111 as arguments, and measures the execution time of the process corresponding to each argument. To measure the execution time, the execution time measurement function unit 112 can, for example, use the internal clock of the computer system.
[0036] The execution time measurement function unit 112 outputs a set of information regarding the type of processing (for example, the type such as "sum" or "print" mentioned above), the parameters of the arguments used in the processing (argument size), and the execution time which is the result of the actual measurement. The execution time measurement function unit 112 passes this set of execution result data to the machine learning model selection function unit 121 and the machine learning model training function unit 122 of the execution time prediction model construction unit 12.
[0037] The execution time prediction model construction unit 12 constructs an execution time prediction model for predicting the execution time of a process, based at least on the type of process and the size of the arguments. To this end, the machine learning model selection function unit 121 selects a machine learning model, and the machine learning model training function unit 122 trains the selected machine learning model using training data. Note that the type of process is not determined solely by the type of function to be executed (such as sum or print), but also by the data type of the arguments.
[0038] The machine learning model selection function unit 121 selects a machine learning model from a list of candidate machine learning models based on the trend of execution time variations corresponding to the type of processing and argument size of the training data generated by the training data generation unit 11.
[0039] Specifically, the machine learning model selection unit 121 analyzes the relationship between argument size and execution time for each piece of processing information and each piece of argument data type information. Based on the analysis results, the machine learning model selection unit 121 selects an appropriate machine learning model from among several candidate machine learning models.
[0040] The machine learning model selection unit 121 receives information on the type of processing, data type, characteristics of the sample data, and a set of execution times as input. The machine learning model selection unit 121 also has information on a set of candidate machine learning models to be selected in advance. The machine learning model selection unit 121 outputs information on the type of processing, data type, characteristics of the sample data, a set of execution times, and information on the selected machine learning model. The machine learning model selection unit 121 passes this output data to the machine learning model training unit 122.
[0041] The machine learning model selection function unit 121 analyzes fluctuations in execution time with respect to parameter fluctuations for each type of processing, and selects an appropriate machine learning model. For example, the machine learning model selection function unit 121 selects a machine learning model having the highest correlation between an equation corresponding to each candidate machine learning model to be selected and a graph of execution time corresponding to parameter fluctuations. In other words, the machine learning model selection function unit 121 selects a machine learning model for which the relationship between the value of the parameter of the argument to be processed and the fluctuation of the execution time measured by the execution time measurement function unit 112 is most consistent. That is, the machine learning model selection function unit 121 selects a machine learning model that constitutes an equation close to the measured fluctuation of the execution time.
[0042] For each machine learning model that is a selection candidate, the machine learning model selection function unit 121 may have a template of the machine learning model and information related to an equation corresponding to the machine learning model (e.g., an example of the equation). In this case, the machine learning model selection function unit 121 may calculate a correlation degree between the equation represented by the training data provided from the training data generation unit 11 (the relationship between execution time and argument size) and the equation of each model, and select a machine learning model with a high correlation degree.
[0043] Alternatively, the machine learning model selection function unit 121 may perform provisional training on each candidate machine learning model using at least a part of the training data provided from the training data generation unit 11, and calculate a difference between the execution time calculated by the provisionally trained machine learning model and the execution time in the training data. The difference herein is, for example, a mean squared error. Then, a machine learning model with a small difference may be selected.
[0044] The machine learning model training function unit 122 trains the machine learning model selected by the machine learning model selection function unit 121. That is, the machine learning model training function unit trains the machine learning model selected by the machine learning model selection function unit 121 using the training data generated by the training data generation unit 11, and constructs an execution time prediction model.
[0045] The machine learning model training unit 122 receives information on the type of processing, information on the data type, a set of pairs of sample data and execution time, and information on the selected machine learning model as inputs. The machine learning model training unit 122 outputs a trained execution time prediction model. In other words, the machine learning model training unit 122 outputs a set of internal parameter values of the machine learning model obtained as a result of training.
[0046] Specifically, for each type of processing (e.g., "sum", "print") and each data type (e.g., list, string (str)), the machine learning model training unit 122 trains the machine learning model based on the relationship between the value of the parameter size and the execution time of the processing measured by the execution time measurement unit 112. The data used by the machine learning model training unit 122 for training the machine learning model is data generated by the training data generation unit 11. That is, the machine learning model training unit 122 trains the machine learning model based on the relationship between the sample data generated by the sample data generation unit 111 and the execution time of the processing measured by the execution time measurement unit 112 using said sample data.
[0047] When the machine learning model training unit 122 performs the above training, the internal parameters of the machine learning model selected by the machine learning model selection unit 121 are adjusted. In other words, the internal parameters of the machine learning model selected by the machine learning model selection unit 121 are adjusted to be optimal using the training data generated by the training data generation unit 11. The machine learning model training unit 122 stores the values of the internal parameters of the model obtained as a result of training in a memory or the like.
[0048] The source code storage unit 13 stores the source code of a program. The source code stored by the source code storage unit 13 is the source code for which the execution time prediction unit 14 predicts the execution time.
[0049] The execution time prediction unit 14 inputs the types of processes included in a given program and the sizes of the arguments passed to those processes into an execution time prediction model constructed by the machine learning model training function unit 122, thereby predicting the execution time of the processes corresponding to the types of processes and the sizes of the arguments. To this end, the source code analysis unit 141 analyzes the source code of the program. The execution time calculation unit 142 inputs the results analyzed by the source code analysis unit 141 into a machine learning model trained by the machine learning model training function unit 122, thereby predicting the execution time of the processes. The execution time calculation unit 142 also calculates the execution time of the program by summing the execution times (predicted values) for all processes included in the program.
[0050] The source code analysis unit 141 analyzes the source code read from the source code storage unit 13 and extracts information necessary for predicting the execution time of the process.
[0051] Specifically, the source code analysis unit 141 takes the source code to be analyzed as input. The source code analysis unit 141 extracts information on the type of processing and argument information that appear in the source code and outputs the analysis result information. The analysis result information output by the source code analysis unit 141 includes information on the type of processing and information on the data type and size of the processing arguments. The source code analysis unit 141 passes the above output information to the execution time calculation unit 142. The source code analysis process performed by the source code analysis unit 141 can be carried out using existing technologies.
[0052] The execution time calculation unit 142 receives information about the type of process and the size of the arguments for each process included in the source code. Based on this input data, the execution time calculation unit 142 uses a trained machine learning model to calculate a predicted execution time for each process. The execution time calculation unit 142 then sums up the predicted execution times for all processes. The execution time calculation unit 142 passes the calculated predicted execution times to the prediction result output unit 15. When predicting execution time, the execution time calculation unit 142 uses a machine learning model that has been selected by the machine learning model selection function unit 121 and trained by the machine learning model training function unit 122, at least according to the type of process and the data type of the arguments.
[0053] The prediction result output unit 15 outputs to the outside the predicted execution time calculated by the execution time calculation unit 142 in relation to a specific source code.
[0054] In the aforementioned "print" process, the output data is buffered before being displayed on the screen. If the output data exceeds the buffer size, the "print" process processes the data up to the buffer size and then clears the buffer. Therefore, if the size of the output data is large, the execution time will increase. Also, in the aforementioned "sum" process, each element of the array is added up from top to bottom, and the sum is stored in memory. However, if the sum cannot be stored in the available memory, additional memory is allocated. Therefore, if the size of the calculation result data is large, the execution time will increase.
[0055] Figure 2 is a schematic diagram showing examples of multiple types of machine learning models that can be selected by the machine learning model selection function unit 121. As shown in the figure, the machine learning models that can be selected by the machine learning model selection function unit 121 may include simple regression models, multiple regression models, support vector regression models, polynomial regression models, regression tree models, and random forest regression models. In the figure, the relationship between the sample points and the graphs represented by each model is shown. The horizontal axis of each graph represents the parameter value (size of the argument), and the vertical axis represents the execution time of the process. For example, a simple regression model regresses to a straight line (a line represented by a linear equation). A polynomial regression model regresses to a curve represented by a polynomial.
[0056] The machine learning model selection function unit 121 may store information about the mathematical formulas for each of the selectable machine learning models. These formulas represent regression curves.
[0057] Figure 3 is an example of a graph showing the relationship between parameter values (argument sizes) and execution time for a given process. The type of process in Figure 3 is the aforementioned "sum" process. The unit of the vertical axis in this graph is seconds (sec). The graph shown in Figure 3 represents a set of pairs of parameter values (argument sizes) for each sample data generated by the sample data generation function unit 111 and the execution time measured by the execution time measurement function unit 112 based on that sample data. In other words, the graph shown in Figure 3 can be drawn based on these sets of pairs. The machine learning model selection function unit 121 and the machine learning model training function unit 122 of the execution time prediction model construction unit 12 each receive the data of these pairs from the training data generation unit 11. As this graph shows, execution time generally increases as the argument size increases.
[0058] Figure 4 is another example of a graph showing the relationship between parameter values (argument sizes) and execution time for a given process. The type of process in Figure 4 is the aforementioned "print". The unit of the vertical axis in this graph is seconds (sec). The graph shown in Figure 4 represents a set of pairs of parameter values (argument sizes) for each sample data generated by the sample data generation function unit 111 and the execution time measured by the execution time measurement function unit 112 based on that sample data. In other words, the graph shown in Figure 4 can be drawn based on a set of such pairs. The machine learning model selection function unit 121 and the machine learning model training function unit 122 of the execution time prediction model construction unit 12 each receive the data of these pairs from the training data generation unit 11. As this graph shows, although there are local increases and decreases, the execution time generally increases as the argument size increases.
[0059] Figure 5 is a schematic diagram showing an example of data representing the relationship between parameter size and measured execution time. As shown in the figure, this data pertains to the aforementioned "sum" process. This data also pertains to the case where the argument data type is "list" (an array of integers). As shown in the figure, this data indicates that the execution time is 4 milliseconds (ms) when the parameter size is 1, 4 milliseconds when the parameter size is 2, and 5 milliseconds when the parameter size is 3. This data may also contain information on the execution time when the parameter size is 4 or greater. The machine learning model selection function unit 121 and the machine learning model training function unit 122 of the execution time prediction model construction unit 12 each receive data like the one shown in this figure from the training data generation unit 11.
[0060] Figure 6 is a schematic diagram showing another example of data representing the relationship between parameter size and measured execution time. As shown in the figure, this data pertains to the "print" process described above. This data also pertains to the case where the argument data type is "str" (string). As shown in the figure, this data indicates that the execution time is 10 milliseconds (ms) when the parameter size is 1, 14 milliseconds when the parameter size is 2, and 29 milliseconds when the parameter size is 3. This data may also contain information on the execution time when the parameter size is 4 or greater. The machine learning model selection function unit 121 and the machine learning model training function unit 122 of the execution time prediction model construction unit 12 each receive data like the one shown in this figure from the training data generation unit 11.
[0061] Figure 7 is a schematic diagram showing the results of the machine learning model selection performed by the machine learning model selection function unit 121. Note that row numbers are added in this figure for convenience. The machine learning model selection function unit 121 selects a machine learning model based on data such as those in Figures 5 and 6. The first row of data in Figure 7 indicates that when the process is "sum" and the argument data type is "list" (an array of integers), the machine learning model selected by the machine learning model selection function unit 121 is a simple linear regression model. This was selected by the machine learning model selection function unit 121 based on the data shown in Figure 5. The second row of data in Figure 7 indicates that when the process is "print" and the argument data type is "str" (a string), the machine learning model selected by the machine learning model selection function unit 121 is a regression tree model. This was selected by the machine learning model selection function unit 121 based on the data shown in Figure 6. The machine learning model selection function unit 121 passes information about the type of machine learning model selected for a specific data type of argument in a specific process to the machine learning model training function unit 122.
[0062] Figure 8 is a schematic diagram showing an example of source code stored in the source code storage unit 13. For convenience, line numbers are included in this diagram. As shown in the diagram, the first line of this source code represents the process of executing the "sum" operation and assigning the result to the variable a. The argument passed to the "sum" operation is of type list (list), and is an array of integers [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]. The second line of this source code represents the execution of the "print" operation. The argument passed to the "print" operation is of type string (str), and is "Hello".
[0063] Figure 9 is a schematic diagram showing an example of the source code analysis results by the source code analysis unit 141 of the execution time prediction unit 14. The analysis result of the first line in Figure 9 corresponds to the first line of the source code in Figure 8. In other words, by analyzing the first line of the source code in Figure 8, the source code analysis unit 141 outputs the analysis result that the process is "sum", the data type of the argument is "list" (an array of integers), and the size of the parameter is 10. The analysis result of the second line in Figure 9 corresponds to the second line of the source code in Figure 8. In other words, by analyzing the second line of the source code in Figure 8, the source code analysis unit 141 outputs the analysis result that the process is "print", the data type of the argument is "str" (a string), and the size of the parameter is 5. The source code analysis unit 141 can output these analysis results by performing lexical analysis of the source code.
[0064] Figure 10 is a block diagram showing an example of the internal configuration of the execution time prediction device 1. The execution time prediction device 1 can be implemented using a computer. As shown in the figure, the computer is composed of a central processing unit 901, RAM 902, input / output ports 903, input / output devices 904 and 905, etc., and a bus 906. The computer itself can be implemented using existing technology. The central processing unit 901 executes instructions contained in programs read from RAM 902, etc. The central processing unit 901 writes data to RAM 902, reads data from RAM 902, and performs arithmetic and logical operations according to each instruction. RAM 902 stores data and programs. Each element contained in RAM 902 has an address and can be accessed using that address. RAM stands for "Random Access Memory". Input / output ports 903 are ports for the central processing unit 901 to exchange data with external input / output devices, etc. Input / output devices 904 and 905 exchange data with the central processing unit 901 via input / output ports 903. Bus 906 is a common communication channel used within the computer. For example, the central processing unit 901 reads and writes data to RAM 902 via bus 906. Also, for example, the central processing unit 901 accesses input / output ports 903 via bus 906.
[0065] Furthermore, at least some of the functions of the execution time prediction device 1 in this embodiment can be realized by a computer and a program. In that case, the program for realizing this function may be recorded on a computer-readable recording medium, and the program recorded on this recording medium may be loaded into a computer system and executed. Here, "computer system" includes hardware such as an OS and peripheral devices. Furthermore, "computer-readable recording medium" refers to portable media such as flexible disks, magneto-optical disks, ROMs, CD-ROMs, DVD-ROMs, USB memory, and storage devices such as hard disks built into a computer system. In other words, "computer-readable recording medium" may be a non-transitory computer-readable recording medium. Moreover, "computer-readable recording medium" may also include those that temporarily and dynamically hold programs, such as communication lines when transmitting programs via networks such as the Internet or communication lines such as telephone lines, and those that hold programs for a certain period of time, such as volatile memory inside a computer system that acts as a server or client in that case. Furthermore, the above program may be for realizing some of the functions described above, and may also be able to realize the above functions in combination with a program already recorded in the computer system.
[0066] The method by which the machine learning model training function unit 122 trains a machine learning model is as follows:
[0067] A machine learning model calculates output data (in this embodiment, predicted execution time) based on input data. The machine learning model utilizes the values of internal parameters when calculating the output data. These internal parameters can be updated and optimized through training. Training data is used when training a machine learning model. The training data includes input data for the machine learning model and the correct output data calculated based on that input data. During training, the machine learning model reads the input data included in the training data and calculates output data based on that input data and using the internal parameter values at that time. This output data is an estimate obtained based on the internal parameters at that time and does not necessarily coincide with the correct answer. To update the internal parameters, the difference between the estimate calculated and output by the machine learning model based on the input data at that time and the correct answer corresponding to that input data is calculated. This difference is called error, loss, etc. The difference calculated here may be, for example, the absolute value of the difference between scalars, a squared error, a cross-entropy error, or a difference calculated by other methods. Based on the calculated difference, the values of the internal parameters can be updated using backpropagation. This operation adjusts the values of the internal parameters in a direction that reduces the error. By performing the above operation multiple times (many times) using a predetermined amount of training data, the values of the internal parameters are optimized. In other words, the machine learning model is adjusted to perform the processing exemplified by the given training data. After a sufficient amount of training, training may be terminated. By storing the set of learned internal parameter values in a memory device, it becomes possible to perform estimations based on the training results. In other words, a machine learning model includes internal parameters. The training of a machine learning model may also be called "learning".
[0068] As described above, according to the first embodiment, the machine learning model selection function unit selects a machine learning model that is suitable for the sample data from among several candidate machine learning models. Furthermore, the machine learning model training function unit can train the machine learning model selected by the machine learning model selection function unit and construct a model for predicting the execution time of the program.
[0069] [Second Embodiment] Next, a second embodiment of the present invention will be described. Note that matters already described in the previous embodiment may be omitted below. Here, we will focus on matters specific to this embodiment.
[0070] Figure 11 is a block diagram illustrating the schematic functional configuration of the execution time prediction device according to this embodiment. The execution time prediction device 2 is based on the configuration of the execution time prediction device 1 described above, but has further features. As shown in the figure, the execution time prediction device 2 is composed of a training data generation unit 11, an execution time prediction model construction unit 22, a source code storage unit 13, an execution time prediction unit 24, and a prediction result output unit 15. The functions of the execution time prediction device 2 can be realized, for example, by a computer and a program, as in the previous embodiment.
[0071] As shown in the figure, the training data generation unit 11 includes a sample data generation function unit 111 and an execution time measurement function unit 112. The execution time prediction model construction unit 22 includes a machine learning model selection function unit 221 and a machine learning model training function unit 222. The execution time prediction unit 24 includes a source code analysis unit 241 and an execution time calculation unit 242.
[0072] In this embodiment, the machine learning model selection function unit 221 selects a machine learning model according to the content of the sample data included in the training data passed from the training data generation unit 11.
[0073] The content of the sample data is, for example, the size of each element in an array. For example, consider two types of data types, "list1" and "list2". Here, data type "list1" is an array of integers (int), and its unit value is [1]. In other words, the amount of memory occupied by one element in an array of data type "list1" is relatively small. On the other hand, data type "list2" is an array of integers (int), and its unit value is [1000000000]. In other words, the amount of memory occupied by one element in an array of data type "list2" is relatively large.
[0074] As an example of a type of process, let's consider the process "sum". The process "sum" calculates the sum of the elements in an array of integers that is passed as an argument. In other words, when an argument of data type "list1" is passed, the process "sum" calculates the sum of the elements of that array (each element occupies a relatively small amount of memory). When an argument of data type "list2" is passed, the process "sum" calculates the sum of the elements of that array (each element occupies a relatively large amount of memory). In other words, if the number of elements in the arrays is the same, the execution time of the process "sum" for data type "list2" tends to be longer than the execution time of the process "sum" for data type "list1". This is because there is a difference in the time required for processing to allocate working memory during the execution of the process "sum".
[0075] In this embodiment, the sample data generation function unit 111 identifies variable parameters for each data type, similar to the first embodiment. The sample data generation function unit 111 then generates sample data by increasing or decreasing the values of the above parameters according to the data type.
[0076] In the example above (data types "list1" and "list2"), the sample data generation function unit 111 generates sample data for each of the data types "list1" and "list2".
[0077] The execution time measurement function unit 112 takes each of the sample data generated by the sample data generation function unit 111 as an argument and executes a process such as "sum", and measures the execution time at that time.
[0078] Figure 12 is a graph showing the relationship between the size of the arguments (number of elements in the array) and the execution time measured by the execution time measurement function 112 when the process "sum" is executed using two types of data type arguments in this embodiment. In the figure, G1 is the graph when the process "sum" is executed with an argument of data type "list1". G2 is the graph when the process "sum" is executed with an argument of data type "list2". Overall, when comparing with the same argument size (number of elements in the array), the processing time shown in graph G2 is longer than that shown in graph G1. In addition, although there are local increases and decreases in graphs G1 and G2, the overall trend is that the execution time is longer as the size of the arguments increases.
[0079] Similar to the first embodiment, the machine learning model selection function 221 selects an appropriate machine learning model based on the relationship between the argument size and execution time shown in the graph in Figure 12. As also shown in Figure 12, when the argument is of data type "list1" (in the case of graph G1), the machine learning model selection function 221 selects a simple linear regression model as the machine learning model. When the argument is of data type "list2" (in the case of graph G2), the machine learning model selection function 221 selects two types of machine learning models according to the size of the argument. Specifically, for arguments of data type "list2" with a size in the range from 0 to 400, the machine learning model selection function 221 selects a regression tree model. For arguments of data type "list2" with a size of 400 or more (from 400 to 1000), the machine learning model selection function 221 selects a simple linear regression model.
[0080] As described above, the machine learning model selection function 221 may select different machine learning models for the same type of processing (e.g., processing "sum") depending on the data type of the argument. Alternatively, the machine learning model selection function 221 may select different machine learning models for a single type of processing (e.g., processing "sum") and a single data type of argument (e.g., data type "list2") depending on the range of the argument size (e.g., less than 400 or 400 or more).
[0081] Figure 13 is a schematic diagram showing the types of machine learning models selected by the machine learning model selection function unit 221 according to the type of processing and data type. As shown in the figure, when the type of processing is "sum" and the data type is "list1", the machine learning model selection function unit 221 selects a simple linear regression model. When the type of processing is "sum" and the data type is "list2", the machine learning model selection function unit 221 selects both a regression tree model and a simple linear regression model. The selection results by the machine learning model selection function unit 221 are consistent with the graph in Figure 12. Note that when the type of processing is "sum" and the data type is "list2", the machine learning model selection function unit 221 selects a regression tree model for argument sizes from 0 to 400, and selects a simple linear regression model for argument sizes from 400 to 1000.
[0082] The processing of the machine learning model training function 222 and the execution time prediction unit 24 after the machine learning model selection function 221 has selected a machine learning model is basically the same as in the first embodiment. However, the machine learning model training function 222 trains the machine learning model selected by the machine learning model selection function 221 for each of the argument data types using appropriate training data. In addition, the source code analysis unit 241 of the execution time prediction unit 24 determines whether the source code to be predicted is a process that uses an argument of data type "list1" or a process that uses an argument of data type "list2". In other words, the source code analysis unit 241 identifies the data type of the argument. The source code analysis unit 241 also identifies which region the size of the argument belongs to. In addition, the execution time calculation unit 242 calculates (predicts) the execution time using the machine learning model selected by the machine learning model selection function 221 and trained by the machine learning model training function 222 according to the data type and size of the argument. The prediction result output unit 15 outputs a predicted value for the execution time of the target source code.
[0083] In other words, in the second embodiment, the machine learning model selection function 221 selects a machine learning model according to the size of the arguments (or the region to which that size belongs). When the machine learning model training function 222 trains the selected machine learning model, it uses data from the training data in which the size of the arguments (or the region to which that size belongs) matches.
[0084] As described above, according to the second embodiment, for example, for one type of process (process "sum", etc.), the machine learning model selection function unit selects a machine learning model that is suitable for the sample data from among multiple candidate machine learning models for each argument of a different data type. Furthermore, the machine learning model training function unit can train the machine learning model selected by the machine learning model selection function unit and construct a model for predicting the execution time of the program.
[0085] [Third Embodiment] Next, a third embodiment of the present invention will be described. Note that matters already described in the previous embodiments may be omitted below. Here, the focus will be on matters specific to this embodiment.
[0086] Figure 14 is a block diagram illustrating the schematic functional configuration of the execution time prediction device according to this embodiment. The execution time prediction device 2 is based on the configurations of the execution time prediction device 1 and execution time prediction device 2 described above, but has further features. As shown in the figure, the execution time prediction device 3 is composed of a training data generation unit 31, an execution time prediction model construction unit 32, a source code storage unit 13, an execution time prediction unit 34, and a prediction result output unit 15. The functions of the execution time prediction device 3 can be realized, for example, by a computer and a program, as in the previous embodiments.
[0087] As shown in the figure, the training data generation unit 31 includes a sample data generation function unit 311 and an execution time measurement function unit 312. The execution time prediction model construction unit 32 includes a machine learning model selection function unit 321 and a machine learning model training function unit 322. The execution time prediction unit 34 includes a source code analysis unit 341 and an execution time calculation unit 342.
[0088] In this embodiment, the machine learning model selection function 321 selects a machine learning model not only based on the type of processing and the size of the arguments, but also based on the performance of the processor, such as the CPU (Central Processing Unit), when executing the processing.
[0089] Here, as in the first embodiment, we consider "sum" and "print" as examples of processing types. We also consider "int" (integer) and "str" (string) as argument data types. The contents of "sum" and "print" are as already explained. In this embodiment, as an example of processor performance, we consider the clock frequency for driving the processor. The processor frequency is expressed in units such as gigahertz (GHz) or terahertz (THz).
[0090] In this embodiment, the sample data generation function 311 identifies variable parameters for each data type, similar to the case in the first embodiment. The sample data generation function 311 then generates sample data by increasing or decreasing the values of the above parameters according to the data type. The sample data generation function 311 also generates the above sample data for each of the multiple processors (CPU, etc.). For example, the sample data generation function 311 generates sample data for each processor performance. The processor performance can be represented, for example, by the processor's clock frequency (e.g., F1, F2, ...).
[0091] The execution time measurement function unit 312 executes a process for each processor using the sample data arguments generated by the sample data generation function unit 311, and measures the execution time. As a result, the execution time measurement function unit 312 outputs data consisting of a set of the type of process, the size of the arguments, the processor performance (represented, for example, by the clock frequency), and the measured execution time corresponding to these.
[0092] The machine learning model selection function unit 321 of the execution time prediction model construction unit 32 selects a machine learning model based on the data output by the execution time measurement function unit 312. In other words, the machine learning model selection function unit 321 analyzes the variation in execution time corresponding to changes in argument size for each processor performance (clock frequency, etc.) and each type of processing. The machine learning model selection function unit 321 selects a machine learning model that constructs an equation similar to the variation in execution time.
[0093] The machine learning model training unit 322 uses the training data provided by the training data generation unit 31 to train the machine learning model selected by the machine learning model selection unit 321. The machine learning model training unit 322 trains the machine learning model selected by the machine learning model selection unit 321 for each type of processing and for each processor performance (clock frequency, etc.). The machine learning model training unit 322 stores the internal parameters of the machine learning model obtained as a result of the training in memory or the like.
[0094] The execution time calculation unit 342 calculates (predicts) the execution time of the process based on the results of the source code analysis unit 341 and the performance of the processor that will execute the process. The prediction result output unit 15 outputs the predicted execution time when the target source code is executed on a processor with a specific performance level to the outside.
[0095] In other words, in the third embodiment, the machine learning model calculates (predicts) the execution time of the process in accordance with the processor's performance information. In this case, the training data for training the machine learning model includes the processor's performance information. Furthermore, when calculating the execution time using the trained machine learning model, the processor's performance information is also used as input to the machine learning model.
[0096] As described above, according to the third embodiment, for each processor having different performance characteristics, the machine learning model selection function unit selects a machine learning model that is suitable for the sample data from among multiple candidate machine learning models. Furthermore, the machine learning model training function unit can train the machine learning model selected by the machine learning model selection function unit and construct a model for predicting the execution time of a program.
[0097] Although several embodiments of this invention have been described in detail above with reference to the drawings, the specific configuration is not limited to these embodiments and includes designs and the like that do not depart from the spirit of this invention.
[0098] The present invention can be used, for example, in services that plan and provide computing resources such as so-called cloud services. However, the scope of use of the present invention is not limited to those exemplified herein.
[0099] 1, 2, 3 Execution Time Prediction Device 11 Training Data Generation Unit 12 Execution Time Prediction Model Construction Unit 13 Source Code Storage Unit 14 Execution Time Prediction Unit 15 Prediction Result Output Unit 22 Execution Time Prediction Model Construction Unit 24 Execution Time Prediction Unit 31 Training Data Generation Unit 32 Execution Time Prediction Model Construction Unit 34 Execution Time Prediction Unit 111 Sample Data Generation Function Unit 112 Execution Time Measurement Function Unit 121 Machine Learning Model Selection Function Unit 122 Machine Learning Model Training Function Unit 141 Source Code Analysis Unit 142 Execution Time Calculation Unit 221 Machine Learning Model Selection Function Unit 222 Machine Learning Model Training Function Unit 241 Source Code Analysis Unit 242 Execution Time Calculation Unit 311 Sample Data Generation Function Unit 312 Execution Time Measurement Function Unit 321 Machine Learning Model Selection Function Unit 322 Machine Learning Model Training Function Unit 341 Source Code Analysis Unit 342 Execution time calculation unit 901 Central processing unit 902 RAM 903 Input / output ports 904, 905 Input / output devices 906 Bus
Claims
A training data generation unit generates training data which is a set of the type of processing, the size of the argument passed to the processing, and the execution time when the processing is executed based on the size of the argument. A machine learning model selection function unit selects a machine learning model from a plurality of candidate machine learning models based on the trend of execution time variations corresponding to the type of processing and the size of the arguments in the training data generated by the training data generation unit. A machine learning model training function unit constructs an execution time prediction model by training the machine learning model selected by the machine learning model selection function unit using the training data generated by the training data generation unit, An execution time prediction device equipped with the following features. An execution time prediction unit predicts the execution time of a process corresponding to the type of process and the size of the arguments passed to the process by inputting the type of process included in the given program and the size of the arguments passed to the process into an execution time prediction model constructed by the machine learning model training function unit. The execution time prediction device according to claim 1, further comprising: The training data generation unit generates training data which is a set of the type of processing, the size of the argument passed to the processing, and the execution time when the processing is performed based on the size of the argument. The machine learning model selection function unit selects a machine learning model from a plurality of candidate machine learning models based on the trend of changes in execution time corresponding to the type of processing and the size of the arguments in the training data generated by the training data generation unit, and The process involves the machine learning model training function unit using the training data generated by the training data generation unit to train the machine learning model selected by the machine learning model selection function unit and construct an execution time prediction model, A method for predicting execution time, including the following. A program for causing a computer to execute the execution time prediction method described in claim 3.