Name: Matrix Multiplication
Contact Person: support-compss@bsc.es
Access Level: public
License Agreement: Apache2
Platform: COMPSs
Description
Matrix multiplication is a binary operation that takes a pair of matrices and produces another matrix.
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.
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.
Versions
There are three versions of Matrix Multiplication, depending on the data types used to store the blocks.
Version 1
''files'', where the matrix blocks are stored in files.
Version 2
''objects'', where the matrix blocks are represented by objects.
Version 3
''arrays'', where the matrix blocks are stored in arrays.
Execution instructions
Usage:
runcompss matmul.files.Matmul numberOfBlocks blockSize
runcompss matmul.objects.Matmul numberOfBlocks blockSize
runcompss matmul.arrays.Matmul numberOfBlocks blockSize
where:
- numberOfBlocks: Number of blocks inside each matrix
- blockSize: Size of each block
Execution Example
runcompss matmul.objects.Matmul 16 4
runcompss matmul.files.Matmul 16 4
runcompss matmul.arrays.Matmul 16 4
Build
Option 1: Native java
cd ~/tutorial_apps/java/matmul/; javac src/main/java/matmul/*/*.java
cd src/main/java/; jar cf matmul.jar matmul/
cd ../../../; mv src/main/java/matmul.jar jar/
Option 2: Maven
cd ~/tutorial_apps/java/matmul/
mvn clean package
Click and drag the diagram to pan, double click or use the controls to zoom.
Version History
Version 1 (earliest) Created 30th May 2023 at 08:23 by Raül Sirvent
Frozen
Version-1
e107f17
Creator
Additional credit
The Workflows and Distributed Computing Team (https://www.bsc.es/discover-bsc/organisation/scientific-structure/workflows-and-distributed-computing)
Submitter
Views: 2035 Downloads: 239
Created: 30th May 2023 at 08:23
Last updated: 26th Oct 2023 at 10:47
None