source: codes/icosagcm/trunk/src/dimensions.f90 @ 525

Last change on this file since 525 was 186, checked in by ymipsl, 10 years ago

Add new openMP parallelism based on distribution of domains on threads. There is no more limitation of number of threads by MPI process.

YM

File size: 2.9 KB
Line 
1MODULE dimensions
2
3    INTEGER,SAVE :: iim
4!$OMP THREADPRIVATE(iim)
5    INTEGER,SAVE :: jjm
6!$OMP THREADPRIVATE(jjm)
7    INTEGER,SAVE :: ii_begin
8!$OMP THREADPRIVATE(ii_begin)
9    INTEGER,SAVE :: jj_begin
10!$OMP THREADPRIVATE(jj_begin)
11    INTEGER,SAVE :: ii_end
12!$OMP THREADPRIVATE(ii_end)
13    INTEGER,SAVE :: jj_end
14!$OMP THREADPRIVATE(jj_end)
15    INTEGER,SAVE :: ii_nb
16!$OMP THREADPRIVATE(ii_nb)
17    INTEGER,SAVE :: jj_nb
18!$OMP THREADPRIVATE(jj_nb)
19    INTEGER,SAVE :: ij_begin
20!$OMP THREADPRIVATE(ij_begin)
21    INTEGER,SAVE :: ij_end
22!$OMP THREADPRIVATE(ij_end)
23    INTEGER,SAVE :: ij_begin_ext
24!$OMP THREADPRIVATE(ij_begin_ext)
25    INTEGER,SAVE :: ij_end_ext
26!$OMP THREADPRIVATE(ij_end_ext)
27       
28    INTEGER,SAVE :: t_right
29!$OMP THREADPRIVATE(t_right)
30    INTEGER,SAVE :: t_rup
31!$OMP THREADPRIVATE(t_rup)
32    INTEGER,SAVE :: t_lup
33!$OMP THREADPRIVATE(t_lup)
34    INTEGER,SAVE :: t_left
35!$OMP THREADPRIVATE(t_left)
36    INTEGER,SAVE :: t_ldown
37!$OMP THREADPRIVATE(t_ldown)
38    INTEGER,SAVE :: t_rdown
39!$OMP THREADPRIVATE(t_rdown)
40
41    INTEGER,SAVE :: u_right
42!$OMP THREADPRIVATE(u_right)
43    INTEGER,SAVE :: u_rup
44!$OMP THREADPRIVATE(u_rup)
45    INTEGER,SAVE :: u_lup
46!$OMP THREADPRIVATE(u_lup)
47    INTEGER,SAVE :: u_left
48!$OMP THREADPRIVATE(u_left)
49    INTEGER,SAVE :: u_ldown
50!$OMP THREADPRIVATE(u_ldown)
51    INTEGER,SAVE :: u_rdown
52!$OMP THREADPRIVATE(u_rdown)
53
54    INTEGER,SAVE :: z_rup
55!$OMP THREADPRIVATE(z_rup)
56    INTEGER,SAVE :: z_up
57!$OMP THREADPRIVATE(z_up)
58    INTEGER,SAVE :: z_lup
59!$OMP THREADPRIVATE(z_lup)
60    INTEGER,SAVE :: z_ldown
61!$OMP THREADPRIVATE(z_ldown)
62    INTEGER,SAVE :: z_down
63!$OMP THREADPRIVATE(z_down)
64    INTEGER,SAVE :: z_rdown
65!$OMP THREADPRIVATE(z_rdown)
66
67    INTEGER,SAVE :: t_pos(6)
68!$OMP THREADPRIVATE(t_pos)
69    INTEGER,SAVE :: u_pos(6)
70!$OMP THREADPRIVATE(u_pos)
71    INTEGER,SAVE :: z_pos(6)
72!$OMP THREADPRIVATE(z_pos)
73       
74CONTAINS
75
76  SUBROUTINE swap_dimensions(ind)
77  USE domain_mod
78  IMPLICIT NONE
79    INTEGER,INTENT(IN) :: ind
80   
81    TYPE(t_domain),POINTER :: d
82   
83    d=>domain(ind)
84     
85     iim=d%iim
86     jjm=d%jjm
87     ii_begin=d%ii_begin
88     jj_begin=d%jj_begin
89     ii_end=d%ii_end
90     jj_end=d%jj_end
91     ii_nb=d%ii_nb
92     jj_nb=d%jj_nb
93   
94     ij_begin=(jj_begin-1)*iim+ii_begin
95     ij_end=(jj_end-1)*iim+ii_end 
96     ij_begin_ext=((jj_begin-1)-1)*iim+ii_begin-1
97     ij_end_ext = ((jj_end+1)-1)*iim+ii_end+1
98       
99     t_right=d%t_right
100     t_rup=d%t_rup
101     t_lup=d%t_lup
102     t_left=d%t_left
103     t_ldown=d%t_ldown
104     t_rdown=d%t_rdown
105
106     u_right=d%u_right
107     u_rup=d%u_rup
108     u_lup=d%u_lup
109     u_left=d%u_left
110     u_ldown=d%u_ldown
111     u_rdown=d%u_rdown
112
113     z_rup=d%z_rup
114     z_up=d%z_up
115     z_lup=d%z_lup
116     z_ldown=d%z_ldown
117     z_down=d%z_down
118     z_rdown=d%z_rdown
119     
120     t_pos(:)=d%t_pos(:)
121     u_pos(:)=d%u_pos(:)
122     z_pos(:)=d%z_pos(:)
123
124   END SUBROUTINE swap_dimensions
125   
126END MODULE dimensions   
127   
Note: See TracBrowser for help on using the repository browser.