// // parallel // #include #include int main() { int nthreads=0, tid=0, tidd=0; omp_set_nested(1); // 打开并行域嵌套功能 #pragma omp parallel private(tid) num_threads(2) { tid=omp_get_thread_num(); // Obtain thread id printf("Hello world from OpenMP thread %d\n", tid); #pragma omp parallel private(tidd) num_threads(3) { tidd=omp_get_thread_num(); // Obtain thread id printf("sub-thread %d of thread %d\n", tidd, tid); } } return 0; }