Matrix Multiplication Optimization and Cache Info
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.

CS3210 - Parallel Computing - Assignment 1

By Lim Jiew Meng (A0087884H)

1. Cache Profiling


  • cache.cpp: for cache levels & size (1 & 2)
  • cache-write.cpp: for cache write policy (3)
  • cache-l1-line.cpp: for L1 cache line size (4)

Compilation & execution

All files are compiled by make {filename} and executed like ./{filename}, where {filename} is the filename without extension. For example

make cache && ./cache


The output is a csv meant as input into a spreadsheet to plot a graph

An Example:

1, 0.52 
4, 0.53 
8, 0.52 
16, 0.52 
32, 0.53 

Where in each row, the 1st value is the test size (KB), and the 2nd the time (s)

2. Matrix Multiplication Optimization

Only file is matrix.cpp. Compiled & run in a similar way as part 1.

make matrix && ./matrix

Output like

SIMD Matrix multiplication took 0.36 seconds
Unoptimized Matrix multiplication took 7.65 seconds
SUCCESS: Both optimized and unoptimized gave same results

The input size defaults to 1024, and can be changed by changing line 1 (or something like below)

#define SIZE 1024

For information on methodology of this "experiments" see Google Doc