Ignore:
Timestamp:
01/20/18 18:46:10 (6 years ago)
Author:
dubos
Message:

devel/unstructured : OpenMP fixes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • codes/icosagcm/devel/src/unstructured/timestep_unstructured.F90

    r658 r665  
    4545    FIELD_GEOPOT :: wflux, w, geopot, &               ! DIAG, INOUT 
    4646         dPhi_fast, dPhi_slow, dW_fast, dW_slow       ! OUT 
    47     FIELD_U      :: u,du_fast,du_slow,hflux,Ftheta,qu ! INOUT,OUT,OUT,DIAG 
     47    FIELD_U      :: u,du_fast,du_slow,hflux,qu        ! INOUT,OUT,OUT,DIAG 
    4848    FIELD_Z      :: qv                                ! DIAG 
    4949    FIELD_PS     :: ps,dmass_col,mass_col             ! OUT,OUT,IN (if eta_mass) or OUT,UNUSED,UNUSED (if eta_lag) 
    50     FIELD_UL     :: wwuu 
     50    ! buffers for fields that need to be shared among OpenMP threads 
     51    ! vertical size is allocated as llm+1 even if only llm is needed 
     52    FIELD_GEOPOT :: bufm1, bufm2, bufm3 
     53    FIELD_UL     :: bufu1, bufu2, bufu3,bufu4 
     54 
    5155    DBL          :: time1,time2 
    5256    INTEGER :: ij 
    5357     
    54     CALL init_trace() 
    5558    !  CALL CPU_TIME(time1) 
    5659    time1=OMP_GET_WTIME() 
     
    7275       CALL compute_pvort_only(rhodz,u,qv,qu) 
    7376       CALL compute_caldyn_slow_hydro(rhodz,theta,u, berni,hflux,du_slow) 
    74        CALL compute_coriolis(hflux,theta,qu,Ftheta, drhodz,dtheta_rhodz,du_slow) 
     77       CALL compute_coriolis(hflux,theta,qu, bufu1, drhodz,dtheta_rhodz,du_slow) 
    7578       IF(caldyn_eta == eta_mass) THEN 
    76           CALL caldyn_vert(drhodz,rhodz,theta,u, dmass_col,wflux,dtheta_rhodz,du_slow,wwuu) 
     79          CALL caldyn_vert(drhodz,rhodz,theta,u, dmass_col,wflux,dtheta_rhodz,du_slow,bufu1) 
    7780       END IF 
    7881       !$OMP END PARALLEL 
     
    8891       END DO 
    8992       CALL compute_theta(mass_col,rhodz,theta_rhodz, theta) 
    90        CALL compute_caldyn_solver(tau,rhodz,theta,pk,geopot,W,dPhi_fast,dW_fast,du_fast) 
     93       CALL compute_caldyn_solver(tau,rhodz,theta, bufm1,bufm2,bufm3, pk,geopot,W,dPhi_fast,dW_fast,du_fast) 
    9194       CALL compute_caldyn_fast(tau, pk,berni,theta,geopot, du_fast,u) 
    9295       CALL compute_pvort_only(rhodz,u,qv,qu) 
    93        CALL compute_caldyn_slow_NH(u,rhodz,geopot,W, hflux,du_slow,dPhi_slow,dW_slow)  
    94        CALL compute_coriolis(hflux,theta,qu,Ftheta, drhodz,dtheta_rhodz,du_slow) 
     96       CALL compute_caldyn_slow_NH(u,rhodz,geopot,W, bufm1,bufm2,bufm3,bufu1,bufu2,bufu3,bufu4, hflux,du_slow,dPhi_slow,dW_slow)  
     97       CALL compute_coriolis(hflux,theta,qu, bufu1, drhodz,dtheta_rhodz,du_slow) 
    9598       IF(caldyn_eta == eta_mass) THEN 
    96           CALL caldyn_vert(drhodz,rhodz,theta,u, dmass_col,wflux,dtheta_rhodz,du_slow,wwuu) 
    97           CALL compute_caldyn_vert_NH(rhodz,geopot,W,wflux, du_slow,dPhi_slow,dW_slow) 
     99          CALL caldyn_vert(drhodz,rhodz,theta,u, dmass_col,wflux,dtheta_rhodz,du_slow,bufu1) 
     100          CALL compute_caldyn_vert_NH(rhodz,geopot,W,wflux, bufm1,bufm2,bufm3, du_slow,dPhi_slow,dW_slow) 
    98101       END IF 
    99102    END IF 
     
    117120    FIELD_MASS   :: rhodz, pk, berni                 ! IN, DIAG 
    118121    FIELD_THETA  :: theta_rhodz, theta               ! IN, DIAG 
    119     FIELD_U      :: u,hflux,qu,Ftheta                ! INOUT,DIAG*3 
    120     FIELD_GEOPOT :: geopot, w, wflux, w_il           ! IN, INOUT, DIAG, DIAG 
     122    FIELD_U      :: u,hflux,qu                       ! INOUT,DIAG*2 
     123    FIELD_GEOPOT :: geopot, w, wflux                 ! IN, INOUT, DIAG 
    121124    FIELD_Z      :: qv                               ! DIAG 
    122125    DOUBLE2(       primal_num, max_nb_stage) :: dmass_col    ! OUT 
     
    126129    DOUBLE3(llm+1, primal_num, max_nb_stage) :: & 
    127130         dPhi_fast, dPhi_slow, dW_fast, dW_slow      ! OUT 
    128     FIELD_UL     :: DePhil, v_el, G_el, wwuu         ! DIAG*4 
     131    ! buffers for fields that need to be shared among OpenMP threads 
     132    ! vertical size is allocated as llm+1 even if only llm is needed 
     133    FIELD_GEOPOT :: bufm1, bufm2, bufm3 
     134    FIELD_UL     :: bufu1, bufu2, bufu3,bufu4 
    129135    DBL       :: time1,time2 
    130136    INTEGER :: step, stage, ij 
    131137     
    132     CALL init_trace() 
    133138    !CALL CPU_TIME(time1) 
    134139    time1=OMP_GET_WTIME() 
     
    154159             CALL compute_pvort_only(rhodz,u,qv,qu) 
    155160             CALL compute_caldyn_slow_hydro(rhodz,theta,u, berni,hflux,du_slow(:,:,stage)) 
    156              CALL compute_coriolis(hflux,theta,qu,Ftheta, drhodz(:,:,stage), dtheta_rhodz(:,:,:,stage),du_slow(:,:,stage)) 
     161             CALL compute_coriolis(hflux,theta,qu, bufu1, drhodz(:,:,stage), dtheta_rhodz(:,:,:,stage),du_slow(:,:,stage)) 
    157162             IF(caldyn_eta == eta_mass) THEN 
    158163                CALL caldyn_vert(drhodz(:,:,stage),rhodz,theta,u, & 
    159                      dmass_col(:,stage),wflux,dtheta_rhodz(:,:,:,stage),du_slow(:,:,stage),wwuu) 
     164                     dmass_col(:,stage),wflux,dtheta_rhodz(:,:,:,stage),du_slow(:,:,stage),bufu1) 
    160165             END IF 
    161166              
     
    168173             !$OMP END DO 
    169174             CALL compute_theta(mass_col,rhodz,theta_rhodz, theta) 
    170              CALL compute_caldyn_solver(tauj(stage),rhodz,theta,pk,geopot,W, & 
     175             CALL compute_caldyn_solver(tauj(stage),rhodz,theta, bufm1,bufm2,bufm3, pk,geopot,W, & 
    171176                  dPhi_fast(:,:,stage), dW_fast(:,:,stage), du_fast(:,:,stage)) 
    172177             CALL compute_caldyn_fast(tauj(stage), pk,berni,theta,geopot, du_fast(:,:,stage),u) 
    173178             CALL compute_pvort_only(rhodz,u,qv,qu) 
    174              CALL compute_caldyn_slow_NH(u,rhodz,geopot,W, hflux, du_slow(:,:,stage), dPhi_slow(:,:,stage), dW_slow(:,:,stage)) 
    175              CALL compute_coriolis(hflux,theta,qu,Ftheta, drhodz(:,:,stage),dtheta_rhodz(:,:,:,stage), du_slow(:,:,stage)) 
     179             CALL compute_caldyn_slow_NH(u,rhodz,geopot,W, bufm1,bufm2,bufm3,bufu1,bufu2,bufu3,bufu4, hflux, & 
     180                  du_slow(:,:,stage), dPhi_slow(:,:,stage), dW_slow(:,:,stage)) 
     181             CALL compute_coriolis(hflux,theta,qu, bufu1, drhodz(:,:,stage),dtheta_rhodz(:,:,:,stage), du_slow(:,:,stage)) 
    176182             IF(caldyn_eta == eta_mass) THEN 
    177183                CALL caldyn_vert(drhodz(:,:,stage),rhodz,theta,u, & 
    178                      dmass_col(:,stage),wflux,dtheta_rhodz(:,:,:,stage), du_slow(:,:,stage), wwuu) 
    179                 CALL compute_caldyn_vert_NH(rhodz,geopot,W,wflux, du_slow(:,:,stage), dPhi_slow(:,:,stage), dW_slow(:,:,stage) ) 
     184                     dmass_col(:,stage),wflux,dtheta_rhodz(:,:,:,stage), du_slow(:,:,stage), bufu1) 
     185                CALL compute_caldyn_vert_NH(rhodz,geopot,W,wflux, bufm1,bufm2,bufm3, & 
     186                     du_slow(:,:,stage), dPhi_slow(:,:,stage), dW_slow(:,:,stage) ) 
    180187             END IF 
    181188          END IF ! NH 
Note: See TracChangeset for help on using the changeset viewer.