Answer:
Answer explained
Explanation:
as PI 3 B+ is quadcore processor(i.e. 4 cores)
omp_get_thread_num() is used for getting thread number.(i.e. 0,1,2,3)
omp_get_num_threads() is used for getting number of threads.(i.e. 4)
1. Output should be,
Hello from thread 0 of 4
Hello from thread 1 of 4
Hello from thread 2 of 4
Hello from thread 3 of 4
2. #pragma omp parallel is used to fork(create child) additional threads to carry out the work enclosed in the construct in parallel.
3. We can Compile this code using,
gcc -o omp_helloc -fopenmp hello.c
4. We can Run this code using,
./hello
5.omp_get_num_threads() is used for getting number of threads.(i.e. 4)