program sections !$ use OMP_LIB implicit none integer :: rank, tnot !$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 !$OMP SECTIONS !$OMP SECTION print *,"I am rank",rank,"and I am in section 1" call system("sleep 1s") !$OMP SECTION print *,"I am rank",rank,"and I am in section 2" call system("sleep 1s") !$OMP SECTION print *,"I am rank",rank,"and I am in section 3" call system("sleep 1s") !$OMP END SECTIONS ! NOWAIT can be used here !$OMP END PARALLEL end program sections