Merge remote-tracking branch 'origin/release-v4.5'
[WRF.git] / frame / module_sm.F
blobf37593a73a43b94f4513964ac8f8de339e2c0768
1 !WRF:PACKAGE:OPENMP
4 MODULE module_sm
6 #ifdef _OPENMP
8    !  There are a few functions in the OpenMP library,
9    !  and to use them easily, we need to define the 
10    !  return types of these functions.
12    INTEGER , EXTERNAL :: omp_get_num_threads , &
13                          omp_get_max_threads , &
14                          omp_get_thread_num  , &
15                          omp_get_num_procs
17    LOGICAL , EXTERNAL :: omp_in_parallel        
18 #endif
20 CONTAINS
22    SUBROUTINE omp_info
24 #ifdef _OPENMP
26       IMPLICIT NONE
28       PRINT '(/A,/,A,/,A,I2/)','omp_get_num_threads:', &
29                               'Number of threads currently in the team executing', &
30                               'the parallel region = ',omp_get_num_threads()
32       PRINT '(A,/,A,/,A,I2/)', 'omp_get_max_threads:', &
33                               'Maximum value that can be returned by the',&
34                               'omp_get_num_threads function = ',omp_get_max_threads()
36       PRINT '(A,/,A,/,A,I2/)', 'omp_get_thread_num:', &
37                               'Returns the thread number, within the team, between', &
38                               '0 and omp_get_num_threads-1, inclusive = ',omp_get_thread_num()
40       PRINT '(A,/,A,/,A,I2/)', 'omp_get_num_procs:', &
41                               'Returns the number of processors that are available', &
42                               'to the program = ',omp_get_num_procs()
44       PRINT '(A,/,A,/,A,L7/)','omp_in_parallel:', &
45                               'Returns .TRUE. if called with the dynamic extent of a region', &
46                               'executing in parallel, and otherwise .FALSE. = ',omp_in_parallel()
48 #endif
50    END SUBROUTINE omp_info
52    SUBROUTINE init_module_sm
53    END SUBROUTINE init_module_sm
55 END MODULE module_sm