Hardware resource determination device, hardware resource determination method, and program
The hardware resource determination device analyzes application source code components to determine suitable hardware resources, addressing the challenge of unknown relationships between source code and hardware resources, enhancing resource allocation efficiency.
Patent Information
- Application Number
- PCT/JP2024/030231
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Filing Date
- 2024-08-26
- Publication Date
- 2026-03-05
AI Technical Summary
Existing technologies, such as those using machine learning, struggle to determine appropriate hardware resources for executing applications when the relationship between the application source code and hardware resources has not been learned.
A hardware resource determination device and method that analyzes application source code components, determines a category based on these components, and allocates suitable hardware resources using pre-stored information, even without prior machine learning.
Enables determination of suitable hardware resources for executing applications, even when the relationship between source code and hardware resources is unknown, improving resource allocation efficiency.
Smart Images

Figure JP2024030231_05032026_PF_FP_ABST
Abstract
Description
HARDWARE RESOURCE DETERMINATION DEVICE, HARDWARE RESOURCE DETERMINATION METHOD, AND PROGRAM
[0001] The present invention relates to a hardware resource determination device, a hardware resource determination method, and a program.
[0002] In recent years, the use of cloud services has become commonplace, and there is a demand for cloud services in which a server executes an application by allocating an optimal hardware resource (HWR) in response to a user's request for application execution. In response to this application execution request, it is necessary to determine an appropriate allocated HWR that satisfies the execution request.
[0003] Non-Patent Document 1 discloses a technique for determining an appropriate HWR allocation using machine learning technology. In machine learning technology, a trained model uses information on execution results such as processing time as features.
[0004] Wu, Horiuchi, Tayama, “A Resource Design Framework to Realize Lintent-based Cloud Management”, 2019 IEEE International Conference on Cloud Computing Technology and Science, Dec, 2019
[0005] Non-Patent Document 1 uses an AI (Artificial Intelligence) model that learns application execution requests and execution results. Therefore, the AI model is specialized for the learned application. Therefore, Non-Patent Document 1 cannot output execution results when an execution request for an application that cannot generate specific features is received. In other words, Non-Patent Document 1 cannot determine hardware resources appropriate for executing an application if the relationship between the application source code and the hardware resources appropriate for executing that source code has not been learned by machine learning.
[0006] The present invention aims to provide a technology that can determine hardware resources suitable for executing source code, even if the relationship between the source code of an application and the hardware resources suitable for executing that source code has not been learned by machine learning.
[0007] One aspect of the present invention is a hardware resource determination device comprising: a source code acquisition unit that acquires source code of an application; a component analysis unit that analyzes the components of the source code acquired by the source code acquisition unit; a category determination unit that determines a category to which the source code belongs based on the results of the analysis by the component analysis unit; and a hardware resource determination unit that determines a hardware resource to execute the application based on the category determined by the category determination unit.
[0008] Another aspect of the present invention is a hardware resource determination method comprising: a source code acquisition process for acquiring source code of an application; a component analysis process for analyzing components of the source code acquired in the source code acquisition process; a category determination process for determining a category to which the source code belongs based on the results of the analysis in the component analysis process; and a hardware resource determination process for determining a hardware resource to run the application based on the category determined in the category determination process.
[0009] According to the present invention, even if the relationship between the source code of an application and the hardware resources suitable for executing that source code has not been learned by machine learning, it is possible to determine the hardware resources suitable for executing that source code.
[0010] FIG. 1 is a schematic block diagram showing a configuration of a hardware resource determination device according to a first embodiment of the present invention. FIG. 2 is a flowchart showing processing of the hardware resource determination device according to the first embodiment of the present invention. FIG. 3 is a diagram showing an example of application information stored in a storage unit according to the first embodiment of the present invention. FIG. 4 is a diagram showing another example of application information stored in a storage unit according to the first embodiment of the present invention. FIG. 5 is a diagram showing an example of similarity determination rule information stored in a storage unit according to the first embodiment of the present invention. FIG. 6 is a diagram showing another example of similarity determination rule information stored in a storage unit according to the first embodiment of the present invention. FIG. 7 is a diagram showing an example of hardware resource information stored in a storage unit according to the first embodiment of the present invention. FIG. 8 is a diagram showing an example of source code acquired by a source code acquisition unit according to the first embodiment of the present invention. FIG. 9 is a diagram showing another example of source code acquired by a source code acquisition unit according to the first embodiment of the present invention. FIG. 10 is a diagram showing another example of source code acquired by a source code acquisition unit according to the first embodiment of the present invention. FIG. 10 is a diagram showing an example of information used by the category determination unit according to the second embodiment of the present invention. FIG. 11 is a diagram showing another example of information used by the category determination unit according to the second embodiment of the present invention. FIG. 12 is a schematic block diagram showing a configuration of a hardware resource determination device according to a third embodiment of the present invention. FIG. 13 is a flowchart showing processing of the hardware resource determination device according to the third embodiment of the present invention. FIG. 14 is a diagram showing an example of source code acquired by a source code acquisition unit according to the third embodiment of the present invention. FIG. 15 is a diagram showing another example of source code acquired by a source code acquisition unit according to the third embodiment of the present invention. FIG. 16 is a diagram showing an example of information used by the category determination unit according to the third embodiment of the present invention.FIG. 11 is a diagram showing another example of information used by the category determination unit according to the third embodiment of the present invention.
[0011] Hereinafter, first to third embodiments of the present invention will be described with reference to the drawings.
[0012] First Embodiment First, a first embodiment of the present invention will be described. Fig. 1 is a schematic block diagram showing the configuration of a hardware resource determination device 100a according to the first embodiment of the present invention. The hardware resource determination device 100a is a PC (Personal Computer) that provides server functions.
[0013] The hardware resource determination device 100a includes a control unit 10a, a storage unit 20a, a source code acquisition unit 30a, a component analysis unit 40a, a category determination unit 50a, a hardware resource determination unit 60a, and a determination result output unit 70a.
[0014] The control unit 10a includes a CPU (Central Processing Unit) and controls the components of the hardware resource determination device 100a, including the storage unit 20a, source code acquisition unit 30a, component analysis unit 40a, category determination unit 50a, hardware resource determination unit 60a, and determination result output unit 70a.
[0015] The storage unit 20a includes semiconductor memories such as RAM (Random Access Memory) and ROM (Read Only Memory). The storage unit 20a is connected to the category determination unit 50a and the hardware resource determination unit 60a. The storage unit 20a stores application information D11, similarity determination rule information D12, and hardware resource information D13. Details of the application information D11, similarity determination rule information D12, and hardware resource information D13 will be described later.
[0016] The source code acquisition unit 30a is connected to the component analysis unit 40a. The source code acquisition unit 30a is also connected to an application execution unit (not shown) via wired or wireless communication. The source code acquisition unit 30a receives from the application execution unit a determination request inquiring on which hardware the application that the application execution unit is about to execute should be executed, as well as the source code included in the application. The hardware may be, for example, a GPU (Graphics Processing Unit), a CPU (Central Processing Unit), or an FPGA (Field Programmable Gate Array).
[0017] The component analysis unit 40a is connected to the source code acquisition unit 30a and the category determination unit 50a. The component analysis unit 40a receives application source code from the source code acquisition unit 30a. The component analysis unit 40a analyzes the components (e.g., commands) contained in the input source code. The component analysis unit 40a outputs the results of the component analysis to the category determination unit 50a.
[0018] The category determination unit 50a is connected to the storage unit 20a, the component analysis unit 40a, and the hardware resource determination unit 60a. The category determination unit 50a receives the analysis results from the component analysis unit 40a from the component analysis unit 40a. The component analysis unit 40a uses application information D11 and similarity determination rule information D12 stored in advance in the storage unit 20a to determine which source code, among multiple source codes stored in advance in the storage unit 20a, the source code analyzed by the component analysis unit 40a is most similar to, and outputs information on the category to which the most similar source code belongs to the hardware resource determination unit 60a.
[0019] The hardware resource determination unit 60a is connected to the storage unit 20a, the category determination unit 50a, and the determination result output unit 70a. Category information is input to the hardware resource determination unit 60a from the category determination unit 50a. The category determination unit 50a uses the category information input from the hardware resource determination unit 60a and the hardware resource information D13 stored in the storage unit 20a to determine which hardware is appropriate for executing an application including the source code acquired by the source code acquisition unit 30a. The hardware resource determination unit 60a outputs the determination result to the determination result output unit 70a.
[0020] The determination result output unit 70a is connected to the hardware resource determination unit 60a. It is also connected to an application execution device (not shown) via wired or wireless connections. The determination result output unit 70a receives the determination result made by the hardware resource determination unit 60a from the hardware resource determination unit 60a. The determination result output unit 70a transmits the determination result made by the hardware resource determination unit 60a to the application execution device via wired or wireless connections.
[0021] 2 is a flowchart showing the processing of the hardware resource determination device 100a according to the first embodiment of the present invention. Before starting the processing of the hardware resource determination device 100a according to the first embodiment shown in FIG. 2, the following information is stored in the storage unit 20a of the hardware resource determination device 100a:
[0022] That is, the storage unit 20a of the hardware resource determination device 100a stores application information D11 shown in FIGS. 3A and 3B. The application information D11 is a collection of application information categorized by a server (here, the hardware resource determination device 100a) according to specific rules such as processing time or genre. The application information refers to source code and general information used in the application. FIG. 3A shows an example of source code in Category 1 (here, performing autonomous driving processing). FIG. 3B shows an example of source code in Category 2 (here, performing scheduler processing). The categories are set by the developer of the application source code. Here, a case will be described in which the application source code is written in Python, a programming language; however, other programming languages may be used.
[0023] 4A and 4B are stored in the storage unit 20a of the hardware resource determination device 100a. In the similarity determination rule information D12 shown in FIG. 4A, the name of a component (e.g., "torch") described in the source code for category 1 (here, the case of autonomous driving processing) is associated with the weight of that component (e.g., "1") and stored. In the similarity determination rule information D12 shown in FIG. 4B, the name of a component (e.g., "logging") described in the source code for category 2 (here, the case of scheduler processing) is associated with the weight of that component (e.g., "0.8") and stored.
[0024] The storage unit 20a of the hardware resource determination device 100a also stores information on rules for defining categories of similar source code as similarity determination rule information D12. For example, a rule may be stored that calculates a weight by dividing the number of source code pieces referencing a certain library by the number of source code pieces in that category, calculates the similarity as the sum of these weights, and determines the category with the maximum value as similar. At this time, a rule may be stored that sets the weight of libraries other than duplicate libraries to 0.
[0025] The storage unit 20a of the hardware resource determination device 100a stores hardware resource information D13 shown in Fig. 5. In the hardware resource information D13 shown in Fig. 5, the storage unit 20a of the hardware resource determination device 100a stores categories (e.g., category 1) in association with hardware resources (e.g., GPUs) suitable for executing source code of the category.
[0026] In the hardware resource determination device 100a, the application information D11 shown in Figures 3A and 3B, the similarity determination rule information D12 shown in Figures 4A and 4B, and the hardware resource information D13 shown in Figure 5 are stored in the memory unit 20a, and then the processing of the flowchart shown in Figure 2 is started.
[0027] First, the source code acquisition unit 30a of the hardware resource determination device 100a determines whether or not it has acquired, from an external application execution device, the source code of an application to be executed on that application execution device (step S11). If the source code acquisition unit 30a has not acquired the source code of the application (NO in step S11), the source code acquisition unit 30a performs the process of step S11 again after a predetermined time has elapsed. If the source code acquisition unit 30a has acquired the source code of the application (YES in step S11), the process of step S12, which will be described later, is performed.
[0028] 6A and 6B are diagrams illustrating an example of source code acquired by the source code acquisition unit 30a of the hardware resource determination device 100a. For example, the source code acquisition unit 30a acquires the source code shown in FIG. 6A as source code 1. Also, for example, the source code acquisition unit 30a acquires the source code shown in FIG. 6B as source code 2.
[0029] Here, we will explain the case where the application execution device (not shown) and the hardware resource determination device 100a are different devices, but the application execution device (not shown) and the hardware resource determination device 100a may also be configured as a single device.
[0030] When the source code acquisition unit 30a acquires the source code of an application (YES in step S11), the component analysis unit 40a of the hardware resource determination device 100a analyzes the components of the source code acquired in step S11 (step S12). Specifically, the component analysis unit 40a generates a source code summary by extracting specific components written in the source code of the application acquired in step S11. For example, when source code 1 as shown in FIG. 6A is acquired in step S11, the component analysis unit 40a extracts characters (e.g., "math") written after the word "import" from the characters (also referred to as components) written in source code 1 to generate source code summary 1 as shown in FIG. 7A. Furthermore, when source code 2 as shown in FIG. 6B is acquired in step S11, the component analysis unit 40a extracts characters (e.g., "logging") written after the word "import" from source code 2 to generate source code summary 2 as shown in FIG. 7B.
[0031] Next, the category determination unit 50a of the hardware resource determination device 100a determines a category to which the source code belongs based on the components included in the source code (step S13). Specifically, the category determination unit 50a determines the category of the source code of the application acquired in step S11 using the source code summary generated in step S12 and the similarity determination rule information D12 (see FIGS. 4A and 4B) stored in the storage unit 20a. For example, if the source code summary shown in FIG. 7A is generated in step S12, the source code summary shown in FIG. 7A includes characters such as “os,” “argparse,” “numpy,” and “torch.” Therefore, weights corresponding to these characters are calculated using the similarity determination rule information D12 for Category 1 shown in FIG. 4A. In other words, based on the similarity determination rule information D12 shown in Figure 4A, the weight of "os" in category 1 is 1, the weight of "argparse" is 0.4, the weight of "numpy" is 0.4, and the weight of "torch" is 1, so the total weight when the source code is in category 1 is 2.8.
[0032] 7A is generated in step S12, the source code summary shown in Fig. 7A includes characters such as "logging," and therefore the weights corresponding to these characters are calculated using the similarity determination rule information D12 for category 2 shown in Fig. 4B. That is, based on the similarity determination rule information D12 shown in Fig. 4B, the weight of "logging" in category 2 is 0.8, and therefore the total weight when the source code is category 2 is 0.8.
[0033] The category determination unit 50a determines that the source code of the application obtained in step S11 is more similar to Category 1, which has a larger value, than to Category 2, which has a smaller value, because the total weight of Category 1 is 2.8 and the total weight of Category 2 is 0.8 for the source code summary of the source code of the application obtained in step S11.
[0034] Next, the hardware resource determination unit 60a of the hardware resource determination device 100a determines a hardware resource that will execute the application acquired in step S11, based on the category determined in step S13 (step S14). Specifically, the hardware resource determination unit 60a refers to the hardware resource information D13 stored in the storage unit 20a to determine which hardware resource the category determined in step S13 corresponds to. For example, if the category of the application acquired in step S11 is determined to be category 1 in step S13, the hardware resource determination unit 60a refers to the hardware resource information D13 ( FIG. 5 ) and determines that it is preferable for the application to be executed by a GPU associated with category 1.
[0035] Next, the determination result output unit 70a of the hardware resource determination device 100a outputs the hardware resources determined in step S14 (step S15). For example, the determination result output unit 70a transmits the hardware resources determined in step S14 to the application execution device via wired or wireless communication, thereby notifying the application execution device that it is preferable for the application execution device to execute the application using the hardware resources determined in step S14.
[0036] According to the first embodiment described above, even if the relationship between the source code of an application and the hardware resources suitable for executing that source code has not been learned by machine learning, it is possible to determine the hardware resources suitable for executing that source code.
[0037] [Second Embodiment] Next, a second embodiment of the present invention will be described. Fig. 8 is a schematic block diagram showing the configuration of a hardware resource determination device 100b according to the second embodiment of the present invention. The hardware resource determination device 100b is a PC (Personal Computer) that provides server functions.
[0038] The hardware resource determination device 100b includes a control unit 10b, a storage unit 20b, a source code acquisition unit 30b, a component analysis unit 40b, a category determination unit 50b, a hardware resource determination unit 60b, and a determination result output unit 70b.
[0039] The control unit 10b includes a CPU (Central Processing Unit) and controls the components of the hardware resource determination device 100b, including the storage unit 20b, source code acquisition unit 30b, component analysis unit 40b, category determination unit 50b, hardware resource determination unit 60b, and determination result output unit 70b.
[0040] The storage unit 20b includes semiconductor memories such as RAM (Random Access Memory) and ROM (Read Only Memory). The storage unit 20b is connected to the category determination unit 50b and the hardware resource determination unit 60b. The storage unit 20b stores application information D21 and hardware resource information D23. Details of the application information D21 and the hardware resource information D23 will be described later.
[0041] The source code acquisition unit 30b is connected to the component analysis unit 40b. The source code acquisition unit 30b is also connected to an application execution unit (not shown) via a wired or wireless connection. The source code acquisition unit 30b receives from the application execution unit a determination request inquiring on which hardware the application that the application execution unit is about to execute should be executed, as well as the source code included in the application. The hardware may be, for example, a GPU (Graphics Processing Unit) or a CPU (Central Processing Unit).
[0042] The component analysis unit 40b is connected to the source code acquisition unit 30b and the category determination unit 50b. The component analysis unit 40b receives application source code from the source code acquisition unit 30b. The component analysis unit 40b analyzes what components (e.g., commands) are included in the input source code and how many times they are included. The component analysis unit 40b outputs the results of the component analysis to the category determination unit 50b.
[0043] The category determination unit 50b is connected to the storage unit 20b, the component analysis unit 40b, and the hardware resource determination unit 60b. The category determination unit 50b receives the analysis results from the component analysis unit 40b from the component analysis unit 40b. The component analysis unit 40b uses application information D21 stored in advance in the storage unit 20b to determine which source code, among multiple source codes stored in advance in the storage unit 20b, the source code analyzed by the component analysis unit 40b is most similar to, and outputs information on the category to which the most similar source code belongs to the hardware resource determination unit 60b.
[0044] The hardware resource determination unit 60b is connected to the storage unit 20b, the category determination unit 50b, and the determination result output unit 70b. Category information is input to the hardware resource determination unit 60b from the category determination unit 50b. The category determination unit 50b uses the category information input from the hardware resource determination unit 60b and the hardware resource information D23 stored in the storage unit 20b to determine which hardware is appropriate for executing an application including the source code acquired by the source code acquisition unit 30b. The hardware resource determination unit 60b outputs the determination result to the determination result output unit 70b.
[0045] The determination result output unit 70b is connected to the hardware resource determination unit 60b. It is also connected to an application execution device (not shown) via wired or wireless connections. The determination result output unit 70b receives the determination result made by the hardware resource determination unit 60b from the hardware resource determination unit 60b. The determination result output unit 70b transmits the determination result made by the hardware resource determination unit 60b to the application execution device via wired or wireless connections.
[0046] FIG. 9 is a flowchart illustrating the processing of a hardware resource determination device 100b according to a second embodiment of the present invention. Before starting the processing of the hardware resource determination device 100b according to the second embodiment illustrated in FIG. 9, information similar to the application information D11 illustrated in FIGS. 3A and 3B is stored as application information D21 in the storage unit 20b of the hardware resource determination device 100b. In the second embodiment, the number of times a predetermined component appears in the source code of each category is counted in advance. For example, it is counted in advance that the process "torch" appears 27 times in the source code of category 1, and the process "logging" appears three times in the source code of category 2. Furthermore, information similar to the hardware resource information D13 illustrated in FIG. 5 is stored as hardware resource information D23 in the storage unit 20b of the hardware resource determination device 100b.
[0047] In the hardware resource determination device 100b, after application information D21 similar to that shown in Figures 3A and 3B and hardware resource information D23 similar to that shown in Figure 5 are stored in the memory unit 20b, the processing of the flowchart shown in Figure 9 is started.
[0048] First, the source code acquisition unit 30b of the hardware resource determination device 100b determines whether or not it has acquired, from an external application execution device, the source code of an application to be executed on that application execution device (step S21). If the source code acquisition unit 30b has not acquired the source code of the application (NO in step S21), the source code acquisition unit 30b performs the process of step S21 again after a predetermined time has elapsed. If the source code acquisition unit 30b has acquired the source code of the application (YES in step S21), the process of step S22, which will be described later, is performed.
[0049] 10A and 10B are diagrams illustrating an example of source code acquired by the source code acquisition unit 30b of the hardware resource determination device 100b. For example, the source code acquisition unit 30b acquires the source code shown in FIG. 10A as source code 1. Also, for example, the source code acquisition unit 30b acquires the source code shown in FIG. 10B as source code 2.
[0050] Here, we will explain the case where the application execution device (not shown) and the hardware resource determination device 100b are different devices, but the application execution device (not shown) and the hardware resource determination device 100b may also be configured as a single device.
[0051] When the source code acquisition unit 30b acquires the source code of the application (YES in step S21), the component analysis unit 40b of the hardware resource determination device 100b analyzes the components of the source code acquired in step S21 (step S22). Specifically, the component analysis unit 40b counts the number of occurrences of a predetermined component described in the source code of the application acquired in step S21.
[0052] Next, the category determination unit 50b of the hardware resource determination device 100b determines the category to which the source code acquired in step S21 belongs, based on the number of occurrences of the components counted in step S22 (step S23).
[0053] For example, if source code 1 as shown in FIG. 10A is acquired in step S21, and the process specified in category 1 (e.g., “torch”) appears 27 times in source code 1 as shown in FIG. 11A, but the process specified in category 2 (e.g., “logging”) does not appear, the category determination unit 50b determines that source code 1 of the application acquired in step S21 belongs to category 1, which has the most occurrences of the specified process.
[0054] In addition, if the number of occurrences of a specified process contained in the source code of the application obtained in step S21 does not match the number of occurrences of a specified process contained in multiple source codes stored in the application information D21 of the memory unit 20b, for example, a category corresponding to the source code with the most similar number of occurrences of the specified process may be selected.
[0055] On the other hand, when source code 2 as shown in Fig. 10B is acquired in step S21, the component analysis unit 40b counts the number of occurrences of each process (e.g., "logging") included in source code 2. For example, when source code 2 as shown in Fig. 10B is acquired in step S21 and a process specified in category 2 (e.g., "logging") appears three times in source code 2 as shown in Fig. 11B, but a process specified in category 1 (e.g., "torch") does not appear, the category determination unit 50b determines that source code 2 of the application acquired in step S21 belongs to category 2, in which the specified process appears most frequently.
[0056] Next, the hardware resource determination unit 60b of the hardware resource determination device 100b determines a hardware resource that will execute the application acquired in step S21, based on the category determined in step S23 (step S24). Specifically, the hardware resource determination unit 60b refers to the hardware resource information D23 stored in the storage unit 20b and determines to which hardware resource the category determined in step S23 corresponds. For example, if the category of the application acquired in step S21 is determined to be category 1 in step S23, the hardware resource determination unit 60b refers to the hardware resource information D23 and determines that it is preferable for the application to be executed by a GPU associated with category 1.
[0057] Next, the determination result output unit 70b of the hardware resource determination device 100b outputs the hardware resources determined in step S24 (step S25). For example, the determination result output unit 70b transmits the hardware resources determined in step S24 to the application execution device via wired or wireless communication, thereby notifying the application execution device that it is preferable for the application execution device to execute the application using the hardware resources determined in step S24.
[0058] According to the second embodiment described above, similar to the first embodiment, even if the relationship between the source code of an application and the hardware resources suitable for executing that source code has not been learned by machine learning, it is possible to determine the hardware resources suitable for executing that source code.
[0059] Furthermore, in the second embodiment, compared to the first embodiment, there is no need to store similarity determination rule information D12 such as that shown in Figures 4A and 4B in the memory unit 20b, and therefore the storage capacity of the memory unit 20b can be reduced.
[0060] [Third Embodiment] Next, a third embodiment of the present invention will be described. Fig. 12 is a schematic block diagram showing the configuration of a hardware resource determination device 100c according to the third embodiment of the present invention. The hardware resource determination device 100c is a PC (Personal Computer) that provides server functions.
[0061] The hardware resource determination device 100c includes a control unit 10c, a storage unit 20c, a source code acquisition unit 30c, a component analysis unit 40c, a category determination unit 50c, a hardware resource determination unit 60c, and a determination result output unit 70c.
[0062] The control unit 10c includes a CPU (Central Processing Unit) and controls the components of the hardware resource determination device 100c, i.e., the storage unit 20c, the source code acquisition unit 30c, the component analysis unit 40c, the category determination unit 50c, the hardware resource determination unit 60c, and the determination result output unit 70c.
[0063] The storage unit 20c includes semiconductor memories such as RAM (Random Access Memory) and ROM (Read Only Memory). The storage unit 20c is connected to the category determination unit 50c and the hardware resource determination unit 60c. The storage unit 20c stores application information D31 and hardware resource information D33. Details of the application information D31 and the hardware resource information D33 will be described later.
[0064] The source code acquisition unit 30c is connected to the component analysis unit 40c. The source code acquisition unit 30c is also connected to an application execution unit (not shown) via a wired or wireless connection. The source code acquisition unit 30c receives from the application execution unit a determination request inquiring on which hardware the application that the application execution unit is about to execute should be executed, as well as the source code included in the application. The hardware may be, for example, a GPU (Graphics Processing Unit) or a CPU (Central Processing Unit).
[0065] The component analysis unit 40c is connected to the source code acquisition unit 30c and the category determination unit 50c. The component analysis unit 40c receives application source code from the source code acquisition unit 30c. The component analysis unit 40c analyzes the size and type of variables (also referred to as components) contained in the input source code. The component analysis unit 40c outputs the results of the component analysis to the category determination unit 50c.
[0066] The category determination unit 50c is connected to the storage unit 20c, the component analysis unit 40c, and the hardware resource determination unit 60c. The category determination unit 50c receives the analysis results from the component analysis unit 40c from the component analysis unit 40c. The component analysis unit 40c uses application information D31 stored in advance in the storage unit 20b to determine which source code, among multiple source codes stored in advance in the storage unit 20c, the source code analyzed by the component analysis unit 40c is most similar to, and outputs information on the category to which the most similar source code belongs to the hardware resource determination unit 60c.
[0067] The hardware resource determination unit 60c is connected to the storage unit 20c, the category determination unit 50c, and the determination result output unit 70c. Category information is input to the hardware resource determination unit 60c from the category determination unit 50c. The category determination unit 50c uses the category information input from the hardware resource determination unit 60c and the hardware resource information D33 stored in the storage unit 20c to determine which hardware is appropriate for executing an application including the source code acquired by the source code acquisition unit 30c. The hardware resource determination unit 60c outputs the determination result to the determination result output unit 70c.
[0068] The determination result output unit 70c is connected to the hardware resource determination unit 60c. It is also connected to an application execution device (not shown) via wired or wireless connections. The determination result output unit 70c receives the determination result made by the hardware resource determination unit 60c from the hardware resource determination unit 60c. The determination result output unit 70c transmits the determination result made by the hardware resource determination unit 60c to the application execution device via wired or wireless connections.
[0069] FIG. 13 is a flowchart illustrating the processing of a hardware resource determination device 100c according to a third embodiment of the present invention. Note that, before starting the processing of the hardware resource determination device 100c according to the third embodiment illustrated in FIG. 13, information similar to the application information D11 illustrated in FIGS. 3A and 3B is stored as application information D31 in the storage unit 20c of the hardware resource determination device 100c. Note that, in the third embodiment, the types of variables and sizes included in the source code of each category are specified in advance. For example, it is specified in advance that the source code of category 1 includes variables of size 256×256 and variables of size 128×128, and the source code of category 2 includes variables of size 64×64 and variables of size 32×64.
[0070] Furthermore, the storage unit 20c of the hardware resource determination device 100c stores, as hardware resource information D33, information similar to the hardware resource information D13 shown in FIG.
[0071] In the hardware resource determination device 100c, application information D21 similar to that shown in Figures 3A and 3B and hardware resource information D23 similar to that shown in Figure 5 are stored in the memory unit 20c, and then the processing of the flowchart shown in Figure 13 is started.
[0072] First, the source code acquisition unit 30c of the hardware resource determination device 100c determines whether or not it has acquired, from an external application execution device, the source code of an application to be executed on that application execution device (step S31). If the source code acquisition unit 30c has not acquired the source code of the application (NO in step S31), the source code acquisition unit 30c performs the process of step S31 again after a predetermined time has elapsed. If the source code acquisition unit 30c has acquired the source code of the application (YES in step S31), the process of step S32, which will be described later, is performed.
[0073] 14A and 14B are diagrams illustrating an example of source code acquired by the source code acquisition unit 30c of the hardware resource determination device 100c. For example, the source code acquisition unit 30c acquires, as source code 1, source code as shown in FIG. 14A, which includes a variable of size 256×256 and a variable of size 128×128. Furthermore, for example, the source code acquisition unit 30c acquires, as source code 2, source code as shown in FIG. 14B, which includes a variable of size 64×64 and a variable of size 32×64.
[0074] Here, we will explain the case where the application execution device (not shown) and the hardware resource determination device 100c are different devices, but the application execution device (not shown) and the hardware resource determination device 100c may also be configured as a single device.
[0075] When the source code acquisition unit 30c acquires the source code of the application (YES in step S31), the component analysis unit 40c of the hardware resource determination device 100c analyzes the components of the source code acquired in step S31 (step S32). Specifically, the component analysis unit 40c analyzes what variables of what sizes are included in the source code of the application acquired in step S31.
[0076] Next, the category determination unit 50c of the hardware resource determination device 100c determines the category to which the source code belongs based on the size and type of variables contained in the source code acquired in step S31 (step S33).
[0077] For example, if source code 1 as shown in Figure 14A is acquired in step S31 and source code 1 contains variables of size 256 x 256 and variables of size 128 x 128 as shown in Figure 15A, but does not contain variables of size 64 x 64 and variables of size 32 x 64 included in category 2, the category determination unit 50c determines that source code 1 of the application acquired in step S31 belongs to category 1, which contains variables of the same size and type.
[0078] In addition, if the source code of the application acquired in step S31 does not contain a source code that contains variables of the same size and type as the multiple source codes stored in the application information D31 of the storage unit 20c, for example, a category corresponding to the source code that is most similar in size and type to the variables may be selected.
[0079] On the other hand, for example, if source code 2 as shown in Figure 14B is acquired in step S31 and that source code 2 contains variables of size 64 x 64 and variables of size 32 x 64 as shown in Figure 15B, but does not contain variables of size 256 x 256 and variables of size 128 x 128, which are included in category 1, the category determination unit 50c determines that source code 2 of the application acquired in step S31 belongs to category 2, which contains variables of the same size and type.
[0080] Next, the hardware resource determination unit 60c of the hardware resource determination device 100c determines a hardware resource that will execute the application acquired in step S31, based on the category determined in step S33 (step S34). Specifically, the hardware resource determination unit 60c refers to the hardware resource information D33 stored in the storage unit 20c and determines to which hardware resource the category determined in step S33 corresponds. For example, if the category of the application acquired in step S31 is determined to be category 1 in step S33, the hardware resource determination unit 60c refers to the hardware resource information D33 and determines that it is preferable for the application to be executed by a GPU associated with category 1.
[0081] Next, the determination result output unit 70c of the hardware resource determination device 100c outputs the hardware resources determined in step S34 (step S35). For example, the determination result output unit 70c transmits the hardware resources determined in step S34 to the application execution device via wired or wireless communication, thereby notifying the application execution device that it is preferable for the application execution device to execute the application using the hardware resources determined in step S34.
[0082] According to the third embodiment described above, similar to the first embodiment, even if the relationship between the source code of an application and the hardware resources suitable for executing that source code has not been learned by machine learning, it is possible to determine the hardware resources suitable for executing that source code.
[0083] Furthermore, in the third embodiment, compared to the first embodiment, there is no need to store similarity determination rule information D12 such as that shown in Figures 4A and 4B in the memory unit 20b, and therefore the storage capacity of the memory unit 20b can be reduced.
[0084] In the third embodiment, the category to which the source code acquired by the source code acquisition unit 30c belongs is determined based on the type of variables and their sizes contained in the source code, but the present invention is not limited to this. For example, the category to which the source code belongs may be determined based on the type of variables and their sizes and the number of occurrences contained in the source code acquired by the source code acquisition unit 30c.
[0085] At least some of the functions of the hardware resource determination devices 100a, 100b, and 100c in the first to third embodiments described above may be implemented by a computer. In this case, a program for implementing this function may be recorded on a computer-readable recording medium, and the program may be loaded into a computer system and executed. Note that the term "computer system" as used herein includes hardware such as an operating system (OS) and peripheral devices. Furthermore, the term "computer-readable recording medium" refers to portable media such as flexible disks, optical magnetic disks, read-only memories (ROMs), and CD-ROMs, as well as storage devices such as hard disks built into computer systems. Furthermore, the term "computer-readable recording medium" may also include devices that dynamically store programs for a short period of time, such as communication lines used when transmitting programs via networks such as the Internet or telephone lines, or devices that store programs for a fixed period of time, such as volatile memory within the computer systems that serve as the server or client in such cases. Furthermore, the above program may be one that realizes part of the functions described above, or may be one that can realize the functions described above in combination with a program already recorded in a computer system, or may be one that is realized using a programmable logic device such as an FPGA.
[0086] The first to third embodiments of the present invention have been described above in detail with reference to the drawings. However, the specific configurations are not limited to these embodiments, and designs within the scope of the present invention are also included.
[0087] The present invention can be applied to hardware resource determination devices, hardware resource determination methods, and programs that require determining hardware resources appropriate for executing source code, even if the relationship between the source code of an application and the hardware resources appropriate for executing that source code has not been learned by machine learning.
[0088] DESCRIPTION OF SYMBOLS 10a, 10b, 10c... Control unit 20a, 20b, 20c... Storage unit 30a, 30b, 30c... Source code acquisition unit 40a, 40b, 40c... Component analysis unit 50a, 50b, 50c... Category determination unit 60a, 60b, 60c... Hardware resource determination unit 70a, 70b, 70c... Determination result output unit 100a, 100b, 100c... Hardware resource determination device
Claims
1. A hardware resource determination device comprising: a source code acquisition unit that acquires the source code of an application; a component analysis unit that analyzes the components of the source code acquired by the source code acquisition unit; a category determination unit that determines a category to which the source code belongs based on the results of the analysis by the component analysis unit; and a hardware resource determination unit that determines a hardware resource to run the application based on the category determined by the category determination unit.
2. A hardware resource determination device as described in claim 1, further comprising a memory unit that stores components included in each of a plurality of categories, wherein the category determination unit determines the category to which the source code belongs based on the results of the analysis by the component analysis unit and the components stored in the memory unit.
3. A hardware resource determination method comprising: a source code acquisition process for acquiring the source code of an application; a component analysis process for analyzing the components of the source code acquired in the source code acquisition process; a category determination process for determining a category to which the source code belongs based on the analysis results in the component analysis process; and a hardware resource determination process for determining a hardware resource to run the application based on the category determined in the category determination process.
4. A program for causing a computer of a hardware resource determination device to execute the hardware resource determination method according to claim 3.
Citation Information
Patent Citations
Allocation determination device, allocation determination method, allocation system and allocation determination program
JP2012173869A
Continuous integration system and continuous integration method
JP2021197098A
Resource allocation control device, computing system and resource allocation control method
JP2022045666A
Electronic device for adjusting computing resources and method thereof
US20160065488A1