From 0f4aa5dbf8aafc3eceb30407eb2a0090258e5d8d Mon Sep 17 00:00:00 2001 From: shayakhmetovi Date: Wed, 13 Sep 2017 18:08:27 +0400 Subject: [PATCH] test --- openmp.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/openmp.cpp b/openmp.cpp index 85e8dd4..906d5d5 100644 --- a/openmp.cpp +++ b/openmp.cpp @@ -10,6 +10,7 @@ //Matrix multiplication int main(int argc, char *argv[]) { + int n = 1024; std::vector a(n*n); @@ -21,6 +22,12 @@ int main(int argc, char *argv[]) std::generate(a.begin(), a.end(), std::rand); std::generate(b.begin(), b.end(), std::rand); + + int threadsNum = 2; + omp_set_num_threads(threadsNum); + + +#pragma omp parallel for shared(a[], b[], с[]) for(int i = 0; i < n; ++i) for(int j = 0; j < n; ++j) for(int k = 0; k < n; ++k)