-
Notifications
You must be signed in to change notification settings - Fork 703
/
module_sm.F
55 lines (37 loc) · 1.74 KB
/
module_sm.F
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
!WRF:PACKAGE:OPENMP
!
MODULE module_sm
#ifdef _OPENMP
! There are a few functions in the OpenMP library,
! and to use them easily, we need to define the
! return types of these functions.
INTEGER , EXTERNAL :: omp_get_num_threads , &
omp_get_max_threads , &
omp_get_thread_num , &
omp_get_num_procs
LOGICAL , EXTERNAL :: omp_in_parallel
#endif
CONTAINS
SUBROUTINE omp_info
#ifdef _OPENMP
IMPLICIT NONE
PRINT '(/A,/,A,/,A,I2/)','omp_get_num_threads:', &
'Number of threads currently in the team executing', &
'the parallel region = ',omp_get_num_threads()
PRINT '(A,/,A,/,A,I2/)', 'omp_get_max_threads:', &
'Maximum value that can be returned by the',&
'omp_get_num_threads function = ',omp_get_max_threads()
PRINT '(A,/,A,/,A,I2/)', 'omp_get_thread_num:', &
'Returns the thread number, within the team, between', &
'0 and omp_get_num_threads-1, inclusive = ',omp_get_thread_num()
PRINT '(A,/,A,/,A,I2/)', 'omp_get_num_procs:', &
'Returns the number of processors that are available', &
'to the program = ',omp_get_num_procs()
PRINT '(A,/,A,/,A,L7/)','omp_in_parallel:', &
'Returns .TRUE. if called with the dynamic extent of a region', &
'executing in parallel, and otherwise .FALSE. = ',omp_in_parallel()
#endif
END SUBROUTINE omp_info
SUBROUTINE init_module_sm
END SUBROUTINE init_module_sm
END MODULE module_sm