JP2004029982A - Parallelization conversion system, parallelization conversion method, program, and compiler - Google Patents
Parallelization conversion system, parallelization conversion method, program, and compiler Download PDFInfo
- Publication number
- JP2004029982A JP2004029982A JP2002182292A JP2002182292A JP2004029982A JP 2004029982 A JP2004029982 A JP 2004029982A JP 2002182292 A JP2002182292 A JP 2002182292A JP 2002182292 A JP2002182292 A JP 2002182292A JP 2004029982 A JP2004029982 A JP 2004029982A
- Authority
- JP
- Japan
- Prior art keywords
- parallelization
- character string
- directive
- program
- procedure
- 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.)
- Granted
Links
Images
Abstract
Description
【0001】
【発明の属する技術分野】
本発明は、コンピュータプログラムの変換技術に係わり、特に、逐次的に処理を行なうように記述されたプログラムを、自動的あるいはプログラマの指示に従って、並列に処理を行なうプログラムに変換するコンピュータ処理技術に関するものである。
【0002】
【従来の技術】
従来、並列処理を行なうプログラムを作成する技術として、プログラマが、逐次的に処理を行なうよう記述されたプログラムに対し、並列化を指示する指示文を挿入し、コンピュータが並列化コンパイラにより、その指示文を解析して並列処理を行なうプログラムに変換するものがある。
【0003】
例えば、共有メモリ型並列計算機向けの並列化言語であるOpenMPを規定した、”OpenMP Fortran Application Program Interface Version 2.0, November 2000, http://www.openmp.org/”では、プログラマがループ並列化や変数のプライベート化等の指示文をプログラム中に挿入し、コンパイラはその指示に従って並列化変換を行なう。
【0004】
しかし、並列化指示を全てプログラマが行なうのは負担が大きい。これを解決する技術として、コンピュータにおいて、コンパイラ、あるいは並列化支援ツール等により、自動的に、プログラムの並列性を解析し、結果をプログラム中に並列化指示文として生成するものがある。
【0005】
このようなコンピュータにより自動的に並列化指示文をプログラム中に生成する従来技術は、例えば、「Haoqiang Jin , Michael Frumkin , Jerry Yan ”Automatic Generation of OpenMP Directives and Its Application to Computational Fluid Dynamics Codes”, Volume 1940, Issue , pp 440− Lecture Notes in Computer Science」に記載されている。
【0006】
このようにしてコンピュータで自動的に生成される並列化指示文は、プログラムのポータビリティを確保するために、例えばOpenMP指示文のような、汎用性のある指示文である必要がある。
【0007】
しかし、従来技術においては、以下のような問題点がある。
【0008】
すなわち、一度、処理系(コンピュータ)によって指示文が付加されたソースプログラムは、プログラマが修正をして再度処理系に入力する場合があり得る。この時、プログラマが実行文を修正することによって、処理系が過去に付加した指示文が正しくなくなる場合がある。処理系は、このような指示文を、プログラマが修正したプログラムに合うように、生成し直す必要がある。
【0009】
一方で、同様の並列化指示文は、プログラマによって手動で付加される場合もある。処理系は、プログラマの指示に従わなければならないため、このような指示文は変更しないようにする必要がある。
【0010】
ここで、ポータビリティを保つために、処理系が例えばOpenMP指示文のような汎用性のある指示文を付加する場合、プログラム中に記述されている指示文が、プログラマが記述したものなのか、処理系が以前に自動的に付加したものであるかの判別がつかないという問題が生じる。
【0011】
このため、処理系は、処理系が過去に生成した指示文を修正することができない。あるいは、プログラマが付加した指示文も修正してしまう可能性がある。
【0012】
【発明が解決しようとする課題】
解決しようとする問題点は、従来の技術では、並列処理を行なうプログラムにおける並列化を指示する指示文が、プログラマが記述したものなのか、処理系(コンピュータ)が以前に自動的に付加したものであるかを、処理系で判別することができない点である。
【0013】
本発明の目的は、これら従来技術の課題を解決し、逐次的に処理を行なうよう記述されたソースプログラムの、並列に処理を行なうオブジェクトプログラムへの、コンピュータによる自動変換を効率化することを可能にすることである。
【0014】
【課題を解決するための手段】
上記目的を達成するため、本発明では、並列化処理系(コンピュータ)が、逐次的に処理を行なうよう記述された入力プログラムを、並列に処理を行なうプログラムに変換する際、自動並列化解析の結果で得られた並列化指示文を、元のソースプログラム中に生成すると共に、当該並列化指示文の文字列を一方向関数に通すことで求められる一意な文字列をコメント文として、当該並列化指示文と同じ行に生成し、そのプログラムを再び入力して並列化する際に、並列化指示文の文字列を前記と同じ一方向関数に通すことで求められる一意な文字列と、当該プログラム上に記述された、前記並列化指示文の文字列を一方向関数に通すことで求められた一意な文字列との一致を調べることで、その指示文が処理系が自動的に挿入したものであり、かつユーザが変更していないことの検出を行なう。そして、処理系が挿入しかつユーザが変更していない指示文および文字列を並列処理プログラムから削除した後、この並列処理プログラムに対して、並列化指示文とその文字列の自動生成を含む再並列化処理を行なう。
【0015】
【発明の実施の形態】
以下、本発明の実施の形態を、図面により詳細に説明する。
【0016】
図1は、本発明に係わる並列化システムを設けたコンパイラを実行するコンピュータ装置の構成例を示すブロック図であり、図2は、図1のコンピュータ装置によるコンパイル動作時における本発明に係わる並列化処理動作例を示すフローチャート、図3は、図1におけるコンピュータ装置で生成された並列処理プログラムの構成例を示す説明図、図4は、図1における中間語生成部の処理動作例を示すフローチャート、図5は、図1における指示文生成部の処理動作例を示すフローチャートである。
【0017】
図1におけるコンピュータ装置は、CPU(Central Processing Unit)や主メモリ、表示装置、入力装置、外部記憶装置などからなり、例えば光ディスク駆動装置を介してCD−ROMに記録されたプログラムやデータを外部記憶装置内にインストールした後、この外部記憶装置から主メモリに読み込みCPUで処理することにより、本発明に係わる並列化システムとしての機能を具備した並列化コンパイラ11としての各機能を実行する。
【0018】
図1において、10は逐次的に処理を行なうよう記述された入力プログラム(ソースファイル)(図中「入力ソース」と記載)、11は並列化コンパイラ、17は並列化コンパイラ11により入力プログラム10から生成されたコンピュータ実行可能なコード形態の並列処理用オブジェクトプログラム((図中「目的コード」と記載)、18は並列処理用オブジェクトプログラム17のソースファイル(図中「出力ソース」と記載)である。
【0019】
並列化コンパイラ11は,中間語生成部12、並列化解析部13、並列化変換部14、目的コード生成部15、指示文生成部16、および、これらの中間語生成部12により生成され、並列化解析部13、並列化変換部14、目的コード生成部15、指示文生成部16により参照・更新される中間語19と、各処理部12〜16でのコンパイル処理時に生成・参照される情報を格納する各種情報テーブル20からなる。
【0020】
中間語生成部12は、入力プログラム10を読み込み、字句解析、構文解析、意味解析等を行なって、中間語19を生成する。中間語19には、指示文による並列化指示の情報も含まれる。
【0021】
並列化解析部13は、中間語生成部12で生成・登録された中間語19および各種情報テーブル20を参照して、プログラムの制御構造、データの参照関係を解析し、並列化可能なループの判定、及び並列化に必要な通信の決定を行ない、中間語19および各種情報テーブル20を更新する。
【0022】
並列化変換部14は、中間語19および各種情報テーブル20を参照して並列化解析部13での並列化解析の結果を基に、プログラムの制御構造の変換及び通信文の生成等を行ない中間語19および各種情報テーブル20を更新する。
【0023】
目的コード生成部15は、中間語19に対して最適化を行なった後、並列処理用オブジェクトプログラム17を出力する。
【0024】
そして、指示文生成部16は、入力プログラム10を読み込み、これに、並列化解析部13で得られた並列化の情報を基に、並列化指示文を生成して挿入すると共に、この並列化指示文の文字列を一方向関数に通す等することでユニーク(唯一無比)な文字列を生成し、この文字列を並列化指示文と同一の行にコメントとして挿入し、ソースファイル18として出力する。
【0025】
このような構成により、コンピュータ装置は、並列化コンパイラ11としての動作において、指示文生成部16により本発明に係わる並列化処理動作を図2に示すようにして行なう。
【0026】
すなわち、指示文生成部16において、入力プログラム10を読み込み(ステップ201)、並列化解析部13で得られた並列化の情報を基に、並列化指示文を生成してこの入力プログラム10に挿入すると共に(ステップ202)、この並列化指示文の文字列を一方向関数に通す等することでユニーク(唯一無比)な文字列を生成し、この文字列を並列化指示文と同一の行にコメントとして挿入し(ステップ203)、ソースファイル18として出力する(ステップ204)。
【0027】
このような手順で指示文生成部16から出力されたソースファイル18の例を図3に示す。
【0028】
並列化コンパイラ11は、図3に示すプログラムにおいて「DO jループ」が並列化できることが分かるので、指示文生成部16により、そのことを指示する「OpenMP」のPARALLEL DO指示文31(「!$OMP PARALLEL DO PRIVATE (I,J)」)を生成して挿入する。
【0029】
さらに、指示文生成部16は、挿入したPARALLEL DO指示文31と同じ行に、並列化指示文の文字列を一方向関数に通すことで求められる一意な文字列32 (ここではハッシュ値「0123456789fedcba」)を、コメントの形式(「!HASH0123456789fedcba」)で挿入する。
【0030】
このようにして、文字列32を付与することにより、このソースファイル18に対してコンパイルを行なう際には、指示文生成部16において、前回並列化指示文を挿入したときと同じハッシュ関数で並列化指示文の字面からハッシュ値を計算し、例えば中間語生成部12において、このハッシュ値と、ソースファイル18上のハッシュ値とを比較・照合することで、並列化コンパイラ11が自動的に生成した並列化指示文をユーザが変更したか否か自動的に検出して調べることができる。
【0031】
尚、ハッシュ値を記述するコメントには適当なプリフィックスを付加して、ユーザが、ユーザ記述のコメントと混同したり、誤って消去したりすることのないようにする。図3に示す例では、コメント記号(「!」)の後ろに、コンパイラが挿入したハッシュ値であることをしめす「HASH」という文字列を付加している。また、この時用いるハッシュ関数は、値域を十分大きくし、異なる字面に対して同一のハッシュ値が生成されることが実用上起きないようなものを選ぶ。
【0032】
このようにすることにより、ユーザが出力ソースに対して再度指示文を挿入し直したいときに、並列化コンパイラ11が自動生成した並列化指示文のみを更新し、ユーザが挿入した並列化指示文、ならびに、並列化コンパイラ11が自動生成してユーザが変更した並列化指示文には手を加えずに保存することが可能となる。
【0033】
次に、指示文生成部16により並列化指示文と文字列とを生成して入力プログラムに挿入したソースファイル18を再変換する際の本発明に係わる処理動作内容の内、上述した中間語生成部12による、並列化指示文を読み込む処理について図4を用いて説明する。
【0034】
図1の中間語生成部12は、ステップ401の処理において並列化指示文を読み込んだ後、ステップ402の処理において、当該並列化指示文に対して指示文生成オプションが指定されているかどうかによって処理を分ける。
【0035】
指示文生成オプションが指定されていなければ、全ての並列化指示文に従ってコンパイルを行なうようにするため、ステップ405の処理に移動して、従来技術と同様に、無条件に、並列化指示文情報として各種情報テーブル20に登録する。
【0036】
また、指示文生成オプションが指定されていれば、並列化コンパイラ11自身が自動生成した並列化指示文は、再解析して挿入し直し、ユーザ(操作者、プログラマ)が指示した並列化指示文のみを読み込むために、ステップ403,304の処理を行なう。
【0037】
すなわち、ステップ403において、並列化指示文の字面から求めたハッシュ値と、ソースファイル18上にコメントとして埋め込まれたハッシュ値とを比較・照合し、一致しているか否かを調べる。尚、ハッシュ値がソースファイル18上にコメントとして埋め込まれていない場合は、ハッシュ値が一致しないものとみなす。
【0038】
ステップ404において、ハッシュ値が一致し、並列化コンパイラ11自身により自動生成された並列化指示文であると分かった場合は、その指示文の情報はテーブルに登録せずに破棄し(ステップ406)、また、ハッシュ値が一致しない場合は、その指示文をユーザ指示とみなし、ステップ405における処理を実行し、並列化指示文の情報を各種情報テーブル20に取り込む。
【0039】
次に、図5を用いて、図1における指示文生成部16の処理動作を説明する。
【0040】
図1における指示文生成部16は、まず、ステップ501における処理で、入力プログラム10に指示文生成オプションが指定されているか否かを調べ、指定されていない場合は何もせずに終了する。
【0041】
指示文生成オプションが指定されている場合、入力プログラム10中の並列化指示文を全て消去する(ステップ502)。その後、ステップ503〜506における処理を繰り返し、図1の並列化解析部13による並列化解析結果の情報(各種情報テーブル20)を基に、入力プログラム10に対する並列化指示文の生成と挿入を行なう。
【0042】
すなわち、図4の処理により図1の中間語生成部12が生成して各種情報テーブル20に登録した並列化指示文が、並列化コンパイラ11自身が自動生成した並列化指示文であるか否かを判定し(ステップ503)、並列化コンパイラ11自身が自動生成した並列化指示文に対しては、当該並列化指示文の字面からハッシュ値を生成して当該並列化指示文と同一の行に付加して(ステップ504)、また、ユーザが入力した並列化指示文に対しては、当該並列化指示文のみを、入力プログラム10に挿入し(ステップ505)、全ての並列化指示文に対して繰り返す(ステップ506)。
【0043】
尚、並列化指示文が対象とする文または有効域に対して、既に並列化指示文が指定されている場合は、並列化指示文は挿入せず、既に存在している指示文を保存する。ユーザ指示は保存したままで指示文を再生成することが可能となる。
【0044】
以上、図1〜図5を用いて説明したように、本例の並列化コンパイラ11では、コンピュータ装置が、逐次的に処理を行なうよう記述された入力プログラムを、並列に処理を行なうプログラムに変換する際、自動並列化解析の結果で得られた並列化指示文を、元のソースプログラム中に生成すると共に、当該並列化指示文の文字列を一方向関数(ハッシュ関数)に通すことで求められる一意な文字列(ハッシュ値)をコメント文として、当該並列化指示文と同じ行に生成して挿入する。
【0045】
このコメント文により、ユーザは、並列処理用に変換されたプログラムのソースファイルにおける、コンパイラが自動的に生成した並列化指示文を容易に特定することができる。
【0046】
さらに、本例では、並列処理用に変換されたプログラムを再び入力して並列化する際に、並列化指示文の文字列を前記と同じ一方向関数に通すことで求められる一意な文字列と、当該プログラム上に記述された、前記並列化指示文の文字列を一方向関数に通すことで求められた一意な文字列との一致を調べることで、その指示文が処理系(コンピュータ)が自動的に挿入したものであり、かつユーザが変更していないことの検出を自動的に行なうことができる。
【0047】
そして、処理系(コンピュータ)が挿入しかつユーザが変更していない指示文および文字列を並列処理プログラムから削除した後、この並列処理プログラムに対して、並列化指示文とその文字列の自動生成を含む再並列化処理を行なう。
【0048】
このように、並列化コンパイラ11自身が自動生成した並列化指示文の入ったソースプログラム(ソースファイル18)を再びコンパイルする際に、プログラマが記述した並列化指示文と並列化コンパイラ11自身が自動生成した並列化指示文とを区別し、並列化コンパイラ11自身が自動生成した並列化指示文のみを消去し、再生成することにより、並列処理プログラムの再変換を効率的に行なうことができる。
【0049】
尚、本発明は、図1〜図5を用いて説明した例に限定されるものではなく、その要旨を逸脱しない範囲において種々変更可能である。例えば、本例では、本発明の並列化変換システムを並列化コンパイラ11の一機能として説明したが、本発明は、逐次プログラムを入力し、並列化指示文の入ったソースを出力するツールとして実現しても良い。
【0050】
また、本例では、共有メモリ型並列計算機向けの並列化指示仕様であるOpenMPを指示文言語として用いていたが、本発明は、分散メモリ型計算機向けの並列化言語を用いて実施することも可能である。例えば、逐次プログラムを入力とし、分散メモリ型並列計算機向けの並列化解析を行ない、結果を分散メモリ型計算機向けの並列化言語であるHPFの並列化指示文として、入力ソース中に挿入することができる。
【0051】
また、本例では、指示文生成部16で生成した文字列(ハッシュ値)を並列化指示文と同一の行にコメントとして挿入した並列処理プログラムを、ソースファイル18として別ファイルで出力しているが、元の入力プログラム10を置き換えることでも良い。
【0052】
また、コンピュータ構成に関しても、キーボードや光ディスクの駆動装置の無いコンピュータ構成としても良い。また、本例では、光ディスクを記録媒体として用いているが、FD(Flexible Disk)等を記録媒体として用いることでも良い。また、プログラムのインストールに関しても、通信装置を介してネットワーク経由でプログラムをダウンロードしてインストールすることでも良い。
【0053】
【発明の効果】
本発明によれば、並列処理を行なうプログラムにおける並列化を指示する指示文(並列化指示文)が、プログラマが記述したものなのか、処理系(コンピュータ)が以前に自動的に付加したものであるかを、処理系で自動的に判別することができ、逐次的に処理を行なうよう記述されたソースプログラムの、並列に処理を行なうオブジェクトプログラムへの、コンピュータによる自動変換を効率化することが可能である。
【図面の簡単な説明】
【図1】本発明に係わる並列化システムを設けたコンパイラを実行するコンピュータ装置の構成例を示すブロック図である。
【図2】図1のコンピュータ装置によるコンパイル動作時における本発明に係わる並列化処理動作例を示すフローチャートである。
【図3】図1におけるコンピュータ装置で生成された並列処理プログラムの構成例を示す説明図である。
【図4】図1における中間語生成部の処理動作例を示すフローチャートである。
【図5】図1における指示文生成部の処理動作例を示すフローチャートである。
【符号の説明】
10:入力プログラム(「入力ソース」)、11:並列化コンパイラ、12:中間語生成部、13:並列化解析部、14:並列化変換部、15:目的コード生成部、16:指示文生成部、17:オブジェクトプログラム(「目的コード」)、18:ソースファイル(「出力ソース」)、19:中間語、20:各種情報テーブル、31:PARALLEL DO指示文、32:文字列(「ハッシュ値」)。[0001]
TECHNICAL FIELD OF THE INVENTION
The present invention relates to a computer program conversion technique, and more particularly to a computer processing technique for converting a program written to perform processing sequentially into a program that performs parallel processing automatically or according to a programmer's instruction. It is.
[0002]
[Prior art]
Conventionally, as a technique for creating a program for performing parallel processing, a programmer inserts a directive for instructing parallelization into a program written to perform processing sequentially, and the computer uses a parallelizing compiler to issue the instruction using a parallelizing compiler. There is a program that analyzes a sentence and converts it into a program that performs parallel processing.
[0003]
For example, in "OpenMP Fortran Application Program Interface Version 2.0, November 2000, http://www.openmp.org/", a programmer loop is defined, which defines OpenMP which is a parallel language for a shared memory type parallel computer. Instruction is inserted into the program, and the compiler performs parallel conversion according to the instruction.
[0004]
However, it is burdensome for a programmer to issue all the parallelization instructions. As a technique for solving this problem, there is a technique in which a computer automatically analyzes the parallelism of a program using a compiler or a parallelization support tool, and generates a result as a parallelization directive in the program.
[0005]
A conventional technique for automatically generating a parallelization directive in a program by such a computer is described in, for example, "Haoqiang Jin, Michael Frumkin, Jerry Yan", "Automatic Generation of OpenMP Direction Appointments and Recommendations. 1940, Issue, pp 440-Lecture Notes in Computer Science.
[0006]
The parallelization directive automatically generated by the computer in this way needs to be a versatile directive such as, for example, an OpenMP directive in order to ensure the portability of the program.
[0007]
However, the prior art has the following problems.
[0008]
That is, a source program to which a directive has been once added by the processing system (computer) may be corrected by the programmer and input to the processing system again. At this time, if the programmer corrects the executable statement, the instruction sent by the processing system in the past may become incorrect. The processing system needs to regenerate such directives so as to match the program modified by the programmer.
[0009]
On the other hand, similar parallelization directives may be manually added by a programmer. Since the processing system must follow the instructions of the programmer, it is necessary to keep such directives unchanged.
[0010]
Here, in order to maintain portability, when the processing system adds a versatile directive such as an OpenMP directive, for example, it is determined whether the directive described in the program is the one described by the programmer. The problem arises that it is not possible to determine whether the system has been automatically added before.
[0011]
For this reason, the processing system cannot correct the instruction sentence generated in the past by the processing system. Alternatively, there is a possibility that the instruction sentence added by the programmer is also modified.
[0012]
[Problems to be solved by the invention]
The problem to be solved is that, in the conventional technique, the instruction to instruct parallelization in a program for performing parallel processing is written by a programmer or automatically added by a processing system (computer) before. Is not determined by the processing system.
[0013]
SUMMARY OF THE INVENTION An object of the present invention is to solve the problems of the prior art, and to improve efficiency of automatic conversion by a computer of a source program written to perform sequential processing into an object program that performs parallel processing. It is to be.
[0014]
[Means for Solving the Problems]
In order to achieve the above object, according to the present invention, when a parallel processing system (computer) converts an input program described so as to perform processing sequentially into a program that performs processing in parallel, it performs automatic parallelization analysis. The parallelization directive obtained as a result is generated in the original source program, and a unique character string obtained by passing the character string of the parallelization directive through a one-way function is used as a comment statement. Generated on the same line as the parallelization directive, and when the program is input again and parallelized, a unique character string obtained by passing the character string of the parallelization directive through the same one-way function as above, By checking the character string of the parallelization directive described in the program with a unique character string obtained by passing the parallelization directive through a one-way function, the directive was automatically inserted by the processing system. What is And to detect that the user has not changed. Then, after deleting the directive and the character string which are inserted by the processing system and not changed by the user from the parallel processing program, the parallel processing program is re-written including the parallelization directive and the automatic generation of the character string. Perform parallel processing.
[0015]
BEST MODE FOR CARRYING OUT THE INVENTION
Hereinafter, embodiments of the present invention will be described in detail with reference to the drawings.
[0016]
FIG. 1 is a block diagram showing a configuration example of a computer device that executes a compiler provided with a parallelization system according to the present invention. FIG. 2 is a block diagram showing a parallelization process according to the present invention at the time of compiling operation by the computer device of FIG. 3 is an explanatory diagram showing a configuration example of a parallel processing program generated by the computer device in FIG. 1, FIG. 4 is a flowchart showing a processing operation example of the intermediate language generation unit in FIG. 1, FIG. 5 is a flowchart illustrating an example of a processing operation of the directive generating unit in FIG. 1.
[0017]
1 includes a CPU (Central Processing Unit), a main memory, a display device, an input device, an external storage device, and the like. For example, programs and data recorded on a CD-ROM via an optical disk drive are stored in an external storage device. After being installed in the apparatus, the main memory is read from the external storage device and processed by the CPU, thereby executing each function as the parallelizing
[0018]
In FIG. 1,
[0019]
The parallelizing
[0020]
The intermediate
[0021]
The
[0022]
The
[0023]
After optimizing the
[0024]
Then, the
[0025]
With such a configuration, the computer device performs the parallel processing operation according to the present invention by the
[0026]
That is, the instruction
[0027]
FIG. 3 shows an example of the
[0028]
Since the parallelizing
[0029]
Furthermore, the
[0030]
By adding the
[0031]
An appropriate prefix is added to the comment describing the hash value so that the user does not confuse the comment with the user description or accidentally delete the comment. In the example shown in FIG. 3, a character string “HASH” indicating that the hash value is inserted by the compiler is added after the comment symbol (“!”). The hash function used at this time is selected so that the value range is sufficiently large and the generation of the same hash value for different character faces does not practically occur.
[0032]
By doing so, when the user wants to reinsert the directive into the output source, only the parallelization directive automatically generated by the parallelizing
[0033]
Next, among the processing operations according to the present invention when the parallelization directive and the character string are generated by the
[0034]
After reading the parallelization directive in the processing of
[0035]
If the directive generation option is not specified, the process moves to step 405 to compile according to all the parallelization directives, and unconditionally executes the parallelization directive information as in the related art. Is registered in the various information tables 20.
[0036]
If the directive generation option is specified, the parallelization directive automatically generated by the parallelizing
[0037]
That is, in
[0038]
If it is determined in
[0039]
Next, the processing operation of the
[0040]
The
[0041]
If the directive generation option is specified, all the parallelization directives in the
[0042]
That is, whether or not the parallelization directive sentence generated by the intermediate
[0043]
If the parallelization directive is already specified for the statement or effective area targeted by the parallelization directive, the parallelization directive is not inserted and the existing directive is saved. . It is possible to regenerate the instruction while retaining the user instruction.
[0044]
As described above with reference to FIGS. 1 to 5, in the parallelizing
[0045]
With this comment statement, the user can easily specify the parallelization directive sentence automatically generated by the compiler in the source file of the program converted for parallel processing.
[0046]
Furthermore, in this example, when the program converted for parallel processing is input again and parallelized, a unique character string obtained by passing the character string of the parallelization directive through the same one-way function as above By checking the character string of the parallelization directive described in the program with a unique character string obtained by passing the character string of the parallelization directive through a one-way function, the directive is processed by a processing system (computer). It can be automatically detected that the data has been automatically inserted and has not been changed by the user.
[0047]
Then, after deleting a directive and a character string that the processing system (computer) has inserted and the user has not changed from the parallel processing program, automatic generation of a parallelization directive and a character string for this parallel processing program is performed. Is performed.
[0048]
As described above, when the source program (the source file 18) containing the parallelization directive automatically generated by the
[0049]
The present invention is not limited to the examples described with reference to FIGS. 1 to 5 and can be variously modified without departing from the gist thereof. For example, in this example, the parallelization conversion system of the present invention is described as a function of the parallelizing
[0050]
Further, in this example, OpenMP which is a parallelization instruction specification for a shared memory type parallel computer is used as a directive statement language. However, the present invention may be implemented using a parallelization language for a distributed memory type computer. It is possible. For example, it is possible to input a sequential program, perform parallel analysis for a distributed memory type parallel computer, and insert the result into the input source as a parallelization directive of HPF which is a parallel language for the distributed memory type computer. it can.
[0051]
Further, in this example, a parallel processing program in which the character string (hash value) generated by the
[0052]
Further, the computer may be configured without a keyboard or an optical disk drive. In this example, the optical disk is used as the recording medium, but an FD (Flexible Disk) or the like may be used as the recording medium. As for the installation of the program, the program may be downloaded and installed via a network via a communication device.
[0053]
【The invention's effect】
According to the present invention, whether a directive (parallelization directive) instructing parallelization in a program for performing parallel processing is written by a programmer or automatically added before by a processing system (computer). It is possible for the processing system to automatically determine whether or not there is, and it is possible to improve the efficiency of automatic conversion by a computer from a source program written to perform processing sequentially to an object program that performs processing in parallel. It is possible.
[Brief description of the drawings]
FIG. 1 is a block diagram illustrating a configuration example of a computer device that executes a compiler provided with a parallelization system according to the present invention.
FIG. 2 is a flowchart illustrating an example of a parallel processing operation according to the present invention when a compiling operation is performed by the computer device of FIG. 1;
FIG. 3 is an explanatory diagram illustrating a configuration example of a parallel processing program generated by a computer device in FIG. 1;
FIG. 4 is a flowchart illustrating an example of a processing operation of an intermediate language generation unit in FIG. 1;
FIG. 5 is a flowchart illustrating an example of a processing operation of a directive generation unit in FIG. 1;
[Explanation of symbols]
10: Input program ("input source"), 11: Parallelizing compiler, 12: Intermediate language generating unit, 13: Parallelizing analyzing unit, 14: Parallelizing converting unit, 15: Object code generating unit, 16: Directive statement generating Part, 17: object program (“object code”), 18: source file (“output source”), 19: intermediate language, 20: various information tables, 31: PARALLEL DO directive, 32: character string (“hash value )).
Claims (7)
上記第1の手段で生成した並列化指示文からユニークな文字列を生成し、該並列化指示文と共に挿入する第2の手段と、
入力された上記並列処理プログラムにおける上記文字列と、該文字列が共に挿入された並列化指示文から上記第2の手段により生成される文字列とを照合し一致すれば、該並列化指示文が上記第1の手段により生成され、かつ、ユーザ変更されていないものであると判別する第3の手段と
を有することを特徴とする並列化変換システム。First means for analyzing the parallelism of an input program written so as to perform processing sequentially, generating a parallelization directive, and inserting the generated instruction into the input program, and processing the input program in parallel A parallel conversion system for converting into a parallel processing program,
A second means for generating a unique character string from the parallelization directive generated by the first means, and inserting the character string together with the parallelization directive;
If the character string in the input parallel processing program is matched with the character string generated by the second means from the parallelization instruction sent with the character string inserted, if the character strings match, the parallelization instruction Is generated by the first means and is determined to have not been changed by the user.
上記第2の手段は、上記並列化指示文の文字列を一方向関数に通すことで上記文字列を生成し、該文字列を当該並列化指示文と同一の行にコメントとして挿入することを特徴とする並列化変換システム。The parallelization conversion system according to claim 1, wherein
The second means generates the character string by passing the character string of the parallelization directive through a one-way function, and inserts the character string as a comment on the same line as the parallelization directive. Characterized parallel conversion system.
上記第1の手順で生成した並列化指示文からユニークな文字列を生成し、該並列化指示文と共に挿入する第2の手順と、
入力された上記並列処理プログラムにおける上記文字列と、該文字列が共に挿入された並列化指示文から上記第2の手段により生成される文字列とを照合する第3の手順と、
該照合結果で両文字列が一致すれば、上記並列化指示文が上記第1の手順で生成され、かつ、ユーザ変更されていないものであると判別する第4の手順と、
上記並列処理プログラムから上記文字列と上記特定指示文を削除する第5の手順とを有し、
上記第5の手順で上記文字列と上記特定指示文を削除した上記並列処理プログラムに対して上記第1,第2の手順を実行して、該並列処理プログラムに対する再変換を行なうことを特徴とする並列化変換方法。A first procedure of analyzing the parallelism of an input program described to be sequentially processed, generating a parallelization directive, and inserting it into the input program, and performing the input program in parallel A parallelization conversion method for a system for converting into a parallel processing program,
A second procedure of generating a unique character string from the parallelization directive generated in the first procedure and inserting the same with the parallelization directive;
A third procedure of comparing the input character string in the parallel processing program with a character string generated by the second means from the parallelization instruction sentence in which the character string is inserted;
If the two character strings match as a result of the collation, a fourth procedure for determining that the parallelization instruction sentence has been generated in the first procedure and has not been changed by the user;
A fifth procedure for deleting the character string and the specific directive from the parallel processing program,
The first and second procedures are executed on the parallel processing program from which the character string and the specific directive have been deleted in the fifth procedure, and the parallel processing program is re-converted. Parallelization conversion method.
上記第2の手順では、上記並列化指示文の文字列を一方向関数に通すことで上記文字列を生成し、該文字列を当該並列化指示文と同一の行にコメントとして挿入することを特徴とする並列化変換方法。The parallelization conversion method according to claim 5, wherein
The second procedure includes generating the character string by passing the character string of the parallelization directive through a one-way function, and inserting the character string as a comment on the same line as the parallelization directive. Characteristic parallelization conversion method.
上記コンピュータに、
上記ソースプログラムの並列性を解析し並列化指示文を生成して挿入する第1の手順と、
上記並列化指示文からユニークな文字列を生成し、該並列化指示文と共に挿入する第2の手順と、
上記並列化指示文と上記文字列を挿入した上記並列処理プログラムのソースファイルを記憶装置に格納する第3の手順と、
再変換のために入力した上記並列処理プログラムにおける文字列と、該文字列が共に挿入された並列化指示文から上記第2の手順により生成される文字列とが一致すれば、該並列化指示文が上記第1の手順により生成され、かつ、ユーザ変更されていない特定指示文であると判別する第4の手順と、
上記並列処理プログラムから上記文字列と上記特定指示文を削除する第5の手順と、
上記文字列と上記特定指示文を削除した上記並列処理プログラムに対する上記第1〜第3の手順を含めたコンパイル手順とを実行させることを特徴とするコンパイラ。A compiler for converting a source program written to perform sequential processing to a computer into an object program that performs parallel processing,
In the above computer,
A first procedure for analyzing the parallelism of the source program and generating and inserting a parallelization directive;
A second procedure of generating a unique character string from the parallelization directive and inserting it together with the parallelization directive;
A third procedure of storing a source file of the parallel processing program into which the parallel processing instruction and the character string are inserted, in a storage device;
If the character string input in the parallel processing program for reconversion matches the character string generated by the second procedure from the parallelization instruction sentence in which the character string is inserted, the parallelization instruction A fourth procedure for determining that the sentence is a specific instruction sentence generated by the first procedure and not changed by the user;
A fifth procedure for deleting the character string and the specific directive from the parallel processing program;
A compiler which executes a compile procedure including the first to third procedures for the parallel processing program from which the character string and the specific directive have been deleted.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2002182292A JP4019361B2 (en) | 2002-06-24 | 2002-06-24 | Parallelization conversion system, parallelization conversion method, program, and compiler |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2002182292A JP4019361B2 (en) | 2002-06-24 | 2002-06-24 | Parallelization conversion system, parallelization conversion method, program, and compiler |
Publications (2)
Publication Number | Publication Date |
---|---|
JP2004029982A true JP2004029982A (en) | 2004-01-29 |
JP4019361B2 JP4019361B2 (en) | 2007-12-12 |
Family
ID=31178843
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP2002182292A Expired - Fee Related JP4019361B2 (en) | 2002-06-24 | 2002-06-24 | Parallelization conversion system, parallelization conversion method, program, and compiler |
Country Status (1)
Country | Link |
---|---|
JP (1) | JP4019361B2 (en) |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
KR100749945B1 (en) * | 2004-12-02 | 2007-08-16 | 에이에스엠엘 네델란즈 비.브이. | Lithographic apparatus and device manufacturing method |
JP2012510661A (en) * | 2008-12-01 | 2012-05-10 | ケーピーアイティ クミンズ インフォシステムズ リミテッド | Method and system for parallel processing of sequential computer program code |
-
2002
- 2002-06-24 JP JP2002182292A patent/JP4019361B2/en not_active Expired - Fee Related
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
KR100749945B1 (en) * | 2004-12-02 | 2007-08-16 | 에이에스엠엘 네델란즈 비.브이. | Lithographic apparatus and device manufacturing method |
JP2012510661A (en) * | 2008-12-01 | 2012-05-10 | ケーピーアイティ クミンズ インフォシステムズ リミテッド | Method and system for parallel processing of sequential computer program code |
Also Published As
Publication number | Publication date |
---|---|
JP4019361B2 (en) | 2007-12-12 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
Rodrigues et al. | Sparse representation of implicit flows with applications to side-channel detection | |
US10261889B2 (en) | Techniques for edit-and-continue and enhanced optimized debugging on optimized code | |
US6978450B2 (en) | Method and system for optimizing compilation time of a program by selectively reusing object code | |
US7917899B2 (en) | Program development apparatus, method for developing a program, and a computer program product for executing an application for a program development apparatus | |
US10942718B2 (en) | Systems and/or methods for type inference from machine code | |
JPH07105012A (en) | Compiling processing system for language processing program | |
CN107203535B (en) | Information query method and device | |
WO2015035827A1 (en) | Method and apparatus for providing string encryption and decryption in program files | |
JP2011065220A (en) | Compiler program, compilation method and computer system | |
US8291397B2 (en) | Compiler optimized function variants for use when return codes are ignored | |
TW201502985A (en) | Method and device for processing file | |
JP2008276735A (en) | Program code converter and program code conversion method | |
Ansel et al. | PyTorch 2: Faster Machine Learning Through Dynamic Python Bytecode Transformation and Graph Compilation | |
JP6790869B2 (en) | Compilation method, compilation program and information processing equipment | |
US8887140B2 (en) | System and method for annotation-driven function inlining | |
JP2004029982A (en) | Parallelization conversion system, parallelization conversion method, program, and compiler | |
JP2005165919A (en) | Program execution method, program creation method, information processor and program | |
CN111796832B (en) | Hot patch file generation method, device, equipment and storage medium | |
JP5891976B2 (en) | Compile execution / management method, apparatus, and program | |
JP6326838B2 (en) | Program processing apparatus, program processing method, and program processing program | |
CN113138797A (en) | Intel SGX-oriented program automatic transplanting system | |
CN113260976A (en) | Techniques for scheduling instructions in compiled source code | |
KR102130016B1 (en) | Method and system for compiling for automatic caching, and recoding medium therefor | |
JP2007265098A (en) | Macro definition information acquisition device | |
JP2017151903A (en) | Compilation device, compilation method and compilation program |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
A621 | Written request for application examination |
Free format text: JAPANESE INTERMEDIATE CODE: A621 Effective date: 20040813 |
|
A977 | Report on retrieval |
Free format text: JAPANESE INTERMEDIATE CODE: A971007 Effective date: 20070521 |
|
A131 | Notification of reasons for refusal |
Free format text: JAPANESE INTERMEDIATE CODE: A131 Effective date: 20070525 |
|
A521 | Written amendment |
Free format text: JAPANESE INTERMEDIATE CODE: A523 Effective date: 20070719 |
|
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: 20070831 |
|
A61 | First payment of annual fees (during grant procedure) |
Free format text: JAPANESE INTERMEDIATE CODE: A61 Effective date: 20070913 |
|
FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20101005 Year of fee payment: 3 |
|
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: 20111005 Year of fee payment: 4 |
|
FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20121005 Year of fee payment: 5 |
|
FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20121005 Year of fee payment: 5 |
|
FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20131005 Year of fee payment: 6 |
|
LAPS | Cancellation because of no payment of annual fees |