omp sections 没有并行效果?
程序A:
#pragma omp parallel sections
{
#pragma omp section
{
int a[5000];
double startwtime,endwtime;
for (int i = 0; i < 5000; i++)
a[i] = 1;
}
#pragma omp section
{
int a[5000];
for (int i = 0; i < 5000; i++)
a[i] = 1;
}
}
程序B:
int a[5000];
double startwtime,endwtime;
for (int i = 0; i < 5000; i++)
a[i] = 1;
我初学OMP,请问为何程序A的执行时间的执行时间是0.042105s,而程序B的执行时间是0.000030s?起不到并行效果?