#include #include #include int main(int argc, char** argv) { int rank, tnot; #pragma omp parallel private(rank) default(shared) { rank = omp_get_thread_num (); // get the rank of current thread tnot = omp_get_num_threads(); // get the total number of threads currently running this PR #pragma omp sections { #pragma omp section { printf("I am rank %d and I am in section 1\n", rank); sleep(1); } #pragma omp section { printf("I am rank %d and I am in section 2\n", rank); sleep(1); } #pragma omp section { printf("I am rank %d and I am in section 3\n", rank); sleep(1); } } } return 0; }