|
再测试一下并行
#include <iostream>
#ifdef _OPENMP
#include <omp.h>
#endif // Meaning?
using namespace std;
int main(int argc, char *argv)
{
int thread_num=0;
int num_threads=1;
#pragma omp parallel
{
#ifdef _OPENMP
thread_num=omp_get_thread_num();
num_threads=omp_get_num_threads();
#endif //Why we should have to do this?
printf("%d %d\n",thread_num,num_threads);
}
return 0;
}
|
|