JP6981223B2 - Sparse matrix vector product calculation device and sparse matrix vector product calculation method - Google Patents

Sparse matrix vector product calculation device and sparse matrix vector product calculation method Download PDF

Info

Publication number
JP6981223B2
JP6981223B2 JP2017241098A JP2017241098A JP6981223B2 JP 6981223 B2 JP6981223 B2 JP 6981223B2 JP 2017241098 A JP2017241098 A JP 2017241098A JP 2017241098 A JP2017241098 A JP 2017241098A JP 6981223 B2 JP6981223 B2 JP 6981223B2
Authority
JP
Japan
Prior art keywords
unit
sparse matrix
arithmetic
vector
calculation
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.)
Active
Application number
JP2017241098A
Other languages
Japanese (ja)
Other versions
JP2019109626A (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 JP2017241098A priority Critical patent/JP6981223B2/en
Publication of JP2019109626A publication Critical patent/JP2019109626A/en
Application granted granted Critical
Publication of JP6981223B2 publication Critical patent/JP6981223B2/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Complex Calculations (AREA)

Description

本発明は、疎行列ベクトル積演算装置及び疎行列ベクトル積演算方法に関する。 The present invention relates to a sparse matrix vector product calculation device and a sparse matrix vector product calculation method.

製品の設計に関するシミュレーションを、シミュレーションツールを使って計算機上で行う技術としてCAE(Computer Aided Engineering)が知られている。例えば、CAEは、構造解析や流体解析を目的として行われる場合がある。 CAE (Computer Aided Engineering) is known as a technique for performing simulations related to product design on a computer using a simulation tool. For example, CAE may be performed for the purpose of structural analysis or fluid analysis.

CAEにおけるシミュレーションで用いられる計算手法の1つに、共役勾配法(CG法:Conjugate Gradient Method)がある。また、CG法の実行時間の大部分は、疎行列ベクトル積の演算(SpMV:Sparse matrix-vector multiplication)によって占められている。 One of the calculation methods used in the simulation in CAE is the conjugate gradient method (CG method). In addition, most of the execution time of the CG method is occupied by the operation of the sparse matrix vector product (SpMV: Sparse matrix-vector multiplication).

また、SpMVを高速化する技術として、メモリを共有する複数の処理装置が、CSR(Compressed Sparse Row format)形式からJAD(Jagged Diagonal format)形式に変換された疎行列のデータを用いて、SpMVを行う技術が知られている。 Further, as a technology for speeding up SpMV, a plurality of processing devices sharing a memory use sparse matrix data converted from a CSR (Compressed Sparse Row format) format to a JAD (Jagged Diagonal format) format to perform SpMV. The techniques to do are known.

特開2001−209631号公報Japanese Unexamined Patent Publication No. 2001-209631 特開平8−212186号公報Japanese Unexamined Patent Publication No. 8-212186

ところで、CG法におけるSpMVの計算対象の疎行列のサイズは、非常に大きい場合がある。また、CG法ではSpMVが反復して行われるため、SpMVの反復のたびにCPUとメモリとの間で疎行列の転送が行われる場合がある。しかし、上記技術では、CPUとメモリとの間で疎行列の転送時間を短縮し、CG法を高速化することが困難な場合がある。 By the way, the size of the sparse matrix for which SpMV is calculated in the CG method may be very large. Further, in the CG method, since SpMV is repeatedly performed, a sparse matrix transfer may be performed between the CPU and the memory each time the SpMV is repeated. However, with the above technique, it may be difficult to shorten the transfer time of a sparse matrix between the CPU and the memory and to speed up the CG method.

一つの側面では、共役勾配法を高速化できる疎行列ベクトル積演算装置及び疎行列ベクトル積演算方法を提供することを目的とする。 In one aspect, it is an object of the present invention to provide a sparse matrix vector product calculation device and a sparse matrix vector product calculation method capable of speeding up the conjugate gradient method.

一つの態様において、疎行列ベクトル積演算装置は、共役勾配法の制御を行う共役勾配法制御装置から入力された演算データを記憶する。演算データは、疎行列との積を計算可能なベクトルと、列指向形式で圧縮された疎行列とを含む。疎行列ベクトル積演算装置は、演算データ記憶部からベクトル及び疎行列を読み込む読込部を有する。疎行列ベクトル積演算装置は、読込部によって読み込まれたベクトル及び疎行列を用いて疎行列ベクトル積の演算を実行する演算部を有する。疎行列ベクトル積演算装置は、演算部による演算の結果を演算データ記憶部に書き込む書込部を有する。疎行列ベクトル積演算装置は、ベクトルの要素である第1の要素と、第1の要素に対応する疎行列の非零の要素である第2の要素とを、複数の演算部のうちの第2の要素の行と予め対応付けられた演算部に割り当てる割当部を有する。演算部は、複数の書き込みポートと、複数の書き込みポートのそれぞれに対応した読み取りポートとを備え、部分和を疎行列の行と対応付けて記憶するマルチポートメモリと、第1の要素及び第2の要素が割り当てられた場合、第1の要素と第2の要素とを乗じた値を出力する複数の乗算器と、複数の書き込みポートのうちのいずれかの書き込みポート及び当該書き込みポートに対応した読み取りポートと接続され、乗算器によって出力された値と、読み取りポートから読み取った第2の要素の行に対応する部分和とを足した値を書き込みポートからマルチポートメモリに書き込む複数の加算器と、を有する。 In one embodiment, the sparse matrix vector product arithmetic unit stores the arithmetic data input from the conjugate gradient method controller that controls the conjugate gradient method. The operational data includes a vector that can calculate the product of a sparse matrix and a sparse matrix compressed in a columnar format. The sparse matrix vector product arithmetic unit has a reading unit that reads a vector and a sparse matrix from an arithmetic data storage unit. The sparse matrix vector product calculation device has a calculation unit that executes a calculation of the sparse matrix vector product using the vector read by the reading unit and the sparse matrix. The sparse matrix vector product arithmetic unit has a writing unit that writes the result of the operation by the arithmetic unit to the arithmetic data storage unit. The sparse matrix vector product operation device uses a first element, which is an element of a vector, and a second element, which is a non-zero element of a sparse matrix corresponding to the first element, as a second element of a plurality of arithmetic units. It has an allocation unit that is assigned to a calculation unit that is previously associated with a row of two elements. The arithmetic unit includes a plurality of write ports and a read port corresponding to each of the plurality of write ports, and stores the partial sum in association with the rows of a sparse matrix, a multiport memory, a first element, and a second. When the element of is assigned, it corresponds to a plurality of multipliers that output a value obtained by multiplying the first element and the second element, and one of a plurality of write ports and the write port. With multiple adders connected to the read port, the value output by the multiplier plus the partial sum corresponding to the row of the second element read from the read port is written from the write port to the multiport memory. , Have.

一つの態様によれば、共役勾配法を高速化できる。 According to one embodiment, the conjugate gradient method can be accelerated.

図1は、SpMVの一例を示す図である。FIG. 1 is a diagram showing an example of SpMV. 図2は、CSR形式の一例を示す図である。FIG. 2 is a diagram showing an example of the CSR format. 図3は、SpMVの処理の一例を示す図である。FIG. 3 is a diagram showing an example of SpMV processing. 図4は、実施例1におけるシミュレーション装置の一例を示す図である。FIG. 4 is a diagram showing an example of the simulation device according to the first embodiment. 図5は、ELL形式及びJAD形式の一例を示す図である。FIG. 5 is a diagram showing an example of the ELL format and the JAD format. 図6は、実施例1における演算データの一例を示す図である。FIG. 6 is a diagram showing an example of arithmetic data in the first embodiment. 図7は、実施例1における前処理部の一例を示す図である。FIG. 7 is a diagram showing an example of the pretreatment unit in the first embodiment. 図8は、実施例1における加速部の一例を示す図である。FIG. 8 is a diagram showing an example of the acceleration unit in the first embodiment. 図9は、実施例1におけるSpMVの処理の一例を示す図である。FIG. 9 is a diagram showing an example of the processing of SpMV in the first embodiment. 図10は、実施例1における演算部の一例を示す図である。FIG. 10 is a diagram showing an example of a calculation unit in the first embodiment. 図11は、実施例1におけるCG法による処理の一例を示すフローチャートである。FIG. 11 is a flowchart showing an example of the processing by the CG method in the first embodiment. 図12は、実施例1におけるSpMVの処理の一例を示すフローチャートである。FIG. 12 is a flowchart showing an example of SpMV processing in the first embodiment. 図13は、実施例1における演算処理の一例を示すフローチャートである。FIG. 13 is a flowchart showing an example of the arithmetic processing in the first embodiment. 図14は、ハードウェア構成例を示す図である。FIG. 14 is a diagram showing a hardware configuration example.

以下に、本願の開示する疎行列ベクトル積演算装置及び疎行列ベクトル積演算方法の実施例を図面に基づいて詳細に説明する。なお、この実施例によりこの発明が限定されるものではない。また、以下に示す各実施例は、矛盾を起こさない範囲で適宜組み合わせても良い。 Hereinafter, examples of the sparse matrix vector product calculation device and the sparse matrix vector product calculation method disclosed in the present application will be described in detail with reference to the drawings. The present invention is not limited to this embodiment. In addition, the examples shown below may be appropriately combined as long as they do not cause a contradiction.

実施例1における、後に説明するシミュレーション装置10は、CG法を使ったシミュレーションを実行する。CG法は、SpMVの反復演算により、一次方程式の解を求める手法である。 The simulation apparatus 10 described later in the first embodiment executes a simulation using the CG method. The CG method is a method for finding a solution of a linear equation by iterative operation of SpMV.

なお、以下において、行列、ベクトル及び配列の各インデックスは0から始まるものとする。また、行列Mの行インデックスがi、列インデックスがjである要素をMijと表記する場合がある。また、ベクトルvのインデックスがiである要素をvと表記する場合がある。また、配列array[]のインデックスがiである要素をarray[i]と表記する場合がある。 In the following, it is assumed that each index of the matrix, vector and array starts from 0. Further, an element in which the row index of the matrix M is i and the column index is j may be expressed as Mij. Also, it may be referred to as the index is i component of vector v v i. Further, an element in which the index of the array array [] is i may be expressed as array [i].

また、行列の行方向は、行インデックスが増加していく方向であり、右方向と同意であることとする。行列の列方向は、列インデックスが増加していく方向であり、下方向と同意であることとする。 Further, the row direction of the matrix is the direction in which the row index increases, which is the same as the right direction. It is assumed that the column direction of the matrix is the direction in which the column index increases and is in agreement with the downward direction.

ここで、例として、シミュレーション装置10がCG法を用いてn元の一次方程式の解を求める場合の処理の流れを説明する。このとき、シミュレーション装置10は、n×nの行列A及び要素数nのベクトルyから、行列Aとの積がベクトルyとなるようなベクトルxを求める。なお、以下において、行列Aのような行列を係数行列と表記し、ベクトルxのようなベクトルを解ベクトルと表記し、ベクトルyのようなベクトルを定数ベクトルと表記する場合がある。また、係数行列及び定数ベクトルは既知であるが、解ベクトルの真値は未知である。 Here, as an example, the flow of processing when the simulation device 10 obtains a solution of an n-dimensional linear equation using the CG method will be described. At this time, the simulation apparatus 10 obtains a vector x such that the product with the matrix A is a vector y from the matrix A of n × n and the vector y of the number of elements n. In the following, a matrix such as the matrix A may be referred to as a coefficient matrix, a vector such as the vector x may be referred to as a solution vector, and a vector such as the vector y may be referred to as a constant vector. The coefficient matrix and the constant vector are known, but the true value of the solution vector is unknown.

まず、シミュレーション装置10は、ベクトルxに任意の初期値を設定し、行列Aとベクトルxの積の計算、すなわちSpMVを実行する。そして、シミュレーション装置10は、行列AとベクトルxのSpMVの結果として得られるベクトルy´とベクトルyとの残差から計算した勾配を基に、ベクトルy´がベクトルyに近付くようにベクトルxを更新する。 First, the simulation device 10 sets an arbitrary initial value in the vector x, and executes the calculation of the product of the matrix A and the vector x, that is, SpMV. Then, the simulation apparatus 10 sets the vector x so that the vector y'approaches the vector y based on the gradient calculated from the residual of the vector y'and the vector y obtained as a result of the SpMV of the matrix A and the vector x. Update.

さらに、シミュレーション装置10は、行列Aと更新したベクトルxとのSpMVを実行する。その後、シミュレーション装置10は、SpMV及びベクトルxの更新を所定の条件が満たされるまで繰り返し、そのときのベクトルxを一次方程式の解又は近似解として得ることができる。 Further, the simulation apparatus 10 executes SpMV of the matrix A and the updated vector x. After that, the simulation device 10 repeats updating the SpMV and the vector x until a predetermined condition is satisfied, and the vector x at that time can be obtained as a solution of a linear equation or an approximate solution.

CG法を使って製品の設計に関するシミュレーションを行う場合、係数行列は疎行列である場合がある。疎行列とは、行列の要素の多くが0の行列である。ここで、図1を用いて、疎行列のSpMVについて説明する。図1は、SpMVの一例を示す図である。図1に示すように、行列Aは疎行列である。このとき、ベクトルyの要素yは(1)式で計算される。 When simulating product design using the CG method, the coefficient matrix may be a sparse matrix. A sparse matrix is a matrix in which many of the elements of the matrix are zero. Here, a sparse matrix SpMV will be described with reference to FIG. FIG. 1 is a diagram showing an example of SpMV. As shown in FIG. 1, the matrix A is a sparse matrix. At this time, the element y 0 of the vector y is calculated by the equation (1).

=a00×x+0×x+0×x+a03×x+0×x ・・・(1) y 0 = a 00 x x 0 + 0 x x 1 + 0 x x 2 + a 03 x x 3 + 0 x x 4 ... (1)

ここで、(1)式の第2項、第3項及び第5項は必ず0になる。このため、プロセッサは(1)式の計算を行う場合、ベクトルxの要素x、x及びxを参照する必要はない。 Here, the second term, the third term, and the fifth term of the equation (1) are always 0. Therefore, the processor does not need to refer to the elements x 1 , x 2 and x 4 of the vector x when performing the calculation of the equation (1).

しかしながら、CPUやGPU(Graphics Processing Unit)等のプロセッサはメモリからのバースト転送によってデータを取得する。このため、例えばCPUが1回の転送サイクルでメモリから取得可能なデータは、連続する一定量のデータに限られる。 However, processors such as CPUs and GPUs (Graphics Processing Units) acquire data by burst transfer from memory. Therefore, for example, the data that the CPU can acquire from the memory in one transfer cycle is limited to a continuous fixed amount of data.

ここで、1回の転送サイクルで取得可能なデータがベクトルxの連続する3要素分であるCPUが(1)式の計算を行う場合を考える。また、このとき、ベクトルxの各要素はインデックスの順に連続してメモリに格納されているものとする。 Here, consider a case where the CPU, in which the data that can be acquired in one transfer cycle is three consecutive elements of the vector x, performs the calculation of the equation (1). Further, at this time, it is assumed that each element of the vector x is continuously stored in the memory in the order of the index.

この場合、CPUは、まず、a00×xを計算するために、1回目の転送サイクルでxを取得する。そして、CPUは、a03×xを計算するために、2回目の転送サイクルでxを取得する。このように、CPUは、(1)式を計算するために、少なくとも2回の転送サイクルを要する。 In this case, the CPU first acquires x 0 in the first transfer cycle in order to calculate a 00 × x 0. Then, CPU to compute the a 03 × x 3, to obtain the x 3 in the second transfer cycle. As described above, the CPU needs at least two transfer cycles to calculate the equation (1).

仮に、CPUがベクトルxから取得する要素がx、xのように連続したものであれば、CPUは1回の転送サイクルで必要な要素を取得することができることになる。逆に、取得するベクトルの要素に連続性がない場合、すなわちベクトルへのアクセスがランダムな場合は、必要な転送サイクルが増加し、その結果SpMVの演算速度が低下する。 If the elements acquired by the CPU from the vector x are continuous such as x 0 and x 1 , the CPU can acquire the necessary elements in one transfer cycle. On the contrary, when the elements of the vector to be acquired are not continuous, that is, when the access to the vector is random, the required transfer cycle increases, and as a result, the calculation speed of SpMV decreases.

さらに、シミュレーションで用いられる一次方程式の元の数は数百万から1千万を超える大きな数になる場合がある。そのような場合、係数行列や解ベクトルのサイズは非常に大きくなり、取得するベクトルの要素に連続性がないことによるSpMVの演算速度への影響も大きくなる。 In addition, the original number of linear equations used in the simulation can be large, ranging from millions to over 10 million. In such a case, the size of the coefficient matrix and the solution vector becomes very large, and the influence on the calculation speed of SpMV due to the lack of continuity in the elements of the acquired vector also becomes large.

また、疎行列は、圧縮した形式で表される場合がある。疎行列の圧縮形式の1つにCSR形式がある。図2は、CSR形式の一例を示す図である。図2に示すようにCSR形式の疎行列は、row_off、col、valの3つの配列で表される。 Also, the sparse matrix may be represented in a compressed form. One of the sparse matrix compression formats is the CSR format. FIG. 2 is a diagram showing an example of the CSR format. As shown in FIG. 2, a sparse matrix in the CSR format is represented by three arrays of row_off, col, and val.

配列valには、疎行列の0でない要素(非零要素)が、疎行列における行インデックスが小さい順に格納される。また、行インデックスが同じ非零要素については、列インデックスが小さいものが配列valにおいて先の順番になる。 Non-zero elements (non-zero elements) of a sparse matrix are stored in the array val in ascending order of row index in the sparse matrix. For non-zero elements with the same row index, the one with the smaller column index is in the first order in the array val.

また、配列colには、配列valに格納された各非零要素の対応する位置に、各非零要素の列インデックスが格納される。また、配列row_offには、配列colのインデックスであって、疎行列の各行の非零要素のうち最も列インデックスが小さい非零要素の列インデックスが格納されたインデックスが、当該非零要素の行インデックスが小さい順に格納される。 Further, in the array col, the column index of each non-zero element is stored at the corresponding position of each non-zero element stored in the array val. In the array row_off, the index that is the index of the array col and stores the column index of the non-zero element with the smallest column index among the non-zero elements of each row of the sparse matrix is the row index of the non-zero element. Are stored in ascending order.

ここで、例えば、図1の行列Aの要素a00の行インデックス及び列インデックスは、いずれも0である。また、配列valにおける要素a00のインデックスは0である。このため配列colのインデックス0の要素は0である。また、配列colのインデックスであって、疎行列の1行目(行インデックスが0の行)の非零要素のうち最も列インデックスが小さい非零要素であるa00の列インデックスが格納されたインデックスは0である。このため、配列row_offのインデックス0の要素は0である。 Here, for example, row index and column index of an element a 00 of the matrix A in FIG. 1 are both 0. Further, the index of the element a 00 in the array val is 0. Therefore, the element of index 0 of the array col is 0. In addition, an index of the sequence col, index column index of a 00 is the most column index is less nonzero elements of the non-zero elements are stored in the first row (row index is 0 line) of the sparse matrix Is 0. Therefore, the element of index 0 of the array row_off is 0.

また、例えば、図1の行列Aの要素a30の行インデックス及び列インデックスは、それぞれ3及び0である。また、配列valにおける要素a30のインデックスは6である。このため配列colのインデックス6の要素は0である。また、配列colのインデックスであって、疎行列の4行目(行インデックスが3の行)の非零要素のうち最も列インデックスが小さい非零要素であるa30の列インデックスが格納されたインデックスは6である。このため、配列row_offのインデックス3の要素は6である。 Further, for example, row index and column index of an element a 30 of the matrix A in FIG. 1, respectively is 3 and 0. Also, index of the element a 30 in the array val is 6. Therefore, the element of the index 6 of the array col is 0. In addition, an index of the sequence col, index column index of a 30 is the most column index is less non-zero elements are stored within the non-zero elements of the fourth line (row index is 3 rows) of the sparse matrix Is 6. Therefore, the element of index 3 of the array row_off is 6.

図3の疑似コードを用いて、図1の行列AがCSR形式で表されている場合の、CPUによるSpMVの処理について説明する。図3は、SpMVの処理の一例を示す図である。図3のiは、ベクトルyの要素のインデックスに対応している。また、jは、ベクトルxのインデックスに対応している。また、x[]及びy[]は、それぞれベクトルx及びベクトルyを格納した配列である。 Using the pseudo code of FIG. 3, the processing of SpMV by the CPU when the matrix A of FIG. 1 is represented in the CSR format will be described. FIG. 3 is a diagram showing an example of SpMV processing. I in FIG. 3 corresponds to the index of the element of the vector y. Further, j corresponds to the index of the vector x. Further, x [] and y [] are arrays storing the vector x and the vector y, respectively.

例えば、図2に示すように、row_off[0]は0であり、row_off[1]は2である。また、col[0]は0であり、col[1]は3である。このため、図3の3行目及び4行目に示すように、i=0の場合、CPUは、x[0]及びx[3]を取得し、取得したx[]の各要素と対応するval[]の要素との積をy[0]に足していく。つまり、i=0の場合、CPUは、(1)式の計算を行うことになる。この場合、取得するx[]の要素が連続でないことの影響を受けて、SpMVの演算速度が低下する。 For example, as shown in FIG. 2, row_off [0] is 0 and row_off [1] is 2. Further, col [0] is 0 and col [1] is 3. Therefore, as shown in the third and fourth rows of FIG. 3, when i = 0, the CPU acquires x [0] and x [3] and corresponds to each element of the acquired x []. Add the product with the elements of val [] to y [0]. That is, when i = 0, the CPU performs the calculation of the equation (1). In this case, the calculation speed of SpMV is reduced due to the influence of the fact that the elements of x [] to be acquired are not continuous.

実施例1のSpMV装置10eは、CG法によるシミュレーションを行う際の疎行列の転送を最小限に抑えつつ、ベクトルへのアクセスが連続でないことによるSpMVの演算速度の低下を抑制することを目的とするものである。 The purpose of the SpMV apparatus 10e of the first embodiment is to suppress a decrease in the calculation speed of the SpMV due to non-continuous access to the vector while minimizing the transfer of a sparse matrix when performing a simulation by the CG method. It is something to do.

[機能ブロック]
次に、本実施例における疎行列ベクトル積演算装置10bを有するシミュレーション装置10の一例について、図4を用いて説明する。図4は、実施例1におけるシミュレーション装置の一例を示す図である。図4に示すように、本実施例におけるシミュレーション装置10は、共役勾配法制御装置10aと、疎行列ベクトル積演算装置10bとを有する。共役勾配法制御装置10aは、例えばCPUによって実現される。一方、疎行列ベクトル積演算装置10bは、例えばFPGA(Field Programmable Gate Array)によって実現される。
[Function block]
Next, an example of the simulation device 10 having the sparse matrix vector product calculation device 10b in this embodiment will be described with reference to FIG. FIG. 4 is a diagram showing an example of the simulation device according to the first embodiment. As shown in FIG. 4, the simulation device 10 in this embodiment includes a conjugate gradient method control device 10a and a sparse matrix vector product calculation device 10b. The conjugate gradient method control device 10a is realized by, for example, a CPU. On the other hand, the sparse matrix vector product arithmetic unit 10b is realized by, for example, FPGA (Field Programmable Gate Array).

共役勾配法制御装置10aは、変換部11及び更新部12を有する。また、疎行列ベクトル積演算装置10bは、演算データ記憶部13、前処理制御部14、前処理部15及び加速部16を有する。 The conjugate gradient method control device 10a has a conversion unit 11 and an update unit 12. Further, the sparse matrix vector product arithmetic unit 10b has an arithmetic data storage unit 13, a preprocessing control unit 14, a preprocessing unit 15, and an acceleration unit 16.

共役勾配法制御装置10aは、CG法の制御を行う。具体的には、共役勾配法制御装置10aは、ユーザから入力された設定等を基にCG法の実行し、その際、疎行列ベクトル積演算装置10bにSpMVを実行させる。なお、SpMVにおける係数行列に対する前処理は、疎行列ベクトル積演算装置10bによって行われる。 The conjugate gradient method control device 10a controls the CG method. Specifically, the conjugate gradient method control device 10a executes the CG method based on the settings and the like input from the user, and at that time, causes the sparse matrix vector product calculation device 10b to execute SpMV. The preprocessing for the coefficient matrix in SpMV is performed by the sparse matrix vector product arithmetic unit 10b.

変換部11は、SpMVで用いられる疎行列である係数行列を列指向形式で圧縮する。例えば、変換部11は、無圧縮又はCSR等の行指向形式で表された係数行列を、列指向形式であるCSC(Compressed Sparse Column format)形式、ELL(Ellpack-Itpack generalized diagonal format)形式、JAD形式等に変換する。 The conversion unit 11 compresses a coefficient matrix, which is a sparse matrix used in SpMV, in a column-oriented format. For example, the conversion unit 11 converts a coefficient matrix expressed in a row-oriented format such as uncompressed or CSR into a column-oriented format such as CSC (Compressed Sparse Column format) format, ELL (Ellpack-Itpack generalized diagonal format) format, or JAD. Convert to format etc.

図5は、ELL形式及びJAD形式の一例を示す図である。図5に示すように、変換部11は、行列AをELL形式に変換する場合、行列Aの非零要素を左側に詰めた行列を仮定し、仮定した行列の列単位で要素を取得し、配列に格納していく。また、行列AをJAD形式に変換する場合、変換部11は、仮定した行列の行を要素数の順でソートした上で、ELL形式と同様に要素を配列に格納していく。 FIG. 5 is a diagram showing an example of the ELL format and the JAD format. As shown in FIG. 5, when converting the matrix A to the ELL format, the conversion unit 11 assumes a matrix in which the non-zero elements of the matrix A are packed on the left side, and acquires the elements in column units of the assumed matrix. Store in an array. Further, when converting the matrix A to the JAD format, the conversion unit 11 sorts the rows of the assumed matrix in the order of the number of elements, and then stores the elements in the array in the same manner as in the ELL format.

本実施例、変換部11は、行列AをJAD形式に変換し、変換した係数行列を、演算データとして疎行列ベクトル積演算装置10bの演算データ記憶部13に格納するものとする。また、このとき、変換部11は、係数行列とともに、初期値を設定した解ベクトルを演算データ記憶部13に格納し、疎行列ベクトル積演算装置10bにSpMVを実行させる。 In this embodiment, the conversion unit 11 converts the matrix A into the JAD format, and stores the converted coefficient matrix as arithmetic data in the arithmetic data storage unit 13 of the sparse matrix vector product arithmetic apparatus 10b. Further, at this time, the conversion unit 11 stores the solution vector in which the initial value is set together with the coefficient matrix in the arithmetic data storage unit 13, and causes the sparse matrix vector product arithmetic unit 10b to execute SpMV.

図6は、実施例1における演算データの一例を示す図である。図6に示すようにJAD形式の係数行列である演算データは、colind、value、jdptr及びpermの4つの配列で表される。 FIG. 6 is a diagram showing an example of arithmetic data in the first embodiment. As shown in FIG. 6, the arithmetic data which is a coefficient matrix in JAD format is represented by four arrays of colond, value, jdptr and perm.

ここで、変換部11によるJAD形式の各配列の作成方法の一例を説明する。まず、変換部11は、行列Aの行インデックスを、各行の要素数順に配列permに格納する。次に、変換部11は、配列permに格納した行インデックスの順序に従って行列Aの行をフォーカスしていき、各行の配列valueに格納されていない要素のうち、最も左側にある要素を配列valueに格納する。変換部11は、フォーカスしている行の配列valueに要素を格納した場合、又はフォーカスしている行に格納する要素が存在しない場合は次の行に進む。 Here, an example of a method of creating each array in JAD format by the conversion unit 11 will be described. First, the conversion unit 11 stores the row indexes of the matrix A in the array perm in the order of the number of elements in each row. Next, the conversion unit 11 focuses the rows of the matrix A according to the order of the row indexes stored in the array perm, and among the elements not stored in the array value of each row, the leftmost element is set to the array value. Store. The conversion unit 11 proceeds to the next row when the element is stored in the array value of the focused row or when the element to be stored does not exist in the focused row.

さらに、変換部11は、配列valueに格納した要素の列インデックスを配列colindの対応する位置に格納する。また、変換部11は、配列permに格納した行インデックスの順序が最初である行の要素の配列valueにおける格納先のインデックスを配列jdptrに格納していく。 Further, the conversion unit 11 stores the column index of the element stored in the array value at the corresponding position in the array colond. Further, the conversion unit 11 stores the index of the storage destination in the array value of the element of the row whose row index order is first stored in the array perm in the array jdptr.

更新部12は、CG法の手順に従い、疎行列ベクトル積演算装置10bによるSpMVの結果を基に解ベクトルを更新する。ここで、疎行列ベクトル積演算装置10bは、SpMVの結果として得られる定数ベクトルの計算値を演算データ記憶部13に格納するものとする。また、更新部12は、更新した解ベクトルをさらに演算データ記憶部13に格納し、疎行列ベクトル積演算装置10bにSpMVを実行させることができる。 The update unit 12 updates the solution vector based on the result of SpMV by the sparse matrix vector product arithmetic unit 10b according to the procedure of the CG method. Here, it is assumed that the sparse matrix vector product calculation device 10b stores the calculated value of the constant vector obtained as a result of SpMV in the calculation data storage unit 13. Further, the update unit 12 can further store the updated solution vector in the operation data storage unit 13, and cause the sparse matrix vector product calculation device 10b to execute SpMV.

演算データ記憶部13は、共役勾配法の制御を行う共役勾配法制御装置10aから入力された演算データであって、係数行列との積を計算可能な解ベクトルと、列指向形式で圧縮された係数行列とを含む演算データを記憶する。なお、係数行列は疎行列である。例えば、演算データ記憶部13は、ELL形式又はJAD形式で圧縮された係数行列を記憶することができる。ただし、本実施例では、演算データ記憶部13は、JAD形式で圧縮された係数行列を記憶するものとする。 The arithmetic data storage unit 13 is arithmetic data input from the conjugate gradient method control device 10a that controls the conjugate gradient method, and is compressed in a column-oriented format with a solution vector capable of calculating the product of the coefficient matrix. Stores operational data including a coefficient matrix. The coefficient matrix is a sparse matrix. For example, the arithmetic data storage unit 13 can store a coefficient matrix compressed in the ELL format or the JAD format. However, in this embodiment, the arithmetic data storage unit 13 stores the coefficient matrix compressed in the JAD format.

前処理部15は、予め設定された演算データに対する複数の前処理のそれぞれに対応した処理部を備え、指定された前処理に対応する処理部を用いて前処理を実行する。前処理制御部14は、共役勾配法制御装置10aによって指定された前処理を、前処理部15に対して指定する。なお、共役勾配法制御装置10aへの前処理の指定は、ユーザによって行われてもよい。 The pre-processing unit 15 includes a processing unit corresponding to each of a plurality of pre-processing for preset calculation data, and executes pre-processing using the processing unit corresponding to the designated pre-processing. The pre-processing control unit 14 designates the pre-processing designated by the conjugate gradient method control device 10a to the pre-processing unit 15. The user may specify the preprocessing for the conjugate gradient method control device 10a.

図7を用いて、前処理部15について説明する。図7は、実施例1における前処理部の一例を示す図である。図7に示すように、前処理部15は、対角スケーリング処理部151と、SSOR処理部152と、ILU処理部153と、AMG処理部154とを有する。 The pretreatment unit 15 will be described with reference to FIG. 7. FIG. 7 is a diagram showing an example of the pretreatment unit in the first embodiment. As shown in FIG. 7, the pretreatment unit 15 includes a diagonal scaling processing unit 151, an STOR processing unit 152, an ILU processing unit 153, and an AMG processing unit 154.

対角スケーリング処理部151は、対角スケーリングによる前処理を行う。SSOR処理部152は、SSOR(Symmetric Successive Over-relaxation)による前処理を行う。ILU処理部153は、ILU(Incomplete LU Factorization)(0)、ILU(1)等による前処理を行う。AMG処理部154は、AMG(Algebraic Multigrid)による前処理を行う。なお、前処理部15に備えられる処理部は、図7に示すものに限られない。前処理部15は、行列に対する前処理を行う処理部を複数有していればよい。 The diagonal scaling processing unit 151 performs preprocessing by diagonal scaling. The STOR processing unit 152 performs preprocessing by STOR (Symmetric Successive Over-relaxation). The ILU processing unit 153 performs pretreatment by ILU (Incomplete LU Factorization) (0), ILU (1) and the like. The AMG processing unit 154 performs pretreatment by AMG (Algebraic Multigrid). The processing unit provided in the preprocessing unit 15 is not limited to that shown in FIG. 7. The preprocessing unit 15 may have a plurality of processing units that perform preprocessing on the matrix.

前処理部15に含まれる各処理部は、回路の接続先の変更等により、再構成可能に配置されている。例えば、前処理制御部14によって指定された前処理が対角スケーリングであった場合、前処理部15は、演算データ記憶部13と対角スケーリング処理部151との接続を有効にする。また、そのとき、前処理部15は、演算データ記憶部13と、SSOR処理部152、ILU処理部153及びAMG処理部154との接続を無効にする。 Each processing unit included in the pre-processing unit 15 is arranged so as to be reconfigurable by changing the connection destination of the circuit or the like. For example, when the pre-processing designated by the pre-processing control unit 14 is diagonal scaling, the pre-processing unit 15 enables the connection between the arithmetic data storage unit 13 and the diagonal scaling processing unit 151. At that time, the pre-processing unit 15 invalidates the connection between the arithmetic data storage unit 13 and the STOR processing unit 152, the ILU processing unit 153, and the AMG processing unit 154.

加速部16は、SpMVを実行する。また、加速部16によるSpMVの実行結果は、演算データ記憶部13に記憶される。なお、演算の結果は、例えば、定数ベクトルの計算値である。また、加速部16は、CG法を高速化するように構成されている。 The acceleration unit 16 executes SpMV. Further, the execution result of SpMV by the acceleration unit 16 is stored in the arithmetic data storage unit 13. The result of the calculation is, for example, a calculated value of a constant vector. Further, the acceleration unit 16 is configured to speed up the CG method.

ここで、前処理部15は、加速部16によるSpMVが完了するたびに前処理を実行することができる。また、加速部16は、前処理部15による前処理が完了するたびにSpMVを実行する。これにより、疎行列ベクトル積演算装置10bは、前処理及びSpMVを反復して行うことができる。 Here, the pre-processing unit 15 can execute the pre-processing every time the SpMV by the acceleration unit 16 is completed. Further, the acceleration unit 16 executes SpMV every time the preprocessing by the preprocessing unit 15 is completed. As a result, the sparse matrix vector product arithmetic unit 10b can repeatedly perform preprocessing and SpMV.

その際、共役勾配法制御装置10aは、所定のタイミングで疎行列ベクトル積演算装置10bによる反復処理に割り込みを行い、定数ベクトルの計算値を取得する。共役勾配法制御装置10aは、取得した計算値と真値との残差から計算した勾配を基に、演算データ記憶部13に記憶された解ベクトルを更新する。 At that time, the conjugate gradient method control device 10a interrupts the iterative processing by the sparse matrix vector product arithmetic unit 10b at a predetermined timing, and acquires the calculated value of the constant vector. The conjugate gradient method control device 10a updates the solution vector stored in the arithmetic data storage unit 13 based on the gradient calculated from the residual between the acquired calculated value and the true value.

図8を用いて、加速部16について説明する。図8は、実施例1における加速部の一例を示す図である。図8に示すように、加速部16は、ロード部161、割当部162及び複数の演算部163を有する。また、加速部16は、演算データ記憶部13と接続されている。また、ロード部161は、読込部161a及び書込部161bを有する。 The acceleration unit 16 will be described with reference to FIG. FIG. 8 is a diagram showing an example of the acceleration unit in the first embodiment. As shown in FIG. 8, the acceleration unit 16 includes a load unit 161, an allocation unit 162, and a plurality of calculation units 163. Further, the acceleration unit 16 is connected to the arithmetic data storage unit 13. Further, the load unit 161 has a read unit 161a and a write unit 161b.

読込部161aは、演算データ記憶部13から解ベクトル及び係数行列を読み込む。割当部162は、演算部163のそれぞれに、演算に必要なデータを割り当てる。演算部163は、読込部161aによって読み込まれた解ベクトル及び係数行列を用いてSpMVを実行する。書込部161bは、演算部163による演算の結果を演算データ記憶部13に書き込む。 The reading unit 161a reads the solution vector and the coefficient matrix from the arithmetic data storage unit 13. The allocation unit 162 allocates data necessary for the calculation to each of the calculation units 163. The arithmetic unit 163 executes SpMV using the solution vector and the coefficient matrix read by the reading unit 161a. The writing unit 161b writes the result of the calculation by the calculation unit 163 to the calculation data storage unit 13.

具体的には、割当部162は、解ベクトルの要素と、解ベクトルの要素に対応する係数行列の要素とを、複数の演算部163のうちの当該係数行列の要素の行と予め対応付けられた演算部163に割り当てる。演算部163は、解ベクトルの要素及び係数行列の要素が割り当てられた場合、割り当てられた解ベクトルの要素と係数行列の要素との積及び積の和を求める演算を実行する。 Specifically, the allocation unit 162 associates the elements of the solution vector and the elements of the coefficient matrix corresponding to the elements of the solution vector with the rows of the elements of the coefficient matrix in the plurality of arithmetic units 163 in advance. It is assigned to the calculation unit 163. When the elements of the solution vector and the elements of the coefficient matrix are assigned, the calculation unit 163 executes an operation for obtaining the product of the elements of the assigned solution vector and the elements of the coefficient matrix and the sum of the products.

ここで、演算データが図6に示すものである場合の例を挙げて、加速部16の処理について説明する。演算データ記憶部13は、解ベクトルであるベクトルxの要素を記憶する。また、演算データ記憶部13は、係数行列である行列Aの要素を格納した配列valueと、行列Aの要素の列を特定する配列colindと、行列Aの要素の行を特定する配列jdptr及び配列permとを少なくとも記憶する。各配列の内容は、図6に示す通りである。 Here, the processing of the acceleration unit 16 will be described with reference to an example in which the arithmetic data is as shown in FIG. The arithmetic data storage unit 13 stores the elements of the vector x, which is a solution vector. Further, the arithmetic data storage unit 13 includes an array value storing the elements of the matrix A, which is a coefficient matrix, an array colond for specifying the columns of the elements of the matrix A, and an array jdptr and an array for specifying the rows of the elements of the matrix A. Remember at least the perm. The contents of each sequence are as shown in FIG.

なお、ベクトルxの要素は、第1の要素の一例である。また、行列Aの要素は、第2の要素の一例である。また、配列valueは、第1のデータの一例である。また、配列colindは、第2のデータの一例である。また、配列jdptr及び配列permは、第3のデータの一例である。 The element of the vector x is an example of the first element. Further, the element of the matrix A is an example of the second element. The array value is an example of the first data. The array colond is an example of the second data. The array jdptr and the array perm are examples of the third data.

また、演算データ記憶部13は、少なくとも演算部163の数と同数のポートを備えているものとする。また、演算部163のそれぞれには、行列Aの行のいずれかが予め対応付けられているものとする。なお、行列Aの各行は、定数ベクトルであるベクトルyの各要素に対応している。また、演算部163のそれぞれは、演算データ記憶部13に備えられたポートのいずれかに対応しているものとする。 Further, it is assumed that the arithmetic data storage unit 13 has at least the same number of ports as the number of arithmetic units 163. Further, it is assumed that any of the rows of the matrix A is associated with each of the arithmetic units 163 in advance. Each row of the matrix A corresponds to each element of the vector y, which is a constant vector. Further, it is assumed that each of the arithmetic units 163 corresponds to any of the ports provided in the arithmetic data storage unit 13.

図9の疑似コードを用いて、加速部16によるSpMVの処理について説明する。図9は、実施例1におけるSpMVの処理の一例を示す図である。図9のrho_maxは、配列jdptrのインデックスの最大値である。また、x[]及びy[]は、それぞれベクトルx及びベクトルyを格納した配列である。 The processing of SpMV by the acceleration unit 16 will be described with reference to the pseudo code of FIG. FIG. 9 is a diagram showing an example of the processing of SpMV in the first embodiment. Rho_max in FIG. 9 is the maximum value of the index of the array jdptr. Further, x [] and y [] are arrays storing the vector x and the vector y, respectively.

例えば、jが0かつiがjdptr[0]すなわち0である場合、図9に示すように、読込部161aは、まずjdptr[0]、perm[0]、value[0]及びcolind[0]を読み込む。さらに、colind[0]は0なので、読込部161aは、バースト転送により、x[0]、x[1]及びx[2]を読み込む。そして、割当部162は、jdptr[0]、perm[0]、value[0]、colind[0]及びx[0]を対応する演算部163に割り当てる。このとき、演算部163は、y[perm[0]]にvalue[0]*x[0]を足す。 For example, when j is 0 and i is jdptr [0], that is, 0, as shown in FIG. 9, the reading unit 161a first uses jdptr [0], perm [0], value [0], and colond [0]. Is read. Further, since colond [0] is 0, the reading unit 161a reads x [0], x [1], and x [2] by burst transfer. Then, the allocation unit 162 allocates jdptr [0], perm [0], value [0], colond [0], and x [0] to the corresponding arithmetic unit 163. At this time, the calculation unit 163 adds value [0] * x [0] to y [perm [0]].

次に、jが0のままiが1になった場合、読込部161aは、jdptr[0]、perm[0]、value[1]及びcolind[1]を読み込む。また、colind[1]は0であり、x[0]は読み込み済みであるため、読込部161aは、ここではx[0]を読み込まない。そして、割当部162は、jdptr[0]、perm[0]、value[1]、colind[1]及びx[0]を対応する演算部163に割り当てる。ここで、perm[0]=3なので、演算部163は、y[3]にvalue[1]*x[0]を足す。 Next, when j remains 0 and i becomes 1, the reading unit 161a reads jdptr [0], perm [0], value [1], and colond [1]. Further, since collind [1] is 0 and x [0] has already been read, the reading unit 161a does not read x [0] here. Then, the allocation unit 162 allocates jdptr [0], perm [0], value [1], colond [1], and x [0] to the corresponding arithmetic unit 163. Here, since perm [0] = 3, the arithmetic unit 163 adds value [1] * x [0] to y [3].

さらに処理が進み、jが1かつiがjdptr[1]、すなわち5になった場合、読込部161aは、jdptr[1]、perm[1]、value[5]及びcolind[5]を読み込む。また、colind[5]は1であり、x[1]は読み込み済みであるため、読込部161aは、ここではx[1]を読み込まない。そして、割当部162は、jdptr[1]、perm[1]、value[5]、colind[5]及びx[1]を対応する演算部163に割り当てる。ここで、perm[1]=1なので、演算部163は、y[1]にvalue[5]*x[1]を足す。 When the processing further progresses and j becomes 1 and i becomes jdptr [1], that is, 5, the reading unit 161a reads jdptr [1], perm [1], value [5], and cold [5]. Further, since colond [5] is 1 and x [1] has already been read, the reading unit 161a does not read x [1] here. Then, the allocation unit 162 allocates jdptr [1], perm [1], value [5], colond [5], and x [1] to the corresponding arithmetic unit 163. Here, since perm [1] = 1, the arithmetic unit 163 adds value [5] * x [1] to y [1].

さらに処理が進み、jが2かつiがjdptr[2]、すなわち10になった場合、読込部161aは、jdptr[2]、perm[2]、value[10]及びcolind[10]を読み込む。また、colind[10]は2であり、x[2]は読み込み済みであるため、読込部161aは、ここではx[2]を読み込まない。そして、割当部162は、jdptr[2]、perm[2]、value[10]、colind[10]及びx[2]を対応する演算部163に割り当てる。ここで、perm[2]=2なので、演算部163は、y[2]にvalue[10]*x[2]を足す。 When the processing further progresses and j becomes 2 and i becomes jdptr [2], that is, 10, the reading unit 161a reads jdptr [2], perm [2], value [10], and cold [10]. Further, since colond [10] is 2 and x [2] has already been read, the reading unit 161a does not read x [2] here. Then, the allocation unit 162 allocates jdptr [2], perm [2], value [10], colond [10], and x [2] to the corresponding arithmetic unit 163. Here, since perm [2] = 2, the arithmetic unit 163 adds value [10] * x [2] to y [2].

さらに処理が進み、jが2かつiがjdptr[2]+1、すなわち11になった場合、読込部161aは、value[11]及びcolind[11]を読み込む。また、colind[11]は3であり、x[3]は読み込み済みでないため、読込部161aは、ここでバースト転送により、x[3]、x[4]及びx[5]を読み込む。そして、割当部162は、jdptr[2]、perm[2]、value[11]、colind[11]及びx[3]を対応する演算部163に割り当てる。ここで、perm[2]=2なので、このとき、演算部163は、y[2]にvalue[11]*x[3]を足す。 When the processing further progresses and j becomes 2 and i becomes jdptr [2] + 1, that is, 11, the reading unit 161a reads the value [11] and the colond [11]. Further, since the colond [11] is 3 and the x [3] has not been read, the reading unit 161a reads x [3], x [4], and x [5] by burst transfer here. Then, the allocation unit 162 allocates jdptr [2], perm [2], value [11], colond [11], and x [3] to the corresponding arithmetic unit 163. Here, since perm [2] = 2, the arithmetic unit 163 adds value [11] * x [3] to y [2].

このように、加速部16は、連続的に読み込んだx[]の要素を使ってSpMVの演算を行うことができるため、ランダムアクセスを緩和し、CG法を高速化することができる。なお、1回の転送サイクルで読み取り取得可能な連続したx[]の要素を3つまでとし、演算データが図2のようなCRS形式である場合、x[]の要素の読み取りには、少なくとも8回の転送サイクルが必要になる。一方、1回の転送サイクルで読み取り取得可能な連続したx[]の要素を3つまでとし、演算データが図6のようなJAD形式である場合、x[]の要素の読み取りに必要な転送サイクルは2回である。 In this way, since the acceleration unit 16 can perform the SpMV calculation using the continuously read elements of x [], the random access can be relaxed and the CG method can be speeded up. When the number of consecutive x [] elements that can be read and acquired in one transfer cycle is up to three and the arithmetic data is in the CRS format as shown in FIG. 2, at least the x [] elements can be read. Eight transfer cycles are required. On the other hand, if the number of consecutive x [] elements that can be read and acquired in one transfer cycle is up to three and the arithmetic data is in the JAD format as shown in FIG. 6, the transfer required for reading the x [] elements. The cycle is 2 times.

割当部162は、配列valueに格納された行列Aの要素と、配列colindによって特定される当該行列Aの要素の列に対応したベクトルxの要素とを、配列jdptr及び配列permとともに演算部163に割り当てる。これにより、演算部163は、行列Aの各要素の、JAD形式におけるソート前の行インデックスを特定することができる。 The allocation unit 162 puts the elements of the matrix A stored in the array value and the elements of the vector x corresponding to the columns of the elements of the matrix A specified by the array colon into the arithmetic unit 163 together with the array jdptr and the array perm. assign. As a result, the arithmetic unit 163 can specify the row index of each element of the matrix A before sorting in the JAD format.

図10を用いて、演算部163について説明する。図10は、実施例1における演算部の一例を示す図である。図10に示すように、演算部163は、マルチポートメモリ163a、複数の乗算器163b及び複数の乗算器163bのそれぞれと接続された複数の加算器163cを有する。また、演算部163は、マルチポートメモリ163a及び複数の加算器163cのそれぞれと接続された複数のパイプラインレジスタ163dを有する。 The arithmetic unit 163 will be described with reference to FIG. FIG. 10 is a diagram showing an example of a calculation unit in the first embodiment. As shown in FIG. 10, the arithmetic unit 163 has a multi-port memory 163a, a plurality of multipliers 163b, and a plurality of adders 163c connected to each of the plurality of multipliers 163b. Further, the arithmetic unit 163 has a plurality of pipeline registers 163d connected to each of the multi-port memory 163a and the plurality of adders 163c.

マルチポートメモリ163aは、複数の書き込みポートと、複数の書き込みポートのそれぞれに対応した読み取りポートとを備え、部分和を係数行列の行と対応付けて記憶する。 The multi-port memory 163a includes a plurality of write ports and a read port corresponding to each of the plurality of write ports, and stores the partial sum in association with the row of the coefficient matrix.

マルチポートメモリ163aは、書き込みポート1w、2w、3w及び4wを有する。また、マルチポートメモリ163aは、読み取りポート1r、2r、3r及び4rを有する。書き込みポート1w、2w、3w及び4wは、それぞれ読み取りポート1r、2r、3r及び4rと対応している。なお、乗算器163b、加算器163c、パイプラインレジスタ163d、書き込みポート及び読み取りポートの数は図10に示すものに限られない。 The multiport memory 163a has write ports 1w, 2w, 3w and 4w. Further, the multi-port memory 163a has read ports 1r, 2r, 3r and 4r. The write ports 1w, 2w, 3w, and 4w correspond to the read ports 1r, 2r, 3r, and 4r, respectively. The number of the multiplier 163b, the adder 163c, the pipeline register 163d, the write port, and the read port is not limited to that shown in FIG.

乗算器163bは、ベクトルxの要素と行列Aの要素とを乗じた値を出力する。加算器163cは、複数の書き込みポートのうちのいずれかの書き込みポート及び当該書き込みポートに対応した読み取りポートと接続されている。加算器163cは、乗算器163bによって出力された値と、読み取りポートから読み取った第2の要素の行に対応する部分和とを足した値を書き込みポートからマルチポートメモリ163aに書き込む。 The multiplier 163b outputs a value obtained by multiplying the element of the vector x and the element of the matrix A. The adder 163c is connected to one of a plurality of write ports and a read port corresponding to the write port. The adder 163c writes the value output by the multiplier 163b and the partial sum corresponding to the row of the second element read from the read port to the multiport memory 163a from the write port.

演算部163は、複数の乗算器163b、加算器163c、書き込みポート及び読み取りポートの組み合わせを用いて、ベクトルyの部分和の計算を並列して実行することができる。このため、割当部162は、各演算部163にベクトルyの要素を担当要素として設定しておき、各担当要素の演算データを各演算部163に割り当てていくことができる。 The arithmetic unit 163 can execute the calculation of the partial sum of the vectors y in parallel by using the combination of the plurality of multipliers 163b, the adder 163c, and the write port and the read port. Therefore, the allocation unit 162 can set the element of the vector y as the responsible element in each calculation unit 163 and allocate the calculation data of each charge element to each calculation unit 163.

[処理の流れ]
次に、本実施例における処理について、図11を用いて説明する。図11は、実施例1におけるCG法による処理の一例を示すフローチャートである。まず、共役勾配法制御装置10aの変換部11は、係数行列を圧縮し列指向形式に変換する(ステップS10)。また、変換部11は、変換した係数行列を疎行列ベクトル積演算装置10bの演算データ記憶部13に格納する。
[Processing flow]
Next, the process in this embodiment will be described with reference to FIG. FIG. 11 is a flowchart showing an example of the processing by the CG method in the first embodiment. First, the conversion unit 11 of the conjugate gradient method control device 10a compresses the coefficient matrix and converts it into a column-oriented format (step S10). Further, the conversion unit 11 stores the converted coefficient matrix in the calculation data storage unit 13 of the sparse matrix vector product calculation device 10b.

次に、疎行列ベクトル積演算装置10bの前処理部15は、演算データ記憶部13から疎行列を取得し、前処理を実行する(ステップS20)。このとき、前処理部15は、前処理制御部14から指定された前処理を実行するために予め各処理部の再構成を行っておく。また、前処理部15は、前処理済みの演算データを演算データ記憶部13に格納する。 Next, the preprocessing unit 15 of the sparse matrix vector product arithmetic unit 10b acquires the sparse matrix from the arithmetic data storage unit 13 and executes the preprocessing (step S20). At this time, the pre-processing unit 15 reconfigures each processing unit in advance in order to execute the pre-processing designated by the pre-processing control unit 14. Further, the preprocessing unit 15 stores the preprocessed arithmetic data in the arithmetic data storage unit 13.

次に、加速部16は、SpMVを実行する(ステップS30)。なお、加速部16によるSpMVの実行については後に説明する。ここで、予め設定されたCG法の終了条件が充足されていない場合(ステップS40:No)、疎行列ベクトル積演算装置10bは、S20に戻って処理を繰り返す。一方、予め設定されたCG法の終了条件が充足されている場合(ステップS40:Yes)、共役勾配法制御装置10a及び疎行列ベクトル積演算装置10bは処理を終了する。例えば、終了条件終了条件は、所定の回数だけ反復が行われたことであってもよいし、定数ベクトルの残差が収束したことであってもよい。 Next, the acceleration unit 16 executes SpMV (step S30). The execution of SpMV by the acceleration unit 16 will be described later. Here, when the preset end condition of the CG method is not satisfied (step S40: No), the sparse matrix vector product arithmetic unit 10b returns to S20 and repeats the process. On the other hand, when the preset end condition of the CG method is satisfied (step S40: Yes), the conjugate gradient method control device 10a and the sparse matrix vector product calculation device 10b end the process. For example, the end condition The end condition may be that the iteration is performed a predetermined number of times, or that the residual of the constant vector has converged.

図12を用いて、疎行列ベクトル積演算装置10bによるSpMVの処理について説明する。図12は、実施例1におけるSpMVの処理の一例を示すフローチャートである。まず、加速部16の読込部161aは、演算データ記憶部13から演算データを読み込む(ステップS310)。演算データには、列指向形式で表された係数行列及び解ベクトルの各要素が含まれる。 The processing of SpMV by the sparse matrix vector product arithmetic unit 10b will be described with reference to FIG. FIG. 12 is a flowchart showing an example of SpMV processing in the first embodiment. First, the reading unit 161a of the acceleration unit 16 reads the operation data from the operation data storage unit 13 (step S310). The arithmetic data includes each element of the coefficient matrix and the solution vector expressed in a column-oriented format.

次に、割当部162は、演算データを各演算部163に割り当てる(ステップS320)。そして、演算部163は、割り当てられた演算データを使って演算を実行する(ステップS330)。なお、演算部163による演算処理については後に説明する。 Next, the allocation unit 162 allocates the calculation data to each calculation unit 163 (step S320). Then, the calculation unit 163 executes a calculation using the assigned calculation data (step S330). The arithmetic processing by the arithmetic unit 163 will be described later.

ここで、演算データ記憶部13に未読み込みの演算データがある場合(ステップS340:Yes)、読込部161aは、S310に戻って処理を繰り返す。一方、演算データ記憶部13に未読み込みの演算データがない場合(ステップS340:No)、疎行列ベクトル積演算装置10bは処理を終了する。 Here, when there is unread arithmetic data in the arithmetic data storage unit 13 (step S340: Yes), the reading unit 161a returns to S310 and repeats the process. On the other hand, when there is no unread arithmetic data in the arithmetic data storage unit 13 (step S340: No), the sparse matrix vector product arithmetic unit 10b ends the process.

図13を用いて、演算部163による演算処理について説明する。図13は、実施例1における演算処理の一例を示すフローチャートである。ここで、係数行列はJAD形式で表されているものとする。まず、演算部163には、演算データとして、value[i]、x[colind[i]]、jdptr、permが入力される(ステップS331)。このとき、value[i]及びx[colind[i]]は乗算器163bへ入力される。また、jdptr及びpermは、パイプラインレジスタ163dへ入力される。 The arithmetic processing by the arithmetic unit 163 will be described with reference to FIG. FIG. 13 is a flowchart showing an example of the arithmetic processing in the first embodiment. Here, it is assumed that the coefficient matrix is expressed in JAD format. First, value [i], x [colind [i]], jdptr, and perm are input to the calculation unit 163 as calculation data (step S331). At this time, value [i] and x [colind [i]] are input to the multiplier 163b. Further, jdptr and perm are input to the pipeline register 163d.

ここで、加算器163cは、パイプラインレジスタ163dに入力されたjdptr及びpermに従って、マルチポートメモリ163aの読み取りポートのいずれかからy[perm[j]]を読み取る(ステップS332)。次に、加算器163cは、y[perm[j]]に、value[i]*x[colind[i]]を足しこむ(ステップS333)。そして、加算器163cは、パイプラインレジスタ163dに入力されたjdptr及びpermに従って、y[perm[j]]を読み取った読み取りポートに対応する書き込みポートからy[perm[j]]を書き込む(ステップS334)。 Here, the adder 163c reads y [perm [j]] from any of the read ports of the multiport memory 163a according to the jdptr and perm input to the pipeline register 163d (step S332). Next, the adder 163c adds value [i] * x [colind [i]] to y [perm [j]] (step S333). Then, the adder 163c writes y [perm [j]] from the write port corresponding to the read port that has read y [perm [j]] according to the jdptr and perm input to the pipeline register 163d (step S334). ).

[効果]
以上説明したように、本実施例における疎行列ベクトル積演算装置の演算データ記憶部は、共役勾配法の制御を行う共役勾配法制御装置から入力された演算データを記憶する。演算データは、疎行列との積を計算可能なベクトルと、列指向形式で圧縮された疎行列とを含む。疎行列ベクトル積演算装置は、演算データ記憶部からベクトル及び疎行列を読み込む。疎行列ベクトル積演算装置は、読み込まれたベクトル及び疎行列を用いて疎行列ベクトル積の演算を実行する。疎行列ベクトル積演算装置は、演算の結果を演算データ記憶部に書き込む。このように、疎行列ベクトル積演算装置は、共役勾配法制御装置から演算データ記憶部に係数行列が入力された後は、当該疎行列の装置間の転送を行うことなくSpMVを反復して行うことができる。このため、疎行列ベクトル積演算装置は、CG法を高速化することができる。
[effect]
As described above, the arithmetic data storage unit of the sparse matrix vector product arithmetic unit in this embodiment stores the arithmetic data input from the conjugate gradient method control apparatus that controls the conjugate gradient method. The operational data includes a vector that can calculate the product of a sparse matrix and a sparse matrix compressed in a columnar format. The sparse matrix vector product arithmetic unit reads the vector and the sparse matrix from the arithmetic data storage unit. The sparse matrix vector product operation device performs the operation of the sparse matrix vector product using the read vector and the sparse matrix. The sparse matrix vector product arithmetic unit writes the arithmetic result in the arithmetic data storage unit. As described above, after the coefficient matrix is input from the conjugate gradient method control device to the arithmetic data storage unit, the sparse matrix vector product operation device repeatedly performs SpMV without performing transfer between the devices of the sparse matrix. be able to. Therefore, the sparse matrix vector product arithmetic unit can speed up the CG method.

また、疎行列ベクトル積演算装置は、ベクトルの要素である第1の要素と、第1の要素に対応する疎行列の非零の要素である第2の要素とを、複数の演算部のうちの第2の要素の行と予め対応付けられた演算部に割り当てる。演算部は、第1の要素及び第2の要素が割り当てられた場合、第1の要素と第2の要素との積及び積の和を求める演算を実行する。これにより、疎行列ベクトル積演算装置は、列指向形式で表された係数行列を使ったSpMVを実行することができる。 Further, the sparse matrix vector product arithmetic unit has a first element which is an element of a vector and a second element which is a non-zero element of a sparse matrix corresponding to the first element among a plurality of arithmetic units. It is assigned to the arithmetic unit previously associated with the line of the second element of. When the first element and the second element are assigned, the calculation unit executes an operation for obtaining the product of the first element and the second element and the sum of the products. Thereby, the sparse matrix vector product arithmetic unit can execute SpMV using the coefficient matrix represented in the column-oriented format.

また、演算データ記憶部は、演算データとして、第2の要素を格納した第1のデータと、第2の要素の列を特定する第2のデータと、第2の要素の行を特定する第3のデータとを少なくとも記憶してもよい。疎行列ベクトル積演算装置は、第1のデータに格納された第2の要素と、第2のデータによって特定される当該第2の要素の列に対応したベクトルの要素とを、第3のデータとともに演算部に割り当てる。これにより、疎行列ベクトル積演算装置は、係数行列を配列として扱うことができる。 Further, the arithmetic data storage unit specifies, as arithmetic data, the first data storing the second element, the second data specifying the column of the second element, and the row of the second element. At least the data of 3 may be stored. The sparse matrix vector product arithmetic unit uses the second element stored in the first data and the vector element corresponding to the column of the second element specified by the second data as the third data. And assign it to the arithmetic unit. As a result, the sparse matrix vector product arithmetic unit can handle the coefficient matrix as an array.

演算部のマルチポートメモリは、複数の書き込みポートと、複数の書き込みポートのそれぞれに対応した読み取りポートとを備え、部分和を疎行列の行と対応付けて記憶する。複数の乗算器は、第1の要素と第2の要素とを乗じた値を出力する。複数の加算器は、複数の書き込みポートのうちのいずれかの書き込みポート及び当該書き込みポートに対応した読み取りポートと接続され、乗算器によって出力された値と、読み取りポートから読み取った第2の要素の行に対応する部分和とを足した値を書き込みポートからマルチポートメモリに書き込む。これにより、疎行列ベクトル積演算装置は、各演算部の内部でさらに並列計算を行うことができる。 The multi-port memory of the arithmetic unit includes a plurality of write ports and read ports corresponding to each of the plurality of write ports, and stores the partial sum in association with the rows of a sparse matrix. The plurality of multipliers output a value obtained by multiplying the first element and the second element. The adder is connected to one of the write ports and the read port corresponding to that write port, the value output by the multiplier and the second element read from the read port. Write the value obtained by adding the partial sum corresponding to the line from the write port to the multiport memory. As a result, the sparse matrix vector product arithmetic unit can further perform parallel calculation inside each arithmetic unit.

演算データ記憶部は、少なくとも演算部の数と同数のポートを備えていてもよい。これにより、疎行列ベクトル積演算装置は、演算部ごとの演算データの並列した読み取り、及びSpMVの並列処理を行うことができる。 The arithmetic data storage unit may have at least the same number of ports as the number of arithmetic units. As a result, the sparse matrix vector product arithmetic unit can read the arithmetic data in parallel for each arithmetic unit and perform parallel processing of SpMV.

演算データ記憶部は、ELL形式又はJAD形式で圧縮された疎行列を記憶してもよい。これにより、疎行列ベクトル積演算装置は、列指向形式で表された係数行列を得ることができる。 The arithmetic data storage unit may store a sparse matrix compressed in ELL format or JAD format. As a result, the sparse matrix vector product arithmetic unit can obtain a coefficient matrix represented in a column-oriented format.

前処理部は、予め設定された演算データに対する複数の前処理のそれぞれに対応した処理部を備え、指定された前処理に対応する処理部を用いて前処理を実行してもよい。前処理制御部は、共役勾配法制御装置によって指定された前処理を、前処理部に対して指定する。これにより、ユーザが共役勾配法制御装置に対して指定した前処理を、疎行列ベクトル積演算装置に実行させることができる。 The pre-processing unit may include a processing unit corresponding to each of a plurality of pre-processing for preset arithmetic data, and may execute the pre-processing using the processing unit corresponding to the designated pre-processing. The pre-processing control unit designates the pre-processing specified by the conjugate gradient method control device for the pre-processing unit. As a result, the sparse matrix vector product arithmetic unit can be made to execute the preprocessing specified by the user for the conjugate gradient method controller.

前処理部は、演算部による疎行列ベクトル積の演算が完了するたびに前処理を実行してもよい。演算部は、前処理部による前処理が完了するたびに疎行列ベクトル積の演算を実行する。これにより、疎行列ベクトル積演算装置は、演算データの装置間での転送をともなうことなく、SpMVの反復を行うことができる。 The preprocessing unit may execute preprocessing each time the operation of the sparse matrix vector product by the arithmetic unit is completed. The arithmetic unit executes a sparse matrix vector product operation each time the preprocessing by the preprocessing unit is completed. As a result, the sparse matrix vector product arithmetic unit can repeat SpMV without transferring the arithmetic data between the apparatus.

[システム]
また、各実施例において説明した各処理のうち、自動的に行われるものとして説明した処理の一部を手動的に行うこともできる。あるいは、手動的に行われるものとして説明した処理の全部又は一部を公知の方法で自動的に行うこともできる。この他、上記文書中や図面中で示した処理手順、制御手順、具体的名称、各種のデータやパラメータを含む情報については、特記する場合を除いて任意に変更することができる。
[system]
Further, it is also possible to manually perform a part of the processes described as being automatically performed among the processes described in each embodiment. Alternatively, all or part of the process described as being performed manually can be automatically performed by a known method. In addition, the processing procedure, control procedure, specific name, and information including various data and parameters shown in the above document and drawings can be arbitrarily changed unless otherwise specified.

また、図示した各装置の各構成要素は機能概念的なものであり、必ずしも物理的に図示の如く構成されていることを要しない。すなわち、各装置の分散や統合の具体的形態は図示のものに限られない。つまり、その全部又は一部を、各種の負荷や使用状況などに応じて、任意の単位で機能的又は物理的に分散・統合して構成することができる。例えば、図4に示す前処理部15と加速部16とを統合してもよい。さらに、各装置にて行われる各処理機能は、その全部又は任意の一部が、所定のプロセッサ(CPU、GPU,FPGA等)及び当該プロセッサにて解析実行されるプログラムにて実現され、あるいは、ワイヤードロジックによるハードウェアとして実現され得る。 Further, each component of each of the illustrated devices is a functional concept, and does not necessarily have to be physically configured as shown in the figure. That is, the specific form of distribution or integration of each device is not limited to the one shown in the figure. That is, all or a part thereof can be functionally or physically distributed / integrated in any unit according to various loads, usage conditions, and the like. For example, the pretreatment unit 15 and the acceleration unit 16 shown in FIG. 4 may be integrated. Further, each processing function performed by each device is realized by a predetermined processor (CPU, GPU, FPGA, etc.) and a program analyzed and executed by the processor, or a program in which all or any part thereof is analyzed and executed. It can be realized as hardware by wired logic.

[ハードウェア構成]
図14は、ハードウェア構成例を示す図である。図14に示すように、シミュレーション装置10は、通信インタフェース50a、HDD(Hard Disk Drive)50b、メモリ50c、CPU10d及びFPGA50eを有する。
[Hardware configuration]
FIG. 14 is a diagram showing a hardware configuration example. As shown in FIG. 14, the simulation device 10 has a communication interface 50a, an HDD (Hard Disk Drive) 50b, a memory 50c, a CPU 10d, and an FPGA 50e.

通信インタフェース50aは、他の装置の通信を制御するネットワークインタフェースカードなどである。HDD50bは、プログラムやデータなどを記憶する記憶装置の一例である。メモリ50cの一例としては、SDRAM(Synchronous Dynamic Random Access Memory)等のRAM(Random Access Memory)、ROM(Read Only Memory)、フラッシュメモリ等が挙げられる。CPU50dは、共役勾配法制御装置10aとして機能する。また、FPGA50eは、疎行列ベクトル積演算装置10bとして機能する。 The communication interface 50a is a network interface card or the like that controls communication of other devices. The HDD 50b is an example of a storage device that stores programs, data, and the like. Examples of the memory 50c include RAM (Random Access Memory) such as SDRAM (Synchronous Dynamic Random Access Memory), ROM (Read Only Memory), flash memory and the like. The CPU 50d functions as the conjugate gradient method control device 10a. Further, the FPGA 50e functions as a sparse matrix vector product arithmetic unit 10b.

10 シミュレーション装置
10a 共役勾配法制御装置
10b 疎行列ベクトル積演算装置
11 変換部
12 更新部
13 演算データ記憶部
14 前処理制御部
15 前処理部
16 加速部
161 ロード部
161a 読込部
161b 書込部
162 割当部
163 演算部
163a マルチポートメモリ
163b 乗算器
163c 加算器
163d パイプラインレジスタ
10 Simulation device 10a Conjugated gradient method control device 10b Sparse matrix vector multiplier calculation device 11 Conversion unit 12 Update unit 13 Operation data storage unit 14 Preprocessing control unit 15 Preprocessing unit 16 Acceleration unit 161 Load unit 161a Reading unit 161b Writing unit 162 Allocation unit 163 Arithmetic unit 163a Multiport memory 163b Multiplier 163c Adder 163d Pipeline register

Claims (7)

共役勾配法の制御を行う共役勾配法制御装置から入力された演算データであって、疎行列との積を計算可能なベクトルと、列指向形式で圧縮された前記疎行列とを含む演算データを記憶する演算データ記憶部と、
前記演算データ記憶部から前記ベクトル及び前記疎行列を読み込む読込部と、
前記読込部によって読み込まれた前記ベクトル及び前記疎行列を用いて疎行列ベクトル積の演算を実行する演算部と、
前記演算部による演算の結果を前記演算データ記憶部に書き込む書込部と、
前記ベクトルの要素である第1の要素と、前記第1の要素に対応する前記疎行列の非零の要素である第2の要素とを、複数の前記演算部のうちの前記第2の要素の行と予め対応付けられた演算部に割り当てる割当部とを有し、
前記演算部は、
複数の書き込みポートと、前記複数の書き込みポートのそれぞれに対応した読み取りポートとを備え、部分和を前記疎行列の行と対応付けて記憶するマルチポートメモリと、
前記第1の要素及び前記第2の要素が割り当てられた場合、前記第1の要素と前記第2の要素とを乗じた値を出力する複数の乗算器と、
前記複数の書き込みポートのうちのいずれかの書き込みポート及び当該書き込みポートに対応した読み取りポートと接続され、前記乗算器によって出力された値と、前記読み取りポートから読み取った前記第2の要素の行に対応する部分和とを足した値を前記書き込みポートから前記マルチポートメモリに書き込む複数の加算器と、
を有することを特徴とする疎行列ベクトル積演算装置。
Arithmetic data input from a conjugate gradient method controller that controls the conjugate gradient method, including a vector that can calculate the product of a sparse matrix and the sparse matrix compressed in a column-oriented format. Arithmetic data storage unit to store and
A reading unit that reads the vector and the sparse matrix from the arithmetic data storage unit,
An arithmetic unit that executes an operation of a sparse matrix vector product using the vector read by the reading unit and the sparse matrix.
A writing unit that writes the result of the calculation by the calculation unit to the calculation data storage unit, and a writing unit.
The first element, which is an element of the vector, and the second element, which is a non-zero element of the sparse matrix corresponding to the first element, are combined with the second element of the plurality of arithmetic units. It has a line of and an allocation unit to be assigned to the arithmetic unit associated in advance.
The calculation unit
A multi-port memory having a plurality of write ports and a read port corresponding to each of the plurality of write ports and storing the partial sum in association with the rows of the sparse matrix.
When the first element and the second element are assigned, a plurality of multipliers that output a value obtained by multiplying the first element and the second element, and a plurality of multipliers.
The value output by the multiplier and the row of the second element read from the read port connected to any one of the plurality of write ports and the read port corresponding to the write port. A plurality of adders that write the sum of the corresponding partial sums from the write port to the multiport memory, and
A sparse matrix vector product arithmetic unit characterized by having.
前記演算データ記憶部は、前記演算データとして、前記第2の要素を格納した第1のデータと、前記第2の要素の列を特定する第2のデータと、前記第2の要素の行を特定する第3のデータとを少なくとも記憶し、
前記割当部は、前記第1のデータに格納された前記第2の要素と、前記第2のデータによって特定される当該第2の要素の列に対応した前記ベクトルの要素とを、前記第3のデータとともに前記演算部に割り当てることを特徴とする請求項に記載の疎行列ベクトル積演算装置。
As the calculation data, the calculation data storage unit stores the first data in which the second element is stored, the second data for specifying the column of the second element, and the row of the second element. At least memorize the third data to be identified and
The allocation unit uses the second element stored in the first data and the element of the vector corresponding to the column of the second element specified by the second data as the third element. The sparse matrix vector product calculation device according to claim 1 , wherein the data is assigned to the calculation unit together with the data of the above.
前記演算データ記憶部は、少なくとも前記演算部の数と同数のポートを備えたことを特徴とする請求項1又は2に記載の疎行列ベクトル積演算装置。 The sparse matrix vector product arithmetic unit according to claim 1 or 2 , wherein the arithmetic data storage unit includes at least as many ports as the number of arithmetic units. 前記演算データ記憶部は、ELL形式又はJAD形式で圧縮された前記疎行列を記憶することを特徴とする請求項1からのいずれか1項に記載の疎行列ベクトル積演算装置。 The sparse matrix vector product arithmetic unit according to any one of claims 1 to 3 , wherein the arithmetic data storage unit stores the sparse matrix compressed in an ELL format or a JAD format. 予め設定された前記演算データに対する複数の前処理のそれぞれに対応した処理部を備え、指定された前処理に対応する処理部を用いて前処理を実行する前処理部と、
前記共役勾配法制御装置によって指定された前処理を、前記前処理部に対して指定する前処理制御部と、
をさらに有することを特徴とする請求項1からのいずれか1項に記載の疎行列ベクトル積演算装置。
A pre-processing unit that has a processing unit corresponding to each of a plurality of pre-processing for the arithmetic data set in advance and executes pre-processing using the processing unit corresponding to the specified pre-processing, and a pre-processing unit.
A pre-processing control unit that designates the pre-processing specified by the conjugate gradient method control device for the pre-processing unit,
The sparse matrix vector product arithmetic unit according to any one of claims 1 to 4, further comprising.
前記前処理部は、前記演算部による疎行列ベクトル積の演算が完了するたびに前処理を実行し、
前記演算部は、前記前処理部による前処理が完了するたびに疎行列ベクトル積の演算を実行することを特徴とする請求項に記載の疎行列ベクトル積演算装置。
The preprocessing unit executes preprocessing each time the calculation of the sparse matrix vector product by the calculation unit is completed.
The sparse matrix vector product arithmetic unit according to claim 5 , wherein the arithmetic unit executes an operation of a sparse matrix vector product each time the preprocessing by the preprocessing unit is completed.
共役勾配法の制御を行う共役勾配法制御装置から入力された演算データであって、疎行列との積を計算可能なベクトルと、列指向形式で圧縮された前記疎行列とを含む演算データを記憶する演算データ記憶部を有する疎行列ベクトル積演算装置が、
前記演算データ記憶部から前記ベクトル及び前記疎行列を読み込み、
前記ベクトルの要素である第1の要素と、前記第1の要素に対応する前記疎行列の非零の要素である第2の要素とを、複数の演算部のうちの前記第2の要素の行と予め対応付けられた演算部に割り当て、
前記第1の要素及び前記第2の要素が割り当てられた演算部に、前記読み込む処理によって読み込まれた前記ベクトル及び前記疎行列を用いて疎行列ベクトル積の演算を実行させ
算の結果を前記演算データ記憶部に書き込む
処理を実行し、
前記演算を実行させる処理は、
複数の乗算器に、前記第1の要素と前記第2の要素とを乗じた値を出力させ、
部分和を前記疎行列の行と対応付けて記憶するマルチポートメモリの複数の書き込みポートのうちいずれかの書き込みポート及び当該書き込みポートに対応した前記マルチポートメモリの読み取りポートと接続された複数の加算器に、前記乗算器によって出力された値と、前記読み取りポートから読み取った前記第2の要素の行に対応する部分和とを足した値を前記書き込みポートから前記マルチポートメモリに書き込ませる
ことを特徴とする疎行列ベクトル積演算方法。
Arithmetic data input from a conjugate gradient method controller that controls the conjugate gradient method, including a vector that can calculate the product of a sparse matrix and the sparse matrix compressed in a column-oriented format. A sparse matrix vector product arithmetic unit having an arithmetic data storage unit to store
The vector and the sparse matrix are read from the arithmetic data storage unit, and the vector and the sparse matrix are read.
The first element, which is an element of the vector, and the second element, which is a non-zero element of the sparse matrix corresponding to the first element, are combined with the second element of the plurality of arithmetic units. Assign to the arithmetic unit associated with the line in advance,
The arithmetic unit to which the first element and the second element are assigned is made to execute the operation of the sparse matrix vector product using the vector and the sparse matrix read by the reading process.
Run the process of writing the result of arithmetic in the arithmetic data storage unit,
The process of executing the above operation is
A plurality of multipliers are made to output a value obtained by multiplying the first element and the second element.
Multiple additions connected to one of the write ports of the multiport memory that stores the partial sum in association with the rows of the sparse matrix and the read port of the multiport memory corresponding to the write port. The device is made to write the value output by the multiplier and the partial sum corresponding to the row of the second element read from the read port to the multiport memory from the write port. A characteristic sparse matrix vector product calculation method.
JP2017241098A 2017-12-15 2017-12-15 Sparse matrix vector product calculation device and sparse matrix vector product calculation method Active JP6981223B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2017241098A JP6981223B2 (en) 2017-12-15 2017-12-15 Sparse matrix vector product calculation device and sparse matrix vector product calculation method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2017241098A JP6981223B2 (en) 2017-12-15 2017-12-15 Sparse matrix vector product calculation device and sparse matrix vector product calculation method

Publications (2)

Publication Number Publication Date
JP2019109626A JP2019109626A (en) 2019-07-04
JP6981223B2 true JP6981223B2 (en) 2021-12-15

Family

ID=67179785

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2017241098A Active JP6981223B2 (en) 2017-12-15 2017-12-15 Sparse matrix vector product calculation device and sparse matrix vector product calculation method

Country Status (1)

Country Link
JP (1) JP6981223B2 (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111079082B (en) * 2019-12-20 2023-03-10 支付宝(杭州)信息技术有限公司 Method and system for improving calculation rate related to sparse matrix

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH0752748B2 (en) * 1989-12-14 1995-06-05 株式会社グラフィカ 3D device simulation device
JP3697992B2 (en) * 2000-01-25 2005-09-21 日本電気株式会社 Matrix vector product operation system, matrix storage system used therefor, and method thereof
JP3865247B2 (en) * 2003-10-03 2007-01-10 日本電気株式会社 Simultaneous linear equation iterative solution calculator and simultaneous linear equation iterative solution calculation method
JP2010122850A (en) * 2008-11-19 2010-06-03 Muroran Institute Of Technology Device and method for calculating matrix equation
JP6550465B2 (en) * 2015-08-20 2019-07-24 株式会社日立製作所 Information processing circuit
WO2017154946A1 (en) * 2016-03-09 2017-09-14 日本電気株式会社 Information processing device, information processing method, data structure, and program

Also Published As

Publication number Publication date
JP2019109626A (en) 2019-07-04

Similar Documents

Publication Publication Date Title
JP7374236B2 (en) accelerated math engine
CN111465924B (en) System and method for converting matrix input into vectorized input for matrix processor
CN111183452A (en) Image pre-processing for generalized image processing
JP2020533691A (en) Efficient direct convolution using SIMD instructions
Kulkarni et al. Systolic processing and an implementation for signal and image processing
US10810281B2 (en) Outer product multipler system and method
EP3093757B1 (en) Multi-dimensional sliding window operation for a vector processor
US9244886B1 (en) Minimum resource fast fourier transform
EP4095719A1 (en) Sparse matrix multiplication in hardware
JP6981223B2 (en) Sparse matrix vector product calculation device and sparse matrix vector product calculation method
US11409840B2 (en) Dynamically adaptable arrays for vector and matrix operations
JP2023070746A (en) Information processing program, information processing apparatus, and information processing method
US10282899B2 (en) Systems, methods and, media for simulating deformations of nonlinear elastic bodies
JP7427001B2 (en) Tiling algorithm for matrix math instruction set
Kapusta et al. Acceleration of image reconstruction in 3D Electrical Capacitance Tomography in heterogeneous, multi-GPU system using sparse matrix computations and Finite Element Method
Chen et al. Sparsity-oriented sparse solver design for circuit simulation
Sato et al. GPU implementation of an incomplete Cholesky conjugate gradient solver for a FEM-generated system using full kernel consolidation
US8819086B2 (en) Naming methodologies for a hierarchical system
Gupta Implementation of the Deflated Preconditioned Conjugate Gradient Method for Bubbly Flow on the Graphical Processing Unit (GPU)
Basha Fast Fourier transform on a 3D FPGA
Liu et al. FPGA implementation of a 2-D discrete cosine transforms algorithm using systemC
Wessels Benchmarking Dataflow for FPGA
Park et al. Structural optimization of mechanical components using radial basis function and CAD-CAE integration approach

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20200901

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20210729

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20210817

A711 Notification of change in applicant

Free format text: JAPANESE INTERMEDIATE CODE: A712

Effective date: 20210824

A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20211006

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

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20211101

R150 Certificate of patent or registration of utility model

Ref document number: 6981223

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R150