| 1 | [[PageOutline]] |
| 2 | |
| 3 | = Application Name = |
| 4 | |
| 5 | Matrix Multiplication |
| 6 | |
| 7 | = Summary = |
| 8 | |
| 9 | * '''Name''': {{{Matrix Multiplication}}} |
| 10 | * '''Contact Person''': {{{support-compss@bsc.es}}} |
| 11 | * '''Access Level''': {{{public}}} |
| 12 | * '''License Agreement''': {{{GPL}}} |
| 13 | * '''Platform''': {{{COMPSs}}} |
| 14 | * '''Repository''': [[https://compss.bsc.es/svn/bar/apps/java/matmul|Matrix Multiplication]] |
| 15 | |
| 16 | |
| 17 | == Description == |
| 18 | Matrix multiplication is a binary operation that takes a pair of matrices and produces another matrix. |
| 19 | |
| 20 | If A is an n×m matrix and B is an m×p matrix, the result AB of their multiplication is an n×p matrix defined only if the number of columns m in A is equal to the number of rows m in B. When multiplying A and B, the elements of the rows in A are multiplied with corresponding columns in B. |
| 21 | |
| 22 | In this implementation, A and B are square matrices (same number of rows and columns), and so it is the result matrix C. Each matrix is divided in N blocks of M doubles. The multiplication of two blocks is done by a multiply task method with a simple three-nested-loop implementation. When executed with COMPSs, the main program generates N^3^ tasks arranged as N^2^ chains of N tasks in the dependency graph. |
| 23 | |
| 24 | |
| 25 | == Versions == |
| 26 | There are three versions of Matrix Multiplication, depending on the data types used to store the blocks. |
| 27 | === Version 1 === |
| 28 | ''files'', where the matrix blocks are stored in files. |
| 29 | === Version 2 === |
| 30 | ''objects'', where the matrix blocks are represented by objects. |
| 31 | === Version 3 === |
| 32 | ''arrays'', where the matrix blocks are stored in arrays. |
| 33 | |
| 34 | |
| 35 | == Execution instructions == |
| 36 | Usage: |
| 37 | runcompss matmul.objects.Matmul <MSIZE> <BSIZE> |
| 38 | runcompss matmul.files.Matmul <MSIZE> <BSIZE> |
| 39 | runcompss matmul.arrays.Matmul <MSIZE> <BSIZE> |
| 40 | |
| 41 | |
| 42 | where: |
| 43 | * - MSIZE: Number of blocks of the matrix |
| 44 | * - BSIZE: Number of elements per block |
| 45 | |
| 46 | |
| 47 | == Execution Example == |
| 48 | runcompss matmul.objects.Matmul 16 4 |
| 49 | |
| 50 | |
| 51 | == Build == |
| 52 | === Option 1: Native java === |
| 53 | cd ~/workspace_java/matmul/; javac src/main/java/matmul/*/*.java |
| 54 | cd src/main/java/; jar cf matmul.jar matmul/ |
| 55 | cd ../../../; mv src/main/java/matmul.jar jar/ |
| 56 | |
| 57 | === Option 2: Maven === |
| 58 | cd ~/workspace_java/matmul/ |
| 59 | mvn clean package |