Hello,

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:

#include <omp.h>

#include <sys/time.h>
#include <sstream>
#include <iostream>

inline double getCpuTime()
{
    struct timeval tv;
    gettimeofday(&tv, 0);
    return tv.tv_sec + tv.tv_usec/1e6;
}

void ompTest()

{
    int tid;
    #pragma omp parallel private(tid)
    {
tid = omp_get_thread_num();
    }
}

int main()
{
    double BENCH_NRUNS = 1E3;
    double t1, t2;
    t1 = getCpuTime();

    for (int i=0;i<BENCH_NRUNS;i++)

ompTest();
    t2 = getCpuTime();

    std::cout << "ompTest time:\t" << ((t2-t1)*1E3/BENCH_NRUNS) << " msecs" << 
std::endl;

    return 0;
}

compiled using: 
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.


Ed


------------------------------------------------------------------------------
See everything from the browser to the database with AppDynamics
Get end-to-end visibility with application monitoring from AppDynamics
Isolate bottlenecks and diagnose root cause in seconds.
Start your free trial of AppDynamics Pro today!
http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk
_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to