From: Ed LEPICIER <edlep_fr@ya...> - 2013-07-23 14:00:23
I have a project which requires a lot of optimizations (SIMD instructions, OpenMP) that works for now under linux without any problem.
On the same computer under windows with Mingw64 (gcc 4.8), the performances are worse using OpenMP than with a single thread.
I made a very simple program to investigate the problem:
inline double getCpuTime()
struct timeval tv;
return tv.tv_sec + tv.tv_usec/1e6;
#pragma omp parallel private(tid)
tid = omp_get_thread_num();
double BENCH_NRUNS = 1E3;
double t1, t2;
t1 = getCpuTime();
for (int i=0;i<BENCH_NRUNS;i++)
t2 = getCpuTime();
std::cout << "ompTest time:\t" << ((t2-t1)*1E3/BENCH_NRUNS) << " msecs" << std::endl;
g++ test.cpp -fopenmp -lgomp -lpthread -o test.exe
The results are the following:
- on linux:
ompTest time: 0.00222707 msecs
- on windows:
ompTest time:1.3129 msecs
which is about 1000x slower and which wipes out the whole program performances.
I obviously tried with different computers and different Mingw64 builds, but the results are always the same.
Any idea how to solve this problem ?
Thanks in advance.
Get latest updates about Open Source Projects, Conferences and News.