Hello again,
I have a piece of code, which worked fine on my PC, but on my notebook
MPI_Wtime and MPI_Wtick won't work with the -mno-sse flag specified.
MPI_Wtick will return 0 instead of 1e-6 and MPI_Wtime will also return
always 0. clock() works in all cases.
The Code is:
#include <iostream>
#include <ctime>
#include <mpi.h>
#include <unistd.h> // sleep
using namespace std;
int main(int argc, char* argv[])
{
MPI_Init(NULL,NULL);
cout << "Wtick: " << MPI_Wtick();
for (int i=0; i<10; i++) {
clock_t t0 = MPI_Wtime();
sleep(0.1);
//sleep(1); // SLEEP WON'T BE COUNTED FOR CLOCK!!! FUCK,
SAME SEEMS TO BE TRUE FOR MPI_WTIME
// ALSO MPI_WTIME might not be working with -mno-sse!!!
clock_t t1 = MPI_Wtime();
cout << "clock=" << clock() << ", CLOCKS_PER_SEC=" <<
CLOCKS_PER_SEC;
cout << ", t0=" << t0 << ", t1=" << t1 << ", dt=" <<
double(t1-t0)/CLOCKS_PER_SEC << endl;
}
return 0;
}
I compile and run it in cygwin 64bit, Open MPI: 1.8.3 r32794 and g++
(GCC) 4.8.3 with the following command lines and outputs:
$ rm matrix-diverror.exe; mpic++ -g matrix-diverror.cpp -o
matrix-diverror.exe -Wall -std=c++0x -mno-sse; ./matrix-diverror.exe
Wtick: 0clock=451, CLOCKS_PER_SEC=1000, t0=0, t1=0, dt=8.37245e-314
clock=451, CLOCKS_PER_SEC=1000, t0=0, t1=0, dt=8.37245e-314
clock=451, CLOCKS_PER_SEC=1000, t0=0, t1=0, dt=8.37245e-314
clock=451, CLOCKS_PER_SEC=1000, t0=0, t1=0, dt=8.37245e-314
clock=451, CLOCKS_PER_SEC=1000, t0=0, t1=0, dt=8.37245e-314
clock=451, CLOCKS_PER_SEC=1000, t0=0, t1=0, dt=8.37245e-314
clock=451, CLOCKS_PER_SEC=1000, t0=0, t1=0, dt=8.37245e-314
clock=451, CLOCKS_PER_SEC=1000, t0=0, t1=0, dt=8.37245e-314
clock=451, CLOCKS_PER_SEC=1000, t0=0, t1=0, dt=8.37245e-314
clock=451, CLOCKS_PER_SEC=1000, t0=0, t1=0, dt=8.37245e-314
Versus the Version without SSE deactivated:
$ rm matrix-diverror.exe; mpic++ -g matrix-diverror.cpp -o
matrix-diverror.exe -Wall -std=c++0x; ./matrix-diverror.exe
Wtick: 1e-06clock=483, CLOCKS_PER_SEC=1000, t0=1415626322,
t1=1415626322, dt=0
clock=483, CLOCKS_PER_SEC=1000, t0=1415626322, t1=1415626322, dt=0
clock=483, CLOCKS_PER_SEC=1000, t0=1415626322, t1=1415626322, dt=0
clock=483, CLOCKS_PER_SEC=1000, t0=1415626322, t1=1415626322, dt=0
clock=483, CLOCKS_PER_SEC=1000, t0=1415626322, t1=1415626322, dt=0
clock=483, CLOCKS_PER_SEC=1000, t0=1415626322, t1=1415626322, dt=0
clock=483, CLOCKS_PER_SEC=1000, t0=1415626322, t1=1415626322, dt=0
clock=483, CLOCKS_PER_SEC=1000, t0=1415626322, t1=1415626322, dt=0
clock=483, CLOCKS_PER_SEC=1000, t0=1415626322, t1=1415626322, dt=0
clock=483, CLOCKS_PER_SEC=1000, t0=1415626322, t1=1415626322, dt=0