常用函数。
#include <iostream>
#include <omp.h>
#define NUM_THREADS 16
using namespace std;
int main(int argc, char* argv[]){
omp_set_num_threads(NUM_THREADS);
#pragma omp parallel
{
cout << "thread num: " << omp_get_num_threads() << endl;
// omp_get_num_threads() 在并行区域之内调用,之外返回1
}
double time = omp_get_wtime(); // 用于获取当前的系统时间
double tick = omp_get_wtick(); // 用于获取计时器的最小单位
cout << "current time: " << time << endl;
cout << "time tick: " << tick << endl;
return 0;
}
待续。。。。。。
标签:include,omp,int,NUM,THREADS,OpenMP,runtime,库函数 From: https://www.cnblogs.com/tao-gak567/p/18075907