source: LMDZ5/trunk/libf/dyn3dmem/allocate_field_mod.f90 @ 1632

Last change on this file since 1632 was 1632, checked in by Laurent Fairhead, 12 years ago

Import initial du répertoire dyn3dmem

Attention! ceci n'est qu'une version préliminaire du code "basse mémoire":
le code contenu dans ce répertoire est basé sur la r1320 et a donc besoin
d'être mis à jour par rapport à la dynamique parallèle d'aujourd'hui.
Ce code est toutefois mis à disposition pour circonvenir à des problèmes
de mémoire que certaines configurations du modèle pourraient rencontrer.
Dans l'état, il compile et tourne sur vargas et au CCRT


Initial import of dyn3dmem

Warning! this is just a preliminary version of the memory light code:
it is based on r1320 of the code and thus needs to be updated before
it can replace the present dyn3dpar code. It is nevertheless put at your
disposal to circumvent some memory problems some LMDZ configurations may
encounter. In its present state, it will compile and run on vargas and CCRT

File size: 15.4 KB
Line 
1MODULE allocate_field
2
3  INTERFACE allocate_u
4    MODULE PROCEDURE allocate1d_u1d,allocate2d_u1d,allocate3d_u1d
5  END INTERFACE allocate_u
6
7  INTERFACE switch_u
8    MODULE PROCEDURE switch1d_u1d,switch2d_u1d,switch3d_u1d
9  END INTERFACE switch_u
10
11  INTERFACE switch_v
12    MODULE PROCEDURE switch1d_v1d,switch2d_v1d,switch3d_v1d
13  END INTERFACE switch_v
14
15  INTERFACE allocate_v
16    MODULE PROCEDURE allocate1d_v1d,allocate2d_v1d,allocate3d_v1d
17  END INTERFACE allocate_v
18
19  INTERFACE allocate2d_u
20    MODULE PROCEDURE allocate1d_u2d,allocate2d_u2d,allocate3d_u2d
21  END INTERFACE allocate2d_u
22
23  INTERFACE allocate2d_v
24    MODULE PROCEDURE allocate1d_v2d,allocate2d_v2d,allocate3d_v2d
25  END INTERFACE allocate2d_v
26
27  INTERFACE switch2d_u
28    MODULE PROCEDURE switch1d_u2d,switch2d_u2d,switch3d_u2d
29  END INTERFACE switch2d_u
30
31  INTERFACE switch2d_v
32    MODULE PROCEDURE switch1d_v2d,switch2d_v2d,switch3d_v2d
33  END INTERFACE switch2D_v
34
35  REAL :: nan
36
37CONTAINS
38
39  SUBROUTINE Init_nan
40  IMPLICIT NONE
41    REAL*8 :: rnan
42    INTEGER :: inan(2)
43    EQUIVALENCE(rnan,inan)
44   
45    inan(1)=2147483647
46    inan(2)=2147483647
47   
48    nan=rnan
49 
50  END SUBROUTINE Init_nan
51
52  SUBROUTINE allocate1d_u1d(field,d)
53  USE parallel
54  IMPLICIT NONE
55  REAL,POINTER :: field(:)
56  TYPE(distrib),INTENT(IN) :: d
57
58!$OMP BARRIER
59!$OMP MASTER   
60    IF (ASSOCIATED(field)) DEALLOCATE(field)
61    ALLOCATE(field(d%ijb_u:d%ije_u))
62!$OMP END MASTER
63!$OMP BARRIER
64
65  END SUBROUTINE allocate1d_u1d
66
67
68  SUBROUTINE allocate2d_u1d(field,dim1,d)
69  USE parallel
70  IMPLICIT NONE
71  REAL,POINTER :: field(:,:)
72  INTEGER      :: dim1
73  TYPE(distrib),INTENT(IN) :: d
74
75!$OMP BARRIER
76!$OMP MASTER   
77    IF (ASSOCIATED(field)) DEALLOCATE(field)
78    ALLOCATE(field(d%ijb_u:d%ije_u,dim1))
79!$OMP END MASTER
80!$OMP BARRIER
81
82  END SUBROUTINE allocate2d_u1d
83
84  SUBROUTINE allocate3d_u1d(field,dim1,dim2,d)
85  USE parallel
86  IMPLICIT NONE
87  REAL,POINTER :: field(:,:,:)
88  INTEGER      :: dim1,dim2
89  TYPE(distrib),INTENT(IN) :: d
90
91!$OMP BARRIER
92!$OMP MASTER   
93    IF (ASSOCIATED(field)) DEALLOCATE(field)
94    ALLOCATE(field(d%ijb_u:d%ije_u,dim1,dim2))
95!$OMP END MASTER
96!$OMP BARRIER
97
98  END SUBROUTINE allocate3d_u1d   
99
100
101
102  SUBROUTINE allocate1d_v1d(field,d)
103  USE parallel
104  IMPLICIT NONE
105  REAL,POINTER :: field(:)
106  TYPE(distrib),INTENT(IN) :: d
107
108!$OMP BARRIER
109!$OMP MASTER   
110    IF (ASSOCIATED(field)) DEALLOCATE(field)
111    ALLOCATE(field(d%ijb_v:d%ije_v))
112!$OMP END MASTER
113!$OMP BARRIER
114
115  END SUBROUTINE allocate1d_v1d
116
117
118  SUBROUTINE allocate2d_v1d(field,dim1,d)
119  USE parallel
120  IMPLICIT NONE
121  REAL,POINTER :: field(:,:)
122  INTEGER      :: dim1
123  TYPE(distrib),INTENT(IN) :: d
124
125!$OMP BARRIER
126!$OMP MASTER   
127    IF (ASSOCIATED(field)) DEALLOCATE(field)
128    ALLOCATE(field(d%ijb_v:d%ije_v,dim1))
129!$OMP END MASTER
130!$OMP BARRIER
131
132  END SUBROUTINE allocate2d_v1d
133
134  SUBROUTINE allocate3d_v1d(field,dim1,dim2,d)
135  USE parallel
136  IMPLICIT NONE
137  REAL,POINTER :: field(:,:,:)
138  INTEGER      :: dim1,dim2
139  TYPE(distrib),INTENT(IN) :: d
140
141!$OMP BARRIER
142!$OMP MASTER   
143    IF (ASSOCIATED(field)) DEALLOCATE(field)
144    ALLOCATE(field(d%ijb_v:d%ije_v,dim1,dim2))
145!$OMP END MASTER
146!$OMP BARRIER
147
148  END SUBROUTINE allocate3d_v1d   
149
150
151
152
153
154
155
156
157
158  SUBROUTINE allocate1d_u2d(field,d)
159  USE parallel
160  USE dimensions
161  IMPLICIT NONE
162  REAL,POINTER :: field(:,:)
163  TYPE(distrib),INTENT(IN) :: d
164
165!$OMP BARRIER
166!$OMP MASTER   
167    IF (ASSOCIATED(field)) DEALLOCATE(field)
168    ALLOCATE(field(iip1,d%jjb_u:d%jje_u))
169!$OMP END MASTER
170!$OMP BARRIER
171
172  END SUBROUTINE allocate1d_u2d
173
174
175  SUBROUTINE allocate2d_u2d(field,dim1,d)
176  USE parallel
177  USE dimensions
178  IMPLICIT NONE
179  REAL,POINTER :: field(:,:,:)
180  INTEGER      :: dim1
181  TYPE(distrib),INTENT(IN) :: d
182
183!$OMP BARRIER
184!$OMP MASTER   
185    IF (ASSOCIATED(field)) DEALLOCATE(field)
186    ALLOCATE(field(iip1,d%jjb_u:d%jje_u,dim1))
187!$OMP END MASTER
188!$OMP BARRIER
189
190  END SUBROUTINE allocate2d_u2d
191
192  SUBROUTINE allocate3d_u2d(field,dim1,dim2,d)
193  USE parallel
194  USE dimensions
195  IMPLICIT NONE
196  REAL,POINTER :: field(:,:,:,:)
197  INTEGER      :: dim1,dim2
198  TYPE(distrib),INTENT(IN) :: d
199
200!$OMP BARRIER
201!$OMP MASTER   
202    IF (ASSOCIATED(field)) DEALLOCATE(field)
203    ALLOCATE(field(iip1,d%jjb_u:d%jje_u,dim1,dim2))
204!$OMP END MASTER
205!$OMP BARRIER
206
207  END SUBROUTINE allocate3d_u2d   
208
209
210
211  SUBROUTINE allocate1d_v2d(field,d)
212  USE parallel
213  USE dimensions
214  IMPLICIT NONE
215  REAL,POINTER :: field(:,:)
216  TYPE(distrib),INTENT(IN) :: d
217
218!$OMP BARRIER
219!$OMP MASTER   
220    IF (ASSOCIATED(field)) DEALLOCATE(field)
221    ALLOCATE(field(iip1,d%jjb_v:d%jje_v))
222!$OMP END MASTER
223!$OMP BARRIER
224
225  END SUBROUTINE allocate1d_v2d
226
227
228  SUBROUTINE allocate2d_v2d(field,dim1,d)
229  USE parallel
230  USE dimensions
231  IMPLICIT NONE
232  REAL,POINTER :: field(:,:,:)
233  INTEGER      :: dim1
234  TYPE(distrib),INTENT(IN) :: d
235
236!$OMP BARRIER
237!$OMP MASTER   
238    IF (ASSOCIATED(field)) DEALLOCATE(field)
239    ALLOCATE(field(iip1,d%jjb_v:d%jje_v,dim1))
240!$OMP END MASTER
241!$OMP BARRIER
242
243  END SUBROUTINE allocate2d_v2d
244
245  SUBROUTINE allocate3d_v2d(field,dim1,dim2,d)
246  USE parallel
247  USE dimensions
248  IMPLICIT NONE
249  REAL,POINTER :: field(:,:,:,:)
250  INTEGER      :: dim1,dim2
251  TYPE(distrib),INTENT(IN) :: d
252
253!$OMP BARRIER
254!$OMP MASTER   
255    IF (ASSOCIATED(field)) DEALLOCATE(field)
256    ALLOCATE(field(iip1,d%jjb_v:d%jje_v,dim1,dim2))
257!$OMP END MASTER
258!$OMP BARRIER
259
260  END SUBROUTINE allocate3d_v2d   
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280  SUBROUTINE switch1d_u1d(field,old_dist,new_dist,up,down)
281  USE parallel
282  USE mod_hallo
283  IMPLICIT NONE
284  REAL,POINTER :: field(:)
285  TYPE(distrib),INTENT(IN) :: old_dist
286  TYPE(distrib),INTENT(IN) :: new_dist
287  INTEGER, OPTIONAL,INTENT(IN) :: up
288  INTEGER, OPTIONAL,INTENT(IN) :: down
289 
290  REAL,POINTER,SAVE :: new_field(:)
291  TYPE(request) :: req
292 
293  !$OMP BARRIER
294  !$OMP MASTER   
295    ALLOCATE(new_field(new_dist%ijb_u:new_dist%ije_u))
296    new_field=nan
297  !$OMP END MASTER
298  !$OMP BARRIER
299    CALL Register_SwapField_u(field,new_field,new_dist,req,old_dist=old_dist,up=up,down=down)
300 
301    CALL SendRequest(req)
302
303  !$OMP BARRIER
304    CALL WaitRequest(req)     
305  !$OMP BARRIER
306   
307  !$OMP MASTER
308    DEALLOCATE(field)
309    field=>new_field
310  !$OMP END MASTER
311  !$OMP BARRIER
312   
313    CALL barrier
314  END SUBROUTINE switch1d_u1d 
315 
316  SUBROUTINE switch2d_u1d(field,old_dist,new_dist,up,down)
317  USE parallel
318  USE mod_hallo
319  IMPLICIT NONE
320  REAL,POINTER :: field(:,:)
321  TYPE(distrib),INTENT(IN) :: old_dist
322  TYPE(distrib),INTENT(IN) :: new_dist
323  INTEGER, OPTIONAL,INTENT(IN) :: up
324  INTEGER, OPTIONAL,INTENT(IN) :: down
325
326  REAL,POINTER,SAVE :: new_field(:,:)
327  TYPE(request) :: req
328 
329  !$OMP BARRIER
330  !$OMP MASTER   
331    ALLOCATE(new_field(new_dist%ijb_u:new_dist%ije_u,size(field,2)))
332    new_field=nan
333  !$OMP END MASTER
334  !$OMP BARRIER
335    CALL Register_SwapField_u(field,new_field,new_dist,req,old_dist=old_dist,up=up,down=down)
336 
337    CALL SendRequest(req)
338
339  !$OMP BARRIER
340    CALL WaitRequest(req)     
341  !$OMP BARRIER
342   
343  !$OMP MASTER
344    DEALLOCATE(field)
345    field=>new_field
346  !$OMP END MASTER
347  !$OMP BARRIER
348    CALL barrier
349
350  END SUBROUTINE switch2d_u1d 
351
352  SUBROUTINE switch3d_u1d(field,old_dist,new_dist,up,down)
353  USE parallel
354  USE mod_hallo
355  IMPLICIT NONE
356  REAL,POINTER :: field(:,:,:)
357  TYPE(distrib),INTENT(IN) :: old_dist
358  TYPE(distrib),INTENT(IN) :: new_dist
359  INTEGER, OPTIONAL,INTENT(IN) :: up
360  INTEGER, OPTIONAL,INTENT(IN) :: down
361
362  REAL,POINTER,SAVE :: new_field(:,:,:)
363  TYPE(request) :: req
364 
365  !$OMP BARRIER
366  !$OMP MASTER   
367    ALLOCATE(new_field(new_dist%ijb_u:new_dist%ije_u,size(field,2),size(field,3)))
368    new_field=nan
369  !$OMP END MASTER
370  !$OMP BARRIER
371    CALL Register_SwapField_u(field,new_field,new_dist,req,old_dist=old_dist,up=up,down=down)
372 
373    CALL SendRequest(req)
374
375  !$OMP BARRIER
376    CALL WaitRequest(req)     
377  !$OMP BARRIER
378   
379  !$OMP MASTER
380    DEALLOCATE(field)
381    field=>new_field
382  !$OMP END MASTER
383  !$OMP BARRIER
384    CALL barrier
385
386  END SUBROUTINE switch3d_u1d 
387
388
389
390
391  SUBROUTINE switch1d_v1d(field,old_dist,new_dist,up,down)
392  USE parallel
393  USE mod_hallo
394  IMPLICIT NONE
395  REAL,POINTER :: field(:)
396  TYPE(distrib),INTENT(IN) :: old_dist
397  TYPE(distrib),INTENT(IN) :: new_dist
398  INTEGER, OPTIONAL,INTENT(IN) :: up
399  INTEGER, OPTIONAL,INTENT(IN) :: down
400
401  REAL,POINTER,SAVE :: new_field(:)
402  TYPE(request) :: req
403 
404  !$OMP BARRIER
405  !$OMP MASTER   
406    ALLOCATE(new_field(new_dist%ijb_v:new_dist%ije_v))
407    new_field=nan
408  !$OMP END MASTER
409  !$OMP BARRIER
410    CALL Register_SwapField_v(field,new_field,new_dist,req,old_dist=old_dist,up=up,down=down)
411 
412    CALL SendRequest(req)
413
414  !$OMP BARRIER
415    CALL WaitRequest(req)     
416  !$OMP BARRIER
417   
418  !$OMP MASTER
419    DEALLOCATE(field)
420    field=>new_field
421  !$OMP END MASTER
422  !$OMP BARRIER
423
424    CALL barrier
425  END SUBROUTINE switch1d_v1d 
426 
427  SUBROUTINE switch2d_v1d(field,old_dist,new_dist,up,down)
428  USE parallel
429  USE mod_hallo
430  IMPLICIT NONE
431  REAL,POINTER :: field(:,:)
432  TYPE(distrib),INTENT(IN) :: old_dist
433  TYPE(distrib),INTENT(IN) :: new_dist
434  INTEGER, OPTIONAL,INTENT(IN) :: up
435  INTEGER, OPTIONAL,INTENT(IN) :: down
436
437  REAL,POINTER,SAVE :: new_field(:,:)
438  TYPE(request) :: req
439 
440  !$OMP BARRIER
441  !$OMP MASTER   
442    ALLOCATE(new_field(new_dist%ijb_v:new_dist%ije_v,size(field,2)))
443    new_field=nan
444  !$OMP END MASTER
445  !$OMP BARRIER
446    CALL Register_SwapField_v(field,new_field,new_dist,req,old_dist=old_dist,up=up,down=down)
447 
448    CALL SendRequest(req)
449
450  !$OMP BARRIER
451    CALL WaitRequest(req)     
452  !$OMP BARRIER
453   
454  !$OMP MASTER
455    DEALLOCATE(field)
456    field=>new_field
457  !$OMP END MASTER
458  !$OMP BARRIER
459    CALL barrier
460
461  END SUBROUTINE switch2d_v1d 
462
463  SUBROUTINE switch3d_v1d(field,old_dist,new_dist,up,down)
464  USE parallel
465  USE mod_hallo
466  IMPLICIT NONE
467  REAL,POINTER :: field(:,:,:)
468  TYPE(distrib),INTENT(IN) :: old_dist
469  TYPE(distrib),INTENT(IN) :: new_dist
470  INTEGER, OPTIONAL,INTENT(IN) :: up
471  INTEGER, OPTIONAL,INTENT(IN) :: down
472
473  REAL,POINTER,SAVE :: new_field(:,:,:)
474  TYPE(request) :: req
475 
476  !$OMP BARRIER
477  !$OMP MASTER   
478    ALLOCATE(new_field(new_dist%ijb_v:new_dist%ije_v,size(field,2),size(field,3)))
479    new_field=nan
480  !$OMP END MASTER
481  !$OMP BARRIER
482    CALL Register_SwapField_v(field,new_field,new_dist,req,old_dist=old_dist,up=up,down=down)
483 
484    CALL SendRequest(req)
485
486  !$OMP BARRIER
487    CALL WaitRequest(req)     
488  !$OMP BARRIER
489   
490  !$OMP MASTER
491    DEALLOCATE(field)
492    field=>new_field
493  !$OMP END MASTER
494  !$OMP BARRIER
495    CALL barrier
496
497  END SUBROUTINE switch3d_v1d 
498
499
500
501
502
503
504
505
506
507
508
509
510  SUBROUTINE switch1d_u2d(field,old_dist,new_dist,up,down)
511  USE parallel
512  USE mod_hallo
513  USE dimensions
514  IMPLICIT NONE
515  REAL,POINTER :: field(:,:)
516  TYPE(distrib),INTENT(IN) :: old_dist
517  TYPE(distrib),INTENT(IN) :: new_dist
518  INTEGER, OPTIONAL,INTENT(IN) :: up
519  INTEGER, OPTIONAL,INTENT(IN) :: down
520
521  REAL,POINTER,SAVE :: new_field(:,:)
522  TYPE(request) :: req
523 
524  !$OMP BARRIER
525  !$OMP MASTER   
526    ALLOCATE(new_field(iip1,new_dist%jjb_u:new_dist%jje_u))
527    new_field=nan
528  !$OMP END MASTER
529  !$OMP BARRIER
530    CALL Register_SwapField2d_u(field,new_field,new_dist,req,old_dist=old_dist,up=up,down=down)
531 
532    CALL SendRequest(req)
533
534  !$OMP BARRIER
535    CALL WaitRequest(req)     
536  !$OMP BARRIER
537   
538  !$OMP MASTER
539    DEALLOCATE(field)
540    field=>new_field
541  !$OMP END MASTER
542  !$OMP BARRIER
543    CALL barrier
544
545  END SUBROUTINE switch1d_u2d 
546 
547  SUBROUTINE switch2d_u2d(field,old_dist,new_dist,up,down)
548  USE parallel
549  USE mod_hallo
550  USE dimensions
551  IMPLICIT NONE
552  REAL,POINTER :: field(:,:,:)
553  TYPE(distrib),INTENT(IN) :: old_dist
554  TYPE(distrib),INTENT(IN) :: new_dist
555  INTEGER, OPTIONAL,INTENT(IN) :: up
556  INTEGER, OPTIONAL,INTENT(IN) :: down
557
558  REAL,POINTER,SAVE :: new_field(:,:,:)
559  TYPE(request) :: req
560 
561  !$OMP BARRIER
562  !$OMP MASTER   
563    ALLOCATE(new_field(iip1,new_dist%jjb_u:new_dist%jje_u,size(field,3)))
564    new_field=nan
565  !$OMP END MASTER
566  !$OMP BARRIER
567    CALL Register_SwapField2d_u(field,new_field,new_dist,req,old_dist=old_dist,up=up,down=down)
568 
569    CALL SendRequest(req)
570
571  !$OMP BARRIER
572    CALL WaitRequest(req)     
573  !$OMP BARRIER
574   
575  !$OMP MASTER
576    DEALLOCATE(field)
577    field=>new_field
578  !$OMP END MASTER
579  !$OMP BARRIER
580    CALL barrier
581
582  END SUBROUTINE switch2d_u2d 
583
584  SUBROUTINE switch3d_u2d(field,old_dist,new_dist,up,down)
585  USE parallel
586  USE mod_hallo
587  USE dimensions
588  IMPLICIT NONE
589  REAL,POINTER :: field(:,:,:,:)
590  TYPE(distrib),INTENT(IN) :: old_dist
591  TYPE(distrib),INTENT(IN) :: new_dist
592  INTEGER, OPTIONAL,INTENT(IN) :: up
593  INTEGER, OPTIONAL,INTENT(IN) :: down
594
595  REAL,POINTER,SAVE :: new_field(:,:,:,:)
596  TYPE(request) :: req
597 
598  !$OMP BARRIER
599  !$OMP MASTER   
600    ALLOCATE(new_field(iip1,new_dist%jjb_u:new_dist%jje_u,size(field,3),size(field,4)))
601    new_field=nan
602  !$OMP END MASTER
603  !$OMP BARRIER
604    CALL Register_SwapField2d_u(field,new_field,new_dist,req,old_dist=old_dist,up=up,down=down)
605 
606    CALL SendRequest(req)
607
608  !$OMP BARRIER
609    CALL WaitRequest(req)     
610  !$OMP BARRIER
611   
612  !$OMP MASTER
613    DEALLOCATE(field)
614    field=>new_field
615  !$OMP END MASTER
616  !$OMP BARRIER
617    CALL barrier
618
619  END SUBROUTINE switch3d_u2d 
620
621
622
623
624  SUBROUTINE switch1d_v2d(field,old_dist,new_dist,up,down)
625  USE parallel
626  USE mod_hallo
627  USE dimensions
628  IMPLICIT NONE
629  REAL,POINTER :: field(:,:)
630  TYPE(distrib),INTENT(IN) :: old_dist
631  TYPE(distrib),INTENT(IN) :: new_dist
632  INTEGER, OPTIONAL,INTENT(IN) :: up
633  INTEGER, OPTIONAL,INTENT(IN) :: down
634
635  REAL,POINTER,SAVE :: new_field(:,:)
636  TYPE(request) :: req
637 
638  !$OMP BARRIER
639  !$OMP MASTER   
640    ALLOCATE(new_field(iip1,new_dist%jjb_v:new_dist%jje_v))
641    new_field=nan
642  !$OMP END MASTER
643  !$OMP BARRIER
644    CALL Register_SwapField2d_v(field,new_field,new_dist,req,old_dist=old_dist,up=up,down=down)
645 
646    CALL SendRequest(req)
647
648  !$OMP BARRIER
649    CALL WaitRequest(req)     
650  !$OMP BARRIER
651   
652  !$OMP MASTER
653    DEALLOCATE(field)
654    field=>new_field
655  !$OMP END MASTER
656  !$OMP BARRIER
657    CALL barrier
658
659  END SUBROUTINE switch1d_v2d 
660 
661  SUBROUTINE switch2d_v2d(field,old_dist,new_dist,up,down)
662  USE parallel
663  USE mod_hallo
664  USE dimensions
665  IMPLICIT NONE
666  REAL,POINTER :: field(:,:,:)
667  TYPE(distrib),INTENT(IN) :: old_dist
668  TYPE(distrib),INTENT(IN) :: new_dist
669  INTEGER, OPTIONAL,INTENT(IN) :: up
670  INTEGER, OPTIONAL,INTENT(IN) :: down
671
672  REAL,POINTER,SAVE :: new_field(:,:,:)
673  TYPE(request) :: req
674 
675  !$OMP BARRIER
676  !$OMP MASTER   
677    ALLOCATE(new_field(iip1,new_dist%jjb_v:new_dist%jje_v,size(field,3)))
678    new_field=nan
679  !$OMP END MASTER
680  !$OMP BARRIER
681    CALL Register_SwapField2d_v(field,new_field,new_dist,req,old_dist=old_dist,up=up,down=down)
682 
683    CALL SendRequest(req)
684
685  !$OMP BARRIER
686    CALL WaitRequest(req)     
687  !$OMP BARRIER
688   
689  !$OMP MASTER
690    DEALLOCATE(field)
691    field=>new_field
692  !$OMP END MASTER
693  !$OMP BARRIER
694
695    CALL barrier
696  END SUBROUTINE switch2d_v2d 
697
698  SUBROUTINE switch3d_v2d(field,old_dist,new_dist,up,down)
699  USE parallel
700  USE mod_hallo
701  USE dimensions
702  IMPLICIT NONE
703  REAL,POINTER :: field(:,:,:,:)
704  TYPE(distrib),INTENT(IN) :: old_dist
705  TYPE(distrib),INTENT(IN) :: new_dist
706  INTEGER, OPTIONAL,INTENT(IN) :: up
707  INTEGER, OPTIONAL,INTENT(IN) :: down
708
709  REAL,POINTER,SAVE :: new_field(:,:,:,:)
710  TYPE(request) :: req
711 
712  !$OMP BARRIER
713  !$OMP MASTER   
714    ALLOCATE(new_field(iip1,new_dist%jjb_v:new_dist%jje_v,size(field,3),size(field,4)))
715    new_field=nan
716  !$OMP END MASTER
717  !$OMP BARRIER
718    CALL Register_SwapField2d_v(field,new_field,new_dist,req,old_dist=old_dist,up=up,down=down)
719 
720    CALL SendRequest(req)
721
722  !$OMP BARRIER
723    CALL WaitRequest(req)     
724  !$OMP BARRIER
725   
726  !$OMP MASTER
727    DEALLOCATE(field)
728    field=>new_field
729  !$OMP END MASTER
730  !$OMP BARRIER
731
732    CALL barrier
733  END SUBROUTINE switch3d_v2d
734
735END MODULE allocate_field
736 
737 
738 
739 
Note: See TracBrowser for help on using the repository browser.