From b89d73e8281ce7db5ea971718916ebbd1c78b9a3 Mon Sep 17 00:00:00 2001 From: Wojtek Kosior Date: Fri, 26 Apr 2019 14:43:00 +0200 Subject: expand README, embed plots --- README.md | 39 ++++++++++++++++++++++++++++++++++++--- 1 file changed, 36 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index e808bb0..ef1e38a 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ #Task solution - matrix multiplication in fortran# This repository contains the realization of the [first task](http://home.agh.edu.pl/~macwozni/fort/zadanie1.pdf) of the fortran programming language course at AGH in Cracov. -##The directory structure## +##Directory structure## CMakeLists.txt README.md @@ -37,6 +37,9 @@ This repository contains the realization of the [first task](http://home.agh.edu wykres4.pdf wykres8.pdf wykres16.pdf + wykres4.svg + wykres8.svg + wykres16.svg ###CmakeLists.txt### This file contains CMake definitions for building fortran sources. It does not, however, define the actions of running the program, generating results, nor plotting. @@ -51,7 +54,7 @@ It's the gnuplot script for generating plots from text files in `res`. In this s This directory contains the fortran sources of the project, namely modules sources `*math.F90` and main program source `main.F90`. ###res/### -This directory contains text results of matrix multiplication time measuring (files without extension) and their corresponding plots (pdf files). +This directory contains text results of matrix multiplication time measuring (files without extension) and their corresponding plots (pdf files as required for the task and respective svg versions for embedding here). ##Building## As a prerequisite, CMake, make and a fortran compiler, either gfortran or ifort, are required (didn't want to support proprietary compiler :c but had to). @@ -81,4 +84,34 @@ Text files and plots in `res/` can be regenerated by issuing $ ./make_results.sh -from within the main project directory (may take up to several tens of minutes). +from the main project directory (may take up to several tens of minutes). + +##Implementation## +5 versions of matrix multiplication are implemented in separate files under `src/`. They're all called and their running times measured in `src/main.F90` together with fortran's built-in `matmul()` intrinsic function. + +####naive#### +Implemented in `src/naivemath.F90` the order of loops is i, j, k. + +####better#### +Implemented in `src/bettermath.F90` the order of loops is j, k, i. It's expected to be faster than naive, because the innermost loop accesses array elements that are closed to each other in memory. + +####dot#### +Implemented in `src/dotmath.F90` the order of loops is i, j, k. The innermost loop is replaced with dot_product() instrinsic function call, that is supposed to aid it's optimization. + +####better2#### +Implemented in `src/bettermath2.F90` the order of loops is j, k, i. The innermost loop is replaced with an operation on an entire column. + +####block#### +Implemented in `src/blockmath.F90`. The multiplication of matrices is achieved by many multiplications of submatrices (blocks). The order of loops for one block is j, k, i with the innermost loop replaced with an operation on entire blocks' columns. + +##Results## + +####KIND=4#### +![plot kind=4](res/wykres4.svg) + +####KIND=8#### +![plot kind=8](res/wykres8.svg) + +####KIND=16#### +![plot kind=16](res/wykres16.svg) + -- cgit v1.2.3