Changeset 985 for LMDZ4/trunk
- Timestamp:
- Jul 30, 2008, 5:50:03 PM (16 years ago)
- Location:
- LMDZ4/trunk/libf/dyn3dpar
- Files:
-
- 26 edited
Legend:
- Unmodified
- Added
- Removed
-
LMDZ4/trunk/libf/dyn3dpar/abort_gcm.F
r949 r985 25 25 write(lunout,*) 'in abort_gcm' 26 26 #ifdef CPP_IOIPSL 27 c$OMP MASTER 27 28 call histclo 28 29 call restclo 30 c$OMP END MASTER 29 31 #endif 30 32 c call getin_dump … … 39 41 else 40 42 write(lunout,*) 'Houston, we have a problem ', ierr 43 STOP 41 44 endif 42 STOP43 45 END -
LMDZ4/trunk/libf/dyn3dpar/advtrac_p.F
r960 r985 82 82 DATA fill/.true./ 83 83 DATA dum/.true./ 84 REAL finmasse(ip1jmp1,llm)84 REAL,SAVE :: finmasse(ip1jmp1,llm) 85 85 integer ijb,ije,ijb_u,ijb_v,ije_u,ije_v,j 86 86 type(Request) :: Request_vanleer … … 161 161 c 2. groupement des mailles pres du pole. 162 162 163 c$OMP BARRIER164 163 CALL groupe_p( massem, pbaruc,pbarvc, pbarug,pbarvg,wg ) 165 c$OMP BARRIER 166 167 c$OMP BARRIER 168 c$OMP MASTER 169 p_tmp(ijb:ije,1:llmp1)=p(ijb:ije,1:llmp1) 170 pk_tmp(ijb:ije,1:llm)=pk(ijb:ije,1:llm) 171 teta_tmp(ijb:ije,1:llm)=teta(ijb:ije,1:llm) 164 165 c$OMP BARRIER 166 167 c$OMP DO SCHEDULE(STATIC,OMP_CHUNK) 168 DO l=1,llmp1 169 p_tmp(ijb:ije,l)=p(ijb:ije,l) 170 ENDDO 171 c$OMP END DO NOWAIT 172 173 c$OMP DO SCHEDULE(STATIC,OMP_CHUNK) 174 DO l=1,llm 175 pk_tmp(ijb:ije,l)=pk(ijb:ije,l) 176 teta_tmp(ijb:ije,l)=teta(ijb:ije,l) 177 ENDDO 178 c$OMP END DO NOWAIT 179 180 c$OMP MASTER 172 181 call VTb(VTHallo) 182 c$OMP END MASTER 183 173 184 call Register_SwapFieldHallo(pbarug,pbarug,ip1jmp1,llm, 174 185 * jj_Nb_vanleer,0,0,Request_vanleer) … … 189 200 * jj_nb_vanleer,0,0,Request_vanleer) 190 201 enddo 191 202 203 call SendRequest(Request_vanleer) 204 c$OMP BARRIER 205 call WaitRequest(Request_vanleer) 206 207 208 c$OMP BARRIER 209 c$OMP MASTER 192 210 call SetDistrib(jj_nb_vanleer) 193 call SendRequest(Request_vanleer)194 call WaitRequest(Request_vanleer)195 196 211 call VTe(VTHallo) 197 198 212 call VTb(VTadvection) 199 213 call start_timer(timer_vanleer) … … 440 454 1234 CONTINUE 441 455 c$OMP BARRIER 442 c$OMP MASTER 456 443 457 ijb=ij_begin 444 458 ije=ij_end 445 459 460 c$OMP DO SCHEDULE(STATIC,OMP_CHUNK) 446 461 DO l = 1, llm 447 462 DO ij = ijb, ije … … 449 464 ENDDO 450 465 ENDDO 451 466 c$OMP END DO 452 467 453 468 CALL qminimum_p( q, 2, finmasse ) … … 457 472 c--------------------------------------------------- 458 473 c iadvtr=0 474 475 c$OMP MASTER 459 476 call VTe(VTadvection) 460 477 call stop_timer(timer_vanleer) 461 462 478 call VTb(VThallo) 479 c$OMP END MASTER 480 463 481 do j=1,nqmx 464 482 call Register_SwapFieldHallo(q(1,1,j),q(1,1,j),ip1jmp1,llm, … … 469 487 * jj_nb_caldyn,0,0,Request_vanleer) 470 488 489 call SendRequest(Request_vanleer) 490 c$OMP BARRIER 491 call WaitRequest(Request_vanleer) 492 493 c$OMP BARRIER 494 c$OMP MASTER 471 495 call SetDistrib(jj_nb_caldyn) 472 call SendRequest(Request_vanleer)473 call WaitRequest(Request_vanleer)474 475 496 call VTe(VThallo) 476 497 call resume_timer(timer_caldyn) -
LMDZ4/trunk/libf/dyn3dpar/bilan_dyn_p.F
r764 r985 164 164 type(Request) :: Req 165 165 166 ! definition du domaine d'ecriture pour le rebuild 167 168 INTEGER,DIMENSION(1) :: ddid 169 INTEGER,DIMENSION(1) :: dsg 170 INTEGER,DIMENSION(1) :: dsl 171 INTEGER,DIMENSION(1) :: dpf 172 INTEGER,DIMENSION(1) :: dpl 173 INTEGER,DIMENSION(1) :: dhs 174 INTEGER,DIMENSION(1) :: dhe 175 176 INTEGER :: bilan_dyn_domain_id 177 166 178 167 179 c===================================================================== … … 233 245 jje=jj_end 234 246 jjn=jj_nb 235 if (pole_sud) jjn=jj_nb-1 247 IF (pole_sud) THEN 248 jjn=jj_nb-1 249 jje=jj_end-1 250 ENDIF 251 252 ddid=(/ 2 /) 253 dsg=(/ jjm /) 254 dsl=(/ jjn /) 255 dpf=(/ jjb /) 256 dpl=(/ jje /) 257 dhs=(/ 0 /) 258 dhe=(/ 0 /) 259 260 call flio_dom_set(mpi_size,mpi_rank,ddid,dsg,dsl,dpf,dpl,dhs,dhe, 261 . 'box',bilan_dyn_domain_id) 236 262 237 call histbeg(trim(infile) //'_'//trim(int2str(mpi_rank)),263 call histbeg(trim(infile), 238 264 . 1, rlong(jjb:jje), jjn, rlatg(jjb:jje), 239 265 . 1, 1, 1, jjn, 240 . tau0, zjulian, dt_cum, thoriid, fileid) 266 . tau0, zjulian, dt_cum, thoriid, fileid, 267 . bilan_dyn_domain_id) 241 268 242 269 C … … 352 379 c 353 380 if(icum.EQ.0) then 354 ps_cum=0. 355 masse_cum=0. 356 flux_u_cum=0. 357 flux_v_cum=0. 358 Q_cum=0. 359 flux_vQ_cum=0. 360 flux_uQ_cum=0. 381 jjb=jj_begin 382 jje=jj_end 383 384 ps_cum(:,jjb:jje)=0. 385 masse_cum(:,jjb:jje,:)=0. 386 flux_u_cum(:,jjb:jje,:)=0. 387 Q_cum(:,jjb:jje,:,:)=0. 388 flux_uQ_cum(:,jjb:jje,:,:)=0. 389 flux_v_cum(:,jjb:jje,:)=0. 390 if (pole_sud) jje=jj_end-1 391 flux_v_cum(:,jjb:jje,:)=0. 392 flux_vQ_cum(:,jjb:jje,:,:)=0. 361 393 endif 362 394 … … 366 398 367 399 c accumulation des flux de masse horizontaux 368 ps_cum=ps_cum+ps 369 masse_cum=masse_cum+masse 370 flux_u_cum=flux_u_cum+flux_u 371 flux_v_cum=flux_v_cum+flux_v 400 jjb=jj_begin 401 jje=jj_end 402 403 ps_cum(:,jjb:jje)=ps_cum(:,jjb:jje)+ps(:,jjb:jje) 404 masse_cum(:,jjb:jje,:)=masse_cum(:,jjb:jje,:)+masse(:,jjb:jje,:) 405 flux_u_cum(:,jjb:jje,:)=flux_u_cum(:,jjb:jje,:) 406 . +flux_u(:,jjb:jje,:) 407 if (pole_sud) jje=jj_end-1 408 flux_v_cum(:,jjb:jje,:)=flux_v_cum(:,jjb:jje,:) 409 . +flux_v(:,jjb:jje,:) 410 411 jjb=jj_begin 412 jje=jj_end 413 372 414 do iQ=1,nQ 373 415 Q_cum(:,jjb:jje,:,iQ)=Q_cum(:,jjb:jje,:,iQ) … … 396 438 c ------------- 397 439 do iQ=1,nQ 440 call Register_Hallo(Q(1,1,1,iQ),ip1jmp1,llm,0,1,1,0,Req) 441 enddo 442 call SendRequest(Req) 443 call WaitRequest(Req) 444 445 jjb=jj_begin 446 jje=jj_end 447 if (pole_sud) jje=jj_end-1 448 449 do iQ=1,nQ 398 450 do l=1,llm 399 451 do j=jjb,jje … … 426 478 call convmas_p(flux_u_cum,flux_v_cum,convm) 427 479 CALL vitvert_p(convm,w) 480 481 jjb=jj_begin 482 jje=jj_end 428 483 429 484 do iQ=1,nQ … … 455 510 enddo 456 511 zz=1./float(ncum) 457 ps_cum=ps_cum*zz 458 masse_cum=masse_cum*zz 459 flux_u_cum=flux_u_cum*zz 460 flux_v_cum=flux_v_cum*zz 461 flux_uQ_cum=flux_uQ_cum*zz 462 flux_vQ_cum=flux_vQ_cum*zz 463 dQ=dQ*zz 512 513 jjb=jj_begin 514 jje=jj_end 515 516 ps_cum(:,jjb:jje)=ps_cum(:,jjb:jje)*zz 517 masse_cum(:,jjb:jje,:)=masse_cum(:,jjb:jje,:)*zz 518 flux_u_cum(:,jjb:jje,:)=flux_u_cum(:,jjb:jje,:)*zz 519 flux_uQ_cum(:,jjb:jje,:,:)=flux_uQ_cum(:,jjb:jje,:,:)*zz 520 dQ(:,jjb:jje,:,:)=dQ(:,jjb:jje,:,:)*zz 521 522 IF (pole_sud) jje=jj_end-1 523 flux_v_cum(:,jjb:jje,:)=flux_v_cum(:,jjb:jje,:)*zz 524 flux_vQ_cum(:,jjb:jje,:,:)=flux_vQ_cum(:,jjb:jje,:,:)*zz 525 526 jjb=jj_begin 527 jje=jj_end 464 528 465 529 … … 476 540 c cumul zonal des masses des mailles 477 541 c ---------------------------------- 478 zv=0. 479 zmasse=0. 480 call massbar(masse_cum,massebx,masseby) 542 jjb=jj_begin 543 jje=jj_end 544 if (pole_sud) jje=jj_end-1 545 546 zv(jjb:jje,:)=0. 547 zmasse(jjb:jje,:)=0. 548 549 call Register_Hallo(masse_cum,ip1jmp1,llm,1,1,1,1,Req) 550 do iQ=1,nQ 551 call Register_Hallo(Q_cum(1,1,1,iQ),ip1jmp1,llm,0,1,1,0,Req) 552 enddo 553 554 call SendRequest(Req) 555 call WaitRequest(Req) 556 557 call massbar_p(masse_cum,massebx,masseby) 481 558 482 559 jjb=jj_begin … … 524 601 c ---------------------------------------- 525 602 603 jjb=jj_begin 604 jje=jj_end 605 if (pole_sud) jje=jj_end-1 606 526 607 zvQ=0. 527 608 psiQ=0. … … 560 641 561 642 c fonction de courant pour la circulation meridienne moyenne 562 psi =0.643 psi(jjb:jje,:)=0. 563 644 do l=llm,1,-1 564 645 do j=jjb,jje … … 588 669 enddo 589 670 590 call histwrite(fileid,'masse',itau,zmasse(jjb:jje,1 )671 call histwrite(fileid,'masse',itau,zmasse(jjb:jje,1:llm) 591 672 s ,jjn*llm,ndex3d) 592 call histwrite(fileid,'v',itau,zv(jjb:jje,1 )673 call histwrite(fileid,'v',itau,zv(jjb:jje,1:llm) 593 674 s ,jjn*llm,ndex3d) 594 psi =psi*1.e-9675 psi(jjb:jje,:)=psi(jjb:jje,:)*1.e-9 595 676 call histwrite(fileid,'psi',itau,psi(jjb:jje,1:llm), 596 677 s jjn*llm,ndex3d) … … 603 684 c ----------------- 604 685 605 zamasse =0.686 zamasse(jjb:jje)=0. 606 687 do l=1,llm 607 688 zamasse(jjb:jje)=zamasse(jjb:jje)+zmasse(jjb:jje,l) 608 689 enddo 609 zavQ=0. 690 691 zavQ(jjb:jje,:,:)=0. 610 692 do iQ=1,nQ 611 693 do itr=2,ntr -
LMDZ4/trunk/libf/dyn3dpar/calfis_p.F
r961 r985 161 161 REAL,ALLOCATABLE,SAVE :: zdtfi(:,:),zdqfi(:,:,:) 162 162 REAL,ALLOCATABLE,SAVE :: zdpsrf(:) 163 REAL,SAVE,ALLOCATABLE :: flxwfi(:,:) ! Flux de masse verticale sur la grille physiq 164 163 165 c 164 166 REAL,ALLOCATABLE,SAVE :: zplev_omp(:,:) … … 177 179 REAL,ALLOCATABLE,SAVE :: zdqfi_omp(:,:,:) 178 180 REAL,ALLOCATABLE,SAVE :: zdpsrf_omp(:) 181 REAL,SAVE,ALLOCATABLE :: flxwfi_omp(:,:) ! Flux de masse verticale sur la grille physiq 179 182 180 183 c$OMP THREADPRIVATE(zplev_omp,zplay_omp,zphi_omp,zphis_omp, 181 184 c$OMP+ presnivs_omp,zufi_omp,zvfi_omp,ztfi_omp, 182 c$OMP+ zqfi_omp, pvervel_omp,zdufi_omp,zdvfi_omp,183 c$OMP+ zdtfi_omp,zdqfi_omp,zdpsrf_omp )185 c$OMP+ zqfi_omp,zdufi_omp,zdvfi_omp, 186 c$OMP+ zdtfi_omp,zdqfi_omp,zdpsrf_omp,flxwfi_omp) 184 187 185 188 LOGICAL,SAVE :: first_omp=.true. … … 198 201 199 202 REAL flxw(iip1,jjp1,llm) ! Flux de masse verticale sur la grille dynamique 200 REAL flxwfi(klon,llm) ! Flux de masse verticale sur la grille physiq201 203 202 204 REAL SSUM … … 254 256 ALLOCATE(zdpsrf(klon)) 255 257 ALLOCATE(zdufi2(klon+iim,llm),zdvfi2(klon+iim,llm)) 258 ALLOCATE(flxwfi(klon,llm)) 256 259 c$OMP END MASTER 257 260 c$OMP BARRIER … … 548 551 allocate(zdqfi_omp(klon,llm,nq)) 549 552 allocate(zdpsrf_omp(klon)) 553 allocate(flxwfi_omp(klon,llm)) 550 554 first_omp=.false. 551 555 endif … … 643 647 zdpsrf_omp(i)=zdpsrf(offset+i) 644 648 enddo 649 650 do l=1,llm 651 do i=1,klon 652 flxwfi_omp(i,l)=flxwfi(offset+i,l) 653 enddo 654 enddo 645 655 646 656 c$OMP BARRIER … … 667 677 c . pvervel_omp, 668 678 c#ifdef INCA 669 . flxwfi ,679 . flxwfi_omp, 670 680 c#endif 671 681 . zdufi_omp, … … 794 804 c$OMP BARRIER 795 805 c$OMP MASTER 806 !$OMP CRITICAL (MPI) 796 807 call MPI_ISSEND(du_send,iim*llm,MPI_REAL8,MPI_Rank-1,401, 797 808 & COMM_LMDZ,Req(1),ierr) 798 809 call MPI_ISSEND(dv_send,iim*llm,MPI_REAL8,MPI_Rank-1,402, 799 810 & COMM_LMDZ,Req(2),ierr) 811 !$OMP END CRITICAL (MPI) 800 812 c$OMP END MASTER 801 813 c$OMP BARRIER … … 806 818 c$OMP BARRIER 807 819 c$OMP MASTER 820 !$OMP CRITICAL (MPI) 808 821 call MPI_IRECV(du_recv,iim*llm,MPI_REAL8,MPI_Rank+1,401, 809 822 & COMM_LMDZ,Req(3),ierr) 810 823 call MPI_IRECV(dv_recv,iim*llm,MPI_REAL8,MPI_Rank+1,402, 811 824 & COMM_LMDZ,Req(4),ierr) 825 !$OMP END CRITICAL (MPI) 812 826 c$OMP END MASTER 813 827 c$OMP BARRIER … … 816 830 c$OMP BARRIER 817 831 c$OMP MASTER 832 !$OMP CRITICAL (MPI) 818 833 if (MPI_rank>0 .and. MPI_rank< MPI_Size-1) then 819 834 call MPI_WAITALL(4,Req(1),Status,ierr) … … 823 838 call MPI_WAITALL(2,Req(3),Status,ierr) 824 839 endif 840 !$OMP END CRITICAL (MPI) 825 841 c$OMP END MASTER 826 842 c$OMP BARRIER -
LMDZ4/trunk/libf/dyn3dpar/conf_gcm.F
r960 r985 8 8 use IOIPSL 9 9 use misc_mod 10 use mod_filtre_fft, ONLY : use_filtre_fft 11 use mod_hallo, ONLY : use_mpi_alloc 12 use parallel, ONLY : omp_chunk 10 13 IMPLICIT NONE 11 14 c----------------------------------------------------------------------- … … 34 37 #include "serre.h" 35 38 #include "comdissnew.h" 36 #include "clesphys.h"39 !#include "clesphys.h" 37 40 #include "iniprint.h" 41 42 ! FH 2008/05/09 On elimine toutes les clefs physiques dans la dynamique 38 43 c 39 44 c … … 298 303 c 299 304 300 !Config Key = ecritphy 301 !Config Desc = Frequence d'ecriture de la physique 302 !Config Def = 1 303 !Config Help = frequence de l'ecriture du fichier histphy 304 !Config en jours. 305 ecritphy = 1 306 CALL getin('ecritphy',ecritphy) 307 308 !Config Key = cycle_diurne 309 !Config Desc = Cycle ddiurne 310 !Config Def = y 311 !Config Help = Cette option permet d'eteidre le cycle diurne. 312 !Config Peut etre util pour accelerer le code ! 313 cycle_diurne = .TRUE. 314 CALL getin('cycle_diurne',cycle_diurne) 315 316 !Config Key = soil_model 317 !Config Desc = Modele de sol 318 !Config Def = y 319 !Config Help = Choix du modele de sol (Thermique ?) 320 !Config Option qui pourait un string afin de pouvoir 321 !Config plus de choix ! Ou meme une liste d'options ! 322 soil_model = .TRUE. 323 CALL getin('soil_model',soil_model) 324 325 !Config Key = new_oliq 326 !Config Desc = Nouvelle eau liquide 327 !Config Def = y 328 !Config Help = Permet de mettre en route la 329 !Config nouvelle parametrisation de l'eau liquide ! 330 new_oliq = .TRUE. 331 CALL getin('new_oliq',new_oliq) 332 333 !Config Key = ok_orodr 334 !Config Desc = Orodr ??? 335 !Config Def = y 336 !Config Help = Y en a pas comprendre ! 337 !Config 338 ok_orodr = .TRUE. 339 CALL getin('ok_orodr',ok_orodr) 340 341 !Config Key = ok_orolf 342 !Config Desc = Orolf ?? 343 !Config Def = y 344 !Config Help = Connais pas ! 345 ok_orolf = .TRUE. 346 CALL getin('ok_orolf', ok_orolf) 347 348 !Config Key = ok_limitvrai 349 !Config Desc = Force la lecture de la bonne annee 350 !Config Def = n 351 !Config Help = On peut forcer le modele a lire le 352 !Config fichier SST de la bonne annee. C'est une tres bonne 353 !Config idee, pourquoi ne pas mettre toujours a y ??? 354 ok_limitvrai = .FALSE. 355 CALL getin('ok_limitvrai',ok_limitvrai) 356 357 !Config Key = nbapp_rad 358 !Config Desc = Frequence d'appel au rayonnement 359 !Config Def = 12 360 !Config Help = Nombre d'appels des routines de rayonnements 361 !Config par jour. 362 nbapp_rad = 12 363 CALL getin('nbapp_rad',nbapp_rad) 364 365 !Config Key = iflag_con 366 !Config Desc = Flag de convection 367 !Config Def = 2 368 !Config Help = Flag pour la convection les options suivantes existent : 369 !Config 1 pour LMD, 370 !Config 2 pour Tiedtke, 371 !Config 3 pour CCM(NCAR) 372 iflag_con = 2 373 CALL getin('iflag_con',iflag_con) 374 ! 305 375 306 !Config Key = ip_ebil_dyn 376 307 !Config Desc = PRINT level for energy conserv. diag. … … 384 315 CALL getin('ip_ebil_dyn',ip_ebil_dyn) 385 316 ! 386 387 DO i = 1, longcles388 clesphy0(i) = 0.389 ENDDO390 clesphy0(1) = FLOAT( iflag_con )391 clesphy0(2) = FLOAT( nbapp_rad )392 393 IF( cycle_diurne ) clesphy0(3) = 1.394 IF( soil_model ) clesphy0(4) = 1.395 IF( new_oliq ) clesphy0(5) = 1.396 IF( ok_orodr ) clesphy0(6) = 1.397 IF( ok_orolf ) clesphy0(7) = 1.398 IF( ok_limitvrai ) clesphy0(8) = 1.399 317 400 318 … … 633 551 write(lunout,*)' purmats = ', purmats 634 552 write(lunout,*)' iflag_phys = ', iflag_phys 635 write(lunout,*)' iphysiq = ', iphysiq636 write(lunout,*)' ecritphy = ', ecritphy637 write(lunout,*)' cycle_diurne = ', cycle_diurne638 write(lunout,*)' soil_model = ', soil_model639 write(lunout,*)' new_oliq = ', new_oliq640 write(lunout,*)' ok_orodr = ', ok_orodr641 write(lunout,*)' ok_orolf = ', ok_orolf642 write(lunout,*)' ok_limitvrai = ', ok_limitvrai643 write(lunout,*)' nbapp_rad = ', nbapp_rad644 write(lunout,*)' iflag_con = ', iflag_con645 553 write(lunout,*)' clonn = ', clonn 646 554 write(lunout,*)' clatt = ', clatt … … 777 685 CALL getin('config_inca',config_inca) 778 686 687 !Config Key = use_filtre_fft 688 !Config Desc = flag d'activation des FFT pour le filtre 689 !Config Def = false 690 !Config Help = permet d'activer l'utilisation des FFT pour effectuer 691 !Config le filtrage aux poles. 692 use_filtre_fft=.FALSE. 693 CALL getin('use_filtre_fft',use_filtre_fft) 694 695 !Config Key = use_mpi_alloc 696 !Config Desc = Utilise un buffer MPI en mémoire globale 697 !Config Def = false 698 !Config Help = permet d'activer l'utilisation d'un buffer MPI 699 !Config en mémoire globale a l'aide de la fonction MPI_ALLOC. 700 !Config Cela peut améliorer la bande passante des transferts MPI 701 !Config d'un facteur 2 702 use_mpi_alloc=.FALSE. 703 CALL getin('use_mpi_alloc',use_mpi_alloc) 704 705 !Config Key = omp_chunk 706 !Config Desc = taille des blocs openmp 707 !Config Def = 1 708 !Config Help = defini la taille des packets d'itération openmp 709 !Config distribuée à chaque tâche lors de l'entrée dans une 710 !Config boucle parallélisée 711 712 omp_chunk=1 713 CALL getin('omp_chunk',omp_chunk) 779 714 780 715 write(lunout,*)' #########################################' … … 799 734 write(lunout,*)' purmats = ', purmats 800 735 write(lunout,*)' iflag_phys = ', iflag_phys 801 write(lunout,*)' iphysiq = ', iphysiq 802 write(lunout,*)' ecritphy = ', ecritphy 803 write(lunout,*)' cycle_diurne = ', cycle_diurne 804 write(lunout,*)' soil_model = ', soil_model 805 write(lunout,*)' new_oliq = ', new_oliq 806 write(lunout,*)' ok_orodr = ', ok_orodr 807 write(lunout,*)' ok_orolf = ', ok_orolf 808 write(lunout,*)' ok_limitvrai = ', ok_limitvrai 809 write(lunout,*)' nbapp_rad = ', nbapp_rad 810 write(lunout,*)' iflag_con = ', iflag_con 811 write(lunout,*)' clonn = ', clonn 812 write(lunout,*)' clatt = ', clatt 736 write(lunout,*)' clon = ', clon 737 write(lunout,*)' clat = ', clat 813 738 write(lunout,*)' grossismx = ', grossismx 814 739 write(lunout,*)' grossismy = ', grossismy … … 820 745 write(lunout,*)' offline = ', offline 821 746 write(lunout,*)' config_inca = ', config_inca 747 write(lunout,*)' use_filtre_fft = ', use_filtre_fft 748 write(lunout,*)' use_mpi_alloc = ', use_mpi_alloc 749 write(lunout,*)' omp_chunk = ', omp_chunk 822 750 c 823 751 RETURN -
LMDZ4/trunk/libf/dyn3dpar/control.h
r960 r985 13 13 COMMON/control/nday,day_step, & 14 14 & iperiod,iapp_tracvl,iconser,iecri,idissip,iphysiq , & 15 & periodav, ecritphy,iecrimoy,dayref,anneeref,&15 & periodav,iecrimoy,dayref,anneeref, & 16 16 & raz_date,offline,ip_ebil_dyn,config_inca 17 17 … … 19 19 & idissip,iphysiq,iecrimoy,dayref,anneeref, raz_date & 20 20 & ,ip_ebil_dyn 21 REAL periodav , ecritphy21 REAL periodav 22 22 logical offline 23 23 CHARACTER*4 config_inca -
LMDZ4/trunk/libf/dyn3dpar/defrun.F
r774 r985 198 198 ccc .... P.Le Van, ajout le 03/01/96 pour l'ecriture phys ... 199 199 c 200 READ (tapedef,9001) ch1,ch4201 READ (tapedef,*) ecritphy202 WRITE(tapeout,9001) ch1,'ecritphy'203 WRITE(tapeout,*) ecritphy204 205 200 READ (tapedef,9001) ch1,ch4 206 201 READ (tapedef,*) cycle_diurne -
LMDZ4/trunk/libf/dyn3dpar/dissip_p.F
r764 r985 99 99 ENDIF 100 100 101 c call write_field3d_p('gdx',reshape(gdx,(/iip1,jjp1,llm/)))102 c call write_field3d_p('gdy',reshape(gdy,(/iip1,jjm,llm/)))103 c stop104 101 105 102 ijb=ij_begin … … 143 140 ENDIF 144 141 145 c call write_field3d_p('grx',reshape(grx,(/iip1,jjp1,llm/)))146 c call write_field3d_p('gry',reshape(gry,(/iip1,jjm,llm/)))147 c stop148 142 149 143 -
LMDZ4/trunk/libf/dyn3dpar/divgrad2_p.F
r764 r985 12 12 USE parallel 13 13 USE times 14 USE mod_hallo 14 15 IMPLICIT NONE 15 16 c … … 32 33 INTEGER l,ij,iter,lh 33 34 c ................................................................... 34 35 Type(Request) :: request_dissip 35 36 INTEGER ijb,ije 36 37 c … … 48 49 c 49 50 c$OMP BARRIER 50 c$OMP MASTER 51 call suspend_timer(timer_dissip) 52 call exchange_Hallo(divgra,ip1jmp1,llm,1,1) 53 call resume_timer(timer_dissip) 54 c$OMP END MASTER 51 call Register_Hallo(divgra,ip1jmp1,llm,1,1,1,1,Request_dissip) 52 call SendRequest(Request_dissip) 55 53 c$OMP BARRIER 54 call WaitRequest(Request_dissip) 55 c$OMP BARRIER 56 56 57 CALL laplacien_p( klevel, divgra, divgra ) 57 58 … … 77 78 DO iter = 1, lh - 2 78 79 c$OMP BARRIER 79 c$OMP MASTER 80 call suspend_timer(timer_dissip) 81 call exchange_Hallo(divgra,ip1jmp1,llm,1,1) 82 call resume_timer(timer_dissip) 83 c$OMP END MASTER 80 call Register_Hallo(divgra,ip1jmp1,llm,1,1,1,1,Request_dissip) 81 call SendRequest(Request_dissip) 84 82 c$OMP BARRIER 83 call WaitRequest(Request_dissip) 84 85 c$OMP BARRIER 86 87 85 88 CALL laplacien_gam_p ( klevel,cuvscvgam2,cvuscugam2,unsair_gam2, 86 89 * unsapolnga2, unsapolsga2, divgra, divgra ) … … 98 101 c 99 102 c$OMP BARRIER 100 c$OMP MASTER 101 call suspend_timer(timer_dissip) 102 call exchange_Hallo(divgra,ip1jmp1,llm,1,1) 103 call resume_timer(timer_dissip) 104 c$OMP END MASTER 103 call Register_Hallo(divgra,ip1jmp1,llm,1,1,1,1,Request_dissip) 104 call SendRequest(Request_dissip) 105 c$OMP BARRIER 106 call WaitRequest(Request_dissip) 105 107 c$OMP BARRIER 106 108 -
LMDZ4/trunk/libf/dyn3dpar/dynredem_p.F
r764 r985 527 527 #include "advtrac.h" 528 528 #include "temps.h" 529 #include "control.h" 529 530 530 531 INTEGER nq, l … … 536 537 537 538 REAL time 538 INTEGER nid, nvarid 539 INTEGER ierr 539 INTEGER nid, nvarid, nid_trac, nvarid_trac 540 REAL trac_tmp(ip1jmp1,llm) 541 INTEGER ierr, ierr_file 540 542 INTEGER iq 541 543 INTEGER length … … 641 643 #endif 642 644 645 IF (config_inca /= 'none') THEN 646 ! Ajout Anne pour lecture valeurs traceurs dans un fichier start_trac.nc 647 ierr_file = NF_OPEN ("start_trac.nc", NF_NOWRITE,nid_trac) 648 IF (ierr_file .NE.NF_NOERR) THEN 649 write(6,*)' Pb d''ouverture du fichier start_trac.nc' 650 write(6,*)' ierr = ', ierr_file 651 ENDIF 652 END IF 653 643 654 IF(nq.GE.1) THEN 644 do iq=1,nq 645 ierr = NF_INQ_VARID(nid, tname(iq), nvarid) 646 IF (ierr .NE. NF_NOERR) THEN 647 PRINT*, "Variable tname(iq) n est pas definie" 648 CALL abort 649 ENDIF 650 #ifdef NC_DOUBLE 651 ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,q(1,1,iq)) 652 #else 653 ierr = NF_PUT_VAR_REAL (nid,nvarid,q(1,1,iq)) 654 #endif 655 do iq=1,nq 656 657 IF (config_inca == 'none') THEN 658 ierr = NF_INQ_VARID(nid, tname(iq), nvarid) 659 IF (ierr .NE. NF_NOERR) THEN 660 PRINT*, "Variable tname(iq) n est pas definie" 661 CALL abort 662 ENDIF 663 #ifdef NC_DOUBLE 664 ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,q(1,1,iq)) 665 #else 666 ierr = NF_PUT_VAR_REAL (nid,nvarid,q(1,1,iq)) 667 #endif 668 ELSE ! config_inca = 'chem' ou 'aero' 669 ! lecture de la valeur du traceur dans start_trac.nc 670 IF (ierr_file .ne. 2) THEN 671 ierr = NF_INQ_VARID (nid_trac, tname(iq), nvarid_trac) 672 IF (ierr .NE. NF_NOERR) THEN 673 PRINT*, tname(iq),"est absent de start_trac.nc" 674 ierr = NF_INQ_VARID(nid, tname(iq), nvarid) 675 IF (ierr .NE. NF_NOERR) THEN 676 PRINT*, "Variable ", tname(iq)," n est pas definie" 677 CALL abort 678 ENDIF 679 #ifdef NC_DOUBLE 680 ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,q(1,1,iq)) 681 #else 682 ierr = NF_PUT_VAR_REAL (nid,nvarid,q(1,1,iq)) 683 #endif 684 685 ELSE 686 PRINT*, tname(iq), "est present dans start_trac.nc" 687 #ifdef NC_DOUBLE 688 ierr = NF_GET_VAR_DOUBLE(nid_trac, nvarid_trac, trac_tmp) 689 #else 690 ierr = NF_GET_VAR_REAL(nid_trac, nvarid_trac, trac_tmp) 691 #endif 692 IF (ierr .NE. NF_NOERR) THEN 693 PRINT*, "Lecture echouee pour", tname(iq) 694 CALL abort 695 ENDIF 696 ierr = NF_INQ_VARID(nid, tname(iq), nvarid) 697 IF (ierr .NE. NF_NOERR) THEN 698 PRINT*, "Variable ", tname(iq)," n est pas definie" 699 CALL abort 700 ENDIF 701 #ifdef NC_DOUBLE 702 ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,trac_tmp) 703 #else 704 ierr = NF_PUT_VAR_REAL (nid,nvarid,trac_tmp) 705 #endif 706 707 ENDIF ! IF (ierr .NE. NF_NOERR) 708 ! fin lecture du traceur 709 ELSE ! si il n'y a pas de fichier start_trac.nc 710 ! print *, 'il n y a pas de fichier start_trac' 711 ierr = NF_INQ_VARID(nid, tname(iq), nvarid) 712 IF (ierr .NE. NF_NOERR) THEN 713 PRINT*, "Variable tname(iq) n est pas definie" 714 CALL abort 715 ENDIF 716 #ifdef NC_DOUBLE 717 ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,q(1,1,iq)) 718 #else 719 ierr = NF_PUT_VAR_REAL (nid,nvarid,q(1,1,iq)) 720 #endif 721 ENDIF ! (ierr_file .ne. 2) 722 END IF ! config_inca 723 655 724 ENDDO 656 725 ENDIF 726 727 728 729 657 730 c 658 731 ierr = NF_INQ_VARID(nid, "masse", nvarid) -
LMDZ4/trunk/libf/dyn3dpar/exner_hyb_p.F
r774 r985 51 51 INTEGER ije,ijb,jje,jjb 52 52 c 53 c$OMP MASTER53 c$OMP BARRIER 54 54 unpl2k = 1.+ 2.* kappa 55 55 c … … 57 57 ije=ij_end 58 58 59 59 c$OMP DO SCHEDULE(STATIC) 60 60 DO ij = ijb, ije 61 61 pks(ij) = cpp * ( ps(ij)/preff ) ** kappa 62 62 ENDDO 63 c$OMP ENDDO 64 c Synchro OPENMP ici 63 65 66 c$OMP MASTER 64 67 if (pole_nord) then 65 68 DO ij = 1, iim … … 83 86 ENDDO 84 87 endif 85 88 c$OMP END MASTER 86 89 c 87 90 c 88 91 c .... Calcul des coeff. alpha et beta pour la couche l = llm .. 89 92 c 93 c$OMP DO SCHEDULE(STATIC) 90 94 DO ij = ijb,ije 91 95 alpha(ij,llm) = 0. 92 96 beta (ij,llm) = 1./ unpl2k 93 97 ENDDO 98 c$OMP ENDDO NOWAIT 94 99 c 95 100 c ... Calcul des coeff. alpha et beta pour l = llm-1 a l = 2 ... … … 97 102 DO l = llm -1 , 2 , -1 98 103 c 104 c$OMP DO SCHEDULE(STATIC) 99 105 DO ij = ijb, ije 100 106 dellta = p(ij,l)* unpl2k + p(ij,l+1)* ( beta(ij,l+1)-unpl2k ) … … 102 108 beta (ij,l) = p(ij,l ) / dellta 103 109 ENDDO 110 c$OMP ENDDO NOWAIT 104 111 c 105 112 ENDDO … … 109 116 c ..... Calcul de pk pour la couche 1 , pres du sol .... 110 117 c 111 118 c$OMP DO SCHEDULE(STATIC) 112 119 DO ij = ijb, ije 113 120 pk(ij,1) = ( p(ij,1)*pks(ij) - 0.5*alpha(ij,2)*p(ij,2) ) / 114 121 * ( p(ij,1)* (1.+kappa) + 0.5*( beta(ij,2)-unpl2k )* p(ij,2) ) 115 122 ENDDO 123 c$OMP ENDDO NOWAIT 116 124 c 117 125 c ..... Calcul de pk(ij,l) , pour l = 2 a l = llm ........ 118 126 c 119 127 DO l = 2, llm 128 c$OMP DO SCHEDULE(STATIC) 120 129 DO ij = ijb, ije 121 130 pk(ij,l) = alpha(ij,l) + beta(ij,l) * pk(ij,l-1) 122 131 ENDDO 132 c$OMP ENDDO NOWAIT 123 133 ENDDO 124 134 c 125 135 c 126 136 c CALL SCOPY ( ngrid * llm, pk, 1, pkf, 1 ) 127 pkf(ijb:ije,1:llm)=pk(ijb:ije,1:llm) 128 c$OMP END MASTER 137 DO l = 1, llm 138 c$OMP DO SCHEDULE(STATIC) 139 DO ij = ijb, ije 140 pkf(ij,l)=pk(ij,l) 141 ENDDO 142 c$OMP ENDDO NOWAIT 143 ENDDO 144 129 145 c$OMP BARRIER 130 146 -
LMDZ4/trunk/libf/dyn3dpar/filtreg_p.F
r763 r985 1 2 1 3 SUBROUTINE filtreg_p ( champ, ibeg, iend, nlat, nbniv, 2 4 . ifiltre, iaire, griscal ,iter) 3 5 USE Parallel, only : OMP_CHUNK 6 USE mod_filtre_fft 7 USE timer_filtre 4 8 IMPLICIT NONE 5 9 … … 59 63 , , matricevn(iim,iim,nfilvn),matricevs(iim,iim,nfilvs) 60 64 , , matrinvn(iim,iim,nfilun),matrinvs (iim,iim,nfilus) 61 REAL eignq(iim), sdd1(iim),sdd2(iim) 65 cym REAL eignq(iim), sdd1(iim),sdd2(iim) 66 67 REAL eignq(iim) 68 REAL :: sdd1(iim),sdd2(iim) 69 62 70 LOGICAL griscal 63 71 INTEGER hemisph, iaire 64 c 72 73 REAL :: champ_fft(iip1,nlat,nbniv) 74 REAL :: champ_in(iip1,nlat,nbniv) 75 76 REAL,SAVE,TARGET :: sddu_loc(iim) 77 REAL,SAVE,TARGET :: sddv_loc(iim) 78 REAL,SAVE,TARGET :: unsddu_loc(iim) 79 REAL,SAVE,TARGET :: unsddv_loc(iim) 80 c$OMP THREADPRIVATE(sddu_loc,sddv_loc,unsddu_loc,unsddv_loc) 81 LOGICAL,SAVE :: first=.TRUE. 82 c$OMP THREADPRIVATE(first) 83 84 IF (first) THEN 85 sddu_loc(1:iim)=sddu(1:iim) 86 sddv_loc(1:iim)=sddv(1:iim) 87 unsddu_loc(1:iim)=unsddu(1:iim) 88 unsddv_loc(1:iim)=unsddv(1:iim) 89 CALL Init_timer 90 first=.FALSE. 91 c PRINT *,"----> sddu_loc=",sddu_loc 92 c PRINT *,"----> sddv_loc=",sddv_loc 93 c PRINT *,"----> unsddu_loc=",unsddu_loc 94 c PRINT *,"----> unsddv_loc=",unsddv_loc 95 ENDIF 96 97 c$OMP MASTER 98 CALL start_timer 99 c$OMP END MASTER 65 100 66 101 IF(ifiltre.EQ.1.or.ifiltre.EQ.-1) … … 97 132 c 98 133 IF( iaire.EQ.1 ) THEN 99 CALL SCOPY( iim, sddv, 1, sdd1, 1 ) 100 CALL SCOPY( iim, unsddv, 1, sdd2, 1 ) 134 cym CALL SCOPY( iim, sddv, 1, sdd1, 1 ) 135 cym CALL SCOPY( iim, unsddv, 1, sdd2, 1 ) 136 cym sdd1=>sddv_loc 137 cym sdd2=>unsddv_loc 138 sdd1(1:iim)=sddv_loc(1:iim) 139 sdd2(1:iim)=unsddv_loc(1:iim) 101 140 ELSE 102 CALL SCOPY( iim, unsddv, 1, sdd1, 1 ) 103 CALL SCOPY( iim, sddv, 1, sdd2, 1 ) 141 cym CALL SCOPY( iim, unsddv, 1, sdd1, 1 ) 142 cym CALL SCOPY( iim, sddv, 1, sdd2, 1 ) 143 sdd1(1:iim)=unsddv_loc(1:iim) 144 sdd2(1:iim)=sddv_loc(1:iim) 104 145 END IF 105 146 c … … 116 157 c 117 158 IF( iaire.EQ.1 ) THEN 118 CALL SCOPY( iim, sddu, 1, sdd1, 1 ) 119 CALL SCOPY( iim, unsddu, 1, sdd2, 1 ) 159 cym CALL SCOPY( iim, sddu, 1, sdd1, 1 ) 160 cym CALL SCOPY( iim, unsddu, 1, sdd2, 1 ) 161 cym sdd1=>sddu_loc 162 cym sdd2=>unsddu_loc 163 sdd1(1:iim)=sddu_loc(1:iim) 164 sdd2(1:iim)=unsddu_loc(1:iim) 165 120 166 ELSE 121 CALL SCOPY( iim, unsddu, 1, sdd1, 1 ) 122 CALL SCOPY( iim, sddu, 1, sdd2, 1 ) 167 cym CALL SCOPY( iim, unsddu, 1, sdd1, 1 ) 168 cym CALL SCOPY( iim, sddu, 1, sdd2, 1 ) 169 cym sdd1=>unsddu_loc 170 cym sdd2=>sddu_loc 171 sdd1(1:iim)=unsddu_loc(1:iim) 172 sdd2(1:iim)=sddu_loc(1:iim) 123 173 END IF 124 174 c … … 129 179 END IF 130 180 END IF 181 182 c PRINT *,"APPEL a filtreg --> sdd1=",sdd1 183 c PRINT *,"APPEL a filtreg --> sdd2=",sdd2 184 c PRINT *,"----> sddu_loc=",sddu_loc 185 c PRINT *,"----> sddv_loc=",sddv_loc 186 c PRINT *,"----> unsddu_loc=",unsddu_loc 187 c PRINT *,"----> unsddv_loc=",unsddv_loc 188 131 189 c 132 190 c … … 143 201 END IF 144 202 203 204 cccccccccccccccccccccccccccccccccccccccccccc 205 c Utilisation du filtre classique 206 cccccccccccccccccccccccccccccccccccccccccccc 207 208 IF (.NOT. use_filtre_fft) THEN 209 145 210 c$OMP DO SCHEDULE(STATIC,OMP_CHUNK) 146 211 DO 50 l = 1, nbniv 147 DO 30 j = jdfil,jffil212 DO 30 j = jdfil,jffil 148 213 149 214 150 DO 5 i = 1, iim 151 champ(i,j,l) = champ(i,j,l) * sdd1(i) 152 5 CONTINUE 153 c 154 155 IF( hemisph. EQ. 1 ) THEN 156 157 IF( ifiltre. EQ. -2 ) THEN 158 #ifdef CRAY 159 CALL MXVA( matrinvn(1,1,j), 1, iim, champ(1,j,l), 1, eignq , 160 * 1, iim, iim ) 161 #else 162 #ifdef BLAS 163 CALL SGEMV("N", iim,iim, 1.0, matrinvn(1,1,j),iim, 164 . champ(1,j,l), 1, 0.0, eignq, 1) 165 #else 166 DO k = 1, iim 167 eignq(k) = 0.0 168 ENDDO 169 DO k = 1, iim 170 DO i = 1, iim 171 eignq(k) = eignq(k) + matrinvn(k,i,j)*champ(i,j,l) 172 ENDDO 173 ENDDO 174 #endif 175 #endif 176 ELSE IF ( griscal ) THEN 177 #ifdef CRAY 178 CALL MXVA( matriceun(1,1,j), 1, iim, champ(1,j,l), 1, eignq , 179 * 1, iim, iim ) 180 #else 181 #ifdef BLAS 182 CALL SGEMV("N", iim,iim, 1.0, matriceun(1,1,j),iim, 183 . champ(1,j,l), 1, 0.0, eignq, 1) 184 #else 185 DO k = 1, iim 186 eignq(k) = 0.0 187 ENDDO 188 DO i = 1, iim 189 DO k = 1, iim 190 eignq(k) = eignq(k) + matriceun(k,i,j)*champ(i,j,l) 191 ENDDO 192 ENDDO 193 #endif 194 #endif 195 ELSE 196 #ifdef CRAY 197 CALL MXVA( matricevn(1,1,j), 1, iim, champ(1,j,l), 1, eignq , 198 * 1, iim, iim ) 199 #else 200 #ifdef BLAS 201 CALL SGEMV("N", iim,iim, 1.0, matricevn(1,1,j),iim, 202 . champ(1,j,l), 1, 0.0, eignq, 1) 203 #else 204 DO k = 1, iim 205 eignq(k) = 0.0 206 ENDDO 207 DO i = 1, iim 208 DO k = 1, iim 209 eignq(k) = eignq(k) + matricevn(k,i,j)*champ(i,j,l) 210 ENDDO 211 ENDDO 212 #endif 213 #endif 214 ENDIF 215 216 ELSE 217 218 IF( ifiltre. EQ. -2 ) THEN 219 #ifdef CRAY 220 CALL MXVA( matrinvs(1,1,j-jfiltsu+1), 1, iim, champ(1,j,l),1 , 221 * eignq, 1, iim, iim ) 222 #else 223 #ifdef BLAS 224 CALL SGEMV("N", iim,iim, 1.0, matrinvs(1,1,j-jfiltsu+1),iim, 225 . champ(1,j,l), 1, 0.0, eignq, 1) 226 #else 227 DO k = 1, iim 228 eignq(k) = 0.0 229 ENDDO 230 DO i = 1, iim 231 DO k = 1, iim 232 eignq(k) = eignq(k) + matrinvs(k,i,j-jfiltsu+1)*champ(i,j,l) 233 ENDDO 234 ENDDO 235 #endif 236 #endif 237 ELSE IF ( griscal ) THEN 238 #ifdef CRAY 239 CALL MXVA( matriceus(1,1,j-jfiltsu+1), 1, iim, champ(1,j,l),1 , 240 * eignq, 1, iim, iim ) 241 #else 242 #ifdef BLAS 243 CALL SGEMV("N", iim,iim, 1.0, matriceus(1,1,j-jfiltsu+1),iim, 244 . champ(1,j,l), 1, 0.0, eignq, 1) 245 #else 246 DO k = 1, iim 247 eignq(k) = 0.0 248 ENDDO 249 DO i = 1, iim 250 DO k = 1, iim 251 eignq(k) = eignq(k) + matriceus(k,i,j-jfiltsu+1)*champ(i,j,l) 252 ENDDO 253 ENDDO 254 #endif 255 #endif 256 ELSE 257 #ifdef CRAY 258 CALL MXVA( matricevs(1,1,j-jfiltsv+1), 1, iim, champ(1,j,l),1 , 259 * eignq, 1, iim, iim ) 260 #else 261 #ifdef BLAS 262 CALL SGEMV("N", iim,iim, 1.0, matricevs(1,1,j-jfiltsv+1),iim, 263 . champ(1,j,l), 1, 0.0, eignq, 1) 264 #else 265 DO k = 1, iim 266 eignq(k) = 0.0 267 ENDDO 268 DO i = 1, iim 269 DO k = 1, iim 270 eignq(k) = eignq(k) + matricevs(k,i,j-jfiltsv+1)*champ(i,j,l) 271 ENDDO 272 ENDDO 273 #endif 274 #endif 275 ENDIF 276 277 ENDIF 278 c 279 IF( ifiltre.EQ. 2 ) THEN 280 DO 15 i = 1, iim 281 champ( i,j,l ) = ( champ(i,j,l) + eignq(i) ) * sdd2(i) 282 15 CONTINUE 283 ELSE 284 DO 16 i=1,iim 285 champ( i,j,l ) = ( champ(i,j,l) - eignq(i) ) * sdd2(i) 286 16 CONTINUE 287 ENDIF 288 c 289 champ( iip1,j,l ) = champ( 1,j,l ) 290 c 291 30 CONTINUE 215 DO 5 i = 1, iim 216 champ(i,j,l) = champ(i,j,l) * sdd1(i) 217 5 CONTINUE 218 c 219 220 IF( hemisph. EQ. 1 ) THEN 221 222 IF( ifiltre. EQ. -2 ) THEN 223 224 225 CALL SGEMV("N", iim,iim, 1.0, matrinvn(1,1,j),iim, 226 . champ(1,j,l), 1, 0.0, eignq, 1) 227 228 229 ELSE IF ( griscal ) THEN 230 231 CALL SGEMV("N", iim,iim, 1.0, matriceun(1,1,j),iim, 232 . champ(1,j,l), 1, 0.0, eignq, 1) 233 234 ELSE 235 236 CALL SGEMV("N", iim,iim, 1.0, matricevn(1,1,j),iim, 237 . champ(1,j,l), 1, 0.0, eignq, 1) 238 ENDIF 239 240 ELSE 241 242 IF( ifiltre. EQ. -2 ) THEN 243 244 CALL SGEMV("N",iim,iim,1.0, matrinvs(1,1,j-jfiltsu+1),iim, 245 . champ(1,j,l), 1, 0.0, eignq, 1) 246 247 ELSE IF ( griscal ) THEN 248 249 CALL SGEMV("N",iim,iim,1.0,matriceus(1,1,j-jfiltsu+1),iim, 250 . champ(1,j,l), 1, 0.0, eignq, 1) 251 ELSE 252 253 CALL SGEMV("N",iim,iim,1.0,matricevs(1,1,j-jfiltsv+1),iim, 254 . champ(1,j,l), 1, 0.0, eignq, 1) 255 ENDIF 256 257 ENDIF 258 259 260 c 261 IF( ifiltre.EQ. 2 ) THEN 262 263 DO 15 i = 1, iim 264 champ( i,j,l ) = ( champ(i,j,l) + eignq(i) ) * sdd2(i) 265 15 CONTINUE 266 267 ELSE 268 269 DO 16 i=1,iim 270 champ( i,j,l ) = ( champ(i,j,l) - eignq(i) ) * sdd2(i) 271 16 CONTINUE 272 273 ENDIF 274 c 275 champ( iip1,j,l ) = champ( 1,j,l ) 276 c 277 30 CONTINUE 292 278 c 293 279 50 CONTINUE 294 280 c$OMP END DO NOWAIT 295 c 281 282 ccccccccccccccccccccccccccccccccccccccccccccc 283 c Utilisation du filtre FFT 284 ccccccccccccccccccccccccccccccccccccccccccccc 285 286 ELSE 287 288 c$OMP DO SCHEDULE(STATIC,OMP_CHUNK) 289 DO l=1,nbniv 290 DO j=jdfil,jffil 291 DO i = 1, iim 292 champ( i,j,l)= champ(i,j,l)*sdd1(i) 293 champ_fft( i,j,l) = champ(i,j,l) 294 ENDDO 295 ENDDO 296 ENDDO 297 c$OMP END DO NOWAIT 298 299 IF (jdfil<=jffil) THEN 300 IF( ifiltre. EQ. -2 ) THEN 301 CALL Filtre_inv_fft(champ_fft,nlat,jdfil,jffil,nbniv) 302 ELSE IF ( griscal ) THEN 303 CALL Filtre_u_fft(champ_fft,nlat,jdfil,jffil,nbniv) 304 ELSE 305 CALL Filtre_v_fft(champ_fft,nlat,jdfil,jffil,nbniv) 306 ENDIF 307 ENDIF 308 309 310 IF( ifiltre.EQ. 2 ) THEN 311 c$OMP DO SCHEDULE(STATIC,OMP_CHUNK) 312 DO l=1,nbniv 313 DO j=jdfil,jffil 314 DO i = 1, iim 315 champ( i,j,l)=(champ(i,j,l)+champ_fft(i,j,l)) 316 . *sdd2(i) 317 ENDDO 318 ENDDO 319 ENDDO 320 c$OMP END DO NOWAIT 321 ELSE 322 323 c$OMP DO SCHEDULE(STATIC,OMP_CHUNK) 324 DO l=1,nbniv 325 DO j=jdfil,jffil 326 DO i = 1, iim 327 champ(i,j,l)=(champ(i,j,l)-champ_fft(i,j,l)) 328 . *sdd2(i) 329 ENDDO 330 ENDDO 331 ENDDO 332 c$OMP END DO NOWAIT 333 ENDIF 334 c 335 c$OMP DO SCHEDULE(STATIC,OMP_CHUNK) 336 DO l=1,nbniv 337 DO j=jdfil,jffil 338 ! champ_FFT( iip1,j,l ) = champ_FFT( 1,j,l ) 339 champ( iip1,j,l ) = champ( 1,j,l ) 340 ENDDO 341 ENDDO 342 c$OMP END DO NOWAIT 343 ENDIF 344 c Fin de la zone de filtrage 345 346 296 347 100 CONTINUE 348 349 ! DO j=1,nlat 350 ! 351 ! PRINT *,"check FFT ----> Delta(",j,")=", 352 ! & sum(champ(:,j,:)-champ_fft(:,j,:))/sum(champ(:,j,:)), 353 ! & sum(champ(:,j,:)-champ_in(:,j,:))/sum(champ(:,j,:)) 354 ! ENDDO 355 356 ! PRINT *,"check FFT ----> Delta(",j,")=", 357 ! & sum(champ-champ_fft)/sum(champ) 358 ! 359 297 360 c 298 361 1111 FORMAT(//20x,'ERREUR dans le dimensionnement du tableau CHAMP a … … 300 363 2222 FORMAT(//20x,'ERREUR dans le dimensionnement du tableau CHAMP a fi 301 364 *ltrer, sur la grille de V ou de Z'/) 365 c$OMP MASTER 366 CALL stop_timer 367 c$OMP END MASTER 302 368 RETURN 303 369 END -
LMDZ4/trunk/libf/dyn3dpar/gcm.F
r960 r985 18 18 USE mod_hallo 19 19 USE Bands 20 USE Write_Field21 USE Write_Field_phy22 20 IMPLICIT NONE 23 21 … … 225 223 if (mpi_rank==0) call WriteBands 226 224 call SetDistrib(jj_Nb_Caldyn) 225 226 c$OMP PARALLEL 227 227 call Init_Mod_hallo 228 c$OMP END PARALLEL 228 229 229 230 c$OMP PARALLEL -
LMDZ4/trunk/libf/dyn3dpar/gr_u_scal_p.F
r790 r985 50 50 ijb=ij_begin 51 51 ije=ij_end 52 if (pole_nord) ijb=ij_begin+ 152 if (pole_nord) ijb=ij_begin+iip1 53 53 54 54 DO l=1,nx -
LMDZ4/trunk/libf/dyn3dpar/gr_v_scal_p.F
r774 r985 49 49 ijb=ij_begin 50 50 ije=ij_end 51 if (pole_nord) ijb=ij_begin+ 152 if (pole_sud) ije=ij_end- 151 if (pole_nord) ijb=ij_begin+iip1 52 if (pole_sud) ije=ij_end-iip1 53 53 54 54 DO l=1,nx -
LMDZ4/trunk/libf/dyn3dpar/gradiv2_p.F
r764 r985 16 16 USE times 17 17 USE Write_field_p 18 USE mod_hallo 18 19 IMPLICIT NONE 19 20 c … … 33 34 c 34 35 REAL,SAVE :: div(ip1jmp1,llm) 36 REAL :: tmp_div2(ip1jmp1,llm) 35 37 REAL signe, nugrads 36 38 INTEGER l,ij,iter,ld 37 39 INTEGER :: ijb,ije,jjb,jje 40 Type(Request) :: request_dissip 38 41 39 42 c ........................................................ … … 63 66 64 67 c$OMP BARRIER 65 c$OMP MASTER 66 call suspend_timer(timer_dissip) 67 call exchange_Hallo(gdy,ip1jm,llm,1,0) 68 call resume_timer(timer_dissip) 69 c$OMP END MASTER 68 call Register_Hallo(gdy,ip1jm,llm,1,0,0,1,Request_dissip) 69 call SendRequest(Request_dissip) 70 c$OMP BARRIER 71 call WaitRequest(Request_dissip) 70 72 c$OMP BARRIER 71 73 c … … 81 83 IF( ld.GT.1 ) THEN 82 84 c$OMP BARRIER 83 c$OMP MASTER 84 call suspend_timer(timer_dissip) 85 call exchange_Hallo(div,ip1jmp1,llm,1,1) 86 call resume_timer(timer_dissip) 87 c$OMP END MASTER 85 call Register_Hallo(div,ip1jmp1,llm,1,1,1,1,Request_dissip) 86 call SendRequest(Request_dissip) 87 c$OMP BARRIER 88 call WaitRequest(Request_dissip) 88 89 c$OMP BARRIER 89 90 CALL laplacien_p ( klevel, div, div ) … … 94 95 DO iter = 1, ld -2 95 96 c$OMP BARRIER 96 c$OMP MASTER 97 call suspend_timer(timer_dissip) 98 call exchange_Hallo(div,ip1jmp1,llm,1,1) 99 call resume_timer(timer_dissip) 100 c$OMP END MASTER 97 call Register_Hallo(div,ip1jmp1,llm,1,1,1,1,Request_dissip) 98 call SendRequest(Request_dissip) 101 99 c$OMP BARRIER 100 call WaitRequest(Request_dissip) 101 102 c$OMP BARRIER 103 102 104 CALL laplacien_gam ( klevel,cuvscvgam1,cvuscugam1,unsair_gam1, 103 105 * unsapolnga1, unsapolsga1, div, div ) … … 112 114 c call exchange_Hallo(div,ip1jmp1,llm,0,1) 113 115 c$OMP BARRIER 114 c$OMP MASTER 115 call suspend_timer(timer_dissip) 116 call exchange_Hallo(div,ip1jmp1,llm,1,1) 117 call resume_timer(timer_dissip) 118 c$OMP END MASTER 116 call Register_Hallo(div,ip1jmp1,llm,1,1,1,1,Request_dissip) 117 call SendRequest(Request_dissip) 119 118 c$OMP BARRIER 120 c call write_field3d_p('div4',reshape(div,(/iip1,jjp1,llm/))) 119 call WaitRequest(Request_dissip) 120 121 c$OMP BARRIER 122 123 121 124 CALL grad_p ( klevel, div, gdx, gdy ) 122 125 -
LMDZ4/trunk/libf/dyn3dpar/guide_p.F
r865 r985 128 128 jjn=jj_nb 129 129 130 print*,'OK0'131 130 CALL pression_p( ip1jmp1, ap, bp, ps, p ) 132 131 call massdair_p(p,masse) 133 print*,'OK1'134 132 CALL exner_hyb_p(ip1jmp1,ps,p,alpha,beta,pks,pk,pkf) 135 print*,'OK2'136 133 tnat(ijb:ije,:)=pk(ijb:ije,:)*teta(ijb:ije,:)/cpp 137 print*,'OK3'138 134 unskap = 1./ kappa 139 135 pres(ijb:ije,:)=preff*(pk(ijb:ije,:)/cpp)**unskap 140 print*,'OK4'141 136 call q_sat(iip1*jjn*llm,tnat(ijb:ije,:),pres(ijb:ije,:), 142 137 . qsat(ijb:ije,:)) … … 151 146 c----------------------------------------------------------------------- 152 147 153 print*,'ONLINE=',online154 148 if(online.eq.-1) then 155 149 return -
LMDZ4/trunk/libf/dyn3dpar/integrd_p.F
r764 r985 58 58 REAL tpn,tps,tppn(iim),tpps(iim) 59 59 REAL qpn,qps,qppn(iim),qpps(iim) 60 REAL deltap( ip1jmp1,llm )60 REAL,SAVE :: deltap( ip1jmp1,llm ) 61 61 62 62 INTEGER l,ij,iq … … 66 66 INTEGER ijb,ije,jjb,jje 67 67 REAL,SAVE :: ps(ip1jmp1) 68 LOGICAL :: checksum 69 INTEGER :: stop_it 68 70 c----------------------------------------------------------------------- 69 71 c$OMP BARRIER 70 72 if (pole_nord) THEN 71 73 c$OMP DO SCHEDULE(STATIC,OMP_CHUNK) … … 102 104 c$OMP END DO NOWAIT 103 105 104 c$OMP MASTER106 c$OMP DO SCHEDULE(STATIC) 105 107 DO 2 ij = ijb,ije 106 108 pscr (ij) = ps0(ij) 107 109 ps (ij) = psm1(ij) + dt * dp(ij) 108 110 2 CONTINUE 109 c 111 c$OMP END DO 112 c$OMP BARRIER 113 c --> ici synchro OPENMP pour ps 114 115 checksum=.TRUE. 116 stop_it=0 117 118 c$OMP DO SCHEDULE(STATIC) 110 119 DO ij = ijb,ije 111 IF( ps(ij).LT.0. ) THEN 112 PRINT*,' Au point ij = ',ij, ' , pression sol neg. ', ps(ij) 120 IF( ps(ij).LT.0. ) THEN 121 IF (checksum) stop_it=ij 122 checksum=.FALSE. 123 ENDIF 124 ENDDO 125 c$OMP END DO NOWAIT 126 127 IF( .NOT. checksum ) THEN 128 PRINT*,' Au point ij = ',stop_it, ' , pression sol neg. ' 129 & , ps(stop_it) 113 130 STOP' dans integrd' 114 131 ENDIF 115 ENDDO 116 c 132 133 c 134 C$OMP MASTER 117 135 if (pole_nord) THEN 118 136 … … 248 266 ije=ij_end 249 267 250 c$OMP MASTER 268 c$OMP BARRIER 269 c$OMP DO SCHEDULE(STATIC,OMP_CHUNK) 251 270 DO l = 1, llm 252 271 DO ij = ijb, ije … … 254 273 ENDDO 255 274 ENDDO 275 c$OMP END DO NOWAIT 276 c$OMP BARRIER 256 277 257 278 CALL qminimum_p( q, nq, deltap ) … … 259 280 c ..... Calcul de la valeur moyenne, unique aux poles pour q ..... 260 281 c 261 282 c$OMP BARRIER 262 283 IF (pole_nord) THEN 263 284 264 285 DO iq = 1, nq 286 287 c$OMP DO SCHEDULE(STATIC,OMP_CHUNK) 265 288 DO l = 1, llm 266 289 … … 275 298 276 299 ENDDO 300 c$OMP END DO NOWAIT 301 277 302 ENDDO 278 303 … … 282 307 283 308 DO iq = 1, nq 309 310 c$OMP DO SCHEDULE(STATIC,OMP_CHUNK) 284 311 DO l = 1, llm 285 312 … … 294 321 295 322 ENDDO 296 ENDDO 297 298 ENDIF 299 300 c$OMP END MASTER 301 c$OMP BARRIER 302 323 c$OMP END DO NOWAIT 324 325 ENDDO 326 327 ENDIF 328 303 329 c CALL SCOPY( ijp1llm , finvmasse, 1, finvmaold, 1 ) 304 330 … … 314 340 15 continue 315 341 316 c$OMP MASTER 317 ps0(ijb:ije)=ps(ijb:ije) 318 c$OMP END MASTER 342 c$OMP DO SCHEDULE(STATIC) 343 DO ij=ijb,ije 344 ps0(ij)=ps(ij) 345 ENDDO 346 c$OMP END DO NOWAIT 347 319 348 c ................................................................. 320 349 … … 323 352 c CALL SCOPY ( ip1jmp1 , pscr , 1, psm1 , 1 ) 324 353 c CALL SCOPY ( ip1jmp1*llm, massescr, 1, massem1, 1 ) 325 c$OMP MASTER 326 psm1(ijb:ije)=pscr(ijb:ije) 327 c$OMP END MASTER 354 c$OMP DO SCHEDULE(STATIC) 355 DO ij=ijb,ije 356 psm1(ij)=pscr(ij) 357 ENDDO 358 c$OMP END DO NOWAIT 328 359 329 360 c$OMP DO SCHEDULE(STATIC,OMP_CHUNK) … … 333 364 c$OMP END DO NOWAIT 334 365 END IF 335 366 c$OMP BARRIER 336 367 RETURN 337 368 END -
LMDZ4/trunk/libf/dyn3dpar/leapfrog_p.F
r961 r985 6 6 #define IO_DEBUG 7 7 8 !#undef CPP_IOIPSL 8 #undef CPP_IOIPSL 9 #define CPP_IOIPSL 9 10 10 11 SUBROUTINE leapfrog_p(ucov,vcov,teta,ps,masse,phis,nq,q,clesphy0, … … 19 20 USE Write_Field_p 20 21 USE vampir 22 USE timer_filtre, ONLY : print_filtre_timer 21 23 22 24 IMPLICIT NONE … … 71 73 72 74 #include "academic.h" 73 #include "clesphys.h"75 !#include "clesphys.h" 74 76 #include "advtrac.h" 75 77 … … 217 219 ENDIF 218 220 219 c$OMP MASTER220 OMP_CHUNK=5221 c$OMP END MASTER222 221 c----------------------------------------------------------------------- 223 222 c On initialise la pression et la fonction d'Exner : … … 237 236 238 237 c$OMP MASTER 238 239 !$OMP CRITICAL (MPI) 239 240 call MPI_BARRIER(COMM_LMDZ,ierr) 241 !$OMP END CRITICAL (MPI) 242 240 243 c$OMP END MASTER 241 244 c$OMP BARRIER … … 297 300 298 301 ENDDO 299 c$OMP ENDDO 302 c$OMP ENDDO 300 303 301 304 … … 321 324 c$OMP MASTER 322 325 ItCount=ItCount+1 323 if (MOD(ItCount,1)== 1) then326 if (MOD(ItCount,1)==0) then 324 327 debug=.true. 325 328 else … … 479 482 c$OMP MASTER 480 483 call VTb(VThallo) 484 c$OMP END MASTER 485 481 486 call Register_Hallo(ucov,ip1jmp1,llm,1,1,1,1,TestRequest) 482 487 call Register_Hallo(vcov,ip1jm,llm,1,1,1,1,TestRequest) … … 494 499 495 500 call SendRequest(TestRequest) 501 c$OMP BARRIER 496 502 call WaitRequest(TestRequest) 503 504 c$OMP MASTER 497 505 call VTe(VThallo) 498 506 c$OMP END MASTER 507 c$OMP BARRIER 499 508 500 509 if (debug) then 510 !$OMP BARRIER 511 !$OMP MASTER 501 512 call WriteField_p('ucov',reshape(ucov,(/iip1,jmp1,llm/))) 502 513 call WriteField_p('vcov',reshape(vcov,(/iip1,jjm,llm/))) … … 511 522 call WriteField_p('q'//trim(int2str(j)), 512 523 . reshape(q(:,:,j),(/iip1,jmp1,llm/))) 513 enddo 524 enddo 525 !$OMP END MASTER 526 c$OMP BARRIER 514 527 endif 515 c$OMP END MASTER 516 c$OMP BARRIER 528 517 529 518 530 True_itau=True_itau+1 519 531 520 532 c$OMP MASTER 521 cprint*,"Iteration No",True_itau533 print*,"Iteration No",True_itau 522 534 523 535 … … 529 541 call VTb(VTcaldyn) 530 542 c$OMP END MASTER 531 c$OMP BARRIER532 543 var_time=time+iday-day_ini 533 cc$OMP PARALLEL DEFAULT(SHARED) 534 cc$OMP+ PRIVATE(rdaym_ini,rdayvrai,ijb,ije, 535 cc$OMP+ tppn,tpn,tpps,tps) 536 537 cc$OMP+ SHARED(itau,ucov,vcov,teta,ps,masse,pk,pkf,phis , 538 cc$OMP+ phi,conser,du,dv,dteta,dp,w, pbaru,pbarv, 539 cc$OMP+ time, iday,day_ini,forward,leapf, iapptrac, 540 cc$OMP+ q,dq,p,VTcaldyn,offline,dtvr,itau) 541 544 545 c$OMP BARRIER 546 ! CALL FTRACE_REGION_BEGIN("caldyn") 542 547 CALL caldyn_p 543 548 $ ( itau,ucov,vcov,teta,ps,masse,pk,pkf,phis , 544 549 $ phi,conser,du,dv,dteta,dp,w, pbaru,pbarv, time+iday-day_ini ) 545 550 546 ccc$OMP END PARALLEL 551 ! CALL FTRACE_REGION_END("caldyn") 547 552 c$OMP MASTER 548 553 call VTe(VTcaldyn) 549 554 c$OMP END MASTER 555 556 cc$OMP BARRIER 557 cc$OMP MASTER 550 558 c call WriteField_p('du',reshape(du,(/iip1,jmp1,llm/))) 551 559 c call WriteField_p('dv',reshape(dv,(/iip1,jjm,llm/))) … … 555 563 c call WriteField_p('pbaru',reshape(pbaru,(/iip1,jmp1,llm/))) 556 564 c call WriteField_p('pbarv',reshape(pbarv,(/iip1,jjm,llm/))) 565 c call WriteField_p('p',reshape(p,(/iip1,jmp1,llmp1/))) 566 c call WriteField_p('masse',reshape(masse,(/iip1,jmp1,llm/))) 567 c call WriteField_p('pk',reshape(pk,(/iip1,jmp1,llm/))) 568 cc$OMP END MASTER 557 569 558 570 c----------------------------------------------------------------------- … … 566 578 * p, masse, dq, teta, 567 579 . flxw,pk, iapptrac) 568 569 c do j=1,nqmx 570 c call WriteField_p('q'//trim(int2str(j)), 571 c . reshape(q(:,:,j),(/iip1,jmp1,llm/))) 572 c call WriteField_p('dq'//trim(int2str(j)), 573 c . reshape(dq(:,:,j),(/iip1,jmp1,llm/))) 574 c enddo 580 575 581 IF (offline) THEN 576 582 Cmaf stokage du flux de masse pour traceurs OFF-LINE 577 #undef CPP_IOIPSL 583 578 584 #ifdef CPP_IOIPSL 579 CALL fluxstokenc (pbaru,pbarv,masse,teta,phi,phis,585 CALL fluxstokenc_p(pbaru,pbarv,masse,teta,phi,phis, 580 586 . dtvr, itau) 581 587 #endif … … 603 609 c call WriteField_p('ps',reshape(ps,(/iip1,jmp1/))) 604 610 cc$OMP PARALLEL DEFAULT(SHARED) 611 c$OMP BARRIER 612 ! CALL FTRACE_REGION_BEGIN("integrd") 605 613 CALL integrd_p ( 2,vcovm1,ucovm1,tetam1,psm1,massem1 , 606 614 $ dv,du,dteta,dq,dp,vcov,ucov,teta,q,ps,masse,phis , 607 615 $ finvmaold ) 608 616 609 617 ! CALL FTRACE_REGION_END("integrd") 618 c$OMP BARRIER 619 cc$OMP MASTER 610 620 c call WriteField_p('ucovm1',reshape(ucovm1,(/iip1,jmp1,llm/))) 611 621 c call WriteField_p('vcovm1',reshape(vcovm1,(/iip1,jjm,llm/))) … … 616 626 c call WriteField_p('teta',reshape(teta,(/iip1,jmp1,llm/))) 617 627 c call WriteField_p('dteta',reshape(dteta,(/iip1,jmp1,llm/))) 618 628 c 619 629 c call WriteField_p('ps',reshape(ps,(/iip1,jmp1/))) 630 c do j=1,nqmx 631 c call WriteField_p('q'//trim(int2str(j)), 632 c . reshape(q(:,:,j),(/iip1,jmp1,llm/))) 633 c call WriteField_p('dq'//trim(int2str(j)), 634 c . reshape(dq(:,:,j),(/iip1,jmp1,llm/))) 635 c enddo 636 cc$OMP END MASTER 637 638 620 639 c$OMP MASTER 621 640 call VTe(VTintegre) … … 647 666 c$OMP MASTER 648 667 call suspend_timer(timer_caldyn) 649 c print*,'Entree dans la physique : Iteration No ',true_itau 650 c$OMP END MASTER 651 652 c$OMP BARRIER 668 print*,'Entree dans la physique : Iteration No ',true_itau 669 c$OMP END MASTER 670 653 671 CALL pression_p ( ip1jmp1, ap, bp, ps, p ) 654 672 673 c$OMP BARRIER 674 655 675 CALL exner_hyb_p( ip1jmp1, ps, p,alpha,beta,pks, pk, pkf ) 676 c$OMP BARRIER 656 677 rdaym_ini = itau * dtvr / daysec 657 678 rdayvrai = rdaym_ini + day_ini … … 678 699 c$OMP MASTER 679 700 call VTb(VThallo) 701 c$OMP END MASTER 702 680 703 call SetTag(Request_physic,800) 681 704 … … 716 739 717 740 call SendRequest(Request_Physic) 741 c$OMP BARRIER 718 742 call WaitRequest(Request_Physic) 719 743 744 c$OMP BARRIER 745 c$OMP MASTER 746 call SetDistrib(jj_nb_Physic) 720 747 call VTe(VThallo) 721 748 … … 732 759 cc$OMP END MASTER 733 760 cc$OMP BARRIER 734 761 ! CALL FTRACE_REGION_BEGIN("calfis") 735 762 CALL calfis_p( nq, lafin ,rdayvrai,time , 736 763 $ ucov,vcov,teta,q,masse,ps,p,pk,phis,phi , … … 738 765 $ flxw, 739 766 $ clesphy0, dufi,dvfi,dtetafi,dqfi,dpfi ) 767 ! CALL FTRACE_REGION_END("calfis") 740 768 ijb=ij_begin 741 769 ije=ij_end … … 760 788 761 789 call VTb(VThallo) 790 c$OMP END MASTER 791 c$OMP BARRIER 762 792 763 793 call Register_Hallo(dufi,ip1jmp1,llm, … … 779 809 780 810 call SendRequest(Request_Physic) 811 c$OMP BARRIER 781 812 call WaitRequest(Request_Physic) 782 813 814 c$OMP BARRIER 815 c$OMP MASTER 783 816 call VTe(VThallo) 784 817 … … 829 862 830 863 call VTb(VThallo) 864 c$OMP END MASTER 831 865 832 866 call SetTag(Request_physic,800) … … 863 897 864 898 call SendRequest(Request_Physic) 899 c$OMP BARRIER 865 900 call WaitRequest(Request_Physic) 866 901 867 call VTe(VThallo) 868 869 call SetDistrib(jj_Nb_caldyn) 902 c$OMP BARRIER 903 c$OMP MASTER 904 call VTe(VThallo) 905 call SetDistrib(jj_Nb_caldyn) 870 906 c$OMP END MASTER 871 907 c$OMP BARRIER … … 916 952 ENDIF 917 953 918 c$OMP BARRIER919 954 CALL pression_p ( ip1jmp1, ap, bp, ps, p ) 955 c$OMP BARRIER 956 957 920 958 CALL exner_hyb_p( ip1jmp1, ps, p,alpha,beta, pks, pk, pkf ) 921 959 c$OMP BARRIER … … 941 979 942 980 c$OMP BARRIER 943 c$OMP MASTER 981 944 982 call Register_SwapFieldHallo(ucov,ucov,ip1jmp1,llm, 945 983 * jj_Nb_dissip,1,1,Request_dissip) … … 958 996 959 997 call SendRequest(Request_dissip) 998 c$OMP BARRIER 960 999 call WaitRequest(Request_dissip) 1000 1001 c$OMP BARRIER 1002 c$OMP MASTER 961 1003 call SetDistrib(jj_Nb_dissip) 962 963 1004 call VTe(VThallo) 964 965 1005 call VTb(VTdissipation) 966 967 1006 call start_timer(timer_dissip) 968 1007 c$OMP END MASTER … … 974 1013 c dissipation 975 1014 1015 ! CALL FTRACE_REGION_BEGIN("dissip") 976 1016 CALL dissip_p(vcov,ucov,teta,p,dvdis,dudis,dtetadis) 1017 ! CALL FTRACE_REGION_END("dissip") 977 1018 978 1019 ijb=ij_begin … … 1001 1042 call suspend_timer(timer_dissip) 1002 1043 call VTb(VThallo) 1003 1044 c$OMP END MASTER 1004 1045 call Register_Hallo(ucov,ip1jmp1,llm,1,1,1,1,Request_Dissip) 1005 1046 call Register_Hallo(vcov,ip1jm,llm,1,1,1,1,Request_Dissip) 1006 1047 call SendRequest(Request_Dissip) 1048 c$OMP BARRIER 1007 1049 call WaitRequest(Request_Dissip) 1050 c$OMP MASTER 1008 1051 call VTe(VThallo) 1009 1052 call resume_timer(timer_dissip) … … 1104 1147 1105 1148 call VTb(VThallo) 1106 1149 c$OMP END MASTER 1107 1150 call Register_SwapField(ucov,ucov,ip1jmp1,llm, 1108 1151 * jj_Nb_caldyn,Request_dissip) … … 1121 1164 1122 1165 call SendRequest(Request_dissip) 1166 c$OMP BARRIER 1123 1167 call WaitRequest(Request_dissip) 1168 1169 c$OMP BARRIER 1170 c$OMP MASTER 1124 1171 call SetDistrib(jj_Nb_caldyn) 1125 1172 call VTe(VThallo) … … 1127 1174 c print *,'fin dissipation' 1128 1175 c$OMP END MASTER 1176 c$OMP BARRIER 1129 1177 END IF 1130 1178 … … 1193 1241 print *, 'Temps total ecoule sur la parallelisation :',DiffTime() 1194 1242 print *, 'Temps CPU ecoule sur la parallelisation :',DiffCpuTime() 1195 1243 CALL print_filtre_timer 1196 1244 call finalize_parallel 1197 1245 c$OMP END MASTER 1246 c$OMP BARRIER 1198 1247 RETURN 1199 1248 ENDIF … … 1222 1271 abort_message = 'Simulation finished' 1223 1272 call abort_gcm(modname,abort_message,0) 1273 RETURN 1224 1274 ENDIF 1225 1275 c----------------------------------------------------------------------- … … 1229 1279 IF(MOD(itau,iperiod).EQ.0 .OR. itau.EQ.itaufin) THEN 1230 1280 c$OMP BARRIER 1231 c$OMP MASTER1232 1281 IF(itau.EQ.itaufin) THEN 1233 1282 iav=1 … … 1237 1286 #ifdef CPP_IOIPSL 1238 1287 call Register_Hallo(vcov,ip1jm,llm,1,0,0,1,TestRequest) 1239 call SendRequest(TestRequest) 1288 call SendRequest(TestRequest) 1289 c$OMP BARRIER 1240 1290 call WaitRequest(TestRequest) 1241 1291 c$OMP MASTER 1242 1292 CALL writedynav_p(histaveid, nqmx, itau,vcov , 1243 1293 , ucov,teta,pk,phi,q,masse,ps,phis) 1244 c call bilan_dyn_p(2,dtvr*iperiod,dtvr*day_step*periodav,1245 c , ps,masse,pk,pbaru,pbarv,teta,phi,ucov,vcov,q) 1294 c$OMP END MASTER 1295 1246 1296 #endif 1247 c$OMP END MASTER1248 1297 ENDIF 1249 1298 … … 1376 1425 abort_message = 'Simulation finished' 1377 1426 call abort_gcm(modname,abort_message,0) 1427 RETURN 1378 1428 ENDIF 1379 1429 GO TO 2 … … 1389 1439 #ifdef CPP_IOIPSL 1390 1440 c$OMP BARRIER 1391 c$OMP MASTER1392 1441 1393 1442 call Register_Hallo(vcov,ip1jm,llm,1,0,0,1,TestRequest) 1394 1443 call SendRequest(TestRequest) 1444 c$OMP BARRIER 1395 1445 call WaitRequest(TestRequest) 1396 1446 1447 c$OMP MASTER 1397 1448 CALL writedynav_p(histaveid, nqmx, itau,vcov , 1398 1449 , ucov,teta,pk,phi,q,masse,ps,phis) 1399 ccall bilan_dyn_p (2,dtvr*iperiod,dtvr*day_step*periodav,1400 c, ps,masse,pk,pbaru,pbarv,teta,phi,ucov,vcov,q)1450 call bilan_dyn_p (2,dtvr*iperiod,dtvr*day_step*periodav, 1451 , ps,masse,pk,pbaru,pbarv,teta,phi,ucov,vcov,q) 1401 1452 c$OMP END MASTER 1402 1453 #endif -
LMDZ4/trunk/libf/dyn3dpar/mod_const_para.F90
r884 r985 1 1 MODULE mod_const_mpi 2 2 3 INTEGER :: COMM_LMDZ4 INTEGER :: MPI_REAL_LMDZ3 INTEGER,SAVE :: COMM_LMDZ 4 INTEGER,SAVE :: MPI_REAL_LMDZ 5 5 6 6 … … 14 14 INTEGER :: ierr 15 15 INTEGER :: comp_id 16 INTEGER :: thread_required 17 INTEGER :: thread_provided 16 18 CHARACTER(len = 6) :: ocean 17 19 … … 19 21 ocean = 'force ' 20 22 CALL getin('OCEAN', ocean) 21 !$OMP END 23 !$OMP END MASTER 24 !$OMP BARRIER 22 25 23 26 IF (ocean=='couple') THEN 24 27 #ifdef CPP_COUPLE 28 !$OMP MASTER 25 29 CALL prism_init_comp_proto (comp_id, 'lmdz.x', ierr) 26 30 CALL prism_get_localcomm_proto(COMM_LMDZ,ierr) 31 !$OMP END MASTER 27 32 #endif 28 33 ELSE 29 CALL MPI_INIT(ierr) 34 !$OMP MASTER 35 thread_required=MPI_THREAD_SERIALIZED 36 CALL MPI_INIT_THREAD(thread_required,thread_provided,ierr) 37 IF (thread_provided < thread_required) THEN 38 CALL abort_gcm('The multithreaded level of MPI librairy do not provide the requiered level', & 39 'mod_const_mpi::Init_const_mpi',1) 40 ENDIF 30 41 COMM_LMDZ=MPI_COMM_WORLD 42 !$OMP END MASTER 31 43 END IF 32 44 -
LMDZ4/trunk/libf/dyn3dpar/mod_hallo.F90
r807 r985 2 2 USE parallel 3 3 implicit none 4 4 logical,save :: use_mpi_alloc 5 5 integer, parameter :: MaxRequest=200 6 6 integer, parameter :: MaxProc=80 … … 9 9 10 10 integer,save :: MaxBufferSize_Used 11 12 real,save,pointer,dimension(:) :: Buffer 13 14 integer,dimension(Listsize) :: Buffer_Pos 15 integer :: Index_Pos 11 !$OMP THREADPRIVATE( MaxBufferSize_Used) 12 13 real,save,pointer,dimension(:) :: Buffer 14 !$OMP THREADPRIVATE(Buffer) 15 16 integer,save,dimension(Listsize) :: Buffer_Pos 17 integer,save :: Index_Pos 18 !$OMP THREADPRIVATE(Buffer_Pos,Index_pos) 16 19 17 20 type Hallo … … 47 50 MaxBufferSize_Used=0 48 51 49 CALL create_global_mpi_buffer 50 52 IF (use_mpi_alloc) THEN 53 CALL create_global_mpi_buffer 54 ELSE 55 CALL create_standard_mpi_buffer 56 ENDIF 57 51 58 end subroutine init_mod_hallo 52 53 59 54 60 SUBROUTINE create_standard_mpi_buffer … … 59 65 END SUBROUTINE create_standard_mpi_buffer 60 66 61 62 67 SUBROUTINE create_global_mpi_buffer 63 68 IMPLICIT NONE … … 68 73 INTEGER :: i,ierr 69 74 70 75 ! Allocation du buffer MPI 71 76 Bs=8*MaxBufferSize 77 !$OMP CRITICAL (MPI) 72 78 CALL MPI_ALLOC_MEM(BS,MPI_INFO_NULL,Pbuffer,ierr) 79 !$OMP END CRITICAL (MPI) 73 80 DO i=1,MaxBufferSize 74 81 MPI_Buffer(i)=i … … 88 95 89 96 END SUBROUTINE create_global_mpi_buffer 90 91 97 92 98 93 99 subroutine allocate_buffer(Size,Index,Pos) … … 381 387 integer :: i,rank,l,ij,Pos,ierr 382 388 integer :: offset 383 ! real,dimension(:),pointer :: Buffer384 389 real,dimension(:,:),pointer :: Field 385 390 integer :: Nb … … 392 397 do i=1,Req%NbRequest 393 398 PtrHallo=>Req%Hallo(i) 394 SizeBuffer=SizeBuffer+PtrHallo%size*PtrHallo%NbLevel*iip1 399 !$OMP DO SCHEDULE(STATIC,OMP_CHUNK) 400 DO l=1,PtrHallo%NbLevel 401 SizeBuffer=SizeBuffer+PtrHallo%size*iip1 402 ENDDO 403 !$OMP ENDDO NOWAIT 395 404 enddo 396 405 397 406 if (SizeBuffer>0) then 398 407 399 ! allocate(Req%Buffer(SizeBuffer))400 408 call allocate_buffer(SizeBuffer,Req%Index,Req%pos) 401 409 402 410 Pos=Req%Pos 403 ! Buffer=>req%Buffer404 411 do i=1,Req%NbRequest 405 412 PtrHallo=>Req%Hallo(i) … … 407 414 Nb=iip1*PtrHallo%size-1 408 415 Field=>PtrHallo%Field 409 416 417 !$OMP DO SCHEDULE(STATIC,OMP_CHUNK) 410 418 do l=1,PtrHallo%NbLevel 411 419 !cdir NODEP … … 413 421 Buffer(Pos+ij)=Field(Offset+ij,l) 414 422 enddo 415 ! Buffer(Pos:Pos+Nb)=Field(offset:offset+Nb,l)416 423 417 424 Pos=Pos+Nb+1 418 425 enddo 419 426 !$OMP END DO NOWAIT 420 427 enddo 421 428 422 ! print *, 'process',MPI_RANK,'ISSEND: requette ',a_request%tag,'au process',rank,'de taille',SizeBuffer 423 ! call MPI_ISSEND(Req%Buffer,SizeBuffer,MPI_REAL8,rank,a_request%tag, & 424 ! COMM_LMDZ,Req%MSG_Request,ierr) 425 call MPI_ISSEND(Buffer(req%Pos),SizeBuffer,MPI_REAL8,rank,a_request%tag, & 429 !$OMP CRITICAL (MPI) 430 call MPI_ISSEND(Buffer(req%Pos),SizeBuffer,MPI_REAL8,rank,a_request%tag+1000*omp_rank, & 426 431 COMM_LMDZ,Req%MSG_Request,ierr) 427 432 ! PRINT *,"-------------------------------------------------------------------" 433 ! PRINT *,"Process de rang",mpi_rank,"Task : ",omp_rank,"--->" 434 ! PRINT *,"Requete envoye au proc :",rank,"tag :",a_request%tag+1000*omp_rank 435 ! PRINT *,"Taille du message :",SizeBuffer,"requete no :",Req%MSG_Request 436 ! PRINT *,"-------------------------------------------------------------------" 437 !$OMP END CRITICAL (MPI) 428 438 endif 429 439 … … 438 448 do i=1,Req%NbRequest 439 449 PtrHallo=>Req%Hallo(i) 440 SizeBuffer=SizeBuffer+PtrHallo%size*PtrHallo%NbLevel*iip1 450 451 !$OMP DO SCHEDULE(STATIC,OMP_CHUNK) 452 DO l=1,PtrHallo%NbLevel 453 SizeBuffer=SizeBuffer+PtrHallo%size*iip1 454 ENDDO 455 !$OMP ENDDO NOWAIT 441 456 enddo 442 457 443 458 if (SizeBuffer>0) then 444 ! allocate(Req%Buffer(SizeBuffer)) 459 445 460 call allocate_buffer(SizeBuffer,Req%Index,Req%Pos) 446 ! print *, 'process',MPI_RANK,'IRECV: requette ',a_request%tag,'au process',rank,'de taille',SizeBuffer 447 448 ! call MPI_IRECV(Req%Buffer,SizeBuffer,MPI_REAL8,rank,a_request%tag, & 449 ! COMM_LMDZ,Req%MSG_Request,ierr) 450 call MPI_IRECV(Buffer(Req%Pos),SizeBuffer,MPI_REAL8,rank,a_request%tag, & 461 !$OMP CRITICAL (MPI) 462 call MPI_IRECV(Buffer(Req%Pos),SizeBuffer,MPI_REAL8,rank,a_request%tag+1000*omp_rank, & 451 463 COMM_LMDZ,Req%MSG_Request,ierr) 452 464 ! PRINT *,"-------------------------------------------------------------------" 465 ! PRINT *,"Process de rang",mpi_rank,"Task : ",omp_rank,"--->" 466 ! PRINT *,"Requete en attente du proc :",rank,"tag :",a_request%tag+1000*omp_rank 467 ! PRINT *,"Taille du message :",SizeBuffer,"requete no :",Req%MSG_Request 468 ! PRINT *,"-------------------------------------------------------------------" 469 470 !$OMP END CRITICAL (MPI) 453 471 endif 454 472 … … 492 510 enddo 493 511 494 if (NbRequest>0) call MPI_WAITALL(NbRequest,TabRequest,TabStatus,ierr) 495 512 if (NbRequest>0) then 513 !$OMP CRITICAL (MPI) 514 ! PRINT *,"-------------------------------------------------------------------" 515 ! PRINT *,"Process de rang",mpi_rank,"Task : ",omp_rank,"--->",NbRequest,"en attente" 516 ! PRINT *,"No des requetes :",TabRequest(1:NbRequest) 517 call MPI_WAITALL(NbRequest,TabRequest,TabStatus,ierr) 518 ! PRINT *,"Process de rang",mpi_rank,"Task : ",omp_rank,"--->",NbRequest,"complete" 519 ! PRINT *,"-------------------------------------------------------------------" 520 !$OMP END CRITICAL (MPI) 521 endif 496 522 do rank=0,MPI_Size-1 497 523 Req=>a_request%RequestRecv(rank) … … 502 528 offset=(PtrHallo%offset-1)*iip1+1 503 529 Nb=iip1*PtrHallo%size-1 504 530 531 !$OMP DO SCHEDULE(STATIC,OMP_CHUNK) 505 532 do l=1,PtrHallo%NbLevel 506 533 !cdir NODEP … … 508 535 PtrHallo%Field(offset+ij,l)=Buffer(Pos+ij) 509 536 enddo 510 ! PtrHallo%Field(offset:offset+Nb,l)=Buffer(Pos:Pos+Nb) 511 ! do ij=offset,offset+iip1*PtrHallo%size-1 512 ! PtrHallo%Field(ij,l)=Buffer(Pos) 513 ! Pos=Pos+1 514 ! enddo 537 515 538 Pos=Pos+Nb+1 516 539 enddo 517 540 !$OMP ENDDO NOWAIT 518 541 enddo 519 542 endif … … 566 589 567 590 568 if (NbRequest>0) call MPI_WAITALL(NbRequest,TabRequest,TabStatus,ierr) 569 591 if (NbRequest>0) THEN 592 !$OMP CRITICAL (MPI) 593 ! PRINT *,"-------------------------------------------------------------------" 594 ! PRINT *,"Process de rang",mpi_rank,"Task : ",omp_rank,"--->",NbRequest,"en attente" 595 ! PRINT *,"No des requetes :",TabRequest(1:NbRequest) 596 call MPI_WAITALL(NbRequest,TabRequest,TabStatus,ierr) 597 ! PRINT *,"Process de rang",mpi_rank,"Task : ",omp_rank,"--->",NbRequest,"complete" 598 ! PRINT *,"-------------------------------------------------------------------" 599 600 !$OMP END CRITICAL (MPI) 601 endif 570 602 571 603 do rank=0,MPI_SIZE-1 … … 608 640 609 641 610 if (NbRequest>0) call MPI_WAITALL(NbRequest,TabRequest,TabStatus,ierr) 642 if (NbRequest>0) then 643 !$OMP CRITICAL (MPI) 644 ! PRINT *,"-------------------------------------------------------------------" 645 ! PRINT *,"Process de rang",mpi_rank,"Task : ",omp_rank,"--->",NbRequest,"en attente" 646 ! PRINT *,"No des requetes :",TabRequest(1:NbRequest) 647 call MPI_WAITALL(NbRequest,TabRequest,TabStatus,ierr) 648 ! PRINT *,"Process de rang",mpi_rank,"Task : ",omp_rank,"--->",NbRequest,"complete" 649 ! PRINT *,"-------------------------------------------------------------------" 650 !$OMP END CRITICAL (MPI) 651 endif 611 652 612 653 do rank=0,MPI_Size-1 … … 618 659 offset=(PtrHallo%offset-1)*iip1+1 619 660 Nb=iip1*PtrHallo%size-1 620 661 !$OMP DO SCHEDULE(STATIC,OMP_CHUNK) 621 662 do l=1,PtrHallo%NbLevel 622 663 !cdir NODEP … … 626 667 Pos=Pos+Nb+1 627 668 enddo 669 !$OMP END DO NOWAIT 628 670 enddo 629 671 endif … … 651 693 include 'mpif.h' 652 694 653 INTEGER :: ij,ll 695 INTEGER :: ij,ll,l 654 696 REAL, dimension(ij,ll) :: FieldS 655 697 REAL, dimension(ij,ll) :: FieldR … … 673 715 ijb=(jjb-1)*iip1+1 674 716 ije=jje*iip1 675 FieldR(ijb:ije,1:ll)=FieldS(ijb:ije,1:ll) 717 718 !$OMP DO SCHEDULE(STATIC,OMP_CHUNK) 719 do l=1,ll 720 FieldR(ijb:ije,l)=FieldS(ijb:ije,l) 721 enddo 722 !$OMP ENDDO NOWAIT 676 723 endif 724 677 725 678 726 end subroutine CopyField … … 691 739 integer,dimension(0:MPI_Size-1) :: jj_Begin_New,jj_End_New 692 740 693 integer ::i,jje,jjb,ijb,ije 741 integer ::i,jje,jjb,ijb,ije,l 694 742 695 743 … … 710 758 ijb=(jjb-1)*iip1+1 711 759 ije=jje*iip1 712 FieldR(ijb:ije,1:ll)=FieldS(ijb:ije,1:ll) 760 761 !$OMP DO SCHEDULE(STATIC,OMP_CHUNK) 762 do l=1,ll 763 FieldR(ijb:ije,l)=FieldS(ijb:ije,l) 764 enddo 765 !$OMP ENDDO NOWAIT 766 713 767 endif 714 768 end subroutine CopyFieldHallo -
LMDZ4/trunk/libf/dyn3dpar/nxgraro2_p.F
r764 r985 15 15 USE parallel 16 16 USE times 17 USE mod_hallo 17 18 IMPLICIT NONE 18 19 c … … 33 34 REAL signe, nugradrs 34 35 INTEGER l,ij,iter,lr 36 Type(Request) :: Request_dissip 35 37 c ........................................................ 36 38 c … … 55 57 56 58 c$OMP BARRIER 57 c$OMP MASTER 58 call suspend_timer(timer_dissip) 59 call exchange_Hallo(grx,ip1jmp1,llm,0,1) 60 call resume_timer(timer_dissip) 61 c$OMP END MASTER 59 call Register_Hallo(grx,ip1jmp1,llm,0,1,1,0,Request_dissip) 60 call SendRequest(Request_dissip) 61 c$OMP BARRIER 62 call WaitRequest(Request_dissip) 62 63 c$OMP BARRIER 63 64 … … 77 78 78 79 c$OMP BARRIER 79 c$OMP MASTER 80 call suspend_timer(timer_dissip) 81 call exchange_Hallo(rot,ip1jm,llm,1,1) 82 call resume_timer(timer_dissip) 83 c$OMP END MASTER 80 call Register_Hallo(rot,ip1jm,llm,1,1,1,1,Request_dissip) 81 call SendRequest(Request_dissip) 82 c$OMP BARRIER 83 call WaitRequest(Request_dissip) 84 84 c$OMP BARRIER 85 85 … … 91 91 DO iter = 1, lr -2 92 92 c$OMP BARRIER 93 c$OMP MASTER 94 call suspend_timer(timer_dissip) 95 call exchange_Hallo(rot,ip1jm,llm,1,1) 96 call resume_timer(timer_dissip) 97 c$OMP END MASTER 93 call Register_Hallo(rot,ip1jm,llm,1,1,1,1,Request_dissip) 94 call SendRequest(Request_dissip) 98 95 c$OMP BARRIER 96 call WaitRequest(Request_dissip) 97 c$OMP BARRIER 98 99 99 CALL laplacien_rotgam_p ( klevel, rot, rot ) 100 100 ENDDO … … 110 110 CALL filtreg_p( rot, jjb,jje,jjm, klevel, 2,1, .FALSE.,1) 111 111 c$OMP BARRIER 112 c$OMP MASTER 113 call suspend_timer(timer_dissip) 114 call exchange_Hallo(rot,ip1jm,llm,1,0) 115 call resume_timer(timer_dissip) 116 c$OMP END MASTER 112 call Register_Hallo(rot,ip1jm,llm,1,0,0,1,Request_dissip) 113 call SendRequest(Request_dissip) 117 114 c$OMP BARRIER 115 call WaitRequest(Request_dissip) 116 c$OMP BARRIER 117 118 118 CALL nxgrad_p ( klevel, rot, grx, gry ) 119 119 -
LMDZ4/trunk/libf/dyn3dpar/parallel.F90
r884 r985 16 16 integer, allocatable, save, dimension(:) :: jj_nb_para 17 17 integer, save :: OMP_CHUNK 18 18 integer, save :: omp_rank 19 integer, save :: omp_size 20 !$OMP THREADPRIVATE(omp_rank) 21 19 22 contains 20 23 … … 27 30 integer :: type_size 28 31 integer, dimension(3) :: blocklen,type 29 30 32 integer :: comp_id 33 #ifdef _OPENMP 34 INTEGER :: OMP_GET_NUM_THREADS 35 EXTERNAL OMP_GET_NUM_THREADS 36 INTEGER :: OMP_GET_THREAD_NUM 37 EXTERNAL OMP_GET_THREAD_NUM 38 #endif 31 39 include 'mpif.h' 32 40 #include "dimensions.h" … … 95 103 print *,"ij_begin",ij_begin 96 104 print *,"ij_end",ij_end 97 105 106 !$OMP PARALLEL 107 108 #ifdef _OPENMP 109 !$OMP MASTER 110 omp_size=OMP_GET_NUM_THREADS() 111 !$OMP END MASTER 112 omp_rank=OMP_GET_THREAD_NUM() 113 #else 114 omp_size=1 115 omp_rank=0 116 #endif 117 !$OMP END PARALLEL 98 118 99 119 end subroutine init_parallel … … 230 250 REAL, dimension(:),allocatable :: Buffer_Recv_up,Buffer_Recv_down 231 251 INTEGER :: Buffer_size 232 252 253 !$OMP CRITICAL (MPI) 233 254 call MPI_Barrier(COMM_LMDZ,ierr) 255 !$OMP END CRITICAL (MPI) 234 256 call VTb(VThallo) 235 257 … … 266 288 allocate(Buffer_Send_up(Buffer_size)) 267 289 call PACK_Data(Field(ij_begin,1),ij,ll,down,Buffer_Send_up) 290 !$OMP CRITICAL (MPI) 268 291 call MPI_ISSEND(Buffer_send_up,Buffer_Size,MPI_REAL8,MPI_Rank-1,1, & 269 292 COMM_LMDZ,Request(NbRequest),ierr) 293 !$OMP END CRITICAL (MPI) 270 294 ENDIF 271 295 … … 277 301 call PACK_Data(Field(ij_end+1-up*iip1,1),ij,ll,up,Buffer_send_down) 278 302 303 !$OMP CRITICAL (MPI) 279 304 call MPI_ISSEND(Buffer_send_down,Buffer_Size,MPI_REAL8,MPI_Rank+1,1, & 280 305 COMM_LMDZ,Request(NbRequest),ierr) 306 !$OMP END CRITICAL (MPI) 281 307 ENDIF 282 308 … … 287 313 allocate(Buffer_recv_up(Buffer_size)) 288 314 315 !$OMP CRITICAL (MPI) 289 316 call MPI_IRECV(Buffer_recv_up,Buffer_size,MPI_REAL8,MPI_Rank-1,1, & 290 317 COMM_LMDZ,Request(NbRequest),ierr) 318 !$OMP END CRITICAL (MPI) 291 319 292 320 … … 298 326 allocate(Buffer_recv_down(Buffer_size)) 299 327 328 !$OMP CRITICAL (MPI) 300 329 call MPI_IRECV(Buffer_recv_down,Buffer_size,MPI_REAL8,MPI_Rank+1,1, & 301 330 COMM_LMDZ,Request(NbRequest),ierr) 331 !$OMP END CRITICAL (MPI) 302 332 303 333 … … 309 339 310 340 call VTe(VThallo) 341 !$OMP CRITICAL (MPI) 311 342 call MPI_Barrier(COMM_LMDZ,ierr) 343 !$OMP END CRITICAL (MPI) 344 312 345 RETURN 313 346 314 347 end subroutine exchange_Hallo 315 348 316 349 317 350 subroutine Gather_Field(Field,ij,ll,rank) 318 351 implicit none … … 342 375 if (MPI_Rank==rank) then 343 376 allocate(Buffer_Recv(ij*ll)) 377 378 !CDIR NOVECTOR 344 379 do i=0,MPI_Size-1 345 380 346 381 if (ij==ip1jmp1) then 347 382 Recv_count(i)=(jj_end_para(i)-jj_begin_para(i)+1)*ll*iip1 … … 351 386 stop 'erreur dans Gather_Field' 352 387 endif 353 388 354 389 if (i==0) then 355 390 displ(i)=0 … … 361 396 362 397 endif 363 398 399 !$OMP CRITICAL (MPI) 364 400 call MPI_GATHERV(Buffer_send,(min(ij_end,ij)-ij_begin+1)*ll,MPI_REAL8, & 365 401 Buffer_Recv,Recv_count,displ,MPI_REAL8,rank,COMM_LMDZ,ierr) 402 !$OMP END CRITICAL (MPI) 366 403 367 404 if (MPI_Rank==rank) then … … 380 417 381 418 endif 382 419 383 420 end subroutine Gather_Field 384 421 422 385 423 subroutine AllGather_Field(Field,ij,ll) 386 424 implicit none … … 394 432 395 433 call Gather_Field(Field,ij,ll,0) 434 !$OMP CRITICAL (MPI) 396 435 call MPI_BCAST(Field,ij*ll,MPI_REAL8,0,COMM_LMDZ,ierr) 436 !$OMP END CRITICAL (MPI) 397 437 398 438 end subroutine AllGather_Field … … 409 449 INTEGER :: ierr 410 450 451 !$OMP CRITICAL (MPI) 411 452 call MPI_BCAST(Field,ij*ll,MPI_REAL8,rank,COMM_LMDZ,ierr) 453 !$OMP END CRITICAL (MPI) 412 454 413 455 end subroutine Broadcast_Field -
LMDZ4/trunk/libf/dyn3dpar/qminimum_p.F
r630 r985 34 34 SAVE imprim 35 35 DATA imprim /0/ 36 c$OMP THREADPRIVATE(imprim) 36 37 INTEGER ijb,ije 38 INTEGER Index_pump(ip1jmp1) 39 INTEGER nb_pump 37 40 c 38 41 c Quand l'eau liquide est trop petite (ou negative), on prend … … 40 43 c (sans changer la temperature !) 41 44 c 45 42 46 ijb=ij_begin 43 47 ije=ij_end 44 48 49 c$OMP DO SCHEDULE(STATIC,OMP_CHUNK) 45 50 DO 1000 k = 1, llm 46 51 DO 1040 i = ijb, ije … … 50 55 1040 CONTINUE 51 56 1000 CONTINUE 57 c$OMP END DO NOWAIT 58 c$OMP BARRIER 59 c ---> SYNCHRO OPENMP ICI 60 52 61 c 53 62 c Quand l'eau vapeur est trop faible (ou negative), on complete … … 58 67 DO k = llm, 2, -1 59 68 ccc zx_abc = dpres(k) / dpres(k-1) 69 c$OMP DO SCHEDULE(STATIC) 60 70 DO i = ijb, ije 61 71 zx_abc = deltap(i,k)/deltap(i,k-1) … … 64 74 q(i,k,iq) = q(i,k,iq) + zx_defau 65 75 ENDDO 76 c$OMP END DO NOWAIT 66 77 ENDDO 78 c$OMP BARRIER 67 79 c 68 80 c Quand il s'agit de la premiere couche au-dessus du sol, on 69 81 c doit imprimer un message d'avertissement (saturation possible). 70 82 c 83 nb_pump=0 84 c$OMP DO SCHEDULE(STATIC) 71 85 DO i = ijb, ije 72 86 zx_pump(i) = AMAX1( 0.0, seuil_vap - q(i,1,iq) ) 73 87 q(i,1,iq) = AMAX1( q(i,1,iq), seuil_vap ) 88 IF (zx_pump(i) > 0.0) THEN 89 nb_pump = nb_pump+1 90 Index_pump(nb_pump)=i 91 ENDIF 74 92 ENDDO 75 pompe = SSUM(ije-ijb+1,zx_pump(ijb),1) 76 IF (imprim.LE.500 .AND. pompe.GT.0.0) THEN 77 WRITE(6,'(1x,"ATT!:on pompe de l eau au sol",e15.7)') pompe 78 DO i = ijb, ije 79 IF (zx_pump(i).GT.0.0) THEN 93 c$OMP END DO 94 ! pompe = SSUM(ije-ijb+1,zx_pump(ijb),1) 95 96 IF (imprim.LE.100 .AND. nb_pump .GT. 0 ) THEN 97 PRINT *, 'ATT!:on pompe de l eau au sol' 98 DO i = 1, nb_pump 80 99 imprim = imprim + 1 81 PRINT*,' en ',i,zx_pump(i) 82 ENDIF 100 PRINT*,' en ',index_pump(i),zx_pump(index_pump(i)) 83 101 ENDDO 84 102 ENDIF -
LMDZ4/trunk/libf/dyn3dpar/temps.h
r796 r985 18 18 INTEGER*4 day_ini, day_end, annee_ref, day_ref 19 19 REAL dt 20 21 !----------------------------------------------------------------------- 20 !$OMP THREADPRIVATE(/temps/) -
LMDZ4/trunk/libf/dyn3dpar/vlspltgen_p.F
r854 r985 87 87 c-- approximation: au milieu des couches play(l)=(p(l)+p(l+1))/2 88 88 c pour eviter une exponentielle. 89 c$OMP MASTER 89 90 90 call SetTag(MyRequest1,100) 91 91 call SetTag(MyRequest2,101) 92 c$OMP END MASTER 92 93 93 94 94 ijb=ij_begin-iip1 … … 182 182 183 183 else if (iadv(iq)==10) then 184 184 185 #ifdef _ADV_HALO 186 call vlx_p(zq(1,1,iq),pente_max,zm(1,1,iq),mu, 187 & ij_begin,ij_begin+2*iip1-1) 188 call vlx_p(zq(1,1,iq),pente_max,zm(1,1,iq),mu, 189 & ij_end-2*iip1+1,ij_end) 190 #else 185 191 call vlx_p(zq(1,1,iq),pente_max,zm(1,1,iq),mu, 186 192 & ij_begin,ij_end) 193 #endif 187 194 188 195 c$OMP MASTER 189 196 call VTb(VTHallo) 197 c$OMP END MASTER 190 198 call Register_Hallo(zq(1,1,iq),ip1jmp1,llm,2,2,2,2,MyRequest1) 191 199 call Register_Hallo(zm(1,1,iq),ip1jmp1,llm,1,1,1,1,MyRequest1) 200 201 c$OMP MASTER 192 202 call VTe(VTHallo) 193 203 c$OMP END MASTER 194 204 else if (iadv(iq)==14) then 195 205 206 #ifdef _ADV_HALO 207 call vlxqs_p(zq(1,1,iq),pente_max,zm(1,1,iq),mu,qsat, 208 & ij_begin,ij_begin+2*iip1-1) 209 call vlxqs_p(zq(1,1,iq),pente_max,zm(1,1,iq),mu,qsat, 210 & ij_end-2*iip1+1,ij_end) 211 #else 212 196 213 call vlxqs_p(zq(1,1,iq),pente_max,zm(1,1,iq),mu,qsat, 197 214 & ij_begin,ij_end) 215 #endif 216 198 217 c$OMP MASTER 199 218 call VTb(VTHallo) 219 c$OMP END MASTER 220 200 221 call Register_Hallo(zq(1,1,iq),ip1jmp1,llm,2,2,2,2,MyRequest1) 201 222 call Register_Hallo(zm(1,1,iq),ip1jmp1,llm,1,1,1,1,MyRequest1) 223 224 c$OMP MASTER 202 225 call VTe(VTHallo) 203 226 c$OMP END MASTER … … 214 237 c$OMP MASTER 215 238 call VTb(VTHallo) 239 c$OMP END MASTER 240 216 241 call SendRequest(MyRequest1) 217 call WaitRecvRequest(MyRequest1) 218 call WaitSendRequest(MyRequest1) 242 243 c$OMP MASTER 244 call VTe(VTHallo) 245 c$OMP END MASTER 246 c$OMP BARRIER 247 do iq=1,nqmx 248 249 if(iadv(iq) == 0) then 250 251 cycle 252 253 else if (iadv(iq)==10) then 254 255 #ifdef _ADV_HALLO 256 call vlx_p(zq(1,1,iq),pente_max,zm(1,1,iq),mu, 257 & ij_begin+2*iip1,ij_end-2*iip1) 258 #endif 259 else if (iadv(iq)==14) then 260 #ifdef _ADV_HALLO 261 call vlxqs_p(zq(1,1,iq),pente_max,zm(1,1,iq),mu,qsat, 262 & ij_begin+2*iip1,ij_end-2*iip1) 263 #endif 264 else 265 266 stop 'vlspltgen_p : schema non parallelise' 267 268 endif 269 270 enddo 271 c$OMP BARRIER 272 c$OMP MASTER 273 call VTb(VTHallo) 274 c$OMP END MASTER 275 276 ! call WaitRecvRequest(MyRequest1) 277 ! call WaitSendRequest(MyRequest1) 278 c$OMP BARRIER 279 call WaitRequest(MyRequest1) 280 281 282 c$OMP MASTER 219 283 call VTe(VTHallo) 220 284 c$OMP END MASTER … … 243 307 enddo 244 308 309 245 310 do iq=1,nqmx 246 311 … … 252 317 253 318 c$OMP BARRIER 319 #ifdef _ADV_HALLO 320 call vlz_p(zq(1,1,iq),pente_max,zm(1,1,iq),mw, 321 & ij_begin,ij_begin+2*iip1-1) 322 call vlz_p(zq(1,1,iq),pente_max,zm(1,1,iq),mw, 323 & ij_end-2*iip1+1,ij_end) 324 #else 254 325 call vlz_p(zq(1,1,iq),pente_max,zm(1,1,iq),mw, 255 326 & ij_begin,ij_end) 327 #endif 256 328 c$OMP BARRIER 257 329 258 330 c$OMP MASTER 259 331 call VTb(VTHallo) 332 c$OMP END MASTER 333 260 334 call Register_Hallo(zq(1,1,iq),ip1jmp1,llm,2,2,2,2,MyRequest2) 261 335 call Register_Hallo(zm(1,1,iq),ip1jmp1,llm,1,1,1,1,MyRequest2) 336 337 c$OMP MASTER 262 338 call VTe(VTHallo) 263 339 c$OMP END MASTER … … 271 347 enddo 272 348 c$OMP BARRIER 349 273 350 c$OMP MASTER 274 351 call VTb(VTHallo) 352 c$OMP END MASTER 353 275 354 call SendRequest(MyRequest2) 276 call WaitRecvRequest(MyRequest2) 277 call WaitSendRequest(MyRequest2) 355 356 c$OMP MASTER 357 call VTe(VTHallo) 358 c$OMP END MASTER 359 360 c$OMP BARRIER 361 do iq=1,nqmx 362 363 if(iadv(iq) == 0) then 364 365 cycle 366 367 else if (iadv(iq)==10 .or. iadv(iq)==14 ) then 368 c$OMP BARRIER 369 370 #ifdef _ADV_HALLO 371 call vlz_p(zq(1,1,iq),pente_max,zm(1,1,iq),mw, 372 & ij_begin+2*iip1,ij_end-2*iip1) 373 #endif 374 375 c$OMP BARRIER 376 else 377 378 stop 'vlspltgen_p : schema non parallelise' 379 380 endif 381 382 enddo 383 384 c$OMP BARRIER 385 c$OMP MASTER 386 call VTb(VTHallo) 387 c$OMP END MASTER 388 389 ! call WaitRecvRequest(MyRequest2) 390 ! call WaitSendRequest(MyRequest2) 391 c$OMP BARRIER 392 CALL WaitRequest(MyRequest2) 393 394 c$OMP MASTER 278 395 call VTe(VTHallo) 279 396 c$OMP END MASTER … … 331 448 ije=ij_end 332 449 c$OMP BARRIER 450 333 451 334 452 DO iq=1,nqmx
Note: See TracChangeset
for help on using the changeset viewer.