openmp并行计算

时间:2021-05-23 19:23:38

#include <omp.h>
#include <stdio.h>
#include <stdlib.h>

void test(int n)
{
for (int i = 0; i < 1000000; i++)
{

}
printf("%d,",n);
}

int main()
{
//#pragma omp parallel for schedule(dynamic)//动态并行计算?

#pragma omp parallel for
for (int i = 0; i < 10;++i)
{
test(i);
}
system("pause");
return 0;
}

参考:http://baike.so.com/doc/1182954-1251375.html

http://baike.so.com/doc/1182954-1251375.html