program hello_world use omp_lib implicit none integer :: n_threads, thread_id !$omp parallel private(n_threads, thread_id) thread_id = omp_get_thread_num() print *, "Hello World from thread ", thread_id if (thread_id .eq. 0) then n_threads = omp_get_num_threads() print *, "Number of threads is ", n_threads end if !$omp end parallel n_threads = omp_get_num_threads() print *, "Number of threads is ", n_threads end program hello_world