560
社区成员
module my_omp_mod
use omp_lib
implicit none
public
integer :: idt, num_threads
contains
subroutine init()
implicit none
num_threads = omp_get_num_threads()
idt = omp_get_thread_num()
write(*, *) "in init(): idt, num_threads = ", idt, num_threads, omp_get_thread_num()
end subroutine
end module
program main
use omp_lib
use my_omp_mod
implicit none
integer :: idt2, num_threads2
!$OMP parallel default(none) private(idt2, num_threads2) private(idt, num_threads)
call init()
write(*, *) "in main(): idt, num_threads = ", idt, num_threads, omp_get_thread_num()
num_threads2 = omp_get_num_threads()
idt2 = omp_get_thread_num()
write(*, *) "in main(): idt2, num_threads2 = ", idt2, num_threads2, omp_get_thread_num()
!$OMP end parallel
end program