标签:
#include <omp.h>
#include <stdio.h>
#include <stdlib.h>
void Test(int n) {
for(int i = 0; i < 10000; ++i) {
//do nothing, just waste time
}
printf("%d, ", n);
}
int main(int argc,char* argv[]) {
#pragma omp parallel for
for(int i = 0; i < 10; ++i)
Test(i);
}
g++ openmp.cpp -fopenmp
0, 3, 6, 4, 9, 1, 7, 5, 2, 8,
标签:
原文地址:http://www.cnblogs.com/timdes/p/4810804.html