JP3633404B2 - Memory allocation optimization system, method, and recording medium - Google Patents
Memory allocation optimization system, method, and recording medium Download PDFInfo
- Publication number
- JP3633404B2 JP3633404B2 JP31413099A JP31413099A JP3633404B2 JP 3633404 B2 JP3633404 B2 JP 3633404B2 JP 31413099 A JP31413099 A JP 31413099A JP 31413099 A JP31413099 A JP 31413099A JP 3633404 B2 JP3633404 B2 JP 3633404B2
- Authority
- JP
- Japan
- Prior art keywords
- program
- memory
- data
- allocation
- memory allocation
- 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
- Devices For Executing Special Programs (AREA)
Description
【0001】
【発明の属する技術分野】
本発明は、分散メモリ型並列計算機におけるメモリ割り付けの最適化方法に関し、特に、再コンパイルによって並列プログラムに対するメモリ割り付けを最適化するメモリ割り付け最適化方法に関する。
【0002】
【従来の技術】
分散メモリ型並列計算機とは、各々がローカルメモリを持つ複数のプロセッサが、相互結合網(ネットワーク)で結合された構造の計算機システムである。通常、データは、各プロセッサ・エレメント(PE)のローカルメモリに分散して配置される。
【0003】
逐次ソースプログラムから分散メモリ型並列計算機向けのオブジェクトプログラムを生成するコンパイラは、ソースプログラムに現れるデータ(配列)を、各PEのローカルメモリ上に分割・配置する。
【0004】
これを実現する方式として、宣言された配列の領域(グローバル領域)のうち、各PEに分割・配置されたローカルな領域だけをローカルメモリに割り付ける方式がある(本明細書中、当該方式をSHRUNK方式と呼ぶことにする)。この方式では、ソースプログラムでは、グローバル領域上の添字式でアクセスされるよう記述されるのに対し、オブジェクトプログラムでは、ローカルメモリ領域上の添字式でアクセスする必要がある。従って、当該方式では、実行時にグローバル領域上の添字からローカル領域上の添字への変換処理が必要になる。
【0005】
また、配列の分割を変更する際には、配列の領域を動的に割り付けたり、元の領域から値をコピーしたりする処理が必要になる。これらの処理は、プログラムの実行時間を増大させる要因となる。
【0006】
尚、複数のPE間に亘って共有すべきデータがある場合、そのデータは、共有メモリや、データを使用する各PEのローカルメモリ等に配置される。
【0007】
一方、配列を各プロセッサに配置する際に領域を分割せず、全プロセッサが配列の全体に等しい領域を保持し、そのうちのローカルな部分のみを用いるという方法も考えられる(ここでは、当該方式をNOSHRUNK方式と呼ぶことにする)。この方法は、HPF/JA (High Performance Fortran 2.0 公式マニュアル, High Performance Fortran Forum, シュプリンガー・フェアラーク東京 (1999))では、「フルシャドウ(FULL−SHADOW)」と呼ばれている。この方法では、必要な添字変換や領域の動的割り付けといった処理は不要であるため、実行時間を削減することができる。しかし、SHRUNK方式に比べると、メモリの使用効率が悪く、巨大な配列を扱うプログラムに適用することはできない。
【0008】
配列に対してメモリ割り付け方法を個別に決めることができる場合、計算機システムのメモリサイズの範囲内でできるだけ多くの配列をNOSHRUNK方式で割り付ける方がよい。しかし、どの配列をNOSHRUNK方式で割り付けるのが最適であるかは、一般には利用可能なメモリサイズに依存し、利用可能なメモリサイズは種々に変化し得るため、最適なメモリ割り付け方法をコンパイル時に決定することはできない。
【0009】
以下では、並列プログラムを記述するのに、HPF/JA の記法を用いる。
【0010】
【発明が解決しようとする課題】
第1の問題点は、SHRUNK方式では、実行時に添字変換や領域の動的割り付けといったオーバヘッドが発生することである。これは、ソースプログラムとオブジェクトプログラムでは配列のメモリ割り付け方法が異なることに起因する。
【0011】
第2の問題点は、NOSHRUNK方式では、巨大な配列を扱えないことである。これは、当該方法では、配列全体をローカルメモリに配置しようとすることに起因する。
【0012】
第3の問題点は、最適なメモリ割り付け方法をコンパイル時に決定することは一般にはできないことである。当該計算機システムの処理内容に応じて、システムの環境が変化すると、それに伴って、利用可能なメモリサイズも変化するからである。
【0013】
従って、本発明の目的は、プログラムの必要メモリサイズを、現在利用可能なメモリサイズ以下に抑えつつ、以上の問題点を解決するメモリ割り付け最適化方法を提供することである。
【0014】
【課題を解決するための手段】
本発明の第1の実施態様によれば、プログラムが複数のプロセッサエレメントを備える並列計算機で実行される場合に、当該プログラムが使用する各データの前記プロセッサエレメントのメモリへの割り付けを最適化するメモリ割り付け最適化システムにおいて、前記プロセッサエレメントで現在利用可能なメモリのサイズを取得する実行モニタと、当該プログラムのソースプログラム、前記メモリのサイズ、及び前記各データの重要度に基づいて、各データの最適なメモリ割り付け方法を決定する最適割り付け決定部とを有するメモリ割り付け最適化システムが提供される。
【0015】
また、本発明の第2の実施態様によれば、プログラムが複数のプロセッサエレメントを備える並列計算機で実行される場合に、当該プログラムが使用する各データの前記プロセッサエレメントのメモリへの割り付けを最適化するメモリ割り付け最適化システムにおいて、前記プロセッサエレメントで現在利用可能なメモリのサイズを取得する実行モニタと、当該プログラムのソースプログラム及び前記取得された前記メモリのサイズに基づいて、前記各データの最適なメモリ割り付け方法を決定する最適割り付け決定部と、前記決定された各データの最適なメモリ割り付け方法に基づいて、前記ソースプログラムを変形し再コンパイルすることにより、オブジェクトプログラムを生成するダイナミックコンパイラと、前記オブジェクトプログラムを、対応する元のオブジェクトプログラムと置換することにより、実行中の実行可能プログラムを変更するダイナミックリンカと、前記各構成要素の動作を制御する実行マネージャとを有するメモリ割り付け最適化システムが提供される。
【0016】
また更に、本発明の第3の実施態様によれば、プログラムが複数のプロセッサエレメントを備える並列計算機で実行される場合に、当該プログラムが使用する各データの前記プロセッサエレメントのメモリへの割り付けを最適化するメモリ割り付け最適化方法において、前記プロセッサエレメントで現在利用可能なメモリのサイズを取得するステップと、当該プログラムのソースプログラム、前記メモリのサイズ、及び前記各データの重要度に基づいて、各データの最適なメモリ割り付け方法を決定するステップとを有するメモリ割り付け最適化方法が提供される。
【0017】
また更に、本発明の第4の実施態様によれば、プログラムが複数のプロセッサエレメントを備える並列計算機で実行される場合に、当該プログラムが使用する各データの前記プロセッサエレメントのメモリへの割り付けを最適化するメモリ割り付け最適化方法において、前記プロセッサエレメントで現在利用可能なメモリのサイズを取得するステップと、当該プログラムのソースプログラム及び前記取得された前記メモリのサイズに基づいて、前記各データの最適なメモリ割り付け方法を決定するステップと、前記決定された各データの最適なメモリ割り付け方法に基づいて、前記ソースプログラムを変形し再コンパイルすることにより、オブジェクトプログラムを生成するステップと、前記オブジェクトプログラムを、対応する元のオブジェクトプログラムと置換することにより、実行中の実行可能プログラムを変更するステップとを有するメモリ割り付け最適化方法が提供される。
【0018】
更に、本発明の第5の実施態様によれば、プログラムが複数のプロセッサエレメントを備える並列計算機で実行される場合に、当該プログラムが使用する各データの前記プロセッサエレメントのメモリへの割り付けを最適化するメモリ割り付け最適化方法を実現させるプログラムを記録したコンピュータ読み取り可能な記録媒体が提供され、前記方法を実現させるプログラムは、前記プロセッサエレメントで現在利用可能なメモリのサイズを取得するステップと、当該プログラムのソースプログラム、前記メモリのサイズ、及び前記各データの重要度に基づいて、各データの最適なメモリ割り付け方法を決定するステップとを有する。
【0019】
また更に、本発明の第6の実施態様によれば、プログラムが複数のプロセッサエレメントを備える並列計算機で実行される場合に、当該プログラムが使用する各データの前記プロセッサエレメントのメモリへの割り付けを最適化するメモリ割り付け最適化方法を実現させるプログラムを記録したコンピュータ読み取り可能な記録媒体が提供され、前記方法を実現させるプログラムは、前記プロセッサエレメントで現在利用可能なメモリのサイズを取得するステップと、当該プログラムのソースプログラム及び前記取得された前記メモリのサイズに基づいて、前記各データの最適なメモリ割り付け方法を決定するステップと、前記決定された各データの最適なメモリ割り付け方法に基づいて、前記ソースプログラムを変形し再コンパイルすることにより、オブジェクトプログラムを生成するステップと、前記オブジェクトプログラムを、対応する元のオブジェクトプログラムと置換することにより、実行中の実行可能プログラムを変更するステップとを有する。
【0020】
【発明の実施の形態】
図1を参照して、本発明の第1の実施形態について図面を参照して詳細に説明する。
【0021】
本発明のメモリ割り付け最適化システム10は、実行マネージャ11と、ダイナミックコンパイラ12と、ダイナミックリンカ13と、実行モニタ14とを含む。
【0022】
実行マネージャ11は、最適割り付け決定部19を備えている。
【0023】
実行マネージャ11は、ダイナミックコンパイラ12、ダイナミックリンカ13、実行モニタ14の制御を行う。
【0024】
ダイナミックコンパイラ12は、実行マネージャ11より最適割り付け方法Ins−optを受け取って、ソースプログラム15を再コンパイルし、最適なメモリ割り付けを実現するオブジェクトプログラム16を生成する。ダイナミックコンパイラ12は、任意の配列がSHRUNK方式またはNOSHRUNK方式で割り付けられるようにソースプログラム15をコンパイルできる。
【0025】
ダイナミックリンカ13は、実行可能プログラム17に含まれる手続きのうちダイナミックコンパイラ12の再コンパイル対象になったものを、新しいオブジェクトプログラム16で置換した後、リンクを行い、新しい実行可能プログラムを生成する。
【0026】
実行モニタ14は、実行可能プログラム17や計算機システム18のオペレーティングシステムまたはハードウェアより、現在のメモリ割り付け方法Ins−current、現在利用可能なメモリのサイズMallを受け取り、実行マネージャ11に伝達する。
【0027】
ここで、メモリ割り付け方法Insとは、NOSHRUNK方式で割り付けられる配列の集合である。また、利用可能なメモリとは、ある1つのPEが有するローカルメモリであって、実行可能プログラム17に関するスカラデータや種々の実行時データが割り付けられているメモリ、あるいは計算機システム18上で動作する他の実行可能プログラムが使用中のメモリなどを除いたものである。
【0028】
最適割り付け決定部19は、実行モニタ14より受け取った実行時情報とソースプログラム15から得られる情報を元に、計算機システム18における、ソースプログラム15に対する最適なメモリ割り付け方法を決定する。決定された方法は、ダイナミックコンパイラ12に伝達される。
【0029】
ここで、最適なメモリ割り付け方法Ins−optの決定方法について説明する。
【0030】
プログラム中で使われる配列A1,A2,…,Anを、SHRUNK方式およびNOSHRUNK方式で割り付ける場合に必要となるメモリサイズをそれぞれ、m1,m2,…,mnおよびM1,M2,…,Mnとする。また、配列の重みをw1,w2,…,wnとする。ここで、wiは、一定時間内に配列Aiがアクセスされた回数(アクセス頻度)とする。wiの値の設定に関しては、例えば、動的割り付けが生じる回数など他の基準も考えられるが、本発明の実施の形態はwiの値として何が設定されるかにはよらない。
【0031】
このとき、最適割り付けを決定する問題は、次の式1、及び式2を用いて記述される。
【0032】
(以下で、I≡{1,2,…,n}とする)。
【0033】
【数1】
の元で、
【数2】
を最大にするような Ins (⊆ I) を求める。ここで、式1の左辺の第1項は、ある1つのPEにおいて、実際にSHRUNK方式で割り当てられる配列のメモリサイズの合計であり、第2項は、当該PEにおいて、実際にNOSHRUNK方式で割り当てられる配列のメモリサイズの合計を示す。式1は、実際に割り当てられるメモリサイズの合計が、1つのPEの使用可能ローカルメモリの合計サイズを越えないことを示している。
【0034】
このような条件は、一般には、当該計算機システム内のPE全てを考慮して設定すべきであるが、ここでは、問題を単純化するため、ある1つのPEについて考える。このとき、他のPEでも前記1つのPEと同一の動作(即ち、同一のメモリ割り当て)が行われていると仮定する。
【0035】
ここで、
M’i ≡ Mi − mi ....(式3)
とすると、この問題は次の式4、及び式5を用いて書き換えられる。但し、上記式3におけるMiとmiはそれぞれ、配列AiをNOSHRUNK方式で割り当てるとした場合のメモリサイズ、配列AiをSHRUNK方式で割り当てるとした場合のメモリサイズを示しており、これらが実際に同時に割り当てられる訳ではない。式1に示すように、ある配列Aiのローカルメモリへの割り当てに関しては、NOSHRUNK方式かSHRUNK方式のどちらかが用いられる。
【0036】
【数3】
の元で、
【数4】
を最大にするような Ins (⊆ I)を求める。
【0037】
これは、いわゆるナップザック問題として把握することが可能である。ナップザック問題はNP問題であることが知られており、配列の数nに対して多項式時間内で解くことはできない。しかし、多項式時間内で近似解を得る方法は多く知られており(Sahni, Sartaj K., ”Approximate algorithms for the 0/1 knapsack problem, ”Journal of the ACM, vol. 22, no. 1, pp. 115−124, January, 1975を参照されたい)、最適割り付け決定部19は、そのうちの任意の1つの方法でIns−optの近似解を求めることができる。
【0038】
次に、図1および図2を参照して本実施の形態の動作について詳細に説明する。
【0039】
実行モニタ14は、実行可能プログラム17や計算機システム18のオペレーティングシステムまたはハードウェアより、現在のメモリ割り付け方法Ins−current、現在利用可能なメモリサイズMallを受け取り、実行マネージャ11に伝達する(図2のステップ21)。
【0040】
最適割り付け決定部19は、現在利用可能なメモリサイズMallおよびソースプログラムの配列出現情報から、最適なメモリ割り付け方法Ins−optを求める(ステップ22)。
【0041】
実行マネージャ11は、実行モニタ14より得たIns−currentがIns−optと等しいか否かを判定する(ステップ23)。
【0042】
Ins−currentがIns−optと異なる場合、実行マネージャ11は、ダイナミックコンパイラ12を起動し、Ins−optを伝達する。
【0043】
ダイナミックコンパイラ12は、配列Ai(iはIns−optに含まれる)がNOSHRUNK方式で、配列Aj(jはIns−optに含まれない)がSHRUNK方式でそれぞれ割り付けられるようにソースプログラム15をコンパイルし、新しいオブジェクトプログラム16を生成する(ステップ24)。
【0044】
本実施形態は、プログラムの実行の間に、対象の手続きが複数回実行される場合に大きな効果がある。従って、例えば、図3のプログラムのように、ループ中から呼ばれて複数回実行される手続きを対象とすることが好ましい。
【0045】
ここで、メインプログラムは、ダイナミックコンパイラ12の再コンパイル処理の対象にはできない。このような制限が存在するのは、ダイナミックコンパイラ12における再コンパイルが、メインプログラム内の手続き呼び出しを対象として行われるためである。
【0046】
また、メモリ割り付け最適化の対象となるのは、ダイナミックコンパイラ12の再コンパイル処理の対象手続き内でのみ割り付けが行われる配列である。
【0047】
ダイナミックリンカ13は、まず実行可能プログラム17の動作を一時的に中断させる。次に、実行可能プログラム17に含まれる手続きのうちダイナミックコンパイラの再コンパイル対象になったものを、新しいオブジェクトプログラム16で置換する。次に、それらのオブジェクトプログラムをリンクして新しい実行可能プログラムを生成し、実行可能プログラムの動作を再開させる(ステップ25)。
【0048】
ステップ23において、Ins−currentがIns−optと等しい場合、本発明の実施の形態は何もせずに処理を終了する。
【0049】
次に、具体的な実施例を用いて本実施の形態の動作を説明する。
【0050】
配列A1ないしA8の現れる、図3のようなプログラムを考える。この場合の、mi, Mi, M’i, wi のそれぞれの値が、図4の表に示されている。
【0051】
ここで、A1 はメインプログラムで割り付けられるので、上述の通り、本実施形態における最適化の対象にはならない。
【0052】
また、Mall = 1000であるとする。
【0053】
図4を参照すると、全ての配列がSHRUNK方式で割り付けられた場合には、
M’all = Mall − Σ mi = 1000 − 160 = 840
となる。
【0054】
ここで、全ての配列がSHRUNK方式で割り付けられるようにコンパイルされた実行可能プログラムが、計算機システム上で動作しているものとする。このとき、
Mcurrent = 160
Ins−current = {}
である。
【0055】
ステップ21において、実行モニタは、計算機システムおよび実行可能プログラムから、上記の Mall, Mcurrent, Ins−current を得て、実行マネージャへ伝達する。
【0056】
ステップ22において、実行マネージャは最適割り付け決定部を起動する。
【0057】
最適割り付け決定部は、実行マネージャより伝達された Mall とソースプログラムから抽出した配列情報から、最適割り付け方法 Ins−opt を計算する。
【0058】
ここでは、wiの値の大きい配列から順に Ins−opt に加えていく「greedy アルゴリズム」を用いる。その結果、
Ins−opt = {3,6,7,8}
が得られる。
【0059】
ステップ23において、Ins−current と Ins−opt は異なるので、ステップ24に移る。
【0060】
ステップ24において、実行マネージャはダイナミックコンパイラを起動する。ダイナミックコンパイラは、Ins−opt に含まれる配列A3, A6, A7, A8がNOSHRUNK方式で、その他の配列がSHRUNK方式で割り付けられるようにソースプログラムを再コンパイルし、新しいオブジェクトプログラムを生成する。
【0061】
ステップ25において、ダイナミックリンカは、新しいオブジェクトプログラムと、実行可能プログラムに含まれるオブジェクトプログラムを置換する。
【0062】
その結果、
Mcurrent = 916 ≦ Mall
となり、Mall の範囲内で、4つの配列A3, A6, A7, A8をNOSHRUNK方式で割り付けることができる。
【0063】
次に、本発明の第2の実施形態の動作について説明する。
【0064】
上述した第1の実施形態においては、実行モニタ14及び実行マネージャ11は、任意のタイミングで1度だけ実行され得る。これに対し、第2の実施形態では、所定のタイミングで実行マネージャを起動することにより、第1の実施形態で行われた処理を繰り返し行う。実行マネージャを起動するタイミングとしては、例えば、計算機システム上で動作する他の実行可能プログラムが終了した時点や配列の分割・配置方法が変更された時点などが考えられる。
【0065】
本実施形態では、プログラムの実行中に計算機システムの状態が変化した場合であっても、それに応じてメモリ割り付け方法を動的に変化させることができる。
【0066】
次に、本発明の第3の実施形態の動作について説明する。
【0067】
第1の実施形態では、メインプログラムを再コンパイルの対象にできなかった。即ち、メインプログラムで割り付けが行われる配列に対しては割り付け方法を最適化できなかった。そこで、本発明の第3の実施形態では、ダイナミックコンパイラ12がダミーのメインプログラムを生成し、本来のメインプログラムはこのダミーのメインプログラムから呼び出されるようにソースプログラムを変形する。この際に、本来の再コンパイル対象である手続き呼び出しを囲むループにストリップマイニングを適用し、その外側ループはダミーのメインプログラムに置く。また、本来のメインプログラム内で宣言される変数は共通ブロック実体とする。その後、本来のメインプログラムであった手続きを再コンパイルの対象として、第1の実施形態を適用する。
【0068】
図3のソースプログラムに本実施形態を適用すると、ダイナミックコンパイラ12は、図5のプログラムを生成する。この場合のmi, Mi, M’i, wi のそれぞれの値は、図6の表に示すようなものである。
【0069】
また、Mall = 1000とする。
【0070】
従って、図6の表から、M’all = Mall − Σ mi = 1000 − 200 = 800が得られる。
【0071】
ここで、第1の実施形態を適用すれば、
Ins−opt = {1,3,8}
が得られる。
【0072】
本実施形態では、上述のように、メインプログラムも再コンパイルの対象にすることができるため、メインプログラムで割り付けが行われる配列に対しても本発明を適用できる。
【0073】
次に、本発明の第4の実施形態について詳細に説明する。
【0074】
前述の通り、第1の実施形態では、再コンパイル対象の各手続きに対して個別に最適割り付け方法を決定する。従って、ある手続き呼び出しに関して、実引数と仮引数で異なる割り付け方法が選択される可能性があり、その場合、実行時に割り付け方法を変換するオーバヘッドが生じる。
【0075】
例えば、
CALL SUB1(A1, A2)
CALL SUB2(A2, A3)
というコードが、再コンパイルされるプログラムのソースコードに記述されている場合、本発明の第1の実施形態では、手続き単位に、各配列に対してSHRUNK方式かNOSHRUNK方式が決定されるため、上記SUB1の引数に示された配列A2が、SHRUNK方式と決定され、上記SUB2の引数に示された配列A2がNOSHRUNK方式と決定される場合がある。実際には、1つの方法で配列A2が配置されるため、当初決定された方式で配置されなかったことになる手続き、SUB1、SUB2のどちらかは、配列A2をアクセスする際に、その異なる方式用に、アドレス等の変換を行う必要が生じる。
【0076】
そこで、第4の実施形態では、最適割り付け決定部は、手続き呼び出しの実引数と仮引数の割り付け方法をできるだけ一致させるように各配列の割り付け方法を決定する。具体的には、決定された1つの配列の割り付け方式が、手続き間で異なっている場合に、当該割り付け方法を、ローカルメモリの合計を越えないという条件の下で、どちらかの方法に統一し、その統一された方法に基づいてオブジェクトプログラムを生成(又は再生成)する。
【0077】
本実施形態により、割り付け方法を変換するための実行時オーバヘッドを削減することができる。
【0078】
次に、図7を参照して、本発明の各実施形態が実行される分散メモリ型並列計算機システムの一構成例について説明する。尚、図1に示した構成要素と同一の要素については、同一の符号が付されている。
【0079】
当該計算機システム18は、n個のプロセッサエレメントPE1ないしPEn(311〜31n)を有している。PEの数は、例えば4、8、16といった数である。これら複数のPEは、ネットワーク32によって相互に接続されている。また、各PEは、それぞれ、ローカルメモリ及びプロセッサを有している。各プロセッサは、対応するローカルメモリ(又は共有メモリ)にロードされたプログラムに従って、ローカルメモリ内のデータその他に対して並列処理を実行する。
【0080】
本発明によるメモリ割り付け最適化システム10は、ネットワーク32に接続され、そのネットワークを介して、各PEに動的に再コンパイルされたプログラムを送信し、データの割り付けの変更等を指示する。また、メモリ割り付け最適化システム10内の実行モニタ14は、当該ネットワーク32を介して、各PEのローカルメモリの空き容量の状況等を取得する。
【0081】
この例では、メモリ割り付け最適化システム10は、PEとは異なる、例えばホストマシン内で実行されるものとして示されているが、1つのPEを使用して当該システム10を実現することも可能である。
【0082】
記録媒体33は、ソースプログラム15や、メモリ割り付け最適化方法を実現するためのプログラム自体を含み、必要に応じてメモリ割り付け最適化システム10で読み取られる。こうした記録媒体33の代表的な例は、フロッピーディスクやCD−ROMである。
【0083】
【発明の効果】
以上に説明したように、本発明では、以下の効果を得ることが出きる。
【0084】
第1の効果は、頻繁にアクセスされる配列を、重要度に応じて、できるだけオーバヘッドの小さいNOSHRUNK方式で割り付けることにより、添字変換や動的割り付けといったオーバヘッドを削減できることである。
【0085】
第2の効果は、必要メモリの小さいSHRUNK方式で割り付けることにより、巨大な配列を扱えることである。
【0086】
第3の効果は、実行時に、計算機システムの現在の状態に応じて最適なメモリ割り付け方式を決定し、それに従って生成されたオブジェクトプログラムで、実行中の実行可能プログラムの一部を(実行を停止することなく)置換するため、計算機システムの状態に応じて、常に最適なメモリ割り付け方式を達成できることである。
【図面の簡単な説明】
【図1】本発明の第1、第2、第3および第4の実施形態の構成を示すブロック図である。
【図2】本発明の第1の実施形態の動作を示す流れ図である。
【図3】本発明の第1の実施形態において入力されるソースプログラムのコードの一部を示す図である。
【図4】各配列毎に、SHRUNK方式、NOSHRUNK方式によるメモリ割り当てサイズ等を示す表である。
【図5】本発明の第3の実施形態において入力されるソースプログラムのコードの一部を示す図である。
【図6】各配列毎に、SHRUNK方式、NOSHRUNK方式によるメモリ割り当てサイズ等を示す表である。
【図7】本発明が実行される分散メモリ並列処理計算機システムの一構成例を示すブロック図である。
【符号の説明】
10 メモリ割り付け最適化システム
11 実行マネージャ
12 ダイナミックコンパイラ
13 ダイナミックリンカ
14 実行モニタ
15 ソースプログラム
16 オブジェクトプログラム
17 実行可能プログラム
18 計算機システム
19 最適割り付け決定部
311〜31n プロセッサエレメント(PE)
32 ネットワーク
33 記録媒体[0001]
BACKGROUND OF THE INVENTION
The present invention relates to a memory allocation optimization method in a distributed memory parallel computer, and more particularly to a memory allocation optimization method for optimizing memory allocation for a parallel program by recompilation.
[0002]
[Prior art]
The distributed memory type parallel computer is a computer system having a structure in which a plurality of processors each having a local memory are connected by an interconnection network. Usually, data is distributed and arranged in the local memory of each processor element (PE).
[0003]
A compiler that generates an object program for a distributed memory parallel computer from a sequential source program divides and arranges data (array) appearing in the source program on the local memory of each PE.
[0004]
As a method for realizing this, there is a method of allocating only a local region divided and arranged in each PE in a declared array region (global region) to a local memory (this method is referred to as SHRUNK in this specification). I will call it a method). In this method, the source program is described to be accessed with a subscript expression on the global area, whereas the object program needs to be accessed with a subscript expression on the local memory area. Therefore, this method requires conversion processing from the subscript on the global area to the subscript on the local area at the time of execution.
[0005]
Further, when changing the division of the array, it is necessary to dynamically allocate the area of the array or copy the value from the original area. These processes increase the program execution time.
[0006]
When there is data to be shared among a plurality of PEs, the data is placed in a shared memory, a local memory of each PE that uses the data, or the like.
[0007]
On the other hand, there is also a method in which the area is not divided when arranging the array in each processor, and all the processors hold an area equal to the entire array, and only a local part of the area is used (here, this method is used). This will be referred to as the NOSHRUNK system). This method is called “FULL SHADOW” in HPF / JA (High Performance Fortran 2.0 Official Manual, High Performance Fortran Forum, Springer Fairlake Tokyo (1999)). This method does not require processing such as necessary subscript conversion or dynamic region allocation, and can therefore reduce execution time. However, compared to the SHRUNK method, the memory use efficiency is poor and cannot be applied to a program that handles a huge array.
[0008]
When the memory allocation method can be individually determined for the array, it is better to allocate as many arrays as possible within the range of the memory size of the computer system using the NOSHRUNK method. However, which array is best allocated using the NOSHRUNK method generally depends on the available memory size, and the available memory size can vary, so the optimal memory allocation method is determined at compile time. I can't do it.
[0009]
In the following, the HPF / JA notation is used to describe a parallel program.
[0010]
[Problems to be solved by the invention]
The first problem is that in the SHRUNK method, overhead such as subscript conversion and dynamic allocation of areas occurs at the time of execution. This is because the array memory allocation method differs between the source program and the object program.
[0011]
The second problem is that the NOSHRUNK method cannot handle a huge array. This is due to the fact that the method attempts to place the entire array in local memory.
[0012]
The third problem is that an optimum memory allocation method cannot generally be determined at compile time. This is because when the system environment changes according to the processing contents of the computer system, the available memory size changes accordingly.
[0013]
Accordingly, an object of the present invention is to provide a memory allocation optimizing method that solves the above-mentioned problems while suppressing the required memory size of a program below a currently available memory size.
[0014]
[Means for Solving the Problems]
According to the first embodiment of the present invention, when a program is executed by a parallel computer including a plurality of processor elements, the memory for optimizing the allocation of each data used by the program to the memory of the processor elements In the allocation optimization system, the optimum of each data is determined based on the execution monitor that obtains the size of the memory currently available in the processor element, the source program of the program, the size of the memory, and the importance of each data. There is provided a memory allocation optimization system having an optimal allocation determination unit for determining a proper memory allocation method.
[0015]
Further, according to the second embodiment of the present invention, when a program is executed by a parallel computer having a plurality of processor elements, the allocation of each data used by the program to the memory of the processor elements is optimized. In the memory allocation optimizing system, an optimum monitor for each data is obtained based on an execution monitor that acquires a size of a memory that is currently available in the processor element, a source program of the program, and the acquired size of the memory. An optimal allocation determination unit that determines a memory allocation method, a dynamic compiler that generates an object program by transforming and recompiling the source program based on the optimal memory allocation method of each determined data; and Object program A memory allocation optimization system is provided that includes a dynamic linker that changes an executable program that is being executed by replacing a corresponding original object program with a corresponding original object program, and an execution manager that controls the operation of each component. The
[0016]
Still further, according to the third embodiment of the present invention, when the program is executed on a parallel computer having a plurality of processor elements, the allocation of each data used by the program to the memory of the processor elements is optimized. In the memory allocation optimizing method, each data is obtained based on the step of obtaining the size of the memory currently available in the processor element, the source program of the program, the size of the memory, and the importance of each data. Determining an optimal memory allocation method. A memory allocation optimization method is provided.
[0017]
Still further, according to the fourth embodiment of the present invention, when a program is executed by a parallel computer having a plurality of processor elements, the allocation of each data used by the program to the memory of the processor elements is optimized. In the memory allocation optimizing method, the optimum size of each data is obtained based on the step of obtaining the size of the memory currently available in the processor element, and the source program of the program and the obtained size of the memory. A step of determining a memory allocation method, a step of generating an object program by transforming and recompiling the source program based on the determined optimal memory allocation method of each data, and the object program, The corresponding original object By replacing the transfected program, memory allocation optimization method and a step of changing the executable program being executed is provided.
[0018]
Furthermore, according to the fifth embodiment of the present invention, when a program is executed by a parallel computer having a plurality of processor elements, the allocation of each data used by the program to the memory of the processor elements is optimized. There is provided a computer-readable recording medium recording a program for realizing a memory allocation optimization method, and the program for realizing the method includes obtaining a size of a memory currently available in the processor element, and the program Determining an optimal memory allocation method for each data based on the source program, the size of the memory, and the importance of each data.
[0019]
Still further, according to the sixth embodiment of the present invention, when a program is executed by a parallel computer having a plurality of processor elements, the allocation of each data used by the program to the memory of the processor elements is optimized. There is provided a computer-readable recording medium storing a program for realizing a memory allocation optimization method to be realized, and the program for realizing the method includes obtaining a size of a memory currently available in the processor element; Determining an optimal memory allocation method for each piece of data based on a source program of the program and the obtained size of the memory; and, based on the determined optimal memory allocation method for each piece of data, the source Transform and recompile the program By having the step of generating the object program, the object program, by substituting the corresponding original object program, and changing the executable programs.
[0020]
DETAILED DESCRIPTION OF THE INVENTION
With reference to FIG. 1, a first embodiment of the present invention will be described in detail with reference to the drawings.
[0021]
The memory
[0022]
The
[0023]
The
[0024]
The
[0025]
The
[0026]
The execution monitor 14 receives the current memory allocation method Ins-current and the currently available memory size Mall from the
[0027]
Here, the memory allocation method Ins is a set of arrays allocated by the NOSHRUNK method. Further, the usable memory is a local memory included in one PE, a memory to which scalar data related to the
[0028]
The optimal
[0029]
Here, a method for determining the optimal memory allocation method Ins-opt will be described.
[0030]
The memory sizes required for allocating the arrays A1, A2,..., An used in the program by the SHRUNK method and the NOSHRUNK method are m1, m2,. Also, the array weights are w1, w2,. Here, wi is the number of times the array Ai is accessed within a certain time (access frequency). Regarding the setting of the value of wi, other criteria such as the number of times dynamic allocation occurs can be considered, but the embodiment of the present invention does not depend on what is set as the value of wi.
[0031]
At this time, the problem of determining the optimal allocation is described using the following
[0032]
(Hereafter, I≡ {1, 2,..., N}).
[0033]
[Expression 1]
Under
[Expression 2]
Find Ins (⊆ I) that maximizes. Here, the first term on the left side of
[0034]
In general, such a condition should be set in consideration of all PEs in the computer system. Here, in order to simplify the problem, a single PE is considered. At this time, it is assumed that the same operation (that is, the same memory allocation) as that of the one PE is performed in other PEs.
[0035]
here,
M'i ≡ Mi-mi. . . . (Formula 3)
Then, this problem can be rewritten using the following
[0036]
[Equation 3]
Under
[Expression 4]
Find Ins (⊆ I) that maximizes.
[0037]
This can be grasped as a so-called knapsack problem. The knapsack problem is known to be an NP problem and cannot be solved in polynomial time for the number n of arrays. However, there are many known methods for obtaining an approximate solution in polynomial time (Sahni, Sartaj K., “Approximate algorithms for the 0/1 knacksack problem,” Journal of the ACM, vol. 22, vol. 22). 115-124, January, 1975), the optimal
[0038]
Next, the operation of the present embodiment will be described in detail with reference to FIG. 1 and FIG.
[0039]
The execution monitor 14 receives the current memory allocation method Ins-current and the currently available memory size Mall from the
[0040]
The optimal
[0041]
The
[0042]
When the Ins-current is different from the Ins-opt, the
[0043]
The
[0044]
This embodiment has a great effect when the target procedure is executed a plurality of times during the execution of the program. Therefore, for example, it is preferable to target a procedure that is called from a loop and executed a plurality of times, such as the program of FIG.
[0045]
Here, the main program cannot be a target of recompilation processing of the
[0046]
In addition, the target of the memory allocation optimization is an array that is allocated only within the target procedure of the recompile process of the
[0047]
The
[0048]
In
[0049]
Next, the operation of this embodiment will be described using specific examples.
[0050]
Consider a program as shown in FIG. 3 in which arrays A1 to A8 appear. The values of mi, Mi, M′i, and wi in this case are shown in the table of FIG.
[0051]
Here, since A1 is allocated by the main program, as described above, it is not an optimization target in the present embodiment.
[0052]
Assume that Mall = 1000.
[0053]
Referring to FIG. 4, when all the arrays are allocated in the SHRUNK method,
M'all = Mall-Σmi = 1000-160 = 840
It becomes.
[0054]
Here, it is assumed that an executable program compiled so that all the arrays are allocated by the SHRUNK method is operating on the computer system. At this time,
McCurrent = 160
Ins-current = {}
It is.
[0055]
In
[0056]
In
[0057]
The optimal allocation determination unit calculates the optimal allocation method Ins-opt from the Mall transmitted from the execution manager and the sequence information extracted from the source program.
[0058]
Here, a “greedy algorithm” that is added to Ins-opt in order from the array with the largest value of wi is used. as a result,
Ins-opt = {3, 6, 7, 8}
Is obtained.
[0059]
In
[0060]
In
[0061]
In
[0062]
as a result,
McCurrent = 916 ≤ Mall
Thus, within the range of Mall, the four arrays A3, A6, A7, and A8 can be assigned by the NOSHRUNK method.
[0063]
Next, the operation of the second exemplary embodiment of the present invention will be described.
[0064]
In the first embodiment described above, the execution monitor 14 and the
[0065]
In this embodiment, even if the state of the computer system changes during execution of the program, the memory allocation method can be changed dynamically accordingly.
[0066]
Next, the operation of the third embodiment of the present invention will be described.
[0067]
In the first embodiment, the main program cannot be recompiled. In other words, the allocation method could not be optimized for an array that is allocated by the main program. Therefore, in the third embodiment of the present invention, the
[0068]
When this embodiment is applied to the source program of FIG. 3, the
[0069]
Also, Mall = 1000.
[0070]
Therefore, M′all = Mall−Σmi = 1000−200 = 800 is obtained from the table of FIG.
[0071]
Here, if the first embodiment is applied,
Ins-opt = {1, 3, 8}
Is obtained.
[0072]
In the present embodiment, as described above, the main program can also be a target of recompilation. Therefore, the present invention can also be applied to an array that is allocated by the main program.
[0073]
Next, a fourth embodiment of the present invention will be described in detail.
[0074]
As described above, in the first embodiment, the optimum allocation method is determined individually for each procedure to be recompiled. Therefore, with respect to a certain procedure call, different allocation methods may be selected for the actual argument and the dummy argument. In this case, an overhead for converting the allocation method occurs at the time of execution.
[0075]
For example,
CALL SUB1 (A1, A2)
CALL SUB2 (A2, A3)
Is described in the source code of the recompiled program, in the first embodiment of the present invention, the SHRUNK method or the NOSHRUNK method is determined for each array for each procedure. The array A2 indicated in the argument of SUB1 may be determined as the SHRUNK method, and the array A2 indicated in the argument of SUB2 may be determined as the NOSHRUNK method. Actually, since the array A2 is arranged by one method, one of the procedures SUB1 and SUB2 that has not been arranged by the originally determined method is different from the method used when accessing the array A2. Therefore, it is necessary to convert an address or the like.
[0076]
Therefore, in the fourth embodiment, the optimum allocation determining unit determines the allocation method of each array so that the allocation method of the actual argument and the dummy argument of the procedure call is matched as much as possible. Specifically, if the allocation method of one determined array differs between procedures, the allocation method is unified to either method under the condition that the total of local memory is not exceeded. The object program is generated (or regenerated) based on the unified method.
[0077]
According to the present embodiment, it is possible to reduce the runtime overhead for converting the allocation method.
[0078]
Next, a configuration example of a distributed memory type parallel computer system in which each embodiment of the present invention is executed will be described with reference to FIG. In addition, the same code | symbol is attached | subjected about the element same as the component shown in FIG.
[0079]
The
[0080]
The memory
[0081]
In this example, the memory
[0082]
The recording medium 33 includes the
[0083]
【The invention's effect】
As described above, according to the present invention, the following effects can be obtained.
[0084]
The first effect is that overhead such as subscript conversion and dynamic allocation can be reduced by allocating frequently accessed arrays in accordance with the importance according to the NOSHRUNK method having as little overhead as possible.
[0085]
The second effect is that a huge array can be handled by allocating in the SHRUNK method with a small required memory.
[0086]
The third effect is that, at the time of execution, an optimal memory allocation method is determined according to the current state of the computer system, and a part of the executable program being executed is stopped (execution is stopped) by the object program generated accordingly. Therefore, an optimum memory allocation method can always be achieved according to the state of the computer system.
[Brief description of the drawings]
FIG. 1 is a block diagram showing the configuration of first, second, third and fourth embodiments of the present invention.
FIG. 2 is a flowchart showing the operation of the first exemplary embodiment of the present invention.
FIG. 3 is a diagram showing a part of code of a source program input in the first embodiment of the present invention.
FIG. 4 is a table showing a memory allocation size and the like according to SHRUNK system and NOSHRUNK system for each array;
FIG. 5 is a diagram showing a part of code of a source program input in the third embodiment of the present invention.
FIG. 6 is a table showing memory allocation sizes and the like according to SHRUNK system and NOSHRUNK system for each array;
FIG. 7 is a block diagram showing a configuration example of a distributed memory parallel processing computer system in which the present invention is executed.
[Explanation of symbols]
10 Memory allocation optimization system
11 execution manager
12 Dynamic compiler
13 Dynamic linker
14 Execution monitor
15 Source program
16 Object program
17 Executable programs
18 Computer system
19 Optimal allocation decision section
31 1 ~ 31 n Processor element (PE)
32 network
33 Recording media
Claims (11)
前記プロセッサエレメントで現在利用可能なメモリのサイズを取得する実行モニタと、
当該プログラムのソースプログラム及び前記取得された前記メモリのサイズに基づいて、前記各データの最適なメモリ割り付け方法を決定する最適割り付け決定部と、
前記決定された各データの最適なメモリ割り付け方法に基づいて、前記ソースプログラムを変形し再コンパイルすることにより、オブジェクトプログラムを生成するダイナミックコンパイラと、前記オブジェクトプログラムを、対応する元のオブジェクトプログラムと置換することにより、実行中の実行可能プログラムを変更するダイナミックリンカと、
前記各構成要素の動作を制御する実行マネージャとを有し、
前記ダイナミックコンパイラが、メインプログラムで直接利用されるデータに関するメモリについても最適な割り付けを行うために、当該メインプログラムに相当する部分が、新たなメインプログラムから呼び出されるように、ソースプログラムを変形することを特徴とするメモリ割り付け最適化システム。 In a memory allocation optimization system that optimizes allocation of each data used by a program to a memory of the processor element when the program is executed on a parallel computer including a plurality of processor elements,
An execution monitor that obtains the size of memory currently available in the processor element;
An optimal allocation determining unit that determines an optimal memory allocation method for each data based on the source program of the program and the acquired size of the memory;
Based on the determined optimal memory allocation method for each data, the source program is transformed and recompiled to generate an object program, and the object program is replaced with the corresponding original object program. A dynamic linker that changes the executable program that is running,
An execution manager that controls the operation of each component;
The dynamic compiler modifies the source program so that the part corresponding to the main program is called from the new main program in order to perform the optimal allocation for the memory related to the data directly used in the main program. Memory allocation optimization system characterized by
前記プロセッサエレメントで現在利用可能なメモリのサイズを取得する実行モニタと、
当該プログラムのソースプログラム及び前記取得された前記メモリのサイズに基づいて、前記各データの最適なメモリ割り付け方法を決定する最適割り付け決定部と、
前記決定された各データの最適なメモリ割り付け方法に基づいて、前記ソースプログラムを変形し再コンパイルすることにより、オブジェクトプログラムを生成するダイナミックコンパイラと、前記オブジェクトプログラムを、対応する元のオブジェクトプログラムと置換することにより、実行中の実行可能プログラムを変更するダイナミックリンカと、
前記各構成要素の動作を制御する実行マネージャとを有し、
前記最適割り付け決定部での決定が、前記プログラム内の手続き呼び出し毎に行われ、割り付け方法が、前記手続き呼び出しの引数として指定された前記データ毎に決定されることを特徴とするメモリ割り付け最適化システム。 In a memory allocation optimization system that optimizes allocation of each data used by a program to a memory of the processor element when the program is executed on a parallel computer including a plurality of processor elements,
An execution monitor that obtains the size of memory currently available in the processor element;
An optimal allocation determining unit that determines an optimal memory allocation method for each data based on the source program of the program and the acquired size of the memory;
Based on the determined optimal memory allocation method for each data, the source program is transformed and recompiled to generate an object program, and the object program is replaced with the corresponding original object program. A dynamic linker that changes the executable program that is running,
An execution manager that controls the operation of each component;
Memory allocation optimization characterized in that determination by the optimal allocation determination unit is performed for each procedure call in the program, and an allocation method is determined for each piece of data specified as an argument of the procedure call system.
前記割り付け方法が、前記データのうち、当該プロセッサエレメントに関連する部分のみを前記プロセッサエレメントのメモリに割り付ける第1の方法と、
前記データ全体を、当該プロセッサエレメントのメモリに割り付ける第2の方法とを含み、
前記最適割り付け決定部が、前記各データの重要度を参照して、前記各データを前記第1または第2の方法のいずれかの方法で割り付け、結果的に当該プロセッサエレメントに割り付けるべき全てのデータについて、少なくとも当該プロセッサエレメントに関連する部分がそのメモリに収容されるように、各データ毎の割り付け方法を決定することを特徴とするメモリ割り付け最適化システム。The memory allocation optimization system according to claim 2 ,
A first method of allocating only a portion of the data related to the processor element to the memory of the processor element;
A second method of allocating the entire data to the memory of the processor element;
The optimum allocation determining unit refers to the importance of each data, allocates each data by either the first method or the second method, and consequently all data to be allocated to the processor element. A memory allocation optimization system, wherein an allocation method for each data is determined such that at least a portion related to the processor element is accommodated in the memory.
前記最適割り付け決定部が、各プロセッサエレメント毎に、
(1)前記第1の方法で割り付けられたデータのメモリ上のサイズの合計と前記第2の方法で割り付けられたデータのメモリ上のサイズの合計を加算した数が当該プロセッサのメモリの合計サイズ以下であり、
(2)前記第2の方法で割り付けられたデータに対応する重要度が最大となるように、各データの割り付け方法を決定する
ことを特徴とするメモリ割り付け最適化システム。The memory allocation optimization system according to claim 3 ,
The optimal allocation determination unit is for each processor element,
(1) The total size of the memory of the processor is the sum of the total size of the data allocated by the first method on the memory and the total size of the data allocated by the second method on the memory. And
(2) A memory allocation optimization system, wherein an allocation method of each data is determined so that importance corresponding to the data allocated by the second method is maximized.
前記割り付け方法の決定が、NP問題の近似解をもとめる手法を用いて行われることを特徴とするメモリ割り付け最適化システム。The memory allocation optimization system according to claim 3 ,
The memory allocation optimization system, wherein the allocation method is determined using a method for obtaining an approximate solution of an NP problem.
前記重要度が、前記プログラムによって、前記データがアクセスされる頻度であることを特徴とするメモリ割り付け最適化システム。The memory allocation optimization system according to claim 3 ,
The memory allocation optimization system, wherein the importance is a frequency with which the data is accessed by the program.
前記最適割り付け決定部で決定された割り付け方法が、1つのデータに対して複数存在する場合に、当該割り付け方法を1つに統一することを特徴とするメモリ割り付け最適化システム。The memory allocation optimization system according to claim 2 ,
A memory allocation optimization system, characterized in that, when there are a plurality of allocation methods determined by the optimal allocation determination unit, one allocation method is unified.
前記プロセッサエレメントで現在利用可能なメモリのサイズを取得するステップと、
当該プログラムのソースプログラム、前記メモリのサイズ、及び前記各データの重要度に基づいて、各データの最適なメモリ割り付け方法を決定するステップと、
当該プログラムのソースプログラム、前記メモリのサイズ、及び前記各データの重要度に基づいて、前記各データの最適なメモリ割り付け方法を決定するステップと、
前記決定された各データの最適なメモリ割り付け方法に基づいて、前記ソースプログラムを変形し再コンパイルすることにより、オブジェクトプログラムを生成するステップと、前記オブジェクトプログラムを、対応する元のオブジェクトプログラムと置換することにより、実行中の実行可能プログラムを変更するステップとを有し、
前記オブジェクトプログラムを生成するステップにおいては、メインプログラムで直接利用されるデータに関するメモリについても最適な割り付けを行うために、当該メインプログラムに相当する部分が、新たなメインプログラムから呼び出されるように、ソースプログラムを変形することを特徴とするメモリ割り付け最適化方法。In a memory allocation optimization method for optimizing allocation of each data used by a program to a memory of the processor element when the program is executed on a parallel computer including a plurality of processor elements,
Obtaining the size of memory currently available in the processor element;
Determining an optimal memory allocation method for each data based on the source program of the program, the size of the memory, and the importance of each data;
A method source programs of the program, the size of the memory, and on the basis the importance of each data to determine the optimal memory allocation method of the respective data,
Based on the determined optimum memory allocation method for each data, the source program is transformed and recompiled to generate an object program, and the object program is replaced with the corresponding original object program. And changing the running executable program,
In the step of generating the object program, the source corresponding to the main program is called from the new main program in order to optimally allocate the memory related to the data directly used in the main program. A memory allocation optimization method characterized by modifying a program .
前記プロセッサエレメントで現在利用可能なメモリのサイズを取得するステップと、
当該プログラムのソースプログラム及び前記取得された前記メモリのサイズに基づいて、前記各データの最適なメモリ割り付け方法を決定するステップと、
当該プログラムのソースプログラム及び前記取得された前記メモリのサイズに基づいて、前記各データの最適なメモリ割り付け方法を決定するステップと、前記決定された各データの最適なメモリ割り付け方法に基づいて、前記ソースプログラムを変形し再コンパイルすることにより、オブジェクトプログラムを生成するステップと、前記オブジェクトプログラムを、対応する元のオブジェクトプログラムと置換することにより、実行中の実行可能プログラムを変更するステップとを有し、
前記メモリ割り付け方法を決定するステップでの決定が、前記プログラム内の手続き呼び出し毎に行われ、割り付け方法が、前記手続き呼び出しの引数として指定された前記データ毎に決定されることを特徴とするメモリ割り付け最適化方法。In a memory allocation optimization method for optimizing allocation of each data used by a program to a memory of the processor element when the program is executed on a parallel computer including a plurality of processor elements,
Obtaining the size of memory currently available in the processor element;
Determining an optimal memory allocation method for each data based on the source program of the program and the acquired size of the memory;
Determining an optimal memory allocation method for each data based on the source program of the program and the acquired size of the memory, and based on the optimal memory allocation method for each determined data, by recompiling modifying the source program and generating an object program, the object program, by substituting the corresponding original object program, and a step of changing the executable program running ,
The determination in the step of determining the memory allocation method is performed for each procedure call in the program, and the allocation method is determined for each piece of data specified as an argument of the procedure call Allocation optimization method.
前記方法を実現させるプログラムは、前記プロセッサエレメントで現在利用可能なメモリのサイズを取得するステップと、
当該プログラムのソースプログラム、前記メモリのサイズ、及び前記各データの重要度に基づいて、各データの最適なメモリ割り付け方法を決定するステップと、
前記決定された各データの最適なメモリ割り付け方法に基づいて、前記ソースプログラムを変形し再コンパイルすることにより、オブジェクトプログラムを生成するステップと、前記オブジェクトプログラムを、対応する元のオブジェクトプログラムと置換することに より、実行中の実行可能プログラムを変更するステップとを有し、
前記オブジェクトプログラムを生成するステップにおいては、メインプログラムで直接利用されるデータに関するメモリについても最適な割り付けを行うために、当該メインプログラムに相当する部分が、新たなメインプログラムから呼び出されるように、ソースプログラムを変形することを特徴とするプログラムを記録したコンピュータ読み取り可能な記録媒体。A computer recording a program for realizing a memory allocation optimization method for optimizing allocation of each data used by the program to a memory of the processor element when the program is executed by a parallel computer including a plurality of processor elements A readable recording medium,
A program for realizing the method obtains a size of memory currently available in the processor element;
Determining an optimal memory allocation method for each data based on the source program of the program, the size of the memory, and the importance of each data ;
Based on the determined optimum memory allocation method for each data, the source program is transformed and recompiled to generate an object program, and the object program is replaced with the corresponding original object program. in particular from, and a step of changing the executable program being executed,
In the step of generating the object program, the source corresponding to the main program is called from the new main program in order to optimally allocate the memory related to the data directly used in the main program. A computer-readable recording medium having a program recorded thereon, the program being modified .
前記プロセッサエレメントで現在利用可能なメモリのサイズを取得するステップと、
当該プログラムのソースプログラム及び前記取得された前記メモリのサイズに基づいて、前記各データの最適なメモリ割り付け方法を決定するステップと、
当該プログラムのソースプログラム及び前記取得された前記メモリのサイズに基づいて、前記各データの最適なメモリ割り付け方法を決定するステップと、
前記決定された各データの最適なメモリ割り付け方法に基づいて、前記ソースプログラムを変形し再コンパイルすることにより、オブジェクトプログラムを生成するステップと、前記オブジェクトプログラムを、対応する元のオブジェクトプログラムと置換することにより、実行中の実行可能プログラムを変更するステップとを有し、
前記メモリ割り付け方法を決定するステップでの決定が、前記プログラム内の手続き呼び出し毎に行われ、割り付け方法が、前記手続き呼び出しの引数として指定された前記データ毎に決定されることを特徴とするプログラムを記録したコンピュータ読み取り可能な記録媒体。A computer recording a program for realizing a memory allocation optimization method for optimizing allocation of each data used by the program to a memory of the processor element when the program is executed by a parallel computer including a plurality of processor elements A readable recording medium, which realizes the method,
Obtaining the size of memory currently available in the processor element;
Determining an optimal memory allocation method for each data based on the source program of the program and the acquired size of the memory;
Determining an optimal memory allocation method for each data based on the source program of the program and the acquired size of the memory;
Based on the determined optimum memory allocation method for each data, the source program is transformed and recompiled to generate an object program, and the object program is replaced with the corresponding original object program. And changing the running executable program ,
The determination in the step of determining the memory allocation method is performed for each procedure call in the program, and the allocation method is determined for each piece of data specified as an argument of the procedure call. A computer-readable recording medium on which is recorded.
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| JP31413099A JP3633404B2 (en) | 1999-11-04 | 1999-11-04 | Memory allocation optimization system, method, and recording medium |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| JP31413099A JP3633404B2 (en) | 1999-11-04 | 1999-11-04 | Memory allocation optimization system, method, and recording medium |
Publications (2)
| Publication Number | Publication Date |
|---|---|
| JP2001134446A JP2001134446A (en) | 2001-05-18 |
| JP3633404B2 true JP3633404B2 (en) | 2005-03-30 |
Family
ID=18049614
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| JP31413099A Expired - Fee Related JP3633404B2 (en) | 1999-11-04 | 1999-11-04 | Memory allocation optimization system, method, and recording medium |
Country Status (1)
| Country | Link |
|---|---|
| JP (1) | JP3633404B2 (en) |
Families Citing this family (4)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| JP3847672B2 (en) | 2002-07-03 | 2006-11-22 | 松下電器産業株式会社 | Compiler apparatus and compiling method |
| JP2008305337A (en) * | 2007-06-11 | 2008-12-18 | Panasonic Corp | Program conversion device, program conversion method, program, storage medium, debug device, debug method, and program development system |
| US8286198B2 (en) * | 2008-06-06 | 2012-10-09 | Apple Inc. | Application programming interfaces for data parallel computing on multiple processors |
| KR102165928B1 (en) * | 2019-12-04 | 2020-10-14 | 서울대학교 산학협력단 | Electronic device, a method of compiling in an electronic device and a method of operating an electronic device |
-
1999
- 1999-11-04 JP JP31413099A patent/JP3633404B2/en not_active Expired - Fee Related
Also Published As
| Publication number | Publication date |
|---|---|
| JP2001134446A (en) | 2001-05-18 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| CN1306399C (en) | Virtual machine for network processor | |
| JP5733860B2 (en) | Efficient parallel computation of dependency problems | |
| US20080178163A1 (en) | Just-In-Time Compilation in a Heterogeneous Processing Environment | |
| US20090271799A1 (en) | Executing A Distributed Java Application On A Plurality Of Compute Nodes | |
| Barton et al. | Shared memory programming for large scale machines | |
| CN101233489A (en) | Adaptive Process Dispatch in Computer Systems with Multiple Processors | |
| Pourmohseni et al. | Hard real-time application mapping reconfiguration for NoC-based many-core systems | |
| JPH08185325A (en) | Code generation method in compiler and compiler | |
| JP2009528589A (en) | Adaptive compilation code | |
| US7028313B2 (en) | Method for transmitting function parameters to a remote node for execution of the function thereon | |
| Guo et al. | Compiler-assisted overlapping of communication and computation in MPI applications | |
| US7694290B2 (en) | System and method for partitioning an application utilizing a throughput-driven aggregation and mapping approach | |
| JP3633404B2 (en) | Memory allocation optimization system, method, and recording medium | |
| JP2002366366A (en) | Compiling method, code generation method, stack register using method, compiler, program for realizing them, and storage medium | |
| US7523448B2 (en) | Optimizing compiler | |
| US6625806B1 (en) | Language processing method and language processing system improving use efficiency of cache memory | |
| JP2002358293A (en) | System, method and program for load distribution at run- time | |
| US6139200A (en) | Register resource allocation feedback | |
| US20050055678A1 (en) | Method and apparatus for managing software in computer system using virtual machine | |
| Gonzàlez‐Tallada et al. | Compute units in OpenMP: Extensions for heterogeneous parallel programming | |
| JPH09293057A (en) | Task allocation method in hierarchical structure type multiprocessor system | |
| Tan et al. | A method for efficient heterogeneous parallel compilation: A cryptography case study | |
| JP3241214B2 (en) | Distributed processing apparatus and process execution method | |
| Zhuang et al. | Balancing register allocation across threads for a multithreaded network processor | |
| JP2003248667A (en) | Area division pattern determination method |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| A131 | Notification of reasons for refusal |
Free format text: JAPANESE INTERMEDIATE CODE: A131 Effective date: 20040519 |
|
| A521 | Written amendment |
Free format text: JAPANESE INTERMEDIATE CODE: A523 Effective date: 20040716 |
|
| A02 | Decision of refusal |
Free format text: JAPANESE INTERMEDIATE CODE: A02 Effective date: 20040908 |
|
| A521 | Written amendment |
Free format text: JAPANESE INTERMEDIATE CODE: A523 Effective date: 20041008 |
|
| RD01 | Notification of change of attorney |
Free format text: JAPANESE INTERMEDIATE CODE: A7421 Effective date: 20041008 |
|
| A521 | Written amendment |
Free format text: JAPANESE INTERMEDIATE CODE: A821 Effective date: 20041008 |
|
| A911 | Transfer of reconsideration by examiner before appeal (zenchi) |
Free format text: JAPANESE INTERMEDIATE CODE: A911 Effective date: 20041112 |
|
| 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: 20041207 |
|
| A61 | First payment of annual fees (during grant procedure) |
Free format text: JAPANESE INTERMEDIATE CODE: A61 Effective date: 20041220 |
|
| R150 | Certificate of patent or registration of utility model |
Free format text: JAPANESE INTERMEDIATE CODE: R150 |
|
| FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20080107 Year of fee payment: 3 |
|
| FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20090107 Year of fee payment: 4 |
|
| FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20100107 Year of fee payment: 5 |
|
| FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20110107 Year of fee payment: 6 |
|
| FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20110107 Year of fee payment: 6 |
|
| FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20120107 Year of fee payment: 7 |
|
| FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20130107 Year of fee payment: 8 |
|
| FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20130107 Year of fee payment: 8 |
|
| LAPS | Cancellation because of no payment of annual fees |