JP4073303B2 - Program division method and program for implementing the method - Google Patents

Program division method and program for implementing the method Download PDF

Info

Publication number
JP4073303B2
JP4073303B2 JP2002350967A JP2002350967A JP4073303B2 JP 4073303 B2 JP4073303 B2 JP 4073303B2 JP 2002350967 A JP2002350967 A JP 2002350967A JP 2002350967 A JP2002350967 A JP 2002350967A JP 4073303 B2 JP4073303 B2 JP 4073303B2
Authority
JP
Japan
Prior art keywords
program
data
division
programs
divided
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
Application number
JP2002350967A
Other languages
Japanese (ja)
Other versions
JP2004185271A (en
Inventor
謙吾 畔上
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Fujitsu Ltd
Original Assignee
Fujitsu Ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Fujitsu Ltd filed Critical Fujitsu Ltd
Priority to JP2002350967A priority Critical patent/JP4073303B2/en
Publication of JP2004185271A publication Critical patent/JP2004185271A/en
Application granted granted Critical
Publication of JP4073303B2 publication Critical patent/JP4073303B2/en
Anticipated expiration legal-status Critical
Expired - Fee Related legal-status Critical Current

Links

Images

Description

【0001】
【発明の属する技術分野】
本発明は、複数のプロセッサにより効率的に実行できるようにプログラムを分割する方法とその分割方法をコンピュータに実行させるプログラムに関し、特に遺伝子を利用した遺伝的アルゴリズム(ジェネティック・アルゴリズム)を利用してプログラムを分割する方法及びその分割方法を行うプログラムに関する。
【0002】
【従来の技術】
近年において、システムを効率的に利用する方法として、複数のマイクロプロセッサをひとまとめにして所定のプログラムを並列的に実行させるマルチプロセッサシステムが提案されている。元々1つのプログラムを1つのプロセッサで実行するよりも、そのプログラムを複数の部分プログラムに分割して、その分割された部分プログラムを複数のプロセッサで実行したほうが、プログラム全体の実行に要する時間を短縮できる。
【0003】
このように、与えられた逐次的なプログラムを、複数のプロセッサで協調して実行するために、プログラム作成者がプログラムに意図的に並列実行を行わせるような追加的な記述を加える方法や、コンピュータにより実行対象の逐次的なプログラムを自動的に分割させる方法などが提案されている。本発明は、このうち後者の方法に関するものである。
【0004】
このようなプログラムの分割方法としては、与えられた実行対象のプログラムに何らの変更も行うことなく分割を行う方法と、与えられた実行対象プログラムに何らかの変更を加えてから分割を行う方法とが提案されているが、前者のほうが実行対象プログラムへの変更を加えないという理由で好ましい。
【0005】
プログラムの分割方法としては、以下の先行技術が提案されている。
【0006】
【特許文献1】
特開平7−281907号公報
【0007】
【特許文献2】
特開平9−282290号公報
【0008】
【発明が解決しようとする課題】
しかしながら、上記の特許文献のプログラム分割方法は、複雑なアルゴリズムによるものであり、実行対象のプログラムを適切に且つ簡単に分割する方法については、具体的な提案はあまりない。
【0009】
そこで、本発明の目的は、実行対象のプログラムを、簡単なアルゴリズムで、複数のプロセッサにより効率的に実行可能な複数の部分プログラムに分割する方法と、その分割方法をコンピュータに実行させるプログラムを提供することにある。
【0010】
【課題を解決するための手段】
上記の目的を達成するために、本発明の一つの側面は、所定のデータへのアクセスを伴う実行対象プログラムを複数の部分プログラムに分割する方法において、
(a)実行対象プログラムの複数の記述を点の集合とし、前記複数の記述の実行順序を有向枝の集合とするグラフモデルを生成する工程と、
(b)前記グラフモデルに含まれる記述の点を複数の部分集合に分割して複数の部分プログラムを有する分割プログラムを、複数、生成する工程と、
(c)前記分割プログラムの分割情報を有する遺伝子データを、前記複数の分割プログラムそれぞれに対して生成する工程と、
(d)前記複数の分割プログラムの中からランダムに選択された1対の分割プログラムを交差して、次の世代の複数の分割プログラムを生成し、当該生成された複数の分割プログラムの前記遺伝子データを生成する工程と、
(e)前記交差により生成された次世代の複数の分割プログラムについて、少なくとも前記部分プログラムへのデータ送信量を有する評価値を求め、当該評価値に基づいて所定数の分割プログラムを選択する工程とを有し、
前記工程(e)で選択された複数の分割プログラムに対して、前記工程(d)と工程(e)とを繰り返すことを特徴とする。
【0011】
上記の発明の側面において、より好ましい実施例では、遺伝子データの分割情報は、前記分割プログラムの有向枝の集合のうち、分割により切断された切断有向枝と切断されなかった非切断有向枝とを示す情報であることを特徴とする。また、別の実施例では、遺伝子データの分割情報は、例えば、分割による切断部分に係る点と非切断部分に係る点とを示す情報であることを特徴とする。
【0012】
更に、上記の発明の側面において、より好ましい実施例では、上記工程(d)と工程(e)の繰り返しが、各世代内の分割プログラムの評価値に応じて終了されることを特徴とする。例えば、各世代内の複数の分割プログラムのうち、最高の評価値を有する最良分割プログラムの評価値が、所定数の連続する世代において、最早改良されなくなったときに、前記工程(d)と工程(e)の繰り返しが終了されることが好ましい。
【0013】
上記の発明によれば、複数の部分プログラムに分割された分割プログラムの分割情報を遺伝子データとして持たせ、ランダムに選択された1対の分割プログラムを交差して次世代の分割プログラムを生成することを繰り返すことにより、最適な分割プログラムを生み出すことができる。この方法によれば、実行対象のプログラムに変更、追加を行うことなく、遺伝的アルゴリズムを利用した簡単なアルゴリズムによって分割して、複数のプロセッサで実行可能な分割プログラムを生成することができる。
【0014】
【発明の実施の形態】
以下、図面を参照して本発明の実施の形態例を説明する。しかしながら、本発明の保護範囲は、以下の実施の形態例に限定されるものではなく、特許請求の範囲に記載された発明とその均等物にまで及ぶものである。
【0015】
図1は、本実施の形態におけるプログラムの実行手順を示したフローチャート図である。また、図2は、実行対象プログラムを実行するマルチプロセッサシステムの構成図である。図1,2を参照しながら、実行対象プログラムを分割して複数のプロセッサにより並列処理することについて説明する。
【0016】
最初に、メインプロセッサ10に、実行対象の逐次処理型のプログラムF1が入力される(S10)。メインプロセッサ10は、この実行対象プログラムF1を、分割方法を実行するプログラムF2によって、複数の部分プログラムに分割する(S12)。この分割されたプログラムが分割プログラムであり、この分割プログラムは、複数の部分プログラムA〜Nを有する。そして、メインプロセッサ10は、この分割プログラムに含まれる部分プログラムA〜Nを、複数のプロセッサ10−A〜10−Nに割り当ててそれぞれに実行させる(16−A〜16−N)。この場合、必ずしも、プロセッサの数と部分プログラムの数とが一致する必要はなく、あるプロセッサが複数の部分プログラムを処理し、他のプロセッサが単一の部分プログラムを処理してもよい。これにより、単一のプログラムF1が、複数のプロセッサにより並列に処理されるので、プログラムの実行効率を高めることができる。
【0017】
図2中において、メインプロセッサ10や複数のプロセッサ群10−A〜10−Nは、それぞれ内部にCPUと、入出力手段I/Oと、メモリRAM,ROMを有し、内部バスを介して接続されている。そして、メインプロセッサ10内のROMに分割方法を実行するプログラムF2が格納されている。
[遺伝的アルゴリズム]
本実施の形態では、図1の入力プログラムの分割方法を提供するものであり、その分割方法は、遺伝的アルゴリズムを利用したものである。遺伝的アルゴリズムの基本的な考え方は、次の通りである。
【0018】
遺伝的アルゴリズムは、良い親の集まりからは良い子の集まりが得られるというポリシーに基づいて、最良の解を探索する手法である。即ち、生物が進化していく過程を、コンピュータ上で問題を解く過程として利用するものである。例えば、ある問題が取りうる全ての解の集合をAとし、解の集合Aの部分集合であるCiを世代iの解の集合であるとする。また、この解Ciを評価する評価関数feval(Ci)を定義する。そして、ある世代iの解Ciを親世代の集合として、その子世代i+1の解の集合をCi+1とし、この子世代の解Ci+1は、親世代の1対の解Ciを交差(crossover)することにより求められるものとする。更に、解Ciの任意の要素を遺伝子(gene)により定義するものとし、親世代の1対の解Ciがそれぞれ有する遺伝子データが、次の世代である子世代の解Ci+1にも一部受け継がれるものとする。つまり、親世代の1対の解Ciが有する遺伝子g1,g2と、ランダムに与えられたパラメータとをもとにして、子世代の1対の解Ci+1の遺伝子g12、g21が生成される。但し、交差だけではローカルな最小値(local minima)に落ち込む恐れがあるので、交差時に突然変異(Mutation)による遺伝子の変異もまれに且つランダムに発生させる。
【0019】
但し、交差と突然変異によって、親世代の解Ciから子世代の解Ci+1を発生させているだけでは、取りうる解の集合Aを逸脱する解が発生する場合がある。従って、実現不可能な(Infeasible)な解が持つ遺伝子を致死遺伝子(lethal gene)と呼んで、そのような致死遺伝子を有する解は、子世代から排除するようにする。
【0020】
以上の遺伝的アルゴリズムを利用して、実行対象プログラムを複数の部分プログラムからなる分割プログラムを生成する。上記の交差により子世代の解を生成する時の交差関数と、突然変異を発生させた時の変異関数と、交差を繰り返して生成された解が適切であるか否かを判断する評価関数を適切に定義することで、最適な分割プログラムを自動生成することが可能になる。
[評価関数の考え方]
上記の通り、実行対象プログラムを複数の部分プログラムに分割し、それらを複数のプロセッサにより実行する場合に、実行効率を良好にする分割状態とはどういうものかについて、基準となる評価値を求める評価関数を定義する必要がある。そこで、この評価関数をどのようにすべきかの考え方を説明する。評価値は、分割プログラムの実行時間や消費電力など様々な指標を選択することができる。最も典型的には、評価値は、分割プログラムの実行時間である。
【0021】
この実行時間は、各部分プログラムの実行に要する時間の総和であるが、各部分プログラムの実行時間は、部分プログラムの総実行ステップ数と、部分プログラムを実行するためのデータ準備時間などの和で表される。特に、後者の時間は、分割された部分プログラムが異なるプロセッサにより実行されるので、部分プログラム間で共有するデータ量、つまり異なるプロセッサ間で転送しあうデータ量を少なくすることが望ましいといえる。
【0022】
短絡的に考えれば、部分プログラム間で共有するデータの量を最も少なくするためには、全ての部分プログラムを単一のプロセッサで実行すればよい。それにより、転送すべきデータ量はゼロになる。しかし、複数の部分プログラムを単一のプロセッサで実行させることは、並列に動作させることで動作時間を短縮させるという本来の目的に整合しないことになり、好ましくないのは当然である。
【0023】
また、部分プログラムの数を減らすことは、部分プログラム間で共有すべきデータ量を減らすことに貢献するものの、1つの部分プログラムの実行ステップ数が多くなって、1つのプロセッサを占有する時間が長くなる。更に、複数の部分プログラムを複数のプロセッサに振り分けるスケジューリングの柔軟性が悪くなり、プロセッサ群の平均稼働率が低下することも招いて、トータルの実行時間が長くなることが予想される。
【0024】
一方で、部分プログラムの数を増やすことは、1つの部分プログラムの実行ステップ数が少なくなって、1つのプロセッサを占有する時間が短くなる。そして、スケジューリングの柔軟性も高くなり、プロセッサ群の平均稼働率が向上する。しかし、部分プログラム間で共有すべきデータ量が増大して、部分プログラム実行に必要な準備時間が長くなるということが予想される。
【0025】
以上のことを総括すると、マルチプロセッサシステムで実行効率を高めることができる分割プログラムの評価値としては、次のような性質が含まれる。
(1)プロセッサ間でのデータ通信時間が長くなるような箇所では、プログラムの分割を行わない。
(2)部分プログラムの大きさは、大き過ぎず同時に小さ過ぎてもいけない。
(3)部分プログラムの数は、多過ぎず、同時に少な過ぎてもいけない。
これらの性質が反映された評価関数を定義することで、種の進化過程において適切な分割プログラムが生成されたか否かを判断することができる。
[プログラムのモデル化]
実行対象のプログラムを一定の分割アルゴリズムによるプログラムによって複数の部分プログラムに分割するためには、実行対象プログラムをモデル化して情報処理に適したデータ構造にする必要がある。そこで、本実施の形態では、実行対象プログラムは、グラフG=(V,E)で与えられると定義する。ここで、Vpは実行対象プログラム中の記述を表す点の集合であり、Vqはプログラム中のデータを表す点の集合であり、この集合Vp、Vqを合わせて点の集合Vで表される。また、Epは実行対象プログラム中の記述の実行順序を示す有向枝の集合であり、Eqはデータへのアクセス(リードとライト)を表す有向枝の集合であり、この集合Ep、Eqを合わせて有向枝の集合Eで表される。
【0026】
図3はプログラムのモデル化の一例を示す図である。図3(A)は、実行対象プログラムF1であり、各記述が含まれるステップa〜dからなり、各ステップではデータV〜Yに対して読み出しや書き込みが行われている。このような実行対象プログラムF1をモデル化したグラフGが、図3(B)に示される。このグラフGは、記述の点集合Vp={a,b,c,d}及びデータの点集合Vq={V,W,X,Y}からなる点集合Vと、記述の実行順序の有向枝集合Ep={ab,bc,cd}及びデータへのアクセスの有向枝集合Eq={aV,Vb,bV,Vc,cX,Wd,Xd,dY}からなる有向枝集合Eとにモデル化される。
[遺伝子]
遺伝的アルゴリズムを適用するためには、モデル化された実行対象プログラムを複数の部分プログラムに分割して得られた分割プログラムを、遺伝子で表さなければならない。そこで、本実施の形態では、分割プログラムの分割状況を示す分割情報を、遺伝子情報として表す。第1の例として、遺伝子データの分割情報は、分割プログラムの有向枝の集合Epに対応して、分割により切断された切断有向枝と切断されなかった非切断有向枝とを「0」「1」で示す情報である。あるいは、第2の例としては、分割情報は、分割プログラムの記述の集合Vpに対応して、分割による切断部分に係る点と非切断部分に係る点とを示す情報である。以下の例では、第1の例に従って遺伝子を説明する。
【0027】
図4は、実行対象プログラムをグラフ化した例を示す図である。このグラフGpは、以下の記述の点集合Vpとその実行順序の有向枝集合Epとでモデル化される。
Vp={a,b,c,d,e,f,g,h,i,j,k,l,m}
Ep={ab,ac,bd,be,cf,dg,eh,fi,fj,gk,hk,ik,il,jl,km,lm}
このようにモデル化されたグラフGpの分割例が、図5、図6に示される。図5、図6は、図4のプログラムを分割した分割プログラムのグラフ例を示す図である。図5の例では、4つの部分プログラムに分割され、各部分プログラムは、{a,c,f,i,k}と{b,d,g}と{e,h}と{j,l,m}とで構成される。また、図6の例では、6つの部分プログラムに分割され、各部分プログラムは、{a,c}と{b,e,h}と{d,g}と{f,j}と{i,l}と{k,m}とで構成される。
【0028】
このように分割された場合、モデル化されたグラフの有向枝が、分割された部分プログラムの境界にあるか否か、または切断枝か非切断枝かを表す情報を遺伝子としてすることができる。つまり、遺伝子gは、有向枝の集合Epの要素に対応する「0」(境界の枝、切断枝)と「1」(非境界の枝、非切断枝)との系列として定義することができる。つまり、図5の例では、遺伝子gは、上記Epに対応してg={0,1,1,0,1,1,1,1,0,0,0,1,0,1,0,1}となり、図6の例では、遺伝子gは、g={0,1,0,1,0,1,1,0,1,0,0,0,1,0,1,0}となる。以上のとおり、モデルGとその遺伝子gが示されれば、分割プログラムの分割状態を一義的に再現することができる。
[分割方法の具体例]
以上の前提をもとに、本実施の形態における実行対象プログラムを遺伝的アルゴリズムにより分割する方法について、以下説明する。
【0029】
図7は、本実施の形態におけるプログラムの分割方法を示すフローチャート図である。このフローチャートに対応する分割方法実行プログラムF2が、図2で示したとおり、メインプロセッサ10のROM内に格納されている。最初に、実行対象プログラムF1がメインプロセッサ10に入力される(S20)。入力された実行対象プログラムF1は、上記の方法でグラフ化される。このグラフ化により生成されたグラフGに対して、グラフの各点と各枝に対して、後述する評価関数による評価値を求めるための重み付けを行う(S24)。この重み付けは、図3(B)のグラフの例で説明すると、各データに対応する点V〜Yに対しては、そのデータ量を重みとする。また、各記述に対応する点a〜dに対しては、その処理時間を重みとする。そして、記述に対応する点a〜dとデータに対応する点V〜Yとの間の枝に対しては、それぞれのデータへのアクセス時間を重みとする。例えば、データがプロセッサの近い位置に格納されていればアクセス時間が短く、遠い位置に格納されていればアクセス時間が長いなどである。更に、記述に対応する点a〜d間の枝に対しては、例えば、異なるプロセッサに引き継ぐ時に必要な時間の長さを重みとする。これらの重み付けは、評価関数にどのような要素が利用されるかにより、選択的に生成すればよい。
【0030】
次に、実行対象プログラムをランダムに複数の部分プログラムに分割して、複数の分割プログラムを生成する(S26)。この工程では、図4に示されたようなグラフGpの実行対象プログラムを、複数の部分プログラムにランダムに分割して、図5,図6などに示したような分割プログラムを生成する。そして、生成されたそれぞれの分割プログラムに対して、それぞれ遺伝子gを生成する(S28)。つまり、前述のとおり、グラフGpの枝集合Epの各要素が、部分プログラムに分割された時の切断枝か非切断枝かを「1」「0」で示す遺伝子gを生成する。そして、この最初の分割プログラムの集合を、第1世代(i=1)の分割プログラムと定義する(S30)。この第1世代の分割プログラムには、後述する致死遺伝子を持つものは含まれないものとする。
【0031】
次に、第1世代の複数の分割プログラムのうち、ランダムに選択した1対の分割プログラムを交差して、次の世代の複数の分割プログラムを生成する(S32)。つまり、親世代の分割プログラムを交差させて、子世代の分割プログラムを生成させる。この子世代の分割プログラムは、親世代の分割プログラムの数よりも多いことが望ましい。そこで、交差のアルゴリズムについて説明する。
[交差アルゴリズム]
交差とは、2つの遺伝子から新しい遺伝子を作り出す操作である。本実施の形態では、分割プログラムの分割情報を有する2つの遺伝子をある交差アルゴリズムで交差させて、新たな遺伝子を生成する。遺伝的な意味での交差では、親の遺伝子情報(分割情報)が子供にも伝達される。それにより、親の持っている特徴(分割の特徴)が子供にも遺伝される。そして、交差により新たに生まれた子供のうち、評価値が高いすぐれたものを残し、更に交差によって次の世代の子供を産むようにすることで、種の原理によりすぐれた種(分割プログラム)が生成されていく。但し、常に同じアルゴリズムにより親の遺伝子情報を子供にも引き継ぐようにすると、ある狭い領域内での優秀な種しか生まれないので、まれに突然変異を発生させて、新たな探索領域を発生させることが必要である。
【0032】
図8は、本実施の形態における交差アルゴリズムを示す図である。図8は、2つのグラフG1,G2を交差させて、次の世代のグラフG12,G21を生成するアルゴリズムが示されている。この交差アルゴリズムによれば、分割プログラムに対応するグラフGp=(Vp,Ep)のランダムな2分割部分Gpa、Gpbを生成する。このランダムな切断線CTにより、複数の枝が切断される。そして、それぞれのグラフの2分割部分G1a,G1b,G2a,G2bを互いに入れ替えて融合することで、新たなグラフ
G12=G1a+G2b
G21=G2a+G1b
を生成する。上記の切断線CTをランダムに選択すること自体が、交差時のランダムなパラメータを意味している。
【0033】
これにより、グラフG12の遺伝子g12は、グラフG1の遺伝子g1の一部とグラフG2の遺伝子g2の一部を引き継いだものになる。また、グラフG21の遺伝子g21も、同様に遺伝子g1の一部とg2の一部を引き継いだものになる。つまり、グラフG12の遺伝子g12とグラフG21の遺伝子g21は、グラフG1の一部の分割情報とグラフG2の一部の分割情報とを有する。但し、ランダムに切断された枝については、融合されるときに所定のルールに従って、切断枝か非切断枝かになる。
【0034】
図9は、ランダムに切断された枝の融合による処理を示す図である。2つに切断された親のグラフを融合した場合、図9のケース1,2,3に示されるように、その切断線CTにおいて、親のグラフでの切断枝と非切断枝とが融合する場合(ケース1,2)と、親のグラフでの非切断枝と非切断枝とが融合する場合(ケース3)とが考えられる。その場合、ケースAのようにそれらの枝をつなぐケースと、ケースBのようにそれらの枝を切断するケースのいずれかにランダムに選択する。或いは、ケースA,Bのいずれか一方を原則的に選択し、まれに他方のケースを選択するようにしてもよい。このいずれかのケースをランダムに選択することは、突然変異を含んだ融合である。また、いずれか一方のケースを原則的に選択し、まれに他方のケースを選択することも、突然変異(まれに他方のケースを選択すること)を含んだ融合である。図8の例では、いずれかのケースA,Bをランダムに選択している。
【0035】
なお、ランダムに切断されたグラフを融合する時に、親のグラフで切断枝と切断枝とが融合する場合があるが、その場合は、融合によっても切断枝のままとする。
【0036】
上記の融合のアルゴリズムは、一例であり、これに限定されるものではない。例えば、上記の例と逆に、いずれか一方が親のグラフにおいて切断枝であれば融合しても切断し、両方共に親のグラフにおいて非切断枝の場合であれば融合しても非切断枝にするようにしても良い。
【0037】
突然変異のアルゴリズムは、上記の融合時のアルゴリズムにランダム性を含ませる他に、融合後のグラフの任意の枝について、非切断枝を切断枝に変更する操作であっても良い。この操作は、ある部分プログラムを複数の部分プログラムに変更する操作である。この操作であれば、後述する致死遺伝子を生成するリスクをなくすことができる。このような操作をすることにより、親の遺伝子とは異なる遺伝子に突然変異することになり、突然変異が発生したことになる。
[致死遺伝子]
ここで、致死遺伝子について説明する。図10は、致死遺伝子の一例を示す図である。この分割プログラムによれば、部分プログラム(b,d,g,e,h)と(f,i,j,l)とが、内部に並列的な関係を有している。複数のプロセッサに分配される部分プログラム自体が並列的な記述部分を含んでいることは、プログラムの実行時間短縮の目的に整合せず、好ましくない。そこで、このような部分プログラムを有する分割プログラムは、致死遺伝子とし、新たな生命として誕生したものとはしないようにする。
【0038】
例えば、図7の工程S26において、実行対象プログラムを分割して複数の分割プログラムを生成するが、この生成された分割プログラムから、致死遺伝子を有するものは除外することが望ましい。また、工程S32において、交差によって次世代の分割プログラムを生成するが、ここでも生成された分割プログラムから、致死遺伝子を有するものを除外することが望ましい。
【0039】
このように、分割状態がそもそも分割プログラムとして好ましくない状態を致死遺伝子として取り扱うことで、種の進化の過程からそのような好ましくない遺伝子を持つ種を排除することが好ましい。致死遺伝子を排除することで、実現可能な遺伝子を持つ親世代を交差すれば、その子世代で生成される遺伝子も必ず実現可能になる。
【0040】
更に、上記の致死遺伝子ではない遺伝子に対して、前述の非切断枝を切断する突然変異を発生させても、その結果生成される分割プログラムの遺伝子は致死遺伝子になることはない。
【0041】
図7のフローチャートに戻り、交差により次世代の複数の分割プログラムが生成されると(S32)、次に、評価関数に基づいて、評価値が高い分割プログラムを選択する。例えば、親の世代の分割プログラムの数と、子の世代の分割プログラムの数とが同等になるように、交差により新たに生まれた複数の分割プログラムの数を減少させる(S36)。こうすることにより、種の進化過程で、優秀な種のみが残されてくることになる。但し、探索領域が限定されたローカルミニマに陥ることを防止するために、まれに或いは低い比率で突然変異が発生される(S34)。
[評価関数の具体例]
前述の評価関数の考え方によれば、分割プログラムの評価値としては、次のような性質が含まれる。
(1)プロセッサ間でのデータ通信時間が長くなるような箇所では、プログラムの分割を行わない。
(2)部分プログラムの大きさは、大き過ぎず同時に小さ過ぎてもいけない。
(3)部分プログラムの数は、多過ぎず、同時に少な過ぎてもいけない。
【0042】
そこで、上記の具体例における評価関数を説明する。まず、分割プログラムに対応するグラフGpの部分プログラムの数n、グラフGpにおける部分プログラム間でのデータの送信量の総量d、部分プログラム内の最長パスの総和lに対して、評価関数fevalは、例えば、
feval(n,pn,l,pl,d,pd)=npn/(dpd×lpl) (1)
ここで、pn,pl,pdは係数である。
【0043】
そして、上記の評価関数の考え方(1)(2)(3)の重要度に応じて、これらの係数が具体的に決定される。例えば、考え方(1)が最も重要な場合は、この係数pdが大きく設定される。
【0044】
図5の分割プログラムのグラフの場合は、部分プログラムの数n=4、部分プログラム内の最長パスの総和l=5+3+2+3=13となる。一方、図5のグラフの婆波、部分プログラムの数n=6、部分プログラム内の最長パスの総和l=2+3+2+2+2+2=13となる。
【0045】
図11は、データの送信量の総和の求め方を示す図である。まず、図11中の上段に示されたグラフは、一例として図8の交差で生成されたグラフG12に対するデータDa〜Deへのアクセスの関係を示している。枝の矢印の方向がデータが通信される方向に対応するので、記述からデータに向かう矢印は書き込み、データから記述に向かう矢印は読み出しをそれぞれ示す。
【0046】
このようなグラフの例において、各部分プログラムに対する複数の枝を1つにまとめて(縮体して)、図11の下段のグラフを作成する。このグラフでは、6つの部分プログラムに対する各データへのアクセスを示す枝が示され、各データにはそのデータ量が括弧内に示されている。そして、1つの部分プログラムへの複数の枝は、1回のデータ転送とみなすことができる。なぜなら、部分プログラムは同じプロセッサにより実行されるので、あるデータに対して1回アクセスすれば、そのプロセッサはそのデータを保有しており、それ以降のアクセスが発生しても、プロセッサ内部のメモリから取得可能であり、データの送信を行う必要はないからである。
【0047】
従って、部分プログラム{a,c,f,i,l}に対しては、データDa,Db,Ddへのアクセスがあり、それぞれのデータ量が3,2,9であるので、その部分プログラムへのデータ送信量は、d=3+2+9=11となる。同様に、他の部分プログラムに対してもデータ送信量を求めると、合計でd=51になる。つまり、図11に示される通りである。
【0048】
上記の部分プログラムの数nと、最長パスの総和lと、データ送信量dが求められれば、上記式(1)の評価関数fevalに従って、分割プログラムの評価値を求めることができる。この評価関数を最適化することにより、ステップS36において、最良の分割プログラムを選択することができる。
【0049】
以上の操作により、次の世代の分割プログラムが生成されたことになる。そこで、世代数iをインクリメントする(S38)。そして、上記ステップS32,S34,S36,S38を、所定の終了条件(S40)に合致するまで繰り返す。繰り返すことで、種の進化によってより最適な分割プログラムが生成される。
【0050】
終了条件は、例えば次のような2つの条件が考えられる。1つめは、ある分割プログラムの集合の平均値が一定のレベルを超えた若しくは数世代にわたって一定のレベル以上にならない場合に、種の進化が停止したと判断する方法である。この場合は、ある世代の分割プログラムの評価値の平均を求めることで、終了条件に合致したか否かが検出できる。この平均値で評価する場合は、特に、ステップS36のように評価値の高い分割プログラムを選択することにより、その次の世代の分割プログラムの平均的評価値も高くなる。
【0051】
2つめは、ある分割プログラムの集合のなかで最も良い値が一定のレベルを超えた若しくは数世代にわたって一定のレベル以上にならない場合に、種の進化が停止したと判断する方法である。図7の例は、この2つの例である。この場合は、集合の中から1つの優秀な評価値をもつ部分プログラムが生成されればよいので、ステップS36では、評価値にかかわらずランダムに次世代の分割プログラムを選択しても差し支えないと考えられる。
【0052】
図12は、図7の分割処理に従って進化させた時の進化の状況を示す図である。図12に従って、分割処理における進化の状況を概説する。最初に、実行対象プログラムP0に対してグラフが生成され、そのグラフをランダムに分割して、第1世代のK個の分割プログラムP1−1〜P1−Kが生成される。そして、その分割プログラムの集合からランダムに選択した1対の分割プログラムを交差して(S32,S34)、部分的に遺伝子情報を受け継いだ第2世代のL個(>K個)の分割プログラムP2−1〜P2−Lを生成する。そして、それぞれの分割プログラムの評価値を比較して、より優秀な評価値を有するK個の分割プログラムP2−1〜P2−Kに絞る(S36)。こうして、第1世代と同じ数のK個の分割プログラムの集合が第2世代の分割プログラムとして生成される。そして、この第2世代の分割プログラムのうち、最良の評価値を有する分割プログラム(例えばP2−12)を記録しておく。
【0053】
同様にして、第2世代の分割プログラムを交差して、L個の第3世代の分割プログラムを生成し、K個の第3世代の分割プログラムに絞る。そして、その第3世代で最良の評価値を有する分割プログラム(例えばP3−13)を記録しておく。同様の交差S32と絞り込みS36を繰り返し、各世代内で最良の評価値を比較し、数世代にわたってこの最良の評価値に改良が見られなくなったら(S40)、分割処理を終了する。
【0054】
図13は、本実施の形態の変形例を示す図である。図12に示したとおり、親世代の分割プログラムからランダムに選択した1対の分割プログラムを交差させて、子世代の分割プログラムを生成してきたが、図13の変形例では、第1世代の分割プログラムの集合を複数のセグメントSEG0〜SEGnに分けて、各セグメント内において主に交差を繰り返す。そして、まれに若しくは一定の比率で、異なるセグメント内の分割プログラム間で交差させる。
【0055】
この方法は、ある地域内において主に交差が繰り返されて、まれに地域外との交差が行われる場合に、より良質の種が生み出されるという種の進化のルールに従うものであり、より最適な分割プログラムを生成できることが期待できる。
【0056】
以上、実施の形態例をまとめると以下の付記の通りである。
【0057】
(付記1)所定のデータへのアクセスを伴う実行対象プログラムを複数の部分プログラムに分割する方法において、
(a)実行対象プログラムの複数の記述を点の集合とし、前記複数の記述の実行順序を有向枝の集合とするグラフモデルを生成する工程と、
(b)前記グラフモデルに含まれる記述の点を複数の部分集合に分割して複数の部分プログラムを有する分割プログラムを、複数、生成する工程と、
(c)前記分割プログラムの分割情報を有する遺伝子データを、前記複数の分割プログラムそれぞれに対して生成する工程と、
(d)前記複数の分割プログラムの中からランダムに選択された1対の分割プログラムを交差して、次の世代の複数の分割プログラムを生成し、当該生成された複数の分割プログラムの前記遺伝子データを生成する工程と、
(e)前記交差により生成された次世代の複数の分割プログラムについて、少なくとも前記部分プログラムへのデータ送信量を有する評価値を求め、当該評価値に基づいて所定数の分割プログラムを選択する工程とを有し、
前記工程(e)で選択された複数の分割プログラムに対して、前記工程(d)と工程(e)とを繰り返すことを特徴とするプログラム分割方法。
【0058】
(付記2)付記1において、
前記遺伝子データの分割情報は、前記分割プログラムの有向枝の集合のうち、分割により切断された切断有向枝と切断されなかった非切断有向枝とを示す情報であることを特徴とするプログラム分割方法。
【0059】
(付記3)付記1において、
前記遺伝子データの分割情報は、分割による切断部分についての点と非切断部分についての点とを示す情報であることを特徴とするプログラム分割方法。
【0060】
(付記4)付記2または3において、
前記工程(d)の交差において、前記1対の分割プログラムをそれぞれランダムに2分割し、互いに異なる分割部分を融合して、次世代の1対の分割プログラムを生成し、当該次世代の分割プログラムの遺伝子データが、前世代の分割プログラムの遺伝子データの一部を引き継ぐことを特徴とするプログラム分割方法。
【0061】
(付記5)付記1において、
前記工程(d)と工程(e)の繰り返しが、前記交差により生成された分割プログラムの評価値に応じて終了されることを特徴とするプログラム分割方法。
【0062】
(付記6)付記5において、
前記各世代内の複数の分割プログラムのうち、最良の評価値を有する最良分割プログラムの評価値が、所定数の連続する世代において、もはや改良されなくなったときに、前記工程(d)と工程(e)の繰り返しが終了されることを特徴とするプログラム分割方法。
【0063】
(付記7)付記5において、
前記各世代内の複数の分割プログラムの評価値の平均値が、所定数の連続する世代において、もはや改良されなくなった時に、前記工程(d)と工程(e)の繰り返しが終了することを特徴とするプログラム分割方法。
【0064】
(付記8)付記1において、
前記グラフモデルは、更に、前記データを点の集合として、前記データへのアクセスを前記記述の点の点とデータの点とを結ぶ有向枝の集合として有し、前記データ送信量は、前記部分プログラムと有向枝で結ばれたデータのデータ量の合計を、当該分割プログラム内で合算した値であることを特徴とするプログラム分割方法。
【0065】
(付記9)付記1において、
前記評価値は、前記部分プログラムへのデータ送信量に加えて、更に、前記複数の部分プログラムの数と、当該部分プログラムのパス長の累計値とを有する評価関数により求められることを特徴とするプログラム分割方法。
【0066】
(付記10)付記1において、
前記交差により新たに生成された分割プログラムの遺伝子データが、所定の分割形態を有する致死遺伝子データである場合は、当該致死遺伝子データに対応する分割プログラムが除外されることを特徴とするプログラム分割方法。
【0067】
(付記11)付記1において、
前記複数の分割プログラムが複数のセグメントに分割されており、
前記工程(d)において、同じセグメント内の1対の分割プログラムに対する交差処理が第1の割合で行われ、異なるセグメント間の1対の分割プログラムに対する交差処理が前記第1の割合よりも少ない第2の割合で行われることを特徴とするプログラム分割方法。
【0068】
(付記12)所定のデータへのアクセスを伴う実行対象プログラムを複数の部分プログラムに分割する方法において、
(a)実行対象プログラムの複数の記述を点の集合とし、前記複数の記述の実行順序を有向枝の集合とするグラフモデルを生成する工程と、
(b)前記グラフモデルに含まれる記述の点を複数の部分集合に分割して複数の部分プログラムを有する分割プログラムを、複数、生成する工程と、
(c)前記分割プログラムの分割情報を有する遺伝子データを、前記複数の分割プログラムそれぞれに対して生成する工程と、
(d)前記複数の分割プログラムの中からランダムに選択された1対の分割プログラムを交差して、次の世代の複数の分割プログラムを生成し、当該生成された複数の分割プログラムの前記遺伝子データを生成する工程と、
(e)前記交差により生成された次世代の複数の分割プログラムについて、所定の評価値を求める工程とを有し、
前記工程(d)で生成された複数の分割プログラムに対して、前記工程(d)と工程(e)とを、前記評価値が所定の条件に合致するまで繰り返すことを特徴とするプログラム分割方法。
【0069】
(付記13)付記12において、
前記各世代内の複数の分割プログラムのうち、最良の評価値を有する最良分割プログラムの評価値が、所定数の連続する世代において、もはや改良されなくなったときに、前記工程(d)と工程(e)の繰り返しが終了されることを特徴とするプログラム分割方法。
【0070】
(付記14)付記12において、
前記各世代内の複数の分割プログラムの評価値の平均値が、所定数の連続する世代において、もはや改良されなくなった時に、前記工程(d)と工程(e)の繰り返しが終了することを特徴とするプログラム分割方法。
【0071】
(付記15)付記12において、
前記評価値は、少なくとも前記部分プログラムへのデータ送信量を有することを特徴とするプログラム分割方法。
【0072】
(付記16)付記12において、
前記遺伝子データの分割情報は、分割による切断部分についての点と非切断部分についての点とを示す情報であることを特徴とするプログラム分割方法。
【0073】
(付記17)付記12において、
前記工程(d)の交差において、前記1対の分割プログラムをそれぞれランダムに2分割し、互いに異なる分割部分を融合して、次世代の1対の分割プログラムを生成し、当該次世代の分割プログラムの遺伝子データが、前世代の分割プログラムの遺伝子データの一部を引き継ぐことを特徴とするプログラム分割方法。
【0074】
(付記18)所定のデータへのアクセスを伴う実行対象プログラムを複数の部分プログラムに分割する手順をコンピュータに実行させるプログラムにおいて、前記分割手順は、
(a)実行対象プログラムの複数の記述を点の集合とし、前記複数の記述の実行順序を有向枝の集合とするグラフモデルを生成する手順と、
(b)前記グラフモデルに含まれる記述の点を複数の部分集合に分割して複数の部分プログラムを有する分割プログラムを、複数、生成する手順と、
(c)前記分割プログラムの分割情報を有する遺伝子データを、前記複数の分割プログラムそれぞれに対して生成する手順と、
(d)前記複数の分割プログラムの中からランダムに選択された1対の分割プログラムを交差して、次の世代の複数の分割プログラムを生成し、当該生成された複数の分割プログラムの前記遺伝子データを生成する手順と、
(e)前記交差により生成された次世代の複数の分割プログラムについて、少なくとも前記部分プログラムへのデータ送信量を有する評価値を求め、当該評価値に基づいて所定数の分割プログラムを選択する手順とを有し、
前記工程(e)で選択された複数の分割プログラムに対して、前記手順(d)と手順(e)とを繰り返すことを特徴とするプログラム。
【0075】
(付記19)所定のデータへのアクセスを伴う実行対象プログラムを複数の部分プログラムに分割する手順をコンピュータに実行させるプログラムにおいて、前記分割手順は、
(a)実行対象プログラムの複数の記述を点の集合とし、前記複数の記述の実行順序を有向枝の集合とするグラフモデルを生成する手順と、
(b)前記グラフモデルに含まれる記述の点を複数の部分集合に分割して複数の部分プログラムを有する分割プログラムを、複数、生成する手順と、
(c)前記分割プログラムの分割情報を有する遺伝子データを、前記複数の分割プログラムそれぞれに対して生成する手順と、
(d)前記複数の分割プログラムの中からランダムに選択された1対の分割プログラムを交差して、次の世代の複数の分割プログラムを生成し、当該生成された複数の分割プログラムの前記遺伝子データを生成する手順と、
(e)前記交差により生成された次世代の複数の分割プログラムについて、所定の評価値を求める手順とを有し、
前記手順(d)で生成された複数の分割プログラムに対して、前記手順(d)と手順(e)とを、前記評価値が所定の条件に合致するまで繰り返すことを特徴とするプログラム。
【0076】
【発明の効果】
以上、本発明によれば、遺伝的アルゴリズムを利用して、実行対象のプログラムに変更や追加を行うことなく分割処理を行って、複数のプロセッサによる並列処理に最適な分割プログラムを生成することができる。
【図面の簡単な説明】
【図1】本実施の形態におけるプログラムの実行手順を示したフローチャート図である。
【図2】実行対象プログラムを実行するマルチプロセッサシステムの構成図である。
【図3】プログラムのモデル化の一例を示す図である。
【図4】実行対象プログラムをグラフ化した例を示す図である。
【図5】図4のプログラムを分割した分割プログラムのグラフ例を示す図である。
【図6】図4のプログラムを分割した分割プログラムのグラフ例を示す図である。
【図7】本実施の形態におけるプログラムの分割方法を示すフローチャート図である。
【図8】本実施の形態における交差アルゴリズムを示す図である。
【図9】ランダムに切断された枝の融合による処理を示す図である。
【図10】致死遺伝子の一例を示す図である。
【図11】データの送信量の総和の求め方を示す図である。
【図12】図7の分割処理に従って進化させた時の進化の状況を示す図である。
【図13】本実施の形態の変形例を示す図である。
【符号の説明】
F1:実行対象プログラム、F2−A〜F2−N:分割プログラム、Gp:グラフ、Vp:点、Ep:有向枝、g:遺伝子データ
[0001]
BACKGROUND OF THE INVENTION
The present invention relates to a method of dividing a program so that it can be efficiently executed by a plurality of processors and a program for causing a computer to execute the dividing method, and more particularly, to a program using a genetic algorithm using a gene (genetic algorithm). And a program for performing the dividing method.
[0002]
[Prior art]
In recent years, as a method for efficiently using the system, a multiprocessor system has been proposed in which a plurality of microprocessors are collectively executed to execute a predetermined program in parallel. Rather than originally executing one program on one processor, dividing the program into multiple partial programs and executing the divided partial programs on multiple processors reduces the time required to execute the entire program. it can.
[0003]
In this way, in order to execute a given sequential program in cooperation with a plurality of processors, a method of adding an additional description that causes the program creator to intentionally execute the program in parallel, A method of automatically dividing a sequential program to be executed by a computer has been proposed. The present invention relates to the latter method.
[0004]
As a method of dividing such a program, there are a method of dividing without giving any change to a given execution target program, and a method of dividing after giving some change to a given execution target program. Although proposed, the former is preferable because it does not change the execution target program.
[0005]
The following prior art has been proposed as a program dividing method.
[0006]
[Patent Document 1]
JP-A-7-281907
[0007]
[Patent Document 2]
Japanese Patent Laid-Open No. 9-282290
[0008]
[Problems to be solved by the invention]
However, the program dividing method of the above-mentioned patent document is based on a complicated algorithm, and there are not many specific proposals for a method for appropriately and easily dividing the program to be executed.
[0009]
SUMMARY OF THE INVENTION An object of the present invention is to provide a method for dividing a program to be executed into a plurality of partial programs that can be efficiently executed by a plurality of processors with a simple algorithm, and a program for causing a computer to execute the dividing method. There is to do.
[0010]
[Means for Solving the Problems]
In order to achieve the above object, one aspect of the present invention relates to a method of dividing an execution target program that accompanies access to predetermined data into a plurality of partial programs.
(A) generating a graph model having a plurality of descriptions of the execution target program as a set of points, and an execution order of the plurality of descriptions as a set of directed edges;
(B) generating a plurality of divided programs having a plurality of partial programs by dividing the description points included in the graph model into a plurality of subsets;
(C) generating gene data having division information of the division program for each of the plurality of division programs;
(D) Generating a plurality of divided programs of the next generation by crossing a pair of divided programs randomly selected from the plurality of divided programs, and generating the gene data of the generated divided programs Generating
(E) For a plurality of next generation divided programs generated by the intersection, obtaining an evaluation value having at least a data transmission amount to the partial program, and selecting a predetermined number of divided programs based on the evaluation value; Have
The step (d) and the step (e) are repeated for the plurality of divided programs selected in the step (e).
[0011]
In the above-mentioned aspect of the invention, in a more preferred embodiment, the division information of the gene data includes the cut directed directional branch cut by the division and the non-cut directed directed by the division among the set of directed branches of the divided program. It is the information which shows a branch, It is characterized by the above-mentioned. In another embodiment, the division information of gene data is, for example, information indicating a point related to a cut portion by division and a point related to a non-cut portion.
[0012]
Furthermore, in the above aspect of the invention, in a more preferred embodiment, the repetition of the step (d) and the step (e) is terminated according to the evaluation value of the divided program in each generation. For example, when the evaluation value of the best division program having the highest evaluation value among a plurality of division programs in each generation is no longer improved in a predetermined number of consecutive generations, the step (d) and the step It is preferable that the repetition of (e) is terminated.
[0013]
According to the above invention, the division information of the division program divided into a plurality of partial programs is provided as gene data, and a next generation division program is generated by crossing a pair of randomly selected division programs. By repeating the above, an optimal division program can be generated. According to this method, it is possible to generate a divided program that can be executed by a plurality of processors by dividing by a simple algorithm using a genetic algorithm without changing or adding to a program to be executed.
[0014]
DETAILED DESCRIPTION OF THE INVENTION
Embodiments of the present invention will be described below with reference to the drawings. However, the protection scope of the present invention is not limited to the following embodiments, but extends to the invention described in the claims and equivalents thereof.
[0015]
FIG. 1 is a flowchart showing a program execution procedure in the present embodiment. FIG. 2 is a configuration diagram of a multiprocessor system that executes an execution target program. With reference to FIGS. 1 and 2, description will be given of dividing an execution target program and performing parallel processing by a plurality of processors.
[0016]
First, the sequential processing type program F1 to be executed is input to the main processor 10 (S10). The main processor 10 divides the execution target program F1 into a plurality of partial programs by the program F2 that executes the division method (S12). This divided program is a divided program, and this divided program has a plurality of partial programs A to N. Then, the main processor 10 assigns the partial programs A to N included in the divided program to the plurality of processors 10-A to 10-N and causes them to be executed (16-A to 16-N). In this case, the number of processors and the number of partial programs do not necessarily match, and a certain processor may process a plurality of partial programs and another processor may process a single partial program. Thereby, since the single program F1 is processed in parallel by a plurality of processors, the execution efficiency of the program can be improved.
[0017]
In FIG. 2, the main processor 10 and the plurality of processor groups 10-A to 10-N each have a CPU, input / output means I / O, memory RAM, and ROM, and are connected via an internal bus. Has been. A program F2 for executing the dividing method is stored in the ROM in the main processor 10.
[Genetic algorithm]
In this embodiment, a method for dividing the input program shown in FIG. 1 is provided, and this method uses a genetic algorithm. The basic concept of the genetic algorithm is as follows.
[0018]
The genetic algorithm is a method for searching for the best solution based on a policy that a good group of children can be obtained from a group of good parents. That is, the process of evolving organisms is used as a process of solving problems on a computer. For example, let A be a set of all solutions that can be taken by a certain problem, and let Ci be a subset of the set A of solutions be a set of solutions of generation i. Also, an evaluation function feval (Ci) for evaluating the solution Ci is defined. Then, a solution Ci of a certain generation i is set as a parent generation set, and a set of solutions of its child generation i + 1 is set as Ci + 1. The child generation solution Ci + 1 crosses a pair of solutions Ci of the parent generation (crossover). ). Furthermore, it is assumed that an arbitrary element of the solution Ci is defined by a gene, and the gene data that each pair of solutions Ci of the parent generation has is partially included in the solution Ci + 1 of the next generation child generation. Shall be inherited. That is, based on the genes g1 and g2 of the paired solution Ci of the parent generation and the parameters given at random, the genes g12 and g21 of the paired solution Ci + 1 of the child generation are generated. . However, since there is a risk of falling to a local minima by crossing alone, gene mutation due to mutation is rarely and randomly generated at the time of crossing.
[0019]
However, if the child generation solution Ci + 1 is merely generated from the parent generation solution Ci by crossing and mutation, a solution deviating from the possible solution set A may occur. Therefore, a gene possessed by an infeasible solution is called a lethal gene, and the solution having such a lethal gene is excluded from the child generation.
[0020]
Using the above genetic algorithm, a divided program composed of a plurality of partial programs is generated as the execution target program. The crossover function when generating the child generation solution by the above crossing, the mutation function when generating the mutation, and the evaluation function for judging whether the solution generated by repeating the crossover is appropriate By appropriately defining it, it becomes possible to automatically generate an optimal division program.
[Concept of evaluation function]
As described above, when a program to be executed is divided into a plurality of partial programs and executed by a plurality of processors, an evaluation for obtaining a reference evaluation value as to what is a divided state that improves the execution efficiency You need to define a function. Therefore, the concept of how this evaluation function should be explained. As the evaluation value, various indexes such as the execution time and power consumption of the divided program can be selected. Most typically, the evaluation value is the execution time of the divided program.
[0021]
This execution time is the sum of the time required to execute each partial program, but the execution time of each partial program is the sum of the total number of execution steps of the partial program and the data preparation time for executing the partial program. expressed. In particular, in the latter time, since the divided partial programs are executed by different processors, it can be said that it is desirable to reduce the amount of data shared between the partial programs, that is, the amount of data transferred between different processors.
[0022]
Considering a short circuit, all the partial programs may be executed by a single processor in order to minimize the amount of data shared between the partial programs. Thereby, the amount of data to be transferred becomes zero. However, executing a plurality of partial programs on a single processor is not preferable because it does not match the original purpose of shortening the operation time by operating in parallel.
[0023]
Although reducing the number of partial programs contributes to reducing the amount of data to be shared between the partial programs, the number of execution steps of one partial program increases, and the time for occupying one processor increases. Become. Furthermore, the flexibility of scheduling for distributing a plurality of partial programs to a plurality of processors is deteriorated, and the average operating rate of the processor group is also lowered, so that the total execution time is expected to be increased.
[0024]
On the other hand, increasing the number of partial programs reduces the number of execution steps of one partial program and shortens the time for occupying one processor. And the flexibility of scheduling is also increased, and the average operating rate of the processor group is improved. However, it is expected that the amount of data to be shared between the partial programs will increase and the preparation time required for executing the partial programs will become longer.
[0025]
To summarize the above, the evaluation value of the divided program that can improve the execution efficiency in the multiprocessor system includes the following properties.
(1) The program is not divided at a place where the data communication time between processors becomes long.
(2) The size of the partial program should not be too small at the same time.
(3) The number of partial programs should not be too large and too small at the same time.
By defining an evaluation function reflecting these properties, it is possible to determine whether or not an appropriate division program has been generated in the evolution process of the species.
[Program modeling]
In order to divide an execution target program into a plurality of partial programs by a program based on a certain division algorithm, it is necessary to model the execution target program into a data structure suitable for information processing. Therefore, in this embodiment, it is defined that the execution target program is given by the graph G = (V, E). Here, Vp is a set of points representing the description in the execution target program, and Vq is a set of points representing the data in the program, and the set Vp, Vq is combined and represented by a set V of points. Ep is a set of directional branches indicating the execution order of descriptions in the execution target program, and Eq is a set of directional branches indicating access to data (read and write). Together, it is represented by a set E of directional branches.
[0026]
FIG. 3 is a diagram showing an example of program modeling. FIG. 3A shows an execution target program F1, which includes steps a to d including each description. In each step, data V to Y is read or written. A graph G obtained by modeling such an execution target program F1 is shown in FIG. This graph G shows a point set V composed of a description point set Vp = {a, b, c, d} and a data point set Vq = {V, W, X, Y}, and the directed execution order of the description. Model with branch set Ep = {ab, bc, cd} and directed branch set E with data access directed branch set Eq = {aV, Vb, bV, Vc, cX, Wd, Xd, dY} It becomes.
[gene]
In order to apply the genetic algorithm, a divided program obtained by dividing a modeled execution target program into a plurality of partial programs must be represented by genes. Therefore, in the present embodiment, the division information indicating the division status of the division program is expressed as gene information. As a first example, the division information of the gene data includes “0” indicating the cut directional branch cut by the division and the non-cut directional branch not cut corresponding to the set Ep of the directional branch of the division program. "1". Alternatively, as a second example, the division information is information indicating a point related to the cut portion by division and a point related to the non-cut portion corresponding to the set Vp of the description of the divided program. In the following example, genes are described according to the first example.
[0027]
FIG. 4 is a diagram illustrating an example of a graph of the execution target program. This graph Gp is modeled by a point set Vp described below and a directed edge set Ep in the execution order.
Vp = {a, b, c, d, e, f, g, h, i, j, k, l, m}
Ep = {ab, ac, bd, be, cf, dg, eh, fi, fj, gk, hk, ik, il, jl, km, lm}
Examples of division of the graph Gp modeled in this way are shown in FIGS. 5 and 6 are diagrams showing examples of graphs of divided programs obtained by dividing the program of FIG. In the example of FIG. 5, the program is divided into four partial programs, each of which is {a, c, f, i, k}, {b, d, g}, {e, h}, and {j, l, m}. In the example of FIG. 6, the program is divided into six partial programs, and each partial program is {a, c}, {b, e, h}, {d, g}, {f, j}, and {i, l} and {k, m}.
[0028]
When divided in this way, information indicating whether the directional branch of the modeled graph is at the boundary of the divided partial program or whether it is a cut branch or a non-cut branch can be used as a gene. . That is, the gene g can be defined as a series of “0” (boundary branch, cut branch) and “1” (non-boundary branch, non-cut branch) corresponding to the elements of the directed branch set Ep. it can. That is, in the example of FIG. 5, the gene g corresponds to the above Ep, g = {0,1,1,0,1,1,1,1,0,0,0,1,0,1,0 , 1}, and in the example of FIG. 6, the gene g is g = {0,1,0,1,0,1,1,0,1,0,0,0,1,0,1,0} It becomes. As described above, if the model G and its gene g are indicated, the division state of the division program can be uniquely reproduced.
[Specific example of division method]
Based on the above assumptions, a method for dividing the execution target program according to the present embodiment by a genetic algorithm will be described below.
[0029]
FIG. 7 is a flowchart showing a program dividing method according to the present embodiment. The division method execution program F2 corresponding to this flowchart is stored in the ROM of the main processor 10 as shown in FIG. First, the execution target program F1 is input to the main processor 10 (S20). The input execution target program F1 is graphed by the above method. The graph G generated by this graphing is weighted to obtain an evaluation value by an evaluation function described later for each point and each branch of the graph (S24). If this weighting is demonstrated with the example of the graph of FIG.3 (B), the data amount will be made into the weight with respect to the points VY corresponding to each data. Further, the processing time is used as a weight for the points a to d corresponding to each description. For the branches between the points a to d corresponding to the description and the points V to Y corresponding to the data, the access time to each data is used as a weight. For example, if the data is stored at a location close to the processor, the access time is short, and if the data is stored at a remote location, the access time is long. Further, for a branch between points a to d corresponding to the description, for example, a length of time required when taking over to a different processor is used as a weight. These weights may be selectively generated depending on what elements are used in the evaluation function.
[0030]
Next, the execution target program is randomly divided into a plurality of partial programs to generate a plurality of divided programs (S26). In this step, the execution target program of the graph Gp as shown in FIG. 4 is randomly divided into a plurality of partial programs to generate a divided program as shown in FIGS. Then, a gene g is generated for each generated divided program (S28). That is, as described above, a gene g is generated that indicates “1” or “0” as to whether each element of the branch set Ep of the graph Gp is a cut branch or a non-cut branch when divided into partial programs. Then, the set of the first divided programs is defined as the first generation (i = 1) divided program (S30). This first generation division program does not include those having a lethal gene, which will be described later.
[0031]
Next, among a plurality of first generation divided programs, a pair of randomly selected divided programs are crossed to generate a plurality of divided programs for the next generation (S32). That is, the parent generation division program is crossed to generate a child generation division program. The number of child generation division programs is preferably larger than the number of parent generation division programs. Therefore, an intersection algorithm will be described.
[Intersection algorithm]
Crossing is an operation that creates a new gene from two genes. In this embodiment, a new gene is generated by crossing two genes having division information of a division program with a certain crossing algorithm. In a genetic intersection, parental genetic information (split information) is also transmitted to the child. As a result, the characteristics of the parent (division characteristics) are inherited by the child. Then, by leaving the newly born children who have been born as a result of crossing and having excellent evaluation values, and by giving birth to the next generation of children by crossing, a superior seed (split program) is generated by the seed principle. It will be done. However, if the parent's genetic information is always handed down to the child using the same algorithm, only excellent species within a narrow area will be born, so in rare cases a mutation will be generated to generate a new search area. is required.
[0032]
FIG. 8 is a diagram showing a crossing algorithm in the present embodiment. FIG. 8 shows an algorithm for generating the next generation graphs G12 and G21 by intersecting two graphs G1 and G2. According to this crossing algorithm, random two-divided portions Gpa and Gpb of the graph Gp = (Vp, Ep) corresponding to the division program are generated. A plurality of branches are cut by the random cutting line CT. A new graph is obtained by merging the two divided parts G1a, G1b, G2a, and G2b of each graph.
G12 = G1a + G2b
G21 = G2a + G1b
Is generated. Random selection of the cutting line CT means a random parameter at the time of intersection.
[0033]
As a result, the gene g12 in the graph G12 is a succession of a part of the gene g1 in the graph G1 and a part of the gene g2 in the graph G2. Similarly, the gene g21 in the graph G21 is obtained by inheriting part of the gene g1 and part of g2. That is, the gene g12 of the graph G12 and the gene g21 of the graph G21 have some division information of the graph G1 and some division information of the graph G2. However, a randomly cut branch becomes a cut branch or a non-cut branch according to a predetermined rule when fused.
[0034]
FIG. 9 is a diagram showing processing by fusing randomly cut branches. When the parent graph cut into two is fused, the cut branch and the non-cut branch in the parent graph are fused in the cut line CT as shown in cases 1, 2 and 3 of FIG. A case (cases 1 and 2) and a case where a non-cutting branch and a non-cutting branch in the parent graph are merged (case 3) can be considered. In that case, it is randomly selected as either a case where the branches are connected as in case A or a case where the branches are cut as in case B. Alternatively, one of cases A and B may be selected in principle, and the other case may be selected in rare cases. Random selection of either case is a fusion involving mutations. In addition, selecting one of the cases in principle and rarely selecting the other case is a fusion including mutation (rarely selecting the other case). In the example of FIG. 8, either case A or B is selected at random.
[0035]
Note that when a randomly cut graph is merged, a cut branch and a cut branch may be fused in the parent graph. In this case, the cut branch remains as a result of the fusion.
[0036]
The above fusion algorithm is an example, and the present invention is not limited to this. For example, contrary to the above example, if either one is a cut branch in the parent graph, it will be cut even if it is fused, and if both are non-cut branches in the parent graph, it will be cut if it is fused. You may make it.
[0037]
In addition to including randomness in the algorithm at the time of fusion, the mutation algorithm may be an operation of changing an uncut branch to a cut branch for any branch of the graph after the fusion. This operation is an operation of changing a partial program into a plurality of partial programs. This operation can eliminate the risk of generating a lethal gene described below. By performing such an operation, the gene is mutated to a gene different from the parent gene, and the mutation has occurred.
[Lethal gene]
Here, lethal genes will be described. FIG. 10 is a diagram showing an example of a lethal gene. According to this divided program, the partial programs (b, d, g, e, h) and (f, i, j, l) have a parallel relationship inside. It is not preferable that the partial program itself distributed to a plurality of processors includes a parallel description part because it does not match the purpose of shortening the execution time of the program. Therefore, a division program having such a partial program is a lethal gene and is not born as a new life.
[0038]
For example, in step S26 of FIG. 7, the execution target program is divided to generate a plurality of divided programs. It is desirable to exclude those having a lethal gene from the generated divided programs. In step S32, a next-generation division program is generated by crossing, but it is desirable to exclude those having a lethal gene from the generated division program.
[0039]
Thus, it is preferable to exclude a species having such an undesired gene from the process of species evolution by treating a state in which the division state is not preferable as a division program as a lethal gene. By excluding lethal genes, if a parent generation with a feasible gene is crossed, the gene generated in that child generation will be feasible.
[0040]
Further, even if a mutation that cuts the above-mentioned non-cutting branch is generated for a gene that is not a lethal gene, the gene of the split program generated as a result will not become a lethal gene.
[0041]
Returning to the flowchart of FIG. 7, when a plurality of next generation divided programs are generated by the intersection (S32), a divided program having a high evaluation value is selected based on the evaluation function. For example, the number of divided programs newly created by the intersection is reduced so that the number of divided programs of the parent generation is equal to the number of divided programs of the child generation (S36). By doing this, only excellent species are left in the process of species evolution. However, in order to prevent the search region from falling into a limited local minimum, mutations are generated infrequently or at a low rate (S34).
[Specific examples of evaluation functions]
According to the concept of the evaluation function described above, the evaluation value of the divided program includes the following properties.
(1) The program is not divided at a place where the data communication time between processors becomes long.
(2) The size of the partial program should not be too small at the same time.
(3) The number of partial programs should not be too large and too small at the same time.
[0042]
Therefore, the evaluation function in the above specific example will be described. First, for the number n of partial programs of the graph Gp corresponding to the divided program, the total amount d of data transmission between the partial programs in the graph Gp, and the total sum l of the longest paths in the partial program, the evaluation function feval is For example,
feval (n, pn, l, pl, d, pd) = n pn / (D pd × l pl (1)
Here, pn, pl, and pd are coefficients.
[0043]
Then, these coefficients are specifically determined according to the importance of the above evaluation function concepts (1), (2), and (3). For example, when the concept (1) is most important, the coefficient pd is set large.
[0044]
In the case of the divided program graph of FIG. 5, the number of partial programs is n = 4, and the sum of the longest paths in the partial program is l = 5 + 3 + 2 + 3 = 13. On the other hand, the ripple of the graph of FIG. 5, the number of partial programs n = 6, and the sum of the longest paths in the partial programs l = 2 + 3 + 2 + 2 + 2 + 2 = 13.
[0045]
FIG. 11 is a diagram illustrating how to obtain the total amount of data transmission. First, the graph shown in the upper part of FIG. 11 shows the relationship of access to the data Da to De for the graph G12 generated at the intersection of FIG. 8 as an example. Since the direction of the branch arrow corresponds to the direction in which data is communicated, the arrow from the description to the data indicates writing, and the arrow from the data to the description indicates reading.
[0046]
In such a graph example, a plurality of branches for each partial program are combined into one (reduced), and the lower graph of FIG. 11 is created. In this graph, branches indicating access to each data for six partial programs are shown, and the amount of data is shown in parentheses for each data. A plurality of branches to one partial program can be regarded as one data transfer. Because the partial program is executed by the same processor, if the data is accessed once, the processor holds the data, and even if the subsequent access occurs, it is stored in the memory inside the processor. This is because the data can be acquired and there is no need to transmit data.
[0047]
Therefore, the partial program {a, c, f, i, l} has access to the data Da, Db, Dd, and the amount of data is 3, 2, 9, respectively. The data transmission amount is d = 3 + 2 + 9 = 11. Similarly, when the data transmission amount is obtained for other partial programs, d = 51 in total. That is, it is as shown in FIG.
[0048]
If the number n of the partial programs, the total length l of the longest path, and the data transmission amount d are obtained, the evaluation value of the divided program can be obtained according to the evaluation function feval of the above equation (1). By optimizing this evaluation function, the best division program can be selected in step S36.
[0049]
With the above operation, the next generation divided program is generated. Therefore, the generation number i is incremented (S38). Then, steps S32, S34, S36 and S38 are repeated until a predetermined end condition (S40) is met. By repeating, a more optimal division program is generated by the evolution of the species.
[0050]
As the termination condition, for example, the following two conditions can be considered. The first is a method of determining that the evolution of the species has stopped when the average value of a set of a certain divided program exceeds a certain level or does not exceed a certain level over several generations. In this case, it is possible to detect whether or not the end condition is met by obtaining an average of the evaluation values of the divided programs of a certain generation. When evaluating with this average value, the average evaluation value of the divided program of the next generation is also increased by selecting a divided program with a high evaluation value as in step S36.
[0051]
The second method is to determine that the evolution of the species has stopped when the best value in a set of divided programs exceeds a certain level or does not exceed a certain level over several generations. The example of FIG. 7 is these two examples. In this case, it is sufficient that a partial program having one excellent evaluation value is generated from the set. Therefore, in step S36, the next generation divided program may be selected randomly regardless of the evaluation value. Conceivable.
[0052]
FIG. 12 is a diagram showing the state of evolution when evolved according to the dividing process of FIG. An outline of evolution in the division process will be outlined according to FIG. First, a graph is generated for the execution target program P0, and the graph is randomly divided to generate first generation K divided programs P1-1 to P1-K. Then, a pair of divided programs randomly selected from the set of divided programs is crossed (S32, S34), and the second generation L (> K) divided programs P2 that partially inherit the genetic information. -1 to P2-L are generated. Then, the evaluation values of the respective divided programs are compared and narrowed down to K divided programs P2-1 to P2-K having more excellent evaluation values (S36). In this way, a set of K divided programs as many as the first generation is generated as the second generation divided programs. Then, among the second generation divided programs, a divided program (for example, P2-12) having the best evaluation value is recorded.
[0053]
Similarly, the second generation divided programs are crossed to generate L third generation divided programs, and narrow down to K third generation divided programs. Then, a division program (for example, P3-13) having the best evaluation value in the third generation is recorded. The same intersection S32 and narrowing S36 are repeated, and the best evaluation value is compared within each generation. When improvement is not seen in this best evaluation value over several generations (S40), the division process is terminated.
[0054]
FIG. 13 is a diagram showing a modification of the present embodiment. As shown in FIG. 12, a pair of split programs randomly selected from the split program of the parent generation is crossed to generate a split program of the child generation. In the modification of FIG. 13, the split of the first generation is generated. The set of programs is divided into a plurality of segments SEG0 to SEGn, and intersections are mainly repeated in each segment. Then, the divided programs in different segments are crossed rarely or at a fixed ratio.
[0055]
This method follows the rules of species evolution, where better quality species are produced when intersections are repeated mainly within a region, and rarely when crossing outside the region. It can be expected that a split program can be generated.
[0056]
The exemplary embodiments are summarized as follows.
[0057]
(Supplementary note 1) In a method of dividing an execution target program accompanied by access to predetermined data into a plurality of partial programs,
(A) generating a graph model having a plurality of descriptions of the execution target program as a set of points, and an execution order of the plurality of descriptions as a set of directed edges;
(B) generating a plurality of divided programs having a plurality of partial programs by dividing the description points included in the graph model into a plurality of subsets;
(C) generating gene data having division information of the division program for each of the plurality of division programs;
(D) Generating a plurality of divided programs of the next generation by crossing a pair of divided programs randomly selected from the plurality of divided programs, and generating the gene data of the generated divided programs Generating
(E) For a plurality of next generation divided programs generated by the intersection, obtaining an evaluation value having at least a data transmission amount to the partial program, and selecting a predetermined number of divided programs based on the evaluation value; Have
A program dividing method comprising repeating the step (d) and the step (e) for a plurality of divided programs selected in the step (e).
[0058]
(Appendix 2) In Appendix 1,
The division information of the gene data is information indicating a cut directional branch cut by the division and a non-cut directional branch that has not been cut out of the set of directed branches of the division program. Program division method.
[0059]
(Appendix 3) In Appendix 1,
The division information of the gene data is information indicating a point about a cut portion and a point about a non-cut portion by division.
[0060]
(Appendix 4) In Appendix 2 or 3,
At the intersection of the step (d), each of the pair of divided programs is randomly divided into two, and different divided portions are merged to generate a next-generation pair of divided programs. A program division method characterized in that the genetic data of the above inherits part of the gene data of the previous generation division program.
[0061]
(Appendix 5) In Appendix 1,
The program dividing method, wherein the repetition of the step (d) and the step (e) is terminated according to an evaluation value of the divided program generated by the intersection.
[0062]
(Appendix 6) In Appendix 5,
When the evaluation value of the best division program having the best evaluation value among the plurality of division programs in each generation is no longer improved in a predetermined number of successive generations, the steps (d) and ( A program dividing method characterized in that the repetition of e) is terminated.
[0063]
(Appendix 7) In Appendix 5,
When the average value of the evaluation values of the plurality of divided programs in each generation is no longer improved in a predetermined number of consecutive generations, the repetition of the step (d) and the step (e) ends. The program division method.
[0064]
(Appendix 8) In Appendix 1,
The graph model further includes the data as a set of points, and the access to the data as a set of directed edges connecting the point of the description and the point of the data, and the data transmission amount is A program dividing method, characterized in that a total amount of data connected to a partial program and a directed edge is a value obtained by adding up in the divided program.
[0065]
(Appendix 9) In Appendix 1,
The evaluation value is obtained by an evaluation function having a number of the plurality of partial programs and a cumulative value of the path lengths of the partial programs in addition to the data transmission amount to the partial programs. Program division method.
[0066]
(Appendix 10) In Appendix 1,
When the gene data of the division program newly generated by the intersection is lethal gene data having a predetermined division form, the division program corresponding to the lethal gene data is excluded. .
[0067]
(Appendix 11) In Appendix 1,
The plurality of division programs are divided into a plurality of segments;
In the step (d), a cross process for a pair of split programs in the same segment is performed at a first ratio, and a cross process for a pair of split programs between different segments is less than the first ratio. A program dividing method characterized by being performed at a ratio of 2.
[0068]
(Supplementary note 12) In a method of dividing an execution target program accompanied by access to predetermined data into a plurality of partial programs,
(A) generating a graph model having a plurality of descriptions of the execution target program as a set of points, and an execution order of the plurality of descriptions as a set of directed edges;
(B) generating a plurality of divided programs having a plurality of partial programs by dividing the description points included in the graph model into a plurality of subsets;
(C) generating gene data having division information of the division program for each of the plurality of division programs;
(D) Generating a plurality of divided programs of the next generation by crossing a pair of divided programs randomly selected from the plurality of divided programs, and generating the gene data of the generated divided programs Generating
(E) obtaining a predetermined evaluation value for a plurality of next-generation divided programs generated by the intersection,
A program dividing method characterized by repeating the step (d) and the step (e) for the plurality of divided programs generated in the step (d) until the evaluation value meets a predetermined condition. .
[0069]
(Appendix 13) In Appendix 12,
When the evaluation value of the best division program having the best evaluation value among the plurality of division programs in each generation is no longer improved in a predetermined number of successive generations, the steps (d) and ( A program dividing method characterized in that the repetition of e) is terminated.
[0070]
(Appendix 14) In Appendix 12,
When the average value of the evaluation values of the plurality of divided programs in each generation is no longer improved in a predetermined number of consecutive generations, the repetition of the step (d) and the step (e) ends. The program division method.
[0071]
(Appendix 15) In Appendix 12,
The evaluation value has at least a data transmission amount to the partial program.
[0072]
(Appendix 16) In Appendix 12,
The division information of the gene data is information indicating a point about a cut portion and a point about a non-cut portion by division.
[0073]
(Appendix 17) In Appendix 12,
At the intersection of the step (d), each of the pair of divided programs is randomly divided into two, and different divided portions are merged to generate a next-generation pair of divided programs. A program division method characterized in that the genetic data of the above inherits part of the gene data of the previous generation division program.
[0074]
(Supplementary note 18) In a program for causing a computer to execute a procedure of dividing an execution target program accompanied by access to predetermined data into a plurality of partial programs, the dividing procedure includes:
(A) a procedure for generating a graph model in which a plurality of descriptions of an execution target program is a set of points, and an execution order of the plurality of descriptions is a set of directed edges;
(B) a procedure for generating a plurality of divided programs having a plurality of partial programs by dividing the description points included in the graph model into a plurality of subsets;
(C) generating gene data having division information of the division program for each of the plurality of division programs;
(D) Generating a plurality of divided programs of the next generation by crossing a pair of divided programs randomly selected from the plurality of divided programs, and generating the gene data of the generated divided programs The steps to generate
(E) a procedure for obtaining an evaluation value having at least a data transmission amount to the partial program and selecting a predetermined number of division programs based on the evaluation value for a plurality of next generation divided programs generated by the intersection; Have
A program that repeats the procedure (d) and the procedure (e) for a plurality of divided programs selected in the step (e).
[0075]
(Supplementary note 19) In a program for causing a computer to execute a procedure for dividing an execution target program with access to predetermined data into a plurality of partial programs, the dividing procedure includes:
(A) a procedure for generating a graph model in which a plurality of descriptions of an execution target program is a set of points, and an execution order of the plurality of descriptions is a set of directed edges;
(B) a procedure for generating a plurality of divided programs having a plurality of partial programs by dividing the description points included in the graph model into a plurality of subsets;
(C) generating gene data having division information of the division program for each of the plurality of division programs;
(D) Generating a plurality of divided programs of the next generation by crossing a pair of divided programs randomly selected from the plurality of divided programs, and generating the gene data of the generated divided programs The steps to generate
(E) A procedure for obtaining a predetermined evaluation value for a plurality of next generation divided programs generated by the intersection,
A program characterized by repeating the procedure (d) and the procedure (e) for the plurality of divided programs generated in the procedure (d) until the evaluation value meets a predetermined condition.
[0076]
【The invention's effect】
As described above, according to the present invention, it is possible to generate a division program optimal for parallel processing by a plurality of processors by performing a division process without changing or adding to an execution target program using a genetic algorithm. it can.
[Brief description of the drawings]
FIG. 1 is a flowchart showing a program execution procedure in the present embodiment.
FIG. 2 is a configuration diagram of a multiprocessor system that executes an execution target program;
FIG. 3 is a diagram illustrating an example of program modeling.
FIG. 4 is a diagram illustrating an example of a graph of an execution target program.
FIG. 5 is a diagram illustrating a graph example of a divided program obtained by dividing the program of FIG. 4;
6 is a diagram illustrating a graph example of a divided program obtained by dividing the program of FIG. 4;
FIG. 7 is a flowchart showing a program dividing method according to the present embodiment.
FIG. 8 is a diagram showing an intersection algorithm in the present embodiment.
FIG. 9 is a diagram showing processing by fusing randomly cut branches.
FIG. 10 shows an example of a lethal gene.
FIG. 11 is a diagram illustrating how to obtain the total sum of data transmission amounts;
12 is a diagram showing an evolution situation when evolved according to the division process of FIG. 7; FIG.
FIG. 13 is a diagram showing a modification of the present embodiment.
[Explanation of symbols]
F1: Execution target program, F2-A to F2-N: Divided program, Gp: Graph, Vp: Point, Ep: Directed branch, g: Gene data

Claims (7)

所定のデータへのアクセスを伴う実行対象プログラムを複数のマイクロプロセッサに並列的に実行させる複数の分割プログラムに分割する方法において、
(a)入出力手段とプログラム分割手段とを有するコンピュータに前記実行対象プログラムを入力する工程と、
(b)前記プログラム分割手段が、前記実行対象プログラムの複数の記述を点の集合とし、前記複数の記述の実行順序を有向枝の集合とするグラフモデルを生成する工程と、
(c)前記プログラム分割手段が、前記点の集合を複数の部分集合に分割し、該分割によって切断された前記有向枝と切断されなかった前記有向枝を区別する分割情報を有する遺伝子データを作成する処理を行って複数の前記遺伝子データを作成する工程と、
(d)前記プログラム分割手段が、前記複数の遺伝子データの中からランダムに選択された1対の遺伝子データを交差して、次世代の複数の遺伝子データを生成する工程と、
(e)前記プログラム分割手段が、前記生成された前記次世代の複数の遺伝子データの各々について、該遺伝子データが有する分割情報に基づいて前記グラフモデルを分割して得られる複数の分割プログラムが前記複数のマイクロプロセッサに配置された場合の前記複数のマイクロプロセッサ間のデータ送信量に基づいて算出される評価値を求め、当該評価値に基づいて前記次世代の複数の遺伝子データから所定数の遺伝子データを選択する工程と、を有し、
前記工程(e)で選択された前記所定数の遺伝子データに対して、前記工程(d)と工程(e)とを繰り返すことを特徴とするプログラム分割方法。
In a method of dividing an execution target program with access to predetermined data into a plurality of divided programs that cause a plurality of microprocessors to execute in parallel,
(A) inputting the execution target program into a computer having input / output means and program dividing means;
(B) the program dividing means generating a graph model having a plurality of descriptions of the execution target program as a set of points and an execution order of the plurality of descriptions as a set of directional branches;
(C) Gene data having division information in which the program dividing unit divides the set of points into a plurality of subsets, and distinguishes the directional branch cut by the division from the directional branch that has not been cut. Creating a plurality of the genetic data by performing a process of creating
A step; (d) the program dividing unit, which intersects a pair of gene data selected randomly from among the plurality of genetic data, to generate a plurality of genetic data of the next generation,
(E) For each of the generated plurality of next generation gene data , the program dividing means includes a plurality of division programs obtained by dividing the graph model based on division information included in the gene data. An evaluation value calculated based on a data transmission amount between the plurality of microprocessors when arranged in a plurality of microprocessors is obtained, and a predetermined number of genes are derived from the next-generation plurality of gene data based on the evaluation value Selecting data , and
Program division method characterized in that to said step (e) the predetermined number of genetic data selected by repeated and said step (d) and step (e).
請求項1において、
前記工程(d)の交差において、前記プログラム分割手段が、前記1対の遺伝子データをそれぞれランダムに2分割し、互いに異なる分割部分を融合して、次世代の1対の遺伝子データを生成し、当該次世代の遺伝子データが、前世代の遺伝子データの一部を引き継ぐことを特徴とするプログラム分割方法。
In claim 1,
In the intersection of the step (d) , the program dividing unit randomly divides the pair of gene data into two parts, fuses different divided parts, and generates a next-generation pair of gene data , program division method characterized in that the next generation of genetic data takes over a part of the previous generation of genetic data.
請求項1において、
前記プログラム分割手段が、前記工程(d)と工程(e)の繰り返しを、前記交差により生成された遺伝子データの評価値に応じて終了することを特徴とするプログラム分割方法。
In claim 1,
The program dividing method, wherein the program dividing means ends the repetition of the steps (d) and (e) according to the evaluation value of the gene data generated by the intersection.
請求項3において、
前記プログラム分割手段が、前記各世代内の複数の遺伝子データのうち、最良の評価値を有する遺伝子データの評価値が、所定数の連続する世代において、もはや改良されなくなったときに、前記工程(d)と工程(e)の繰り返しを終了することを特徴とするプログラム分割方法。
In claim 3,
The program dividing unit, among a plurality of genetic data in said each generation, the evaluation value of the genetic data having the best evaluation value, in a predetermined number of successive generations, when no longer be improved, the step ( A program dividing method characterized by ending the repetition of d) and step (e) .
請求項3において、
前記プログラム分割手段が、前記各世代内の複数の遺伝子データの評価値の平均値が、所定数の連続する世代において、もはや改良されなくなった時に、前記工程(d)と工程(e)の繰り返しを終了することを特徴とするプログラム分割方法。
In claim 3,
The program dividing means repeats the steps (d) and (e) when the average value of the evaluation values of the plurality of gene data in each generation is no longer improved in a predetermined number of consecutive generations. And dividing the program.
請求項1において、
前記グラフモデルは、更に、前記所定のデータを点の集合として表現し、前記記述を表現する点と前記所定のデータを表現する点とを結ぶ第2の有向枝の集合として前記所定のデータへのアクセスが表現されており、前記データ送信量は、前記グラフモデルに属するすべての前記分割プログラムの各々について、前記分割プログラムに属する前記記述を表現する点と有向枝で結ばれた前記所定のデータのデータ量を合計することによって算出さ れることを特徴とするプログラム分割方法。
In claim 1,
The graph model further represents the predetermined data as a set of points, and the predetermined data as a set of second directed edges connecting the points expressing the description and the points expressing the predetermined data. The amount of data transmission is the predetermined amount connected with a point representing the description belonging to the divided program and a directional branch for each of all the divided programs belonging to the graph model. program division method characterized by calculated by summing the data amount of the data.
所定のデータへのアクセスを伴う実行対象プログラムを複数のマイクロプロセッサに並列的に実行させる複数の分割プログラムに分割する手順をコンピュータに実行させるプログラムにおいて、
前記分割手順は、
(a)入出力手段とプログラム分割手段とを有するコンピュータに前記実行対象プログラムを入力する手順と、
(b)前記プログラム分割手段が、前記実行対象プログラムの複数の記述を点の集合とし、前記複数の記述の実行順序を有向枝の集合とするグラフモデルを生成する手順と、
(c)前記プログラム分割手段が、前記点の集合を複数の部分集合に分割し、該分割によって切断された前記有向枝と切断されなかった前記有向枝を区別する分割情報を有する遺伝子データを作成する処理を行って複数の前記遺伝子データを作成する手順と、
(d)前記プログラム分割手段が、前記複数の遺伝子データの中からランダムに選択された1対の遺伝子データを交差して、次世代の複数の遺伝子データを生成する手順と、
(e)前記プログラム分割手段が、前記生成された前記次世代の複数の遺伝子データの各々について、該遺伝子データが有する分割情報に基づいて前記グラフモデルを分割して得られる複数の分割プログラムが前記複数のマイクロプロセッサに配置された場合の前記複数のマイクロプロセッサ間のデータ送信量に基づいて算出される評価値を求め、当該評価値に基づいて前記次世代の複数の遺伝子データから所定数の遺伝子データを選択する手順と、を有し、
前記手順(e)で選択された前記所定数の遺伝子データに対して、前記手順(d)と手順(e)とを繰り返すことを特徴とするプログラム。
In a program for causing a computer to execute a procedure for dividing a program to be executed with access to predetermined data into a plurality of divided programs for causing a plurality of microprocessors to execute in parallel.
The dividing procedure is as follows:
(A) a procedure for inputting the execution target program to a computer having input / output means and program dividing means;
(B) a procedure for generating a graph model in which the program dividing unit sets a plurality of descriptions of the execution target program as a set of points and sets the execution order of the plurality of descriptions as a set of directed branches;
(C) Gene data having division information in which the program dividing unit divides the set of points into a plurality of subsets, and distinguishes the directional branch cut by the division from the directional branch that has not been cut. A process of creating a plurality of the genetic data by performing a process of creating
And procedures; (d) the program dividing unit, which intersects a pair of gene data selected randomly from among the plurality of genetic data, to generate a plurality of genetic data of the next generation,
(E) For each of the generated plurality of next generation gene data , the program dividing means includes a plurality of division programs obtained by dividing the graph model based on division information included in the gene data. An evaluation value calculated based on a data transmission amount between the plurality of microprocessors when arranged in a plurality of microprocessors is obtained, and a predetermined number of genes are derived from the next-generation plurality of gene data based on the evaluation value And a procedure for selecting data ,
Program, characterized in that to the procedure (e) the predetermined number of genetic data selected by, repeating the steps (d) and the procedure (e).
JP2002350967A 2002-12-03 2002-12-03 Program division method and program for implementing the method Expired - Fee Related JP4073303B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2002350967A JP4073303B2 (en) 2002-12-03 2002-12-03 Program division method and program for implementing the method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2002350967A JP4073303B2 (en) 2002-12-03 2002-12-03 Program division method and program for implementing the method

Publications (2)

Publication Number Publication Date
JP2004185271A JP2004185271A (en) 2004-07-02
JP4073303B2 true JP4073303B2 (en) 2008-04-09

Family

ID=32753007

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2002350967A Expired - Fee Related JP4073303B2 (en) 2002-12-03 2002-12-03 Program division method and program for implementing the method

Country Status (1)

Country Link
JP (1) JP4073303B2 (en)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP5119590B2 (en) * 2005-11-10 2013-01-16 富士通セミコンダクター株式会社 Task distribution program and task distribution device for processor device having multiprocessor
US8881158B2 (en) * 2008-11-14 2014-11-04 Nec Corporation Schedule decision device, parallel execution device, schedule decision method, and program
KR102628902B1 (en) 2015-10-28 2024-01-24 구글 엘엘씨 Processing computational graphs
JP6917732B2 (en) * 2017-03-01 2021-08-11 株式会社日立製作所 Program introduction support system, program introduction support method, and program introduction support program

Also Published As

Publication number Publication date
JP2004185271A (en) 2004-07-02

Similar Documents

Publication Publication Date Title
US7466663B2 (en) Method and apparatus for identifying components of a network having high importance for network integrity
Pantrigo et al. Scatter search for the cutwidth minimization problem
JP6724576B2 (en) Multi-target optimization method and apparatus
Sebt et al. Solving resource-constrained project scheduling problem with evolutionary programming
JP2020046891A (en) Prediction program, prediction method, and learning device
JP4073303B2 (en) Program division method and program for implementing the method
US20030144748A1 (en) Apparatus for optimizing combinatorial optimization problems
US11461656B2 (en) Genetic programming for partial layers of a deep learning model
JP3761238B2 (en) Judgment rule correction device and determination rule correction method
Fernández-Domingos et al. Emerging Cooperation in N-Person Iterated Prisoner's Dilemma over Dynamic Complex Networks.
Wang et al. MLQCC: an improved local search algorithm for the set k‐covering problem
Bartlett et al. New progressive variable ordering for binary decision diagram analysis of fault trees
Yassen et al. Lion optimization algorithm for team orienteering problem with time window
Geetha et al. An observational analysis of genetic operators
CN110321208B (en) Evolutionary computing method for solving cloud task scheduling
CN114202609A (en) Mixed heuristic graph coloring method
KR100902737B1 (en) Many most suitable path search method to do with dynamic traffic information
CN110782006A (en) Method and system for generating complex neural network based on cross
Paiva et al. Unsupervised strategies to network topology reconfiguration optimization with limited link addition
JP3579349B2 (en) Data analysis method, data analysis device, and recording medium
CN117521576B (en) Computing resource sharing method, device, equipment and medium
JPH11306216A (en) Automatic arranging method and automatic arrangement system
JP2000029858A (en) Optimizing device
JP3251792B2 (en) Circuit network division method
US7047260B1 (en) Selecting tree summary operations for a tree

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20041224

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20070622

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20070703

A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20070829

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20071016

A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20071217

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: 20080122

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20080122

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20110201

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: 20110201

Year of fee payment: 3

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20120201

Year of fee payment: 4

LAPS Cancellation because of no payment of annual fees