JP3542184B2 - Linear calculation method - Google Patents

Linear calculation method Download PDF

Info

Publication number
JP3542184B2
JP3542184B2 JP31151994A JP31151994A JP3542184B2 JP 3542184 B2 JP3542184 B2 JP 3542184B2 JP 31151994 A JP31151994 A JP 31151994A JP 31151994 A JP31151994 A JP 31151994A JP 3542184 B2 JP3542184 B2 JP 3542184B2
Authority
JP
Japan
Prior art keywords
block
matrix
linear
block axis
processor
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 - Lifetime
Application number
JP31151994A
Other languages
Japanese (ja)
Other versions
JPH08166941A (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.)
Hitachi Ltd
Original Assignee
Hitachi 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 Hitachi Ltd filed Critical Hitachi Ltd
Priority to JP31151994A priority Critical patent/JP3542184B2/en
Publication of JPH08166941A publication Critical patent/JPH08166941A/en
Application granted granted Critical
Publication of JP3542184B2 publication Critical patent/JP3542184B2/en
Anticipated expiration legal-status Critical
Expired - Lifetime legal-status Critical Current

Links

Images

Landscapes

  • Complex Calculations (AREA)
  • Memory System Of A Hierarchy Structure (AREA)

Description

【0001】
【産業上の利用分野】
本発明は並列計算機を用いて例えば連立一次方程式の求解,固有値計算などの線形計算を高速に行う方法に関する。
【0002】
【従来の技術】
構造解析,流体計算などの科学技術計算では,数万次元から数百万次元に上る大規模行列を係数行列とする連立一次方程式の求解,固有値計算などの線形計算が必要となる。このような計算を高速に行う手段としては,並列計算機が有力である。並列計算機は数十個から数万個に上る多数の高速プロセッサをネットワークで結んだシステムであり,問題を適切に分割して各プロセッサに割り当て,同時に処理を行わせることにより,1台のプロセッサによる実行と比べて飛躍的な実行速度の向上が可能となる。
【0003】
問題の分割と部分問題のプロセッサへの割り当てにおいては,(1) プロセッサの単体性能を発揮させること,(2) 並列化効率(プロセッサを1台からp台に増やしたときの理想的な性能向上であるp倍に対し,実際にどの程度の性能向上が達成できたかの比)を高めること,の2つを考慮することが必要である。(1)の単体性能に関しては,高性能な並列計算機に使われるプロセッサはキャッシュを備えたRISC型プロセッサであることが多いため,キャッシュを有効に利用できる分割法が必要となる。また,(2)の並列化効率に関しては,プロセッサ間通信の回数とデータ量とを減らして通信時間を削減すること,およびプロセッサ間の負荷を均等にして負荷不均等によるプロセッサの待ち時間を削減することが必要となる。
【0004】
連立一次方程式を解くために使われるガウス消去法(LU分解法)の場合,従来はこの2つの課題を解決するために並列化ブロックガウス法(たとえばインテル・コーポレーション:”並列処理コンピュータで超大規模連立一次方程式を解く方法”,特開平5−250401(1991年12月20日出願)参照)と呼ばれる手法が使われてきた。これは図2の係数行列4を大きさLB×LB(LB:ブロックサイズ)のブロック5,6,7などに分割し,各ブロックを実数のようにみなして,通常のガウス消去法を適用する手法である。並列化にあたっては各ブロックを図2のように16台のプロセッサ0〜15に割り当て,各ブロックに対する消去演算を担当のプロセッサに行わせる。
【0005】
通常のガウス消去法と比べた場合,並列化ブロックガウス法の利点は次の通りである。まず,消去演算における実数どうしの乗算が,並列化ブロックガウス法ではLB×LBの行列どうしの乗算になる。一般に行列乗算では,データがキャッシュ中にある間に何回も演算を行うため,キャッシュの有効利用が可能となり,RISC型プロセッサ上での単体性能を向上させることが可能となる。さらに,プロセッサ間でのデータ通信もブロック単位となるため,通常のガウス消去法に比べて通信回数は減少し,通信時間の削減により並列化効率の向上が可能となる。これらの利点のため,並列化ブロックガウス法は,並列計算機上でガウス消去法により連立一次方程式を解くためのもっとも一般的な手法となっている。
【0006】
【発明が解決しようとする課題】
並列化ブロックガウス法では,ブロックサイズLBは2つの異なる要請から決定される。まず(1) 単体性能の向上という面からは,消去演算で現われる C ← C − A×B という形の行列乗算において,行列A,B,Cのすべてがキャッシュに入るという条件の下で,LBはできるだけ大きいことが望ましい。LBが大きいほど,データがキャッシュ中にある間に多数回の演算が行われることになり,キャッシュの有効利用が計られるからである。一方,(2) 並列化効率の向上という面からもLBの最適値がある。LBが大きくなるとデータ通信の単位となるブロックは大きくなり,通信回数の減少により通信時間が減る一方,各プロセッサの担当するブロックの個数のばらつきが大きくなり,負荷の不均等による待ち時間は増大する。LBが小さくなるとデータ通信回数は増加するが,各プロセッサの負荷は均等になる。したがって,これら2つの均衡により,並列化効率を最大にするLBが定まる。以上で述べた(1) 単体性能を最大にするLBの値と(2) 並列化効率を最大にするLBの値とは,一般には一致しない。例として,16台のプロセッサで並列化ブロックガウス法を実行する場合を図3に示す。この例では単体性能を最大にするようにLBを決めた結果,プロセッサ0の担当ブロック5は4個,プロセッサ15の担当ブロック7は1個と,担当ブロック数に大きな差が生じている。このため,高い並列化効率は期待できない。このように従来の並列化ブロックガウス法では,単体性能,並列化効率の一方あるいは両方を犠牲にしつつ総合的に見てもっとも高い性能を達成するようにLBを決める必要があったため,並列計算機の持つ性能を十分に引き出せないという問題があった。
【0007】
本発明は,並列化ブロックガウス法を改良することにより,この問題を解決し,単体性能と並列化効率の両方を高めることにより,線形計算において並列計算機の持つ性能を十分に引き出すことを目的とする。
【0008】
【課題を解決するための手段】
上記目的を達成するため,本発明では並列化ブロックガウス法を改良し,2種の異なるブロックサイズを導入した。従来の並列化ブロックガウス法が単体性能と並列化効率とを同時に高められないのは,この2つの目的のそれぞれに対し,最適なブロックサイズが異なるからである。そこで本発明では,まず並列化効率の面から最適なブロックサイズLBを決定し,このサイズにより行列をブロックに分割して,各ブロックをプロセッサに割り当てる。これにより,並列化効率の最適化が可能となる。次に消去演算においては,各ブロック段において毎回行列全体の消去を行うのではなく,ある段数k段分のブロックピボット行とブロックピボット列とを作成しておき,k段に一回,まとめて消去を行う。これにより,消去演算はMB=k*LBの大きさの行列乗算として処理できることになり,kを適当に取ることにより,単体性能の最適化が可能となる。
【0009】
【作用】
16台のプロセッサでガウス消去法を実行する場合を例にとり,本発明により高い並列化効率と高い単体性能とが同時に達成される様子を説明する。
【0010】
まず,図4(a)が全体行列の消去演算を示す。行列はブロックに分割されており,各ブロックのサイズはLB×LBである。行列中の影の付いたブロックは,プロセッサ0の担当ブロックを示す。LBを十分小さく取ることにより,各プロセッサの担当ブロック数はほぼ均等になり,並列化効率を高めることができる。図4(a)では4段分のブロックピボット列とブロックピボット行とを作成しておき,まとめて4段分の消去を行う場合を示している。この場合,プロセッサ0では,ブロックピボット行・列のうちの影の付いたブロックを用いて消去演算を行う。プロセッサ0の行う演算のみを取り出して表示したのが図4(b)である。図から明らかなように,4ブロック段分の消去をまとめて行うことにより,プロセッサ0での消去演算はサイズMB=4*LBの行列どうしの乗算として処理できる。これにより,従来の並列化ブロックガウス法に比べて行列乗算のサイズを大きくすることができ,キャッシュの有効利用により単体性能を高めることができる。
【0011】
以上により,本発明の手法では並列化効率の向上と単体性能の向上とを同時に達成することができる。
【0012】
【実施例】
(実施例1)
以下,本発明の原理および実施例を,図面により詳細に説明する。ここで実施例として挙げるのは,並列計算機を用いてガウス消去法により連立一次方程式を解く方法である。図1に示すように,本方法を適用する並列計算機システムは行列データ,右辺ベクトルなどのデータを入力するための入力装置1, それぞれがキャッシュメモリを備えたp台のプロセッサ31を持つ連立一次方程式求解装置2,解を出力するための出力装置3から構成される。本実施例における処理を図5に示す。まず入力装置から係数行列A,右辺ベクトルb,行列の次元N,2つのブロックサイズLB,MBを入力し(処理13),行列データおよび右辺ベクトルのプロセッサへの割り当てを行い(処理14),K=1からK=N/LBまでの各ブロック段について消去演算を行って係数行列のLU分解を求める(処理15)。次に,得られたLU分解を用いて前進消去演算(処理22),後退代入演算(処理23)を行って解を求め,最後に各プロセッサに分散して格納されている解を収集し(処理24),出力する(処理25)。本発明のもっとも大きな特徴は,処理14のデータ割り当て部分,および処理15の消去演算部分にあるので,以下,これらの部分について説明する。
【0013】
(1) プロセッサへのデータ割り当て
入力ステップ(処理13)で入力したプロセッサ割り当てのためのブロックサイズLBを用いて,図2のように係数行列を大きさLB×LBのブロックに分割し,各ブロックをプロセッサに割り当てる。図2の5,6,7はそれぞれプロセッサ0,1,15に割り当てられたブロックを示す。LBが大きいと通信の単位が大きくなるため,通信回数が減少して通信オーバーヘッドは減少するが,各プロセッサの担当ブロック数のばらつきが大きくなり,プロセッサ間の負荷不均等によりアイドル時間が増大する。一方LBが小さいと負荷は均等になるが,通信の回数が多くなって通信オーバーヘッドが増大する。本発明では,これら2つの兼ね合いから,並列化効率を最大にするようにLBをあらかじめ決める。
【0014】
(2) 消去演算
本発明における消去演算の特徴は,各ブロック段ごとに行列全体の消去演算を行わず,k本のブロックピボット列・行を予め作成してからkブロック段分の消去を行い,これにより消去演算を大きさMB=k*LBの大きな行列の演算として処理してキャッシュの有効利用を計ることにある。そこで,図5の処理15から処理21により,消去演算の各過程を説明する。
【0015】
まず,第Kブロック段の最初では第(K,K)ブロックのLU分解を行う(処理16)。これは従来の並列化ブロックガウス法と同じである。次に,今作成したUの逆行列を第Kブロック列に右からかけることにより第Kブロックピボット列を作成し(処理17),Lの逆行列を第Kブロック行に左からかけることにより第Kブロックピボット行を作成する(処理18)。そして第Kブロックピボット列と第Kブロックピボット行とにより,消去演算を行う(処理19)。ただし,ここでの消去は行列全体に対しては行わず,次のk本のブロックピボット列・行となる部分に対してのみ行う。k段分のブロックピボット列・行を作成するためには,この範囲の消去で十分である。この後,Kがk=MB/LBの倍数でなければ,第K+1ブロック段に進む(処理20)。Kがk=MB/LBの倍数の場合には,それまでに作成したk本のブロックピボット列・行を用いて,行列全体の消去を行う(処理21)。この消去演算での処理を図4(a)に示す。この例ではk=4であり,4本のブロックピボット列8,4本のブロックピボット行10による消去演算を行っている。図4(a)は全体の係数行列4に対する演算であるが,このうちプロセッサ0の担当ブロック5(それぞれの大きさはLB×LB)に対する演算を抜き出したものを図4(b)に示す。図から明らかなように,ブロックピボット列のうちでプロセッサ0の演算で使われる部分9,ブロックピボット行のうちでプロセッサ0の演算で使われる部分11を用いて,消去演算は大きさMB=4*LBの行列に対する乗算として処理できる。この結果,kを適当に選んでMB×MBの行列3個がちょうどキャッシュに入るようにすれば,キャッシュを最大限に利用することができ,単体性能が向上する。一方,従来の並列化ブロックガウス法では各ブロック段ごとに行列全体の消去演算を行うので,消去演算はLB×LBの行列乗算となるが,LBの範囲は並列化効率の最適化との兼ね合いにより決められてしまい,単体性能を十分に発揮させることが難しい。本発明では、この点が大きく改良されている。
【0016】
(実施例2)
実施例1では線形計算の一つであるガウス消去法の場合について説明したが、これ以外にも、ピボット列とピボット行とを用いて行列を消去していくという線形計算に対しては,本発明が適用可能である。このような線形計算の例としては、最小二乗法などに使われる行列のQR分解や、固有値計算に使われるHouseholder変換などがある。本実施例では,最小二乗法への本発明の適用例を述べる。
【0017】
最小二乗法の問題例として,実験により与えられたm個のの入力データと出力データの組(x1, y1),(x2, y2),... ,(xm, ym)に基づき,入力xと出力yの関係をn−1次式 y = f(x) で近似する問題を考える。求めたいのは,f(x)におけるxの0次,1次,... ,n−1次の項の係数a1,a2,... ,an である。これを求めるには,最小二乗法の標準的な手続きにより,まず第i番目の入力データxiのj−1乗を第(i, j)要素とする行列Aを求め,これを A = QRとQR分解してから,Rを係数行列とし,(Qの転置行列)×(y1, y2, ... , ym)を右辺ベクトルとする連立一次方程式を解けばよい。この一連の処理のうち,もっとも計算量が多いのはAのQR分解の部分であり,これを並列機上で実行する場合に本発明が利用できる。
【0018】
本発明の手法を用いて,このQR分解を並列機上で実行する場合の処理を図6に示す。QR分解の場合も,並列化効率を最大にするように選んだブロックサイズLBにしたがって行列をブロックに分割し,プロセッサに割り当てる部分(処理27)は実施例1のガウス消去法と同様である。ただし次の消去演算において,第Kブロックピボット行・列を作成するための前処理演算が,ガウス消去法の場合のLU分解処理(図5の処理16)からQR分解処理(図6の処理28)へと置き替わっている。また,第Kブロックピボット行・列の作成(図6の処理16,17)の詳細もガウス消去法の場合とは異なる。しかし,あらかじめ数本のブロックピボット行・列を作成しておき,MB/LB段に1回まとめて消去演算を行うという本発明の手法(処理21)は全く同様に適用できる。また,この手法により得られる効果も,ガウス消去法の場合と同様である。
【0019】
本実施例では他の線形演算に対する適用例として最小二乗法などに使われるQR分解の場合を示したが,Householder変換など,さらに他の線形計算アルゴリズムに対しても,本手法は同様に適用できる。
【0020】
【発明の効果】
以上説明したように,本発明によれば,並列計算機上でのガウス消去法などの線形計算において,単体性能と並列化効率とを共に高めることができ,並列計算機の性能を十分に引き出した計算が可能となる。
【図面の簡単な説明】
【図1】並列計算機による線形計算システムの全体を示す図である。
【図2】従来の並列化ブロックガウス法でのブロックへのプロセッサ割り当てを示す図である。
【図3】従来の並列化ブロックガウス法において,単体性能を高めるためにブロックサイズを大きく取った結果,各プロセッサの担当ブロック数が不均等になったことを示す図である。
【図4】本発明により,プロセッサ割り当てのためのブロックサイズを小さくとっても,消去演算のためのブロックサイズが大きく取れるようになったことを示す図である。
【図5】本発明をガウス消去法による連立一次方程式解法に適用した場合の手続き全体を示す図である。
【図6】本発明を行列のQR分解に適用した場合の手続き全体を示す図である。
【符号の説明】
1:入力装置,2:連立一次方程式求解装置,3:出力装置,4:係数行列の全体,5:プロセッサ0の担当するブロック,6:プロセッサ1の担当するブロック,7:プロセッサ15の担当するブロック,8:4段分のブロックピボット列の全体,9:ブロックピボット列のうちプロセッサ0の計算に使われる部分,10:4段分のブロックピボット行の全体,11:ブロックピボット行のうちプロセッサ0の計算に使われる部分,12:スタート,13:データの入力,14:係数行列および右辺ベクトルのプロセッサへの割り当て,15:最外側の繰り返しループ,16:第(K,K)ブロックのLU分解,17:第Kブロックピボット列の作成,18:第Kブロックピボット行の作成,19:第Kブロックピボット列・行による部分的な消去演算,20:KがMB/LBの倍数か否かの判定,21:K段分の同時消去演算,22:前進消去演算,23:後退代入演算,24:解ベクトルの収集,25:解ベクトルの出力,26:終了,27:行列データのプロセッサへの割り当て,28:第(K,K)ブロックのQR分解,29:解行列の収集,30:解行列の出力,31:プロセッサ,32:キャッシュメモリ。
[0001]
[Industrial applications]
The present invention relates to a method for performing high-speed linear calculations, such as solving simultaneous linear equations and calculating eigenvalues, using a parallel computer.
[0002]
[Prior art]
In scientific and technical calculations such as structural analysis and fluid calculation, linear calculations such as solution of simultaneous linear equations using large-scale matrices ranging from tens of thousands to millions of dimensions as coefficient matrices and eigenvalue calculations are required. As a means for performing such calculations at high speed, a parallel computer is effective. A parallel computer is a system in which a large number of high-speed processors, from tens to tens of thousands, are connected via a network. Problems are divided appropriately, assigned to each processor, and processed at the same time. The execution speed can be dramatically improved compared to execution.
[0003]
In dividing the problem and assigning partial problems to the processors, (1) the performance of a single processor must be exhibited, and (2) parallelization efficiency (ideal performance improvement when the number of processors is increased from one to p). It is necessary to consider two factors: (a ratio of how much performance improvement was actually achieved with respect to p times). Regarding the single performance of (1), a processor used in a high-performance parallel computer is often a RISC-type processor having a cache, so that a partitioning method that can effectively use the cache is required. Regarding the parallelization efficiency of (2), the number of inter-processor communications and the amount of data are reduced to reduce communication time, and the load between processors is equalized to reduce the waiting time of the processor due to uneven load. It is necessary to do.
[0004]
In the case of the Gaussian elimination method (LU decomposition method) used to solve a system of linear equations, conventionally, to solve these two problems, a parallelized block Gaussian method (for example, Intel Corporation: "Large-scale simultaneous processing with a parallel processing computer") A method called "Method of Solving a Linear Equation" (see Japanese Patent Application Laid-Open No. 5-250401 (filed on Dec. 20, 1991)) has been used. This is done by dividing the coefficient matrix 4 of FIG. 2 into blocks 5, 6, 7 and the like having a size of LB × LB (LB: block size), treating each block as a real number, and applying a normal Gaussian elimination method. Method. In parallelization, each block is allocated to 16 processors 0 to 15 as shown in FIG. 2, and a processor in charge performs an erasure operation on each block.
[0005]
The advantages of the parallelized block Gaussian method compared to the normal Gaussian elimination method are as follows. First, multiplication between real numbers in the erasure operation is multiplication between LB × LB matrices in the parallelized block Gaussian method. Generally, in the matrix multiplication, since the operation is performed many times while the data is in the cache, the cache can be effectively used, and the single performance on the RISC processor can be improved. Furthermore, since data communication between processors is performed in block units, the number of times of communication is reduced as compared with the normal Gaussian elimination method, and the parallelization efficiency can be improved by reducing the communication time. Due to these advantages, the parallelized block Gaussian method is the most common method for solving simultaneous linear equations by Gaussian elimination on a parallel computer.
[0006]
[Problems to be solved by the invention]
In the parallelized block Gaussian method, the block size LB is determined from two different requirements. First, (1) from the standpoint of improving the performance of a single unit, in a matrix multiplication of the form C ← C−A × B that appears in the erasure operation, LB under the condition that all of the matrices A, B, and C enter the cache Is desirably as large as possible. This is because the larger the LB is, the more operations are performed while the data is in the cache, and the more effective use of the cache is achieved. On the other hand, (2) there is an optimum value of LB also from the viewpoint of improving parallelization efficiency. As the LB increases, the block serving as a unit of data communication increases, and the communication time decreases due to the decrease in the number of times of communication. On the other hand, the number of blocks handled by each processor increases, and the waiting time due to uneven load increases. . As the LB decreases, the number of data communications increases, but the load on each processor becomes equal. Therefore, the LB that maximizes the parallelization efficiency is determined by these two balances. Generally, (1) the value of LB that maximizes the single unit performance and (2) the value of LB that maximizes the parallelization efficiency do not match. As an example, FIG. 3 shows a case where the parallelized block Gaussian method is executed by 16 processors. In this example, as a result of determining the LB so as to maximize the single unit performance, the assigned block 5 of the processor 0 and the assigned block 7 of the processor 15 greatly differ from each other. Therefore, high parallelization efficiency cannot be expected. As described above, in the conventional parallelized block Gaussian method, it is necessary to determine the LB so as to achieve the highest overall performance while sacrificing one or both of the unit performance and the parallelization efficiency. There was a problem that it was not possible to bring out the performance that it had.
[0007]
An object of the present invention is to solve this problem by improving the parallelized block Gaussian method, and to fully exploit the performance of a parallel computer in linear computation by increasing both the unit performance and the parallelization efficiency. I do.
[0008]
[Means for Solving the Problems]
In order to achieve the above object, the present invention improves the parallelized block Gaussian method and introduces two different block sizes. The reason that the conventional parallelized block Gaussian method cannot simultaneously increase the simplex performance and the parallelization efficiency is that the optimum block size differs for each of these two purposes. Therefore, in the present invention, first, an optimal block size LB is determined from the viewpoint of parallelization efficiency, a matrix is divided into blocks based on this size, and each block is assigned to a processor. This makes it possible to optimize the parallelization efficiency. Next, in the erasure operation, instead of erasing the entire matrix each time at each block stage, block pivot rows and block pivot columns for a certain number of stages k are created, and once in k stages, they are collectively collected. Perform erasure. As a result, the erasure operation can be processed as a matrix multiplication of the size of MB = k * LB. By appropriately setting k, the performance of a single device can be optimized.
[0009]
[Action]
Taking the case where the Gaussian elimination method is executed by 16 processors as an example, how the present invention achieves high parallelization efficiency and high unit performance simultaneously will be described.
[0010]
First, FIG. 4A shows the erasure operation of the entire matrix. The matrix is divided into blocks, and the size of each block is LB × LB. The shaded blocks in the matrix indicate the blocks in charge of the processor 0. By making the LB small enough, the number of blocks in charge of each processor becomes substantially equal, and the parallelization efficiency can be increased. FIG. 4A shows a case where block pivot columns and block pivot rows for four stages are created, and erase for four stages is collectively performed. In this case, the processor 0 performs the erasure operation using the shaded block of the block pivot row / column. FIG. 4B shows only the operation performed by the processor 0, which is displayed. As is clear from the figure, by erasing four blocks at a time, the erasing operation in the processor 0 can be processed as a multiplication between matrices of size MB = 4 * LB. As a result, the size of matrix multiplication can be increased as compared with the conventional parallelized block Gaussian method, and the unit performance can be improved by effective use of the cache.
[0011]
As described above, according to the method of the present invention, it is possible to simultaneously improve the parallelization efficiency and the single-unit performance.
[0012]
【Example】
(Example 1)
Hereinafter, the principle and embodiments of the present invention will be described in detail with reference to the drawings. Here, as an embodiment, a method of solving simultaneous linear equations by a Gaussian elimination method using a parallel computer is described. As shown in FIG. 1, a parallel computer system to which the present method is applied is an input device for inputting data such as matrix data and a right-hand side vector, and a system of linear equations having p processors 31 each having a cache memory. It comprises a solving device 2 and an output device 3 for outputting a solution. FIG. 5 shows the processing in this embodiment. First, a coefficient matrix A, a right side vector b, a matrix dimension N, two block sizes LB and MB are input from an input device (process 13), and matrix data and a right side vector are assigned to a processor (process 14), and K An erasure operation is performed for each block stage from = 1 to K = N / LB to obtain an LU decomposition of the coefficient matrix (process 15). Next, using the obtained LU factorization, a forward elimination operation (process 22) and a backward substitution operation (process 23) are performed to obtain a solution, and finally, solutions stored in a distributed manner among the processors are collected ( Process 24) and output (Process 25). The most significant features of the present invention are the data allocation part of the processing 14 and the erasure calculation part of the processing 15, and these parts will be described below.
[0013]
(1) Using the block size LB for processor allocation input in the data allocation input step to the processor (process 13), the coefficient matrix is divided into blocks of size LB × LB as shown in FIG. To the processor. 2 indicate blocks assigned to the processors 0, 1, and 15, respectively. When the LB is large, the unit of communication becomes large, so that the number of communication times is reduced and the communication overhead is reduced. However, the number of blocks in charge of each processor increases, and the idle time increases due to uneven load between the processors. On the other hand, if the LB is small, the load becomes equal, but the number of times of communication increases and the communication overhead increases. In the present invention, the LB is determined in advance so as to maximize the parallelization efficiency based on a balance between these two.
[0014]
(2) Erasing Operation The erasing operation according to the present invention is characterized in that the erasing operation for the entire matrix is not performed for each block stage, but k block pivot columns / rows are created in advance and then erasing for k block stages is performed. Thus, the erasure operation is processed as an operation of a large matrix having a size of MB = k * LB to effectively use the cache. Therefore, each process of the erasure calculation will be described with reference to processes 15 to 21 in FIG.
[0015]
First, at the beginning of the K-th block, LU decomposition of the (K, K) -th block is performed (process 16). This is the same as the conventional parallelized block Gaussian method. Next, a K-th block pivot column is created by applying the inverse matrix of U just created to the K-th block column from the right (process 17), and the inverse matrix of L is applied to the K-th block row from the left by applying the inverse matrix to the K-th block row. A K block pivot row is created (process 18). Then, an erase operation is performed using the K-th block pivot column and the K-th block pivot row (process 19). However, the erasure is not performed on the entire matrix, but is performed only on a portion to be the next k block pivot columns / rows. This range suffices to create k columns of block pivot columns and rows. Thereafter, if K is not a multiple of k = MB / LB, the process proceeds to the (K + 1) th block stage (process 20). If K is a multiple of k = MB / LB, the entire matrix is erased using the k block pivot columns and rows created so far (process 21). FIG. 4A shows the processing in the erase operation. In this example, k = 4, and the erasure calculation is performed using four block pivot columns 8 and four block pivot rows 10. FIG. 4A shows an operation on the entire coefficient matrix 4, and FIG. 4B shows an extracted result of the operation on the block 5 in charge (each size is LB × LB) of the processor 0. As is apparent from the figure, the erasure operation is performed using the part 9 used in the operation of the processor 0 in the block pivot row and the part 11 used in the operation of the processor 0 in the block pivot row, and the size MB = 4. * Can be processed as a multiplication of a matrix of LB. As a result, if k is appropriately selected and three MB × MB matrices are just entered into the cache, the cache can be used to the maximum, and the performance of a single unit can be improved. On the other hand, in the conventional parallelized block Gaussian method, the erasure operation of the entire matrix is performed for each block stage, so the erasure operation is a matrix multiplication of LB × LB, but the range of LB balances the optimization of the parallelization efficiency. And it is difficult to make full use of single performance. In the present invention, this point is greatly improved.
[0016]
(Example 2)
In the first embodiment, the case of the Gaussian elimination method, which is one of the linear calculations, has been described. However, in addition to the above, the linear calculation in which the matrix is deleted using the pivot columns and the pivot rows is used in the present embodiment. The invention is applicable. Examples of such linear calculations include QR decomposition of matrices used in the least squares method and the like, and Householder transform used in eigenvalue calculations. In this embodiment, an application example of the present invention to the least squares method will be described.
[0017]
As an example of the problem of the least squares method, m sets of input data and output data (x1, y1), (x2, y2),. . . , (Xm, ym), consider the problem of approximating the relationship between the input x and the output y with an (n−1) -order expression y = f (x). What we want to find is the 0th, 1st,. . . , N-1 order terms a1, a2,. . . , An. To find this, first, a matrix A having the (i, j) -th element as the (j−1) th element of the i-th input data xi is obtained by a standard procedure of the least squares method, and this is expressed as A = QR. After the QR decomposition, a simultaneous linear equation in which R is a coefficient matrix and (transposed matrix of Q) × (y1, y2,..., Ym) is a right-hand side vector may be solved. Of this series of processing, the largest calculation amount is the QR decomposition part of A, and the present invention can be used when this is executed on a parallel machine.
[0018]
FIG. 6 shows a process for executing this QR decomposition on a parallel machine using the method of the present invention. Also in the case of the QR decomposition, the matrix is divided into blocks according to the block size LB selected so as to maximize the parallelization efficiency, and the portion to be assigned to the processor (process 27) is the same as the Gaussian elimination method of the first embodiment. However, in the next erasure operation, the pre-processing operation for creating the K-th block pivot row / column is performed from the LU decomposition process (process 16 in FIG. 5) to the QR decomposition process (process 28 in FIG. 6) when the Gaussian elimination method is used. ). The details of the creation of the K-th block pivot row and column (steps 16 and 17 in FIG. 6) are also different from those of the Gaussian elimination method. However, the method (process 21) of the present invention in which several block pivot rows and columns are created in advance and the erasing operation is performed once in the MB / LB stage can be applied in exactly the same manner. The effect obtained by this method is the same as that of the Gaussian elimination method.
[0019]
In the present embodiment, the QR decomposition used in the least squares method and the like is shown as an application example to another linear operation. However, this method can be similarly applied to other linear calculation algorithms such as the Householder transform. .
[0020]
【The invention's effect】
As described above, according to the present invention, in a linear calculation such as a Gaussian elimination method on a parallel computer, both the stand-alone performance and the parallelization efficiency can be improved, and the calculation that fully exploits the performance of the parallel computer can be achieved. Becomes possible.
[Brief description of the drawings]
FIG. 1 is a diagram illustrating an entire linear calculation system using a parallel computer.
FIG. 2 is a diagram showing processor assignment to blocks in a conventional parallelized block Gaussian method.
FIG. 3 is a diagram showing that, in the conventional parallelized block Gaussian method, as a result of increasing the block size in order to improve the performance of a single unit, the number of blocks in charge of each processor becomes uneven.
FIG. 4 is a diagram showing that, according to the present invention, a large block size for an erasure operation can be obtained even if a small block size is used for processor allocation.
FIG. 5 is a diagram showing an entire procedure when the present invention is applied to a simultaneous linear equation solution method by the Gaussian elimination method.
FIG. 6 is a diagram showing an overall procedure when the present invention is applied to a QR decomposition of a matrix.
[Explanation of symbols]
1: input device, 2: simultaneous linear equation solving device, 3: output device, 4: entire coefficient matrix, 5: block assigned to processor 0, 6: block assigned to processor 1, 7: assigned to processor 15. Block, 8: whole block pivot column for 4 stages, 9: part of block pivot column used for calculation by processor 0, 10: whole block pivot line for 4 stages, 11: processor among block pivot lines Part used for calculation of 0, 12: Start, 13: Data input, 14: Assignment of coefficient matrix and right side vector to processor, 15: Outermost repetition loop, 16: LU of (K, K) block Decomposition, 17: Creation of K-th block pivot column, 18: Creation of K-th block pivot row, 19: Part by K-th block pivot column / row Erasure operation, 20: determination of whether K is a multiple of MB / LB, 21: simultaneous erasure operation for K stages, 22: forward erasure operation, 23: backward substitution operation, 24: collection of solution vectors, 25: Output of solution vector, 26: end, 27: assignment of matrix data to processor, 28: QR decomposition of (K, K) th block, 29: collection of solution matrix, 30: output of solution matrix, 31: processor, 32: cache memory.

Claims (4)

入力装置と、それぞれがキャッシュメモリを備えた複数のプロセッサからなる処理装置と、出力装置とからなる並列計算機を用いてN次元の行列Aに対して線形計算を行う方法であって、
計算対象の行列Aおよび2つの異なるブロックサイズLB,MBを入力し、
係数行列Aを大きさLB×LBの複数個のブロックに分割し、分割したブロックを上記複数のプロセッサに分散して割り当て、
前記線形演算を前記分割したブロックのブロック段ごとに順次実施し、
該順次実施の第K段(1≦K≦N/LB)の計算は、
前記ブロック段のそれぞれのブロックが割り当てられたプロセッサにて各々演算を担当し、且つ、
a.第Kブロック枢軸列および第Kブロック枢行を作成するために必要な前処理演算と、
b.第Kブロック枢軸列の作成と、
c.第Kブロック枢軸行の作成と、
d.第Kブロック枢軸列と第Kブロック枢軸行とを用いて更新すべき行列Aの部分のうち、次の数段分のブロック枢軸列とブロック枢軸行を作成するのに必要な範囲の消去演算と、
KがMB/LBの倍数であるか否かを判定して倍数であるときには上記に加えて、
e.行列Aの更新すべき部分の第(K−MB/LB+1),第(K−MB/LB+2),・・・,第Kブロック枢軸列・ブロック枢軸行によるMB/LB段分の同時更新演算を実行する、
との方法で並列実行することを特徴とする線形計算方法。
A method for performing a linear calculation on an N-dimensional matrix A using a parallel computer including an input device, a processing device including a plurality of processors each including a cache memory, and an output device,
Input the matrix A to be calculated and two different block sizes LB, MB,
The coefficient matrix A is divided into a plurality of blocks of size LB × LB, and the divided blocks are distributed and assigned to the plurality of processors.
The linear operation is sequentially performed for each block stage of the divided block,
The calculation of the K-th stage (1 ≦ K ≦ N / LB) of the sequential execution is as follows .
The processor assigned to each block of the block stage is in charge of each operation, and
a. Preprocessing operations required to create the Kth block axis column and the Kth block axis;
b. Creation of the K-th block axis row,
c. Creation of the K-th block axis line,
d. A part of the matrix A to be updated by using the K-th block axis row and the K-th block axis row, the elimination operation of the range necessary to create the next several stages of block axis rows and block axis rows, ,
It is determined whether or not K is a multiple of MB / LB, and when K is a multiple, in addition to the above,
e. Simultaneous update operations for MB / LB stages by the (K-MB / LB + 1), (K-MB / LB + 2),..., K-th block axis rows and block axis rows of the part to be updated of the matrix A Execute,
A linear calculation method characterized by performing parallel execution by the above method.
請求項1の線形計算方法であって、上記入力する処理は、演算に使われるデータを単位にして計った上記キャッシュメモリのサイズをW語とするとき、MB×MB≦W≦4×MB×MBを満たすように上記MBを決める処理を含む線形計算方法。2. The linear calculation method according to claim 1, wherein the input processing is performed when MB × MB ≦ W ≦ 4 × MB ×, where the size of the cache memory measured in units of data used for calculation is W words. A linear calculation method including a process of determining the MB so as to satisfy the MB. 請求項1の線形計算方法であって、上記前処理演算は、N次元の連立一次方程式Ax=bにおける係数行列Aの第(K,K)ブロックのLU分解を行う演算である線形計算方法。2. The linear calculation method according to claim 1, wherein the preprocessing operation is an operation for performing an LU decomposition of the (K, K) block of the coefficient matrix A in the N-dimensional simultaneous linear equation Ax = b. 請求項1の線形計算方法であって、上記前処理演算は、N次元の行列Aの第(K,K)ブロックのQR分解を行う演算である線形計算方法。2. The linear calculation method according to claim 1, wherein the preprocessing operation is an operation for performing a QR decomposition of the (K, K) block of the N-dimensional matrix A.
JP31151994A 1994-12-15 1994-12-15 Linear calculation method Expired - Lifetime JP3542184B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP31151994A JP3542184B2 (en) 1994-12-15 1994-12-15 Linear calculation method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP31151994A JP3542184B2 (en) 1994-12-15 1994-12-15 Linear calculation method

Publications (2)

Publication Number Publication Date
JPH08166941A JPH08166941A (en) 1996-06-25
JP3542184B2 true JP3542184B2 (en) 2004-07-14

Family

ID=18018222

Family Applications (1)

Application Number Title Priority Date Filing Date
JP31151994A Expired - Lifetime JP3542184B2 (en) 1994-12-15 1994-12-15 Linear calculation method

Country Status (1)

Country Link
JP (1) JP3542184B2 (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20030182518A1 (en) 2002-03-22 2003-09-25 Fujitsu Limited Parallel processing method for inverse matrix for shared memory type scalar parallel computer

Also Published As

Publication number Publication date
JPH08166941A (en) 1996-06-25

Similar Documents

Publication Publication Date Title
JP6977239B2 (en) Matrix multiplier
JPH07271760A (en) Method and computer for simultaneous linear equation calculating process by memory decentralized type parallel computer
CN110766128A (en) Convolution calculation unit, calculation method and neural network calculation platform
KR102256288B1 (en) Pruning-based training method and system for acceleration hardware of a artificial neural network
JP2002163246A (en) Parallel matrix processing method in shared memory type scalar parallel computer and recording medium
US11983616B2 (en) Methods and apparatus for constructing digital circuits for performing matrix operations
CN111639701B (en) Method, system and equipment for extracting image features and readable storage medium
CN112306555A (en) Method, apparatus, device and computer readable storage medium for extracting image data in multiple convolution windows in parallel
CN110414672B (en) Convolution operation method, device and system
Funasaka et al. Single kernel soft synchronization technique for task arrays on CUDA-enabled GPUs, with applications
JP2001067206A (en) System and method for executing modular multiplication
JP3542184B2 (en) Linear calculation method
US11886347B2 (en) Large-scale data processing computer architecture
JP3071899B2 (en) Charge beam drawing data creation device
CN116431562A (en) Multi-head attention mechanism fusion calculation distribution method based on acceleration processor
EP3940605A1 (en) Mapping convolution to connected processing elements using distributed pipelined separable convolution operations
Wu et al. Skeletongcn: a simple yet effective accelerator for gcn training
US11132195B2 (en) Computing device and neural network processor incorporating the same
CN111340224B (en) Accelerated design method of CNN (computer network) suitable for low-resource embedded chip
JP3659307B2 (en) Calculation method and recording medium in vector computer
Tokura et al. Gpu-accelerated bulk computation of the eigenvalue problem for many small real non-symmetric matrices
JP3808925B2 (en) Apparatus and method for parallel processing of simultaneous equations capable of using various matrix storage methods
JPH0644289A (en) Linear regression dispersion method for parallel processor
KR20240093301A (en) Apparatus and Method for Matrix Multiplication
JPH07239843A (en) Parallel arithmetic processors

Legal Events

Date Code Title Description
A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20040130

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

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20040330

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

Free format text: PAYMENT UNTIL: 20090409

Year of fee payment: 5

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

Free format text: PAYMENT UNTIL: 20090409

Year of fee payment: 5

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

Free format text: PAYMENT UNTIL: 20100409

Year of fee payment: 6

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

Free format text: PAYMENT UNTIL: 20110409

Year of fee payment: 7

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

Free format text: PAYMENT UNTIL: 20120409

Year of fee payment: 8

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

Free format text: PAYMENT UNTIL: 20120409

Year of fee payment: 8

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

Free format text: PAYMENT UNTIL: 20130409

Year of fee payment: 9

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

Free format text: PAYMENT UNTIL: 20140409

Year of fee payment: 10

EXPY Cancellation because of completion of term