JP5379765B2 - Program execution apparatus and program execution method - Google Patents
Program execution apparatus and program execution method Download PDFInfo
- Publication number
- JP5379765B2 JP5379765B2 JP2010184509A JP2010184509A JP5379765B2 JP 5379765 B2 JP5379765 B2 JP 5379765B2 JP 2010184509 A JP2010184509 A JP 2010184509A JP 2010184509 A JP2010184509 A JP 2010184509A JP 5379765 B2 JP5379765 B2 JP 5379765B2
- Authority
- JP
- Japan
- Prior art keywords
- processing
- variable
- processing time
- value
- program
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Expired - Fee Related
Links
Images
Landscapes
- Memory System Of A Hierarchy Structure (AREA)
Abstract
Description
本発明は、プロセッサの処理速度を向上する技術に関する。 The present invention relates to a technique for improving the processing speed of a processor.
特許文献1には、マルチコアプロセッサにおける処理速度の向上を目的として、キャッシュミスを防ぐために、マルチコアプロセッサのどのコアにどのスレッドをどのタイミングで動作させるかをスケジューリングする技術が開示されている。具体的には、L2(Level 2)キャッシュ内に既に格納されているデータを再利用可能なように、スレッドを以前動作したコアで割り当てるスケジューリングを行うことによって、データをロードする時間を削減し高速化を実現する技術である。
しかし、1つのスレッドが処理中に扱うデータのバリエーション(データアドレス、データのサイズ、データのビットパターン等の相違のこと)が多く、かつ、それらのデータが均等に処理に使用される場合には、データがキャッシュアウトした(データがキャッシュ上に存在しない)状態になるケースがほとんどである。また、特定のスレッド単独で見ればデータのバリエーションが少なく、キャッシュヒット率が高くなり得る場合であっても、同一コアで動作する他のスレッドが使用するデータのバリエーションが大きい場合には、他のスレッドのデータがL2キャッシュ内で支配的になり、単独ならばキャッシュヒット率が高いデータがキャッシュアウトした状態になる可能性が高い。つまり、特許文献1に記載の技術では、プロセッサの処理速度の向上を確実には望めないケースがあるといった問題がある。
However, when there are many data variations (differences in data address, data size, data bit pattern, etc.) that one thread handles during processing, and these data are used for processing equally In most cases, the data is cached out (data does not exist in the cache). In addition, even if the data variation is small and the cache hit rate can be high if the specific thread alone is viewed, if the data variation used by other threads operating on the same core is large, The thread data becomes dominant in the L2 cache, and if it is alone, there is a high possibility that data with a high cache hit rate will be in a cache-out state. That is, the technique described in
また、プロセッサの処理効率向上のため、並行動作可能な処理をスレッド群として複数のコアで並行動作させることも考えられるが、この場合、バリエーションが少なく、本来キャッシュヒット率が高くなり得るデータであっても、複数のコアでスレッドが動作するが故に、同じアドレスのデータを複数のコア間で参照し合い、結果的にデータロードの時間を多く必要としてしまう可能性がある。このように、複数のコアのキャッシュ上に同じアドレスのキャッシュデータが存在してしまうと、キャッシュコヒーレンシ(複数のキャッシュに格納されている同一のデータの一貫性)を保つためのオーバヘッドが大きくなるため、プロセッサの処理速度の向上を損ねる原因となる。 In addition, in order to improve the processing efficiency of the processor, it is conceivable that processes that can be operated in parallel are operated in parallel by a plurality of cores as a thread group. However, in this case, there are few variations and the cache hit rate can be increased originally. However, since threads operate on a plurality of cores, data at the same address may be referred to between a plurality of cores, and as a result, a long time for data loading may be required. Thus, if cache data with the same address exists in the caches of multiple cores, the overhead for maintaining cache coherency (consistency of the same data stored in multiple caches) increases. This is a cause of impairing the improvement of the processing speed of the processor.
そこで、本発明は、前記した問題を解決し、プロセッサの処理速度を向上する技術を提供することを課題とする。 Therefore, an object of the present invention is to provide a technique for solving the above-described problems and improving the processing speed of the processor.
本発明は、プログラムをスレッドに分割し、前記スレッドそれぞれをCPU(Central Processing Unit)を構成するコアに割り当てて前記プログラムを実行するプログラム実行装置であって、任意の前記コアに任意の前記スレッドを割り当てて前記プログラムの処理を行う通常処理の実行時に所定の周期で収集される、前記プログラムに記述されている変数の処理開始時刻と、その変数の処理がキャッシュヒットしたことを示すキャッシュヒット情報と、を関連付けて記憶しているとともに、前記CPUのコア数と、キャッシュヒットの効果の判定に用いる閾値とを記憶している記憶部と、(1)前記変数の中の第1の変数の前記処理開始時刻およびその第1の変数の次に処理される第2の変数の前記処理開始時刻を読み出して差分を算出し、収集された回数分の前記差分の平均値を算出し、その算出した平均値を第1の処理時間とし、(2)前記変数の中の、前記キャッシュヒット情報が関連付けられた前記第1の変数の前記処理開始時刻および当該第1の変数の次に処理される第2の変数の前記処理開始時刻を読み出して差分を算出し、収集された回数分の前記差分の平均値を算出し、その算出した平均値を第2の処理時間とし、(3)前記第1の処理時間を前記第2の処理時間で除算して、独立化判定値を算出し、(4)前記独立化判定値が前記第1の変数の処理に用いるスレッド数を示す前記閾値より大きいか否かを判定し、その判定結果において大きいという判定の場合に、前記第1の変数の前記処理時間を前記第2の処理時間とし、その判定結果において否という判定の場合に、前記第1の変数の前記処理時間を前記第1の処理時間とし、(5)前記(1)〜前記(4)の処理を前記プログラムの変数について実行し、(6)前記CPUのコア数を、前記通常処理の実行時の前記プログラムの前記変数について前記第1の処理時間を合計した合計値で除算し、その値を第1のスループット係数とし、(7)前記CPUの1つのコアに、前記第2の処理時間を処理時間とする1つの前記変数の処理を実行させるように割り当てたときのスループットを、コア数の1を分子とし、前記第2の処理時間と当該変数の処理から次の処理までの待ち時間との合算値を分母とする第1の除算値を算出し、前記CPUのコア数から前記第2の処理時間を処理時間とする前記変数の数を減算して、その減算値を分子とし、前記プログラムの前記変数の中から前記第2の処理時間とならなかった前記変数の前記第1の処理時間と当該変数の処理の次の処理までの待ち時間との合計値を分母とする第2の除算値を算出し、前記第1の除算値および前記第2の除算値の中で最も小さい値を第2のスループット係数とし、(8)前記第2のスループット係数が前記第1のスループット係数より大きい場合、前記第2の処理時間を処理時間とする前記変数を処理するスレッドを固定の前記コアに割り当てることを示したコア割当情報を生成する解析部と、前記解析部によって生成された前記コア割当情報に基づいて、前記第2の処理時間を処理時間とする前記変数を処理するスレッドを固定の前記コアに割り当てて、前記プログラムを実行する実行部とを備えることを特徴とする。 The present invention is a program execution apparatus that divides a program into threads, assigns each of the threads to a core that constitutes a CPU (Central Processing Unit), and executes the program. A process start time of a variable described in the program, which is collected at a predetermined period when a normal process for allocating and processing the program is performed, and cache hit information indicating that the process of the variable has a cache hit; , And a storage unit storing the number of cores of the CPU and a threshold value used for determining the effect of the cache hit, and (1) the first variable among the variables Read the processing start time and the processing start time of the second variable processed next to the first variable, calculate the difference, and collect The average value of the difference for the number of times is calculated, and the calculated average value is set as a first processing time. (2) Among the variables, the first variable associated with the cache hit information is calculated. Read the processing start time and the processing start time of the second variable to be processed next to the first variable, calculate the difference, calculate the average value of the differences for the number of times collected, and calculate the difference The average value obtained is used as the second processing time, (3) the first processing time is divided by the second processing time to calculate an independence determination value, and (4) the independence determination value is It is determined whether or not it is larger than the threshold value indicating the number of threads used for processing the first variable, and when it is determined that the determination result is large, the processing time of the first variable is set to the second processing time. And in the case of a negative determination The processing time of the first variable is the first processing time, (5) the processing of (1) to (4) is executed for the variable of the program, and (6) the number of cores of the CPU Is divided by the total sum of the first processing times for the variables of the program at the time of execution of the normal processing, and the value is set as a first throughput coefficient. (7) One core of the CPU , The throughput when the processing of one variable with the second processing time as the processing time is assigned to be executed, with the number of cores being 1 as a numerator, and the processing time of the second processing time and the variable Calculating a first division value using a sum of a waiting time until the next processing as a denominator and subtracting the number of variables having the second processing time as a processing time from the number of cores of the CPU; Using the subtraction value as the numerator, the program A second division of which the denominator is the total value of the first processing time of the variable that has not become the second processing time and the waiting time until the next processing of the variable. A value is calculated, and the smallest value among the first divided value and the second divided value is set as a second throughput coefficient. (8) The second throughput coefficient is larger than the first throughput coefficient. An analysis unit for generating core allocation information indicating that a thread for processing the variable having the second processing time as a processing time is allocated to a fixed core; and the core allocation generated by the analyzing unit And an execution unit that executes the program by allocating a thread that processes the variable having the second processing time as the processing time to the fixed core based on the information.
また、本発明は、プログラムをスレッドに分割し、前記スレッドそれぞれをCPUを構成するコアに割り当てて前記プログラムを実行するプログラム実行装置において用いられるプログラム実行方法であって、前記プログラム実行装置が、任意の前記コアに任意の前記スレッドを割り当てて前記プログラムの処理を行う通常処理の実行時に所定の周期で収集される、前記プログラムに記述されている変数の処理開始時刻と、その変数の処理がキャッシュヒットしたことを示すキャッシュヒット情報と、を関連付けて記憶しているとともに、前記CPUのコア数と、キャッシュヒットの効果の判定に用いる閾値とを記憶している記憶部と、解析部と、実行部と、を備え、前記解析部が、(1)前記変数の中の第1の変数の前記処理開始時刻およびその第1の変数の次に処理される第2の変数の前記処理開始時刻を読み出して差分を算出し、収集された回数分の前記差分の平均値を算出し、その算出した平均値を第1の処理時間とするステップ、(2)前記変数の中の、前記キャッシュヒット情報が関連付けられた前記第1の変数の前記処理開始時刻および当該第1の変数の次に処理される第2の変数の前記処理開始時刻を読み出して差分を算出し、収集された回数分の前記差分の平均値を算出し、その算出した平均値を第2の処理時間とするステップ、(3)前記第1の処理時間を前記第2の処理時間で除算して、独立化判定値を算出するステップ、(4)前記独立化判定値が前記第1の変数の処理に用いるスレッド数を示す前記閾値より大きいか否かを判定し、その判定結果において大きいという判定の場合に、前記第1の変数の前記処理時間を前記第2の処理時間とし、その判定結果において否という判定の場合に、前記第1の変数の前記処理時間を前記第1の処理時間とするステップ、(5)前記(1)〜前記(4)の処理を前記プログラムの変数について実行するステップ、(6)前記CPUのコア数を、前記通常処理の実行時の前記プログラムの前記変数について前記第1の処理時間を合計した合計値で除算し、その値を第1のスループット係数とするステップ、(7)前記CPUの1つのコアに、前記第2の処理時間を処理時間とする1つの前記変数の処理を実行させるように割り当てたときのスループットを、コア数の1を分子とし、前記第2の処理時間と当該変数の処理から次の処理までの待ち時間との合算値を分母とする第1の除算値を算出し、前記CPUのコア数から前記第2の処理時間を処理時間とする前記変数の数を減算して、その減算値を分子とし、前記プログラムの前記変数の中から前記第2の処理時間とならなかった前記変数の前記第1の処理時間と当該変数の処理の次の処理までの待ち時間との合計値を分母とする第2の除算値を算出し、前記第1の除算値および前記第2の除算値の中で最も小さい値を第2のスループット係数とするステップ、(8)前記第2のスループット係数が前記第1のスループット係数より大きい場合、前記第2の処理時間を処理時間とする前記変数を処理するスレッドを固定の前記コアに割り当てることを示したコア割当情報を生成するステップ、を実行し、前記実行部が、前記解析部によって生成された前記コア割当情報に基づいて、前記第2の処理時間を処理時間とする前記変数を処理するスレッドを固定の前記コアに割り当てて、前記プログラムを実行するステップを実行することを特徴とする。 The present invention also relates to a program execution method used in a program execution apparatus that divides a program into threads, assigns each of the threads to a core that constitutes a CPU, and executes the program. The processing start time of the variable described in the program and the processing of the variable are collected at a predetermined cycle when executing the normal processing for assigning the arbitrary thread to the core and executing the processing of the program. Cache hit information indicating that a hit has been associated and stored, a storage unit storing the number of cores of the CPU, and a threshold used for determining the effect of the cache hit, an analysis unit, and an execution And the analysis unit (1) includes: (1) the processing start time and first variable of the first variable among the variables; Read the processing start time of the second variable processed next to the first variable, calculate the difference, calculate the average value of the difference for the number of times collected, and calculate the calculated average value (2) Among the variables, the processing start time of the first variable associated with the cache hit information and the second processed next to the first variable Reading the processing start time of the variable, calculating a difference, calculating an average value of the difference for the number of times collected, and setting the calculated average value as a second processing time; (3) the first (4) calculating the independence determination value by dividing the processing time by the second processing time; and (4) the independence determination value being greater than the threshold value indicating the number of threads used for processing the first variable. Whether or not If it is determined that the processing time of the first variable is large, the processing time of the first variable is the second processing time. If the determination result is NO, the processing time of the first variable is the first processing time. A step of processing time; (5) a step of executing the processing of (1) to (4) with respect to a variable of the program; and (6) the number of cores of the CPU is set as the number of cores of the program at the time of execution of the normal processing. Dividing the variable by the total sum of the first processing times for the variable and setting the value as a first throughput coefficient; (7) assigning the second processing time to one core of the CPU as the processing time; The throughput when assigned to execute the processing of one of the variables is the sum of the second processing time and the waiting time from the processing of the variable to the next processing, where 1 is the numerator of the number of cores. A first division value having a value as a denominator is calculated, the number of the variables having the second processing time as the processing time is subtracted from the number of cores of the CPU, and the subtraction value is used as a numerator. A second division value having a denominator as a total value of the first processing time of the variable that has not become the second processing time and the waiting time until the next processing of the variable among the variables. And (8) the second throughput coefficient is greater than the first throughput coefficient, wherein the second throughput coefficient is set to the smallest value among the first divided value and the second divided value. If it is larger, a step of generating core allocation information indicating that a thread for processing the variable having the second processing time as a processing time is allocated to the fixed core is executed, and the execution unit performs the analysis Produced by the department Was based on the core allocation information assigned to the second processing said core securing the thread to handle the variable time and the processing time, and executes a step of executing the program.
このような構成によれば、実測した値を用いて前記(1)〜(8)の処理を実行して変数のバリエーションを考慮した上で、キャッシュヒットによる効果が明らかな変数の処理のためのスレッドを特定している。例えば、前記(1)〜(5)の処理では、処理速度の向上のために、キャッシュヒットすることの効果の判定指標として、独立化判定値を算出している。そして、前記(6)〜(8)の処理では、独立化判定値によってキャッシュヒットすることの効果があると判定されたケースについて、スループット係数を算出して、前記効果を検証している。そして、前記検証結果に基づいて、そのスレッドを固定のコアに割り当てることができる。すなわち、変数のバリエーションを考慮しつつ、プロセッサの処理速度を向上することができる。 According to such a configuration, the processing of (1) to (8) described above is executed using the actually measured values to consider the variation of the variables, and the processing for processing variables that clearly show the effect of the cache hit. The thread is specified. For example, in the processes (1) to (5), an independence determination value is calculated as a determination index of the effect of a cache hit in order to improve the processing speed. In the processes (6) to (8), the throughput coefficient is calculated for the case where it is determined that there is an effect of the cache hit by the independence determination value, and the effect is verified. Based on the verification result, the thread can be assigned to a fixed core. That is, the processing speed of the processor can be improved while taking into account variable variations.
本発明は、前記記憶部が、前記CPUのコアのキャッシュサイズと、前記通常処理実行時に所定の周期で収集される、前記変数の、配列長、前記通常処理実行時に格納されるメモリのアドレス、およびデータサイズと、キャッシュヒット率の第2の閾値と、をさらに記憶しており、前記解析部が、前記変数について、前記記憶部から前記アドレスを読み出して異なるアドレスの数を集計した前記異なるアドレスの数と、前記記憶部から読み出した前記キャッシュサイズ、前記配列長、および前記データサイズとをパラメータとして、前記異なるアドレスの数の減少、前記配列長の減少、前記データサイズの減少、前記キャッシュサイズの増大、にしたがって大きな値となる前記キャッシュヒット率を算出する算出手段と、前記キャッシュヒット率が前記記憶部に記憶している前記第2の閾値より大きいか否かを判定する判定手段と、をさらに備え、前記解析部が、前記判定手段において前記キャッシュヒット率が前記第2の閾値より大きいと判定された場合、当該変数を、前記(1)および前記(2)の処理に用いる前記第1の変数として、前記(1)〜前記(8)の処理を実行することを特徴とする。 In the present invention, the storage unit collects the cache size of the core of the CPU, the array length of the variables collected at a predetermined period when the normal process is executed, the address of the memory stored when the normal process is executed, And the data size and the second threshold value of the cache hit rate, and the analysis unit reads the address from the storage unit and aggregates the number of different addresses for the variable. And the cache size read from the storage unit, the array length, and the data size as parameters, the number of different addresses decreases, the array length decreases, the data size decreases, the cache size Calculating means for calculating the cache hit rate, which increases as the value increases, and the cache hit rate. Determining means for determining whether or not the rate is greater than the second threshold value stored in the storage unit, wherein the analysis unit determines whether the cache hit rate is the second threshold value in the determination unit. When it is determined that the variable is larger, the variable (1) and the process (8) are executed as the first variable used in the processes (1) and (2). To do.
また、本発明は、前記プログラム実行装置が、前記CPUのコアのキャッシュサイズと、前記通常処理実行時に所定の周期で収集される、前記変数の、配列長、前記通常処理実行時に格納されるメモリのアドレス、およびデータサイズと、キャッシュヒット率の第2の閾値と、をさらに記憶している前記記憶部を備え、前記解析部が、前記変数について、前記記憶部から前記アドレスを読み出して異なるアドレスの数を集計した前記異なるアドレスの数と、前記記憶部から読み出した前記キャッシュサイズ、前記配列長、および前記データサイズとをパラメータとして、前記異なるアドレスの数の減少、前記配列長の減少、前記データサイズの減少、前記キャッシュサイズの増大、にしたがって大きな値となるキャッシュヒット率を算出する算出ステップ、前記キャッシュヒット率が前記記憶部に記憶している前記第2の閾値より大きいか否かを判定する判定ステップ、前記判定ステップにおいて前記キャッシュヒット率が前記第2の閾値より大きいと判定された場合、当該変数を、前記(1)および前記(2)の処理に用いる前記第1の変数として、前記(1)〜前記(8)の処理を実行するステップを実行することを特徴とする。 Further, the present invention provides the program execution device that stores the cache size of the CPU core, the array length of the variables, and the memory that is stored when the normal process is executed, that is collected at a predetermined period when the normal process is executed. And the data size and the second threshold value of the cache hit rate are stored in the storage unit, and the analysis unit reads out the address from the storage unit and outputs a different address for the variable. The number of different addresses, the number of different addresses, and the cache size read from the storage unit, the array length, and the data size are used as parameters to reduce the number of different addresses, decrease the array length, Calculate a cache hit rate that increases as the data size decreases and the cache size increases. Determining step of determining whether or not the cache hit rate is greater than the second threshold stored in the storage unit; and determining in the determination step that the cache hit rate is greater than the second threshold If so, the step of executing the processes of (1) to (8) is executed as the first variable used for the processes of (1) and (2). To do.
このような構成によれば、キャッシュヒット率に基づいて、前記(1)〜前記(8)の処理に用いる変数の候補を大まかに絞ることができる。したがって、特定のコアにスレッドを割り当て実行する変数を決定するために掛かる時間を短縮することができるので、短時間でプロセッサの処理速度の向上を図ることができる。 According to such a configuration, variable candidates used in the processes (1) to (8) can be roughly narrowed down based on the cache hit rate. Therefore, it is possible to reduce the time required to determine a variable to be executed by assigning a thread to a specific core, so that the processing speed of the processor can be improved in a short time.
本発明によれば、プロセッサの処理速度を向上する技術を提供することができる。 ADVANTAGE OF THE INVENTION According to this invention, the technique which improves the processing speed of a processor can be provided.
本発明を実施するための形態(以降、「本実施形態」と称す。)におけるプログラム実行装置は、プロセッサ上でのソフトウェアの処理速度を向上させるために、バリエーションが少ないデータを扱うスレッドを決定し、そのスレッドをマルチコアプロセッサのコアに固定的に割り当てつつ、パイプライン状(後記)に並列処理する構成を備えている。以下に、それらの構成および処理フローについて、適宜図面を参照しながら詳細に説明する。 A program execution device in a mode for carrying out the present invention (hereinafter referred to as “the present embodiment”) determines a thread that handles data with little variation in order to improve the processing speed of software on the processor. The thread is fixedly assigned to the core of the multi-core processor, and is configured to perform parallel processing in a pipeline shape (described later). Hereinafter, the configuration and the processing flow will be described in detail with reference to the drawings as appropriate.
本実施形態におけるプログラム実行装置の構成について、図1を用いて説明する。
図1に示すように、プログラム実行装置10は、ネットワーク20内に配置され、ネットワーク20に接続しているPC(Personal Computer)等の端末30(30A,30B,30C)との間で、情報を送受信可能になっている。プログラム実行装置10は、端末30からデプロイされたプログラムに基づいて、その処理動作が決定される。なお、プログラム実行装置10は、例えば、汎用コンピュータ、サーバ、ルータ等である。
プログラム実行装置10は、端末30Cからデプロイされたプログラムを受信し、そのプログラムを動作させて、端末30Aから受信したデータに処理を施し、端末30Bに処理後の処理データを送信する。
なお、図1では、端末30を3台しか記載していないが、4台以上がネットワーク20に接続していても構わない。
The configuration of the program execution device in this embodiment will be described with reference to FIG.
As shown in FIG. 1, the
The
Although only three
次に、プログラム実行装置10の構成例について説明する。
図1に示すように、プログラム実行装置10は、入力部11、実行部12、出力部13、解析部14、記憶部15、および受付部16を備える。プログラム実行装置10は、図示しないCPUおよびメインメモリによって構成される処理部(不図示)とアプリケーションプログラム等を記憶する記憶部15とで構成される。処理部は、記憶部15に記憶されているアプリケーションプログラムをメインメモリに展開して、実行部12および解析部14を具現化する。
Next, a configuration example of the
As shown in FIG. 1, the
入力部11は、通信インタフェースであり、端末30から処理用のデータを含むデータ情報を受信する。
実行部12は、解析部14によって生成されたプログラムのスレッドを記憶部15から取得して、その取得したスレッドを実行し、入力部11を介して取得したデータに対して、処理を実行する。
出力部13は、通信インタフェースであり、端末30へ処理結果をデータとして含むデータ情報を送信する。
The
The
The
解析部14は、端末30からデプロイされたプログラムをスレッドに分割するコンパイル処理を実行し、その分割したスレッド(分割プログラム)を記憶部15に記憶する。また、解析部14は、スレッドを、どのようにコアに割り当てるかを決定する処理を実行し、その割り当てに関するコア割当情報(後記)を記憶部15に記憶する。
受付部16は、通信インタフェースであり、端末30からデプロイされたプログラムを含むプログラム情報を受信する。なお、受付部16は、ネットワーク20を介さずに、端末30Cに通信ケーブルを介して直接接続するインタフェースであっても構わない。
記憶部15は、解析部14によって処理された結果等を記憶している。
The
The accepting
The
次に、プログラム実行装置10の処理シーケンス例について、図2を用いて説明する(適宜、図1参照)。
ステップS201では、端末30Cが、プログラム実行装置10に実行させるプログラムをプログラム実行装置10へデプロイ(送信)し、受付部16がそのプログラムを受け付ける。なお、プログラムは、逐次処理用のプログラムであっても構わない。
ステップS202では、受付部16が、記憶部15に受け付けたプログラムを記憶する。
ステップS203では、解析部14が、記憶部15からプログラムを取得する。この取得のタイミングは、例えば、新しくプログラムが記憶されたタイミングとする。
ステップS204では、解析部14が、コンパイラレベルの解析を実行する。具体的には、解析部14は、プログラムをコンパイルし、スレッドに分割した分割プログラムを生成する。
ステップS205では、解析部14は、解析結果(分割プログラム)を記憶部15に記憶する。
Next, a processing sequence example of the
In step S201, the
In step S <b> 202, the
In step S <b> 203, the
In step S204, the
In step S205, the
ステップS206では、実行部12が、記憶部15から、分割プログラムを取得する。この取得のタイミングは、例えば、新しく解析結果が記憶されたタイミングとする。そして、実行部12は、分割プログラムに基づいて、太線に示すように、通常処理(逐次処理)を実行状態にする。
ステップS207では、端末30Aが、データを含むデータ情報をプログラム実行装置10へ送信し、入力部11がそのデータ情報を受け付ける。
ステップS208では、実行部12が、入力部11を介してデータを取得する。
ステップS209では、実行部12が、取得したデータに対して、通常処理(逐次処理)を実行する。
ステップS210〜S211では、実行部12が、出力部13を介して、処理結果を含むデータ情報を端末30Bへ出力する。
In step S <b> 206, the
In step S207, the terminal 30A transmits data information including data to the
In step S <b> 208, the
In step S209, the
In steps S210 to S211, the
ステップS212では、実行部12が、予め設定された周期ごとに、通常処理によって処理したデータの処理経過状況および処理開始時刻を、解析用データとして収集し、記憶部15に記憶する。処理経過状況とは、例えば、プログラムに記述されている関数の引数(変数)のデータサイズ、その変数が格納されたメモリ上のアドレス等である。例えば変数が配列になっている場合は、配列長×各要素のデータサイズが、変数としてのデータサイズになる。処理開始時刻とは、例えば、その変数について処理が開始された時刻である。
ステップS213では、解析部14が、記憶部15に記憶された解析用データを取得する。
ステップS214では、解析部14が、記憶部15に記憶されている解析用データを読み出して、解析する。この解析によって、高速処理を実施できるか否かを判定し、高速処理を実施できると判定した場合に、どのスレッドをコアに占有して割り当てるかを表すコア割当情報を作成する。なお、解析部14は、高速処理を実施できないと判定した場合には、コア割当情報を作成しない。
In step S <b> 212, the
In step S <b> 213, the
In step S214, the
ステップS215では、解析部14が、ステップS214において作成したコア割当情報を記憶部15に記憶する。なお、解析部14は、高速処理を実施できないと判定した場合に、既に記憶部15にコア割当情報が記憶されているとき、当該コア割当情報を消去する。
ステップS216では、実行部12が、記憶部15から、コア割当情報を取得する。そして、実行部12は、当該コア割当情報に基づいて、太い点線に示すように、高速処理(コア占有処理)を実行状態にする。なお、記憶部15にコア割当情報が記憶されていない場合には、高速処理(コア占有処理)は実行状態とならず、通常処理(逐次処理)を継続することになる。
In step S215, the
In step S <b> 216, the
ステップS217では、端末30Aが、データを含むデータ情報をプログラム実行装置10へ送信し、入力部11がそのデータ情報を受け付ける。
ステップS218では、実行部12が、入力部11を介してデータを取得する。
ステップS219では、実行部12が、取得したデータに対して、高速処理(コア占有処理)を実行する。
ステップS220〜S221では、実行部12が、出力部13を介して、処理結果を含むデータ情報を端末30Bへ出力する。
In step S217, terminal 30A transmits data information including data to program
In step S218, the
In step S219, the
In steps S220 to S221, the
なお、ステップS214における解析部14は、記憶部15から、少なくとも繰返し2回以上の解析用データを取得した上で、その解析用データに対して統計処理を施して平均値を算出する等の前処理を行った後、解析を行うことが好ましい。
The
ここで、図2のステップS212において、実行部12が解析用データを収集する方法の一例について、図3を用いて説明する。
図3の左側は、プログラムの一例を示している。ただし、プログラム言語は、限定されなくてもよい。プログラム中の実行文および変数に対して、処理経過状況および処理開始時刻を収集する動作を有する指定子(図3では、analyzeと表している。)が付加される。そして、実行部12は、この指定子に基づいて、プログラムに記述されている関数の変数のデータサイズ(変数が配列の場合は配列長×各要素のデータサイズ)、その変数が格納されたアドレス、および処理開始時刻を予め設定された周期で収集する。
Here, an example of a method in which the
The left side of FIG. 3 shows an example of the program. However, the programming language need not be limited. A specifier (represented as “analyze” in FIG. 3) having an operation of collecting the processing progress status and the processing start time is added to the executable statement and variable in the program. Based on this specifier, the
図3の右側は、収集結果の例を示している。本実施形態では、配列(例えば、a0,a1等)の要素数や木の葉数(例えば、tree0,tree1等)が計測可能なデータ構造を収集対象としているが、これに限られることはなく、規模が計測可能なものであれば、他の要素であっても構わない。なお、以降の説明では、木構造は配列で表現することができるので、木と配列とを区別せずに、配列と表記することにする。
図3に示すように、配列の配列長(配列の要素の数)、配列の各要素のデータサイズ、キャッシュヒット(hitと表示)であったか、キャッシュミス(missと表示)であったか、処理開始時刻、通常処理(逐次処理)の中で呼び出しているアドレス、および配列のデータサイズを集計対象としている。
The right side of FIG. 3 shows an example of the collection result. In the present embodiment, a data structure that can measure the number of elements of an array (for example, a0, a1, etc.) and the number of leaves of a tree (for example, tree0, tree1, etc.) is a collection target. Other elements may be used as long as can be measured. In the following description, the tree structure can be expressed as an array, so that the tree and the array are not distinguished from each other and are described as an array.
As shown in FIG. 3, whether the array length (number of elements in the array), the data size of each element in the array, a cache hit (displayed as hit), a cache miss (displayed as miss), or the processing start time The addresses called during normal processing (sequential processing) and the data size of the array are to be counted.
次に、図2のステップS214における解析部14の処理フローについて、図4を用いて説明する(適宜、図2,3参照)。
ステップS401では、解析部14は、記憶部15に記憶されている解析用データを取得する。そして、解析部14は、解析用データに統計処理を施して、解析用データのうち異なるアドレスの数(Kと表記)を集計し、配列長の平均値(Lと表記)、各要素のデータサイズの平均値(Eと表記)を算出する。また、解析部14は、プログラム実行装置10のシステム情報(不図示)等から、コアのキャッシュサイズCを取得する。
Next, the processing flow of the
In step S <b> 401, the
ステップS402では、解析部14は、キャッシュヒット係数P(=(1/K+1/L)×C/E)を算出する。ここで、キャッシュヒット係数Pの特性について、以下に説明する。例えば、キャッシュヒット係数Pは、Kが大きい場合、すなわち、演算するたびに毎回異なるアドレスとなる場合には、スレッドが使用するアドレス領域が広いため、L2キャッシュにヒットする確率も小さくなると考えられ、値として小さくなるように見積もる。また、キャッシュヒット係数Pは、Lが大きい場合に関しても、該当箇所の処理が扱うデータがL2キャッシュに入りきらない可能性が高くなるため、値として小さくなるように見積もる。また同様に、キャッシュヒット係数Pは、Eが大きい場合にも、該当箇所の処理が扱うデータがL2キャッシュに入りきらない可能性が高くなるため、値として小さくなるように見積もる。また、キャッシュヒット係数Pは、Cが大きいほど、該当箇所の処理が扱うデータのL2キャッシュに入りきる可能性が高くなるため、値として大きくなるように見積もる。すなわち、キャッシュヒット係数Pを用いることで、スレッド処理化した際にキャッシュに収まり得るデータを扱う処理箇所の候補を、大まかに抽出することができる。
In step S402, the
ステップS403では、解析部14は、キャッシュヒット係数Pが予め設定してある閾値Th0(第2の閾値)より大きいか否かを判定する。なお、閾値Th0(第2の閾値)は、独立化処理を分類するための閾値であり、記憶部15に記憶されている。
そして、Pが閾値Th0(第2の閾値)より大きい場合(ステップS403でYes)には、ステップS404では、解析部14は、その指定子の振られた処理を独立化処理(コアに占有して割り当てて実行する処理)の候補に設定する。
また、Pが閾値Th0(第2の閾値)以下の場合(ステップS403でNo)には、処理はステップS413へ進む。
このステップS401〜S404の処理は、独立化処理のスレッドを確定するための前処理であって、独立化処理に当てはまらないものを大まかに振るい落とす効果がある。すなわち、独立化処理のスレッドを確定するためのステップS405以降の処理時間を短縮する効果もある。したがって、変数が少ない場合等には、ステップS401〜S404の処理を省略することも可能である。
In step S403, the
If P is greater than the threshold value Th0 (second threshold value) (Yes in step S403), in step S404, the
If P is equal to or less than the threshold Th0 (second threshold) (No in step S403), the process proceeds to step S413.
The processes in steps S401 to S404 are pre-processes for determining the thread of the independence process, and have the effect of roughly shaking out items that do not apply to the independence process. That is, there is an effect of shortening the processing time after step S405 for determining the thread of the independence processing. Therefore, when there are few variables, the processing in steps S401 to S404 can be omitted.
ステップS405では、解析部14は、独立化処理の候補について、記憶部15に記憶している解析用データ中から処理開始時刻を読み出して、独立化判定値Fを算出する。ただし、F=通常処理時の処理時間M/キャッシュヒット時の処理時間Hである。
ここで、その処理の具体例について、図5を用いて説明する。
In step S405, the
Here, a specific example of the processing will be described with reference to FIG.
図5(a)の上段は、通常処理における指定子の振られた処理[a1]の処理時間を表している。すなわち、処理[a1]の処理開始時刻(=101001)から処理[a2]の処理開始時刻(=101250)までの時間を、通常処理における指定子の振られた処理時間(M)として表す。図5(a)では、そのMの値は「249」である。なお、Mの値は、キャッシュヒットおよびキャッシュミスのいずれであっても区別せずに、統計処理によって算出される。例えば、Mの値は、平均値である。
次に、図5(a)の下段は、キャッシュヒットした場合の処理[a1]の処理時間を表している。すなわち、処理[a1]の処理開始時刻(=318741)から処理[a2]の処理開始時刻(=318806)までの時間を、キャッシュヒットした場合の処理時間(H)として表す。図5(a)では、そのHの値は「55」である。なお、Hの値は、キャッシュヒットした場合の処理時間のみを対象として、統計処理によって算出される。例えば、Hの値は、平均値である。
そして、図5(a)のケースでは、独立化判定値Fは、M/H=249/55=4.53として求まる。
The upper part of FIG. 5A represents the processing time of the assigned process [a1] in the normal process. That is, the time from the process start time (= 101001) of the process [a1] to the process start time (= 101250) of the process [a2] is expressed as a process time (M) with a specifier assigned in the normal process. In FIG. 5A, the value of M is “249”. Note that the value of M is calculated by statistical processing without distinguishing whether it is a cache hit or a cache miss. For example, the value of M is an average value.
Next, the lower part of FIG. 5A represents the processing time of the process [a1] when a cache hit occurs. That is, the time from the process start time (= 318741) of process [a1] to the process start time (= 318806) of process [a2] is represented as the process time (H) when a cache hit occurs. In FIG. 5A, the value of H is “55”. Note that the value of H is calculated by statistical processing only for the processing time when a cache hit occurs. For example, the value of H is an average value.
In the case of FIG. 5A, the independence determination value F is obtained as M / H = 249/55 = 4.53.
また、図5(b)の上段は、通常処理における指定子の振られた処理[a2]の処理時間を表している。すなわち、処理[a2]の処理開始時刻(=101250)から処理[a3]の処理開始時刻(=101510)までの時間を、通常処理における指定子の振られた処理時間(M)として表す。図5(b)では、そのMの値は「260」である。
次に、図5(b)の下段は、キャッシュヒットした場合の処理[a2]の処理時間を表している。すなわち、処理[a2]の処理開始時刻(=318806)から処理[a3]の処理開始時刻(=318846)までの時間を、キャッシュヒットした場合の処理時間(H)として表す。図5(b)では、そのHの値は「40」である。
そして、図5(b)のケースでは、独立化判定値Fは、M/H=260/40=6.5として求まる。
Further, the upper part of FIG. 5B represents the processing time of the process [a2] assigned with the specifier in the normal process. That is, the time from the process start time (= 101250) of the process [a2] to the process start time (= 101510) of the process [a3] is expressed as a process time (M) in which the specifier is assigned in the normal process. In FIG. 5B, the value of M is “260”.
Next, the lower part of FIG. 5B represents the processing time of the process [a2] when a cache hit occurs. That is, the time from the process start time (= 318806) of process [a2] to the process start time (= 318846) of process [a3] is represented as the process time (H) when a cache hit occurs. In FIG. 5B, the value of H is “40”.
In the case of FIG. 5B, the independence determination value F is obtained as M / H = 260/40 = 6.5.
図4へ戻って、ステップS406では、解析部14は、独立化処理の候補の処理に含まれるスレッド数を閾値として、独立化判定値Fが、当該閾値より大きいか否かを判定する。なお、この閾値は、ステップS204のコンパイラレベルの解析において算出され、ステップS205の解析結果(分割プログラム)とともに記憶部15に記憶される。
例えば、図5に示す例において、閾値が5である場合には、図5(a)の場合は、独立化判定値F=4.53<閾値(=5)であるので、独立化処理にしないと判定する。また、図5(b)の場合は、独立化判定値F=6.5>閾値(=5)であるので、独立化処理にすると判定する。
すなわち、この判定では、独立化判定値F=閾値の場合は、元の並列度倍の高速化となることを意味している。そして、独立化判定値F>閾値の場合であれば、独立化処理の候補は、1コアで捌ききることができ、コアを占有させる効果(処理速度の向上)を期待できる。
Returning to FIG. 4, in step S <b> 406, the
For example, in the example shown in FIG. 5, when the threshold value is 5, in the case of FIG. 5A, the independence determination value F = 4.53 <threshold value (= 5). Judge that not. In the case of FIG. 5B, since the independence determination value F = 6.5> threshold (= 5), it is determined that the independence processing is performed.
That is, in this determination, when the independence determination value F = the threshold value, it means that the speed is increased to double the original degree of parallelism. If independence determination value F> threshold value, candidates for independence processing can be handled by one core, and an effect of occupying the core (an improvement in processing speed) can be expected.
ステップS406において、独立化判定値Fが閾値以下の場合(ステップS406でNo)、処理はステップS413へ進む。
また、独立化判定値Fが閾値より大きい場合(ステップS406でNo)、ステップS407では、解析部14は、当該候補を独立化処理に確定する。なお、独立化判定値Fが閾値より大きい場合は、確定した独立化処理におけるスレッドは、キャッシュ内に収まり得るデータを扱う高速処理可能なスレッドとなっている。
If the independence determination value F is equal to or smaller than the threshold value in step S406 (No in step S406), the process proceeds to step S413.
If the independence determination value F is greater than the threshold (No in step S406), in step S407, the
ステップS408では、解析部14は、独立化処理が連続、かつPが予め設定された所定の閾値(Th1)より小さいか、またはそうでないかを判定する。なお、閾値(Th1)は、独立化処理を連結するか否かの判定に用いる閾値であり、記憶部15に記憶されている。
独立化処理が連続しており、かつPが予め設定された所定の閾値(Th1)より小さいと判定された場合(ステップS408でYes)、ステップS409では、解析部14は、連続する独立化処理を1つの独立化処理にまとめる。閾値(Th1)に充分小さい値を設定した場合、その閾値(Th1)より小さくなるということは、1つのコアにおけるL2キャッシュのサイズで領域が余り得ることを示唆している。したがって、このような独立化領域が連続する限り分割をせずに1つのスレッドとする。このような処理を行うことで、スレッドの粒度を大きくすることによって、パイプライン処理(後記)で発生し得るデメリットを低減できるようになる。すなわち、パイプライン処理において、処理間でのデータの入出力の調整のために設けられるキューにおける待ち時間を小さくすることができる。つまり、処理速度を向上させることができる。
また、ステップS408でNoの場合、処理は、ステップS409をスキップして、ステップS410へ進む。
In step S408, the
When it is determined that the independence process is continuous and P is smaller than a predetermined threshold (Th1) set in advance (Yes in step S408), in step S409, the
Also, in the case of No in step S408, the process skips step S409 and proceeds to step S410.
ステップS410では、解析部14は、独立化処理について、スループット係数THを算出する。
スループット係数THの算出の具体例について、図6を用いて説明する。なお、図6の例では、プロセッサのコアが16であるとし、1コアに1スレッドを割り当てるものとする。
図6の上段は、通常処理(16スレッド使用)における処理時間と、コア占有処理の場合における処理時間とを示している。なお、コア占有処理とは、CPUのコアを、独立化処理を占有的に配置する領域と、それ以外の領域とに分けてスレッドを割り当てるようにしたものである。例えば、図6の左下の図のように、1つの独立化処理を、1つの占有コア(斜め線を付したコア)に固定的に配置する。そして、それ以外の処理は、通常処理の分割スレッド用コアの領域(斜め線を付していないコア)に、特に制限なくスレッド配置するものとする。また、コア占有処理を用いる場合には、独立化処理と通常処理(分割スレッド処理)とが混在するため、図6中の右下に示す、パイプライン状に分割された処理が実行される。
In step S410, the
A specific example of calculating the throughput coefficient TH will be described with reference to FIG. In the example of FIG. 6, it is assumed that the number of cores of the processor is 16, and one thread is allocated to one core.
The upper part of FIG. 6 shows the processing time in normal processing (using 16 threads) and the processing time in the case of core occupation processing. The core occupying process is a process in which threads of a CPU core are allocated to an area where an independent process is exclusively arranged and an area other than that. For example, as shown in the lower left diagram of FIG. 6, one independence process is fixedly arranged on one occupied core (core with diagonal lines). In other processes, the threads are arranged without limitation in the area of the split thread core for normal processing (the core without diagonal lines). Further, when using the core occupancy process, the independence process and the normal process (divided thread process) are mixed, so the process divided in the pipeline shape shown in the lower right in FIG. 6 is executed.
このパイプライン状の処理は、分割したスレッドごとに、独立に次々に処理を実行していくため、並列処理を実行することができ、処理速度を向上させることができる。例えば、公知例(Matt Welsh, etal.,「SEDA:An Architecture for Well-Conditioned, Scalable Internet Services」,SOSP2001, October, 2001)に開示されている方法を用いて行うことができる。そこで、本実施形態では、コア占有処理を実行する場合に、図6に示すように、パイプライン状の処理を適用する。 Since this pipeline-like process is executed independently for each divided thread, parallel processing can be executed and the processing speed can be improved. For example, it can be performed using a method disclosed in a known example (Matt Welsh, et al., “SEDA: An Architecture for Well-Conditioned, Scalable Internet Services”, SOSP2001, October, 2001). Therefore, in the present embodiment, when executing the core occupancy process, a pipeline-like process is applied as shown in FIG.
図6に示すように、指定子の振られた処理b0,b1,b2,b3,b4について、通常処理における処理時間は、それぞれ、80,90,80,100である。それに対して、コア占有処理における処理時間は、独立化処理スレッド0および独立化処理スレッド2をそれぞれ占有コアに割り当てて処理を行うことを想定した場合、接続遅延(処理間でのデータの入出力の調整のための待ち時間)を5と仮定すると、それぞれ5,5,90,5,5,5,100である。なお、独立化処理スレッドの処理時間には、キャッシュヒットした場合の処理時間を用いる。
ここで、スループット係数THは、コア数Cと、処理時間の合計Tとを用いて、コア数Cを処理時間の合計Tで除算する演算によって算出することができる。なお、コア数Cは、記憶部15に記憶されている。
通常処理の場合のスループット係数THは、C/T=(16−0)/(80+90+80+100)=0.046となる。また、コア占有処理の場合のスループット係数THは、C/T=min{1/(5(スレッド0)+5(接続遅延))=0.1,1/(5(スレッド2)+5(接続遅延))=0.1,(16−2)/(90(スレッド1)+5(接続遅延)+100(スレッド3))=0.072}=0.072となる。ただし、minは、最小値を選択する関数である。この関数は、コア割り当てをした際に最もボトルネックとなる箇所が、最終的なスループットとなることを決定している。この例では、コア占有側ではない方でボトルネックが発生していることが分かる。
As shown in FIG. 6, the processing times in the normal processing are 80, 90, 80, and 100 for the processing b0, b1, b2, b3, and b4 assigned with the specifiers, respectively. On the other hand, the processing time in the core occupancy processing is assumed to be a connection delay (input / output of data between processes) assuming that the processing is performed by allocating the independent processing thread 0 and the independent processing thread 2 to the dedicated core. Assuming that the waiting time for the adjustment is 5 is 5, 5, 90, 5, 5, 5, 100, respectively. Note that the processing time when a cache hit occurs is used as the processing time of the independent processing thread.
Here, the throughput coefficient TH can be calculated by an operation of dividing the number of cores C by the total processing time T using the number of cores C and the total processing time T. The core number C is stored in the
The throughput coefficient TH in the case of normal processing is C / T = (16−0) / (80 + 90 + 80 + 100) = 0.046. The throughput coefficient TH in the case of core occupation processing is C / T = min {1 / (5 (thread 0) +5 (connection delay)) = 0.1, 1 / (5 (thread 2) +5 (connection delay). )) = 0.1, (16-2) / (90 (thread 1) +5 (connection delay) +100 (thread 3)) = 0.072} = 0.072. Here, min is a function for selecting the minimum value. This function determines that the most bottleneck when assigning cores is the final throughput. In this example, it can be seen that a bottleneck has occurred on the side that is not on the core occupation side.
図4へ戻って、ステップS411では、解析部14は、コア占有処理のスループット係数THが通常処理のスループット係数THより大きいか否かを判定する。
コア占有処理のスループット係数THが通常処理のスループット係数THより大きい場合(ステップS411でYes)、ステップS412では、解析部14は、コア占有処理(高速処理)のために、前記したコア割当情報を記憶部15に記憶する。
また、コア占有処理のスループット係数THが通常処理のスループット係数TH以下の場合(ステップS411でNo)、ステップS413では、解析部14は、通常処理のために、コア割当情報を記憶部15から消去する。なお、ステップS413において、記憶部15にコア割当情報が記憶されていない状態であれば、解析部14は、消去処理を行わない。
Returning to FIG. 4, in step S411, the
When the throughput coefficient TH of the core occupation process is larger than the throughput coefficient TH of the normal process (Yes in step S411), in step S412, the
If the throughput coefficient TH of the core occupation process is equal to or less than the throughput coefficient TH of the normal process (No in step S411), in step S413, the
以上、本実施形態で説明したプログラム実行装置10は、プロセッサの処理速度を向上させるように、スレッドを固定的に特定のコア(占有コア)に割り当てて実行させる独立化処理を決定する解析部14を備えている。具体的には、解析部14は、図4のステップS403において、キャッシュヒット係数Pを算出して、閾値と比較し、独立化処理の候補を絞る。解析部14は、図4のステップS406では、独立化判定値Fを算出して、閾値と比較し、候補の中から独立化処理を確定する。図4のステップS411では、解析部14は、スループット係数THを算出して、コア占有処理の方が通常処理よりスループット係数THが大きい場合に、コア占有処理を実行させるためのコア割当情報を作成する。そして、実行部12は、そのコア割当情報に基づいて、コア割当処理(高速処理)を実行する。したがって、本実施形態におけるプログラム実行装置10は、処理速度を向上させることができる。また、パイプライン状の処理を用いることによって、分割したスレッドごとに、独立に次々に処理を実行していくため、処理を並列に実行することができ、さらに処理速度を向上させることができる。
As described above, the
ここで、プログラム実行装置10を呼処理に適用した例について、図7を用いて説明する。
図7に示すように、サーバまたはルータ50がネットワーク20内に配置されている。サーバまたはルータ50は、ネットワーク20に接続している端末30Aから接続要求を受け付けて、呼処理を行って、接続先の端末30Bに接続要求を送信する。
図7では、サーバまたはルータ50は、負荷分散装置40と2台以上のプログラム実行装置10とを備え、プログラム実行装置10同士が並列に呼処理を実行する構成を備えている。なお、ネットワーク20の管理者が操作する管理端末31は、プログラム実行装置10に対して、プログラムをデプロイするために用いられる。そして、プログラム実行装置10は、デプロイされたプログラムに対して、前記した通常処理および高速処理を実行する。
Here, an example in which the
As shown in FIG. 7, a server or router 50 is arranged in the
In FIG. 7, the server or router 50 includes a
なお、従来の呼処理のプログラムは、一般的に繰返し演算が少なく、逐次処理用に生成されている。したがって、呼処理は、スレッドがキャッシュヒットしたかどうかによって、処理速度が大きく異なっていた。それに対して、管理者等によってデプロイされたプログラムをプログラム実行装置10に適用することによって、安定して高速処理を実現させることができる。また、2台以上のプログラム実行装置10に対して、それぞれ担当する処理を決めておいて、それぞれのプログラム実行装置10に跨ってパイプライン状に並列処理させることによって、分散かつ並列度を高めることができ、処理速度を向上させることができる。
Note that conventional call processing programs generally have few repetitive calculations and are generated for sequential processing. Therefore, the call processing has a large processing speed depending on whether or not the thread hits the cache. On the other hand, by applying a program deployed by an administrator or the like to the
10 プログラム実行装置
12 実行部
14 解析部
15 記憶部
E データサイズ
F 独立化判定値
H キャッシュヒット時の処理時間
K 異なるアドレスの数
L 配列長
M 通常処理時の処理時間
P キャッシュヒット係数
TH スループット係数
Th0 閾値(第2の閾値)
Th1 閾値
DESCRIPTION OF
Th1 threshold
Claims (4)
任意の前記コアに任意の前記スレッドを割り当てて前記プログラムの処理を行う通常処理の実行時に所定の周期で収集される、前記プログラムに記述されている変数の処理開始時刻と、その変数の処理がキャッシュヒットしたことを示すキャッシュヒット情報と、を関連付けて記憶しているとともに、前記CPUのコア数と、キャッシュヒットの効果の判定に用いる閾値とを記憶している記憶部と、
(1)前記変数の中の第1の変数の前記処理開始時刻およびその第1の変数の次に処理される第2の変数の前記処理開始時刻を読み出して差分を算出し、収集された回数分の前記差分の平均値を算出し、その算出した平均値を第1の処理時間とし、
(2)前記変数の中の、前記キャッシュヒット情報が関連付けられた前記第1の変数の前記処理開始時刻および当該第1の変数の次に処理される第2の変数の前記処理開始時刻を読み出して差分を算出し、収集された回数分の前記差分の平均値を算出し、その算出した平均値を第2の処理時間とし、
(3)前記第1の処理時間を前記第2の処理時間で除算して、独立化判定値を算出し、
(4)前記独立化判定値が前記第1の変数の処理に用いるスレッド数を示す前記閾値より大きいか否かを判定し、その判定結果において大きいという判定の場合に、前記第1の変数の前記処理時間を前記第2の処理時間とし、その判定結果において否という判定の場合に、前記第1の変数の前記処理時間を前記第1の処理時間とし、
(5)前記(1)〜前記(4)の処理を前記プログラムの変数について実行し、
(6)前記CPUのコア数を、前記通常処理の実行時の前記プログラムの前記変数について前記第1の処理時間を合計した合計値で除算し、その値を第1のスループット係数とし、
(7)前記CPUの1つのコアに、前記第2の処理時間を処理時間とする1つの前記変数の処理を実行させるように割り当てたときのスループットを、コア数の1を分子とし、前記第2の処理時間と当該変数の処理から次の処理までの待ち時間との合算値を分母とする第1の除算値を算出し、前記CPUのコア数から前記第2の処理時間を処理時間とする前記変数の数を減算して、その減算値を分子とし、前記プログラムの前記変数の中から前記第2の処理時間とならなかった前記変数の前記第1の処理時間と当該変数の処理の次の処理までの待ち時間との合計値を分母とする第2の除算値を算出し、前記第1の除算値および前記第2の除算値の中で最も小さい値を第2のスループット係数とし、
(8)前記第2のスループット係数が前記第1のスループット係数より大きい場合、前記第2の処理時間を処理時間とする前記変数を処理するスレッドを固定の前記コアに割り当てることを示したコア割当情報を生成する解析部と、
前記解析部によって生成された前記コア割当情報に基づいて、前記第2の処理時間を処理時間とする前記変数を処理するスレッドを固定の前記コアに割り当てて、前記プログラムを実行する実行部と
を備えることを特徴とするプログラム実行装置。 A program execution device that divides a program into threads, assigns each of the threads to a core that constitutes a CPU (Central Processing Unit), and executes the program,
A process start time of a variable described in the program, which is collected at a predetermined period during execution of a normal process for assigning an arbitrary thread to an arbitrary core and executing the process of the program, and processing of the variable Cache hit information indicating that a cache hit has been associated and stored, and a storage unit storing the number of cores of the CPU and a threshold used for determining the effect of the cache hit;
(1) The number of times the processing start time of the first variable of the variables and the processing start time of the second variable processed next to the first variable are read to calculate the difference and collected An average value of the difference in minutes, and the calculated average value as the first processing time,
(2) Among the variables, the processing start time of the first variable associated with the cache hit information and the processing start time of the second variable processed next to the first variable are read. The difference is calculated, the average value of the difference of the collected number of times is calculated, and the calculated average value is set as the second processing time.
(3) dividing the first processing time by the second processing time to calculate an independence determination value;
(4) It is determined whether or not the independence determination value is larger than the threshold value indicating the number of threads used for the processing of the first variable, and in the case of determination that the determination result is large, The processing time is the second processing time, and if the determination result is NO, the processing time of the first variable is the first processing time,
(5) The processes (1) to (4) are executed for the variables of the program,
(6) The number of cores of the CPU is divided by a total value obtained by summing up the first processing times for the variables of the program at the time of execution of the normal processing, and the value is set as a first throughput coefficient,
(7) The throughput when one core of the CPU is assigned to execute the processing of the one variable with the second processing time as the processing time is defined as a numerator of 1 of the number of cores. A first division value having a sum of a processing time of 2 and a waiting time from the processing of the variable to the next processing as a denominator, and calculating the second processing time from the number of cores of the CPU as a processing time. Subtracting the number of variables to be used, and using the subtracted value as a numerator, the first processing time of the variable that did not become the second processing time among the variables of the program and the processing of the variable A second division value with the total value of the waiting time until the next processing as a denominator is calculated, and the smallest value among the first division value and the second division value is set as a second throughput factor. ,
(8) Core assignment indicating that a thread for processing the variable having the second processing time as a processing time is assigned to the fixed core when the second throughput coefficient is larger than the first throughput coefficient An analysis unit for generating information;
Based on the core allocation information generated by the analysis unit, an execution unit that allocates a thread for processing the variable having the second processing time as a processing time to the fixed core and executes the program A program execution device comprising:
前記解析部は、
前記変数について、前記記憶部から前記アドレスを読み出して異なるアドレスの数を集計した前記異なるアドレスの数と、前記記憶部から読み出した前記キャッシュサイズ、前記配列長、および前記データサイズとをパラメータとして、前記異なるアドレスの数の減少、前記配列長の減少、前記データサイズの減少、前記キャッシュサイズの増大、にしたがって大きな値となる前記キャッシュヒット率を算出する算出手段と、
前記キャッシュヒット率が前記記憶部に記憶している前記第2の閾値より大きいか否かを判定する判定手段と、
をさらに備え、
前記解析部は、
前記判定手段において前記キャッシュヒット率が前記第2の閾値より大きいと判定された場合、当該変数を、前記(1)および前記(2)の処理に用いる前記第1の変数として、前記(1)〜前記(8)の処理を実行する
ことを特徴とする請求項1に記載のプログラム実行装置。 The storage unit includes a cache size of the core of the CPU, an array length of the variables, an address of a memory stored during execution of the normal process, and a data size collected at a predetermined period when the normal process is executed. , Further storing a second threshold value of the cache hit rate,
The analysis unit
For the variable, the number of different addresses obtained by reading the address from the storage unit and totaling the number of different addresses, the cache size read from the storage unit, the array length, and the data size as parameters, A calculation means for calculating the cache hit ratio that becomes a large value in accordance with a decrease in the number of different addresses, a decrease in the array length, a decrease in the data size, and an increase in the cache size;
Determining means for determining whether or not the cache hit rate is greater than the second threshold stored in the storage unit;
Further comprising
The analysis unit
When the determination unit determines that the cache hit rate is greater than the second threshold, the variable is set as the first variable used in the processes (1) and (2). The program execution device according to claim 1, wherein the processing (8) is executed.
前記プログラム実行装置は、
任意の前記コアに任意の前記スレッドを割り当てて前記プログラムの処理を行う通常処理の実行時に所定の周期で収集される、前記プログラムに記述されている変数の処理開始時刻と、その変数の処理がキャッシュヒットしたことを示すキャッシュヒット情報と、を関連付けて記憶しているとともに、前記CPUのコア数と、キャッシュヒットの効果の判定に用いる閾値とを記憶している記憶部と、解析部と、実行部と、を備え、
前記解析部は、
(1)前記変数の中の第1の変数の前記処理開始時刻およびその第1の変数の次に処理される第2の変数の前記処理開始時刻を読み出して差分を算出し、収集された回数分の前記差分の平均値を算出し、その算出した平均値を第1の処理時間とするステップ、
(2)前記変数の中の、前記キャッシュヒット情報が関連付けられた前記第1の変数の前記処理開始時刻および当該第1の変数の次に処理される第2の変数の前記処理開始時刻を読み出して差分を算出し、収集された回数分の前記差分の平均値を算出し、その算出した平均値を第2の処理時間とするステップ、
(3)前記第1の処理時間を前記第2の処理時間で除算して、独立化判定値を算出するステップ、
(4)前記独立化判定値が前記第1の変数の処理に用いるスレッド数を示す前記閾値より大きいか否かを判定し、その判定結果において大きいという判定の場合に、前記第1の変数の前記処理時間を前記第2の処理時間とし、その判定結果において否という判定の場合に、前記第1の変数の前記処理時間を前記第1の処理時間とするステップ、
(5)前記(1)〜前記(4)の処理を前記プログラムの変数について実行するステップ、
(6)前記CPUのコア数を、前記通常処理の実行時の前記プログラムの前記変数について前記第1の処理時間を合計した合計値で除算し、その値を第1のスループット係数とするステップ、
(7)前記CPUの1つのコアに、前記第2の処理時間を処理時間とする1つの前記変数の処理を実行させるように割り当てたときのスループットを、コア数の1を分子とし、前記第2の処理時間と当該変数の処理から次の処理までの待ち時間との合算値を分母とする第1の除算値を算出し、前記CPUのコア数から前記第2の処理時間を処理時間とする前記変数の数を減算して、その減算値を分子とし、前記プログラムの前記変数の中から前記第2の処理時間とならなかった前記変数の前記第1の処理時間と当該変数の処理の次の処理までの待ち時間との合計値を分母とする第2の除算値を算出し、前記第1の除算値および前記第2の除算値の中で最も小さい値を第2のスループット係数とするステップ、
(8)前記第2のスループット係数が前記第1のスループット係数より大きい場合、前記第2の処理時間を処理時間とする前記変数を処理するスレッドを固定の前記コアに割り当てることを示したコア割当情報を生成するステップ、
を実行し、
前記実行部は、
前記解析部によって生成された前記コア割当情報に基づいて、前記第2の処理時間を処理時間とする前記変数を処理するスレッドを固定の前記コアに割り当てて、前記プログラムを実行するステップ
を実行することを特徴とするプログラム実行方法。 A program execution method used in a program execution device that divides a program into threads, assigns each of the threads to a core that constitutes a CPU, and executes the program,
The program execution device includes:
A process start time of a variable described in the program, which is collected at a predetermined period during execution of a normal process for assigning an arbitrary thread to an arbitrary core and executing the process of the program, and processing of the variable Cache hit information indicating that a cache hit has been associated and stored, a storage unit storing the number of cores of the CPU, and a threshold value used for determining the effect of the cache hit, an analysis unit, An execution unit, and
The analysis unit
(1) The number of times the processing start time of the first variable of the variables and the processing start time of the second variable processed next to the first variable are read to calculate the difference and collected Calculating an average value of the difference in minutes, and setting the calculated average value as a first processing time;
(2) Among the variables, the processing start time of the first variable associated with the cache hit information and the processing start time of the second variable processed next to the first variable are read. Calculating a difference, calculating an average value of the difference for the collected number of times, and setting the calculated average value as a second processing time;
(3) calculating an independence determination value by dividing the first processing time by the second processing time;
(4) It is determined whether or not the independence determination value is larger than the threshold value indicating the number of threads used for the processing of the first variable, and in the case of determination that the determination result is large, The processing time as the second processing time, and in the case of a determination of NO in the determination result, the processing time of the first variable as the first processing time;
(5) A step of executing the processes of (1) to (4) for the variables of the program,
(6) dividing the number of cores of the CPU by a total value obtained by summing up the first processing times for the variables of the program at the time of execution of the normal processing, and setting the value as a first throughput coefficient;
(7) The throughput when one core of the CPU is assigned to execute the processing of the one variable with the second processing time as the processing time is defined as a numerator of 1 of the number of cores. A first division value having a sum of a processing time of 2 and a waiting time from the processing of the variable to the next processing as a denominator, and calculating the second processing time from the number of cores of the CPU as a processing time. Subtracting the number of variables to be used, and using the subtracted value as a numerator, the first processing time of the variable that did not become the second processing time among the variables of the program and the processing of the variable A second division value with a total value of a waiting time until the next processing as a denominator is calculated, and the smallest value among the first division value and the second division value is set as a second throughput coefficient. Step to do,
(8) Core assignment indicating that a thread for processing the variable having the second processing time as a processing time is assigned to the fixed core when the second throughput coefficient is larger than the first throughput coefficient Generating information,
Run
The execution unit is
Based on the core allocation information generated by the analysis unit, a step of allocating a thread for processing the variable having the second processing time as a processing time to the fixed core and executing the program is executed. A program execution method characterized by the above.
前記CPUのコアのキャッシュサイズと、前記通常処理実行時に所定の周期で収集される、前記変数の、配列長、前記通常処理実行時に格納されるメモリのアドレス、およびデータサイズと、キャッシュヒット率の第2の閾値と、をさらに記憶している前記記憶部を備え、
前記解析部は、
前記変数について、前記記憶部から前記アドレスを読み出して異なるアドレスの数を集計した前記異なるアドレスの数と、前記記憶部から読み出した前記キャッシュサイズ、前記配列長、および前記データサイズとをパラメータとして、前記異なるアドレスの数の減少、前記配列長の減少、前記データサイズの減少、前記キャッシュサイズの増大、にしたがって大きな値となるキャッシュヒット率を算出する算出ステップ、
前記キャッシュヒット率が前記記憶部に記憶している前記第2の閾値より大きいか否かを判定する判定ステップ、
前記判定ステップにおいて前記キャッシュヒット率が前記第2の閾値より大きいと判定された場合、当該変数を、前記(1)および前記(2)の処理に用いる前記第1の変数として、前記(1)〜前記(8)の処理を実行するステップ
を実行することを特徴とする請求項3に記載のプログラム実行方法。 The program execution device includes:
The cache size of the CPU core, the array length of the variables, the memory address stored during execution of the normal process, the data size, and the cache hit rate collected at a predetermined period when the normal process is executed The storage unit further storing a second threshold value,
The analysis unit
For the variable, the number of different addresses obtained by reading the address from the storage unit and totaling the number of different addresses, the cache size read from the storage unit, the array length, and the data size as parameters, A calculation step of calculating a cache hit rate that becomes a large value according to a decrease in the number of different addresses, a decrease in the array length, a decrease in the data size, and an increase in the cache size;
A determination step of determining whether or not the cache hit rate is greater than the second threshold stored in the storage unit;
When it is determined in the determination step that the cache hit rate is greater than the second threshold, the variable is set as the first variable used in the processes (1) and (2). The program execution method according to claim 3, wherein the step of executing the process of (8) is executed.
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| JP2010184509A JP5379765B2 (en) | 2010-08-20 | 2010-08-20 | Program execution apparatus and program execution method |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| JP2010184509A JP5379765B2 (en) | 2010-08-20 | 2010-08-20 | Program execution apparatus and program execution method |
Publications (2)
| Publication Number | Publication Date |
|---|---|
| JP2012043232A JP2012043232A (en) | 2012-03-01 |
| JP5379765B2 true JP5379765B2 (en) | 2013-12-25 |
Family
ID=45899445
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| JP2010184509A Expired - Fee Related JP5379765B2 (en) | 2010-08-20 | 2010-08-20 | Program execution apparatus and program execution method |
Country Status (1)
| Country | Link |
|---|---|
| JP (1) | JP5379765B2 (en) |
Families Citing this family (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN106484537B (en) | 2016-09-30 | 2019-07-19 | 网易(杭州)网络有限公司 | A kind of distribution method and equipment of CPU core resource |
Family Cites Families (3)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| JPH0612395A (en) * | 1992-06-29 | 1994-01-21 | Canon Inc | Task allocation method in multiprocessor system |
| JP4348639B2 (en) * | 2006-05-23 | 2009-10-21 | 日本電気株式会社 | Multiprocessor system and workload management method |
| US8635405B2 (en) * | 2009-02-13 | 2014-01-21 | Nec Corporation | Computational resource assignment device, computational resource assignment method and computational resource assignment program |
-
2010
- 2010-08-20 JP JP2010184509A patent/JP5379765B2/en not_active Expired - Fee Related
Also Published As
| Publication number | Publication date |
|---|---|
| JP2012043232A (en) | 2012-03-01 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| US11403220B2 (en) | Method and apparatus for adaptive cache load balancing for SSD-based cloud computing storage system | |
| CN104239141B (en) | Optimizing and scheduling task method based on workflow critical path in data center | |
| KR101600129B1 (en) | Application efficiency engine | |
| JP5845809B2 (en) | Efficient parallelization of software analysis in distributed computing environment by intelligent and dynamic load balancing | |
| US9965329B2 (en) | Method and apparatus for workload placement on heterogeneous systems | |
| US20100107174A1 (en) | Scheduler, processor system, and program generation method | |
| US11188348B2 (en) | Hybrid computing device selection analysis | |
| CN106020941A (en) | Selecting Resource Allocation Policies and Resolving Resource Conflicts | |
| JP6428476B2 (en) | Parallelizing compilation method and parallelizing compiler | |
| US11716384B2 (en) | Distributed resource management by improving cluster diversity | |
| Jiang et al. | Profiling and optimizing deep learning inference on mobile GPUs | |
| CN117742876A (en) | Binding method, device and equipment of processor core and computer storage medium | |
| CN110647390A (en) | Parallel task allocation scheduling method based on locality quantization for multi-core system | |
| CN114265668A (en) | Virtual machine migration method and related product | |
| JP6252140B2 (en) | Task allocation program and task allocation method | |
| JPH11259433A (en) | Parallel execution system | |
| JP5379765B2 (en) | Program execution apparatus and program execution method | |
| CN116010447A (en) | A load balancing method and device for optimizing heterogeneous database user query | |
| JP2011141703A (en) | System, method and program for arranging resource | |
| CN119829226A (en) | Cloud host migration method, computer storage medium and program product | |
| CN119167147A (en) | A cluster node classification method, device, storage medium and processor | |
| Tariq et al. | Execution time prediction model that considers dynamic allocation of spark executors | |
| Wang et al. | Container resource allocation versus performance of data-intensive applications on different cloud servers | |
| CN112214286B (en) | Container starting method and device and electronic equipment | |
| CN117519905A (en) | A virtual machine selection method based on migration cost and resource balancing |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| A621 | Written request for application examination |
Free format text: JAPANESE INTERMEDIATE CODE: A621 Effective date: 20121001 |
|
| RD04 | Notification of resignation of power of attorney |
Free format text: JAPANESE INTERMEDIATE CODE: A7424 Effective date: 20130201 |
|
| A977 | Report on retrieval |
Free format text: JAPANESE INTERMEDIATE CODE: A971007 Effective date: 20130918 |
|
| TRDD | Decision of grant or rejection written | ||
| A01 | Written decision to grant a patent or to grant a registration (utility model) |
Free format text: JAPANESE INTERMEDIATE CODE: A01 Effective date: 20130924 |
|
| A61 | First payment of annual fees (during grant procedure) |
Free format text: JAPANESE INTERMEDIATE CODE: A61 Effective date: 20130927 |
|
| R150 | Certificate of patent or registration of utility model |
Ref document number: 5379765 Country of ref document: JP Free format text: JAPANESE INTERMEDIATE CODE: R150 Free format text: JAPANESE INTERMEDIATE CODE: R150 |
|
| S531 | Written request for registration of change of domicile |
Free format text: JAPANESE INTERMEDIATE CODE: R313531 |
|
| R350 | Written notification of registration of transfer |
Free format text: JAPANESE INTERMEDIATE CODE: R350 |
|
| LAPS | Cancellation because of no payment of annual fees |