-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathompThreading.c
More file actions
29 lines (26 loc) · 730 Bytes
/
ompThreading.c
File metadata and controls
29 lines (26 loc) · 730 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#include<omp.h>
#include<stdio.h>
int main()
{
omp_set_num_threads(5);
int maxThreads = omp_get_max_threads();
printf("Maximum number of threads is %d\n", naxThreads);
#pragma omp parallel
{
printf("Hello\n");
}
omp_set_num_threads(4);
maxThreads = omp_get_max_threads();
printf("Maximum number of threads is updated to %d\n", maxThreads);
#pragma omp parallel
{
#pragma omp master
{
printf("www.openmp.org %d\n", omp_get_thread_num());
}
printf("Welcome to HPC %d\n" omp_get_thread_num());
#pragma omp barrier
printf("Are you able to understand the concepts! %d\n", omp_get_thread_num());
}
return 0;
}