I am the beginner of OpenMP.the code below:
#include "windows.h"
#include "math.h"
#include <omp.h>
#include <iostream>
int main(void)
{
double t1 = omp_get_wtime( );
for(int i = 0;i < 8;i ++)
{
float a = 0;
for(int j = 0;j < 10000000;j++)
{
a += sqrtf(j);
}
}
double t2 = omp_get_wtime( );
std::cout<<"time: "<<t2 - t1<<std::endl;
#pragma omp parallel for
for(int i = 0;i < 8;i ++)
{
float a = 0;
for(int j = 0;j < 10000000;j++)
{
a += sqrtf(j);
}
}
t1 = omp_get_wtime( );
std::cout<<"time: "<<t1 - t2<<std::endl;
system("pause");
return 0;
}
when i release with VS2010,and run,there is no upgrade!In some cases , it will decline.i don't know Y?