November 2015
Beginner to intermediate
236 pages
4h 54m
English
1 /* mm.c */
2
3 //
4 // My Matrix Multiplication app
5 //
6 // Uses standard triply-nested loop, not cache-friendly.
7 //
8
9 // Usage:
10 // mm [-?] [-n MatrixSize] [-t NumThreads]
11 //
12 #define LINUX
13 // #define WINDOWS
14
15 #include <stdio.h>
16 #include <stdlib.h>
17 #include <string.h>
18 #include <math.h>
19 #include <time.h>
20
21 #ifdef LINUX
22 #include <sys/time.h>
23 #endif
24
25 #include "pthread.h"
26
27
28 //
29 // Function prototypes:
30 //
31 double **MatrixMultiply(double** A, double** B, int N, int numthreads);
32 void _SequentialMM(double** C, double** A, double** B, int N);
33 void _ParallelMM(double** C, double** ...
Read now
Unlock full access