#include <omp.h>
#include <iostream>
using namespace std;
int main() {
int n=10;
#pragma omp parallel shared(n)
{
#pragma omp for
for (int i=0; i<n; i++)
cout <<"Thread "<<omp_get_thread_num()<<" executes loop iteration "<< i<<endl;
}
return 0;
}
references:
OpenMP Official Web sites
Using OpenMP: Portable Shared Memory Parallel Programming
沒有留言:
張貼留言