TechDiary
Saturday, September 3, 2011
OpenMP with GCC
std::vector < int > a(N, 1), b(N, 2), c(N, 0);
#pragma omp parallel for
for (i=0; i < N; ++i)
c[i] = a[i] + b[i];
g++ test.cc -fopenmp -o parallel_for
On a dual-core machine, it was up to 80% faster than the normal for loop.
Newer Posts
Older Posts
Home
Subscribe to:
Posts (Atom)