/* 8:35PM up 13:23, 12 users, load averages: 1.85, 1.47, 1.36
USER TTY FROM LOGIN@ IDLE WHAT
huanggl p0 121.15.139.129 8:12PM 22 -bash (bash)
wrightxu p1 222.190.126.142 6:52PM 1:42 -bash (bash)
wrightxu p2 222.190.126.142 11:02AM 9:32 -bash (bash)
huanggl p3 121.15.139.129 8:32PM 2 -bash (bash)
ericzqma p4 dmg009.resnet.us 8:13PM 18 -bash (bash)
ricaricarica p6 mail.tech4field. 6:15PM - w
tianccm p8 218.106.180.157 6:41PM 1:53 -bash (bash)
denke pa 117.32.153.155 6:50PM 1:44 -bash (bash)
jamy325 pb 125.38.35.201 7:37PM 1 emacs
LaoLiulaoliu pc 123.62.27.59 7:41PM 52 -bash (bash)
zte_zxr10 q1 116.228.53.170 12:42PM 7:52 -bash (bash)
huanggl qe 121.15.139.129 4:55PM 3:39 -bash (bash)
*
* Filename: nestedOpenmp.c
*
* Description:
*
* Version: 1.0
* Created: 03/22/12 20:33:41
* Revision: none
* Compiler: gcc
*
* Author: YOUR NAME (),
* Company:
*
*
*
*
*
* Compiling :gcc -fopenmp -o nestedOpenmp nestedOpenmp.c
*
*
* Level 1: number of threads in the team - 2
* Level 2: number of threads in the team - 2
* Level 2: number of threads in the team - 2
* Level 3: number of threads in the team - 2
* Level 3: number of threads in the team - 2
* Level 3: number of threads in the team - 2
* Level 3: number of threads in the team - 2
*
*
*
* =====================================================================================
*/
#include <omp.h>
#include <stdio.h>
void report_num_threads(int level)
{
#pragma omp single
{
printf("Level %d: number of threads in the team - %d\n",
level, omp_get_num_threads());
}
}
int main()
{
// omp_set_dynamic(0);
omp_set_nested(1);
//set nested parallel with non-zero value : enable nested parallel is ture
#pragma omp parallel num_threads(2)
{
report_num_threads(1);
#pragma omp parallel num_threads(2)
{
report_num_threads(2);
#pragma omp parallel num_threads(2)
{
report_num_threads(3);
}
}
}
return(0);
}
浙公网安备 33010602011771号