From dc1343d12e01c812d6c643a1baf079b47471c6b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Kr=C3=B6ning?= <m.kroening@hotmail.de> Date: Thu, 6 Jun 2019 12:53:33 +0200 Subject: [PATCH] kguebung04: Parallelize using OpenMP --- kguebung/kguebung04/matmul/Makefile | 4 ++-- kguebung/kguebung04/matmul/main.c | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/kguebung/kguebung04/matmul/Makefile b/kguebung/kguebung04/matmul/Makefile index 61edf2f..a8767bf 100644 --- a/kguebung/kguebung04/matmul/Makefile +++ b/kguebung/kguebung04/matmul/Makefile @@ -1,5 +1,5 @@ -CFLAGS = -Wall -Winvalid-pch -Wextra -Wpedantic -LDFLAGS = +CFLAGS = -fopenmp -Wall -Winvalid-pch -Wextra -Wpedantic +LDFLAGS = -fopenmp binaries = matmul diff --git a/kguebung/kguebung04/matmul/main.c b/kguebung/kguebung04/matmul/main.c index 8de511d..a7b4bc8 100644 --- a/kguebung/kguebung04/matmul/main.c +++ b/kguebung/kguebung04/matmul/main.c @@ -39,9 +39,11 @@ int main(int argc, char* argv[]) gettimeofday(&start, NULL); +#pragma omp parallel for for (i = 0; i < L; ++i) { for (j = 0; j < N; ++j) { double sum = 0.; +#pragma omp simd reduction(+ : sum) for (k = 0; k < M; ++k) { sum += A[i][k] * B[k][j]; } -- GitLab