| 1 | !WRF:PACKAGE:OPENMP |
|---|
| 2 | ! |
|---|
| 3 | |
|---|
| 4 | MODULE module_sm |
|---|
| 5 | |
|---|
| 6 | #ifdef _OPENMP |
|---|
| 7 | |
|---|
| 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. |
|---|
| 11 | |
|---|
| 12 | INTEGER , EXTERNAL :: omp_get_num_threads , & |
|---|
| 13 | omp_get_max_threads , & |
|---|
| 14 | omp_get_thread_num , & |
|---|
| 15 | omp_get_num_procs |
|---|
| 16 | |
|---|
| 17 | LOGICAL , EXTERNAL :: omp_in_parallel |
|---|
| 18 | #endif |
|---|
| 19 | |
|---|
| 20 | CONTAINS |
|---|
| 21 | |
|---|
| 22 | SUBROUTINE omp_info |
|---|
| 23 | |
|---|
| 24 | #ifdef _OPENMP |
|---|
| 25 | |
|---|
| 26 | IMPLICIT NONE |
|---|
| 27 | |
|---|
| 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() |
|---|
| 31 | |
|---|
| 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() |
|---|
| 35 | |
|---|
| 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() |
|---|
| 39 | |
|---|
| 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() |
|---|
| 43 | |
|---|
| 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() |
|---|
| 47 | |
|---|
| 48 | #endif |
|---|
| 49 | |
|---|
| 50 | END SUBROUTINE omp_info |
|---|
| 51 | |
|---|
| 52 | SUBROUTINE init_module_sm |
|---|
| 53 | END SUBROUTINE init_module_sm |
|---|
| 54 | |
|---|
| 55 | END MODULE module_sm |
|---|