Changeset 1046


Ignore:
Timestamp:
08/20/20 16:22:41 (4 years ago)
Author:
ymipsl
Message:

Introduce modification from A. Durocher github to make held&suarez testcase working on GPU

YM & AD

Location:
codes/icosagcm/trunk/src
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • codes/icosagcm/trunk/src/diagnostics/geopotential_mod.f90

    r899 r1046  
    2828       theta_rhodz = f_theta_rhodz(ind) 
    2929       theta = f_theta(ind) 
    30        CALL compute_theta_rhodz2theta(ps, theta_rhodz,theta,0) 
     30       CALL compute_theta_rhodz2theta(ps, theta_rhodz,theta,0, ondevice=.FALSE.) 
    3131       phis = f_phis(ind) 
    3232       phi = f_phi(ind) 
  • codes/icosagcm/trunk/src/diagnostics/theta_rhodz.f90

    r548 r1046  
    3939      theta_rhodz=f_theta_rhodz(ind) 
    4040      theta=f_theta(ind) 
    41       CALL compute_theta_rhodz2theta(ps, theta_rhodz,theta,0) 
     41      CALL compute_theta_rhodz2theta(ps, theta_rhodz,theta,0, ondevice=.false.) 
    4242    ENDDO 
    4343!$OMP BARRIER 
     
    132132      theta=f_theta(ind) 
    133133      theta_rhodz=f_theta_rhodz(ind) 
    134       CALL compute_theta2theta_rhodz(ps, theta, theta_rhodz,0) 
     134      CALL compute_theta2theta_rhodz(ps, theta, theta_rhodz,0,ondevice=.false.) 
    135135    ENDDO 
    136136!$OMP BARRIER 
     
    138138  END SUBROUTINE theta2theta_rhodz 
    139139   
    140   SUBROUTINE compute_theta2theta_rhodz(ps,theta, theta_rhodz,offset) 
     140  SUBROUTINE compute_theta2theta_rhodz(ps,theta, theta_rhodz,offset, ondevice) 
    141141  USE icosa 
    142142  USE disvert_mod 
     
    147147    REAL(rstd),INTENT(OUT) :: theta_rhodz(iim*jjm,llm) 
    148148    INTEGER,INTENT(IN) :: offset 
     149    LOGICAL, INTENT(IN) :: ondevice 
    149150    REAL(rstd) :: rhodz 
    150151    INTEGER :: i,j,ij,l 
    151152     
    152153!$OMP BARRIER 
     154    !$acc parallel loop collapse(3) default(present) async if(ondevice) 
    153155    DO    l    = ll_begin, ll_end 
    154156      DO j=jj_begin-offset,jj_end+offset 
     
    165167  END SUBROUTINE compute_theta2theta_rhodz 
    166168 
    167   SUBROUTINE compute_theta_rhodz2theta(ps,theta_rhodz,theta,offset) 
     169  SUBROUTINE compute_theta_rhodz2theta(ps,theta_rhodz,theta,offset,ondevice) 
    168170  USE icosa 
    169171  USE disvert_mod 
     
    174176    REAL(rstd),INTENT(OUT) :: theta(iim*jjm,llm) 
    175177    INTEGER,INTENT(IN) :: offset 
     178    LOGICAL, INTENT(IN) :: ondevice 
    176179    REAL(rstd) :: rhodz 
    177180    INTEGER :: i,j,ij,l 
    178181 
    179182!$OMP BARRIER 
     183    !$acc parallel loop collapse(3) default(present) async if(ondevice) 
    180184    DO    l    = ll_begin, ll_end 
    181185      DO j=jj_begin-offset,jj_end+offset 
  • codes/icosagcm/trunk/src/initial/etat0_academic.f90

    r899 r1046  
    228228    ENDDO 
    229229 
    230     CALL compute_theta2theta_rhodz(ps,theta,theta_rhodz,1) 
     230    CALL compute_theta2theta_rhodz(ps,theta,theta_rhodz,1, ondevice=.false.) 
    231231        
    232232 
  • codes/icosagcm/trunk/src/initial/etat0_heldsz.f90

    r970 r1046  
    8989       theta=f_theta(ind) 
    9090       CALL compute_etat0_heldsz(theta_eq,theta) 
    91        CALL compute_theta2theta_rhodz(ps,theta,theta_rhodz(:,:,1),1) 
     91       CALL compute_theta2theta_rhodz(ps,theta,theta_rhodz(:,:,1),1, ondevice=.false.) 
    9292       IF(nqtot>0) THEN 
    9393          q=f_q(ind) 
     
    9696          IF(nqtot>2) q(:,:,3:)=0. 
    9797       END IF 
     98    
     99       call update_device_field(f_theta_eq) 
     100       call update_device_field(f_theta) 
     101      !$acc enter data copyin(knewt_t(:)) async 
     102      !$acc enter data copyin(kfrict(:)) async 
     103 
    98104    ENDDO 
    99105  END SUBROUTINE etat0 
     
    236242    INTEGER :: i,j,l,ij 
    237243 
    238     CALL compute_theta_rhodz2theta(ps,theta_rhodz,theta,1) 
     244    CALL compute_theta_rhodz2theta(ps,theta_rhodz,theta,1, ondevice=.TRUE.) 
    239245    DO l=ll_begin,ll_end 
    240246       DO j=jj_begin-1,jj_end+1 
     
    246252       ENDDO 
    247253    ENDDO 
    248     CALL compute_theta2theta_rhodz(ps,theta,theta_rhodz,1) 
    249  
    250     Do l=ll_begin,ll_end 
     254    CALL compute_theta2theta_rhodz(ps,theta,theta_rhodz,1, ondevice=.true.) 
     255 
     256    !$acc kernels default(present) async 
     257    DO l=ll_begin,ll_end 
    251258       u(:,l)=u(:,l)*(1.-itau_physics*dt*kfrict(l)) 
    252259    END DO 
     260    !$acc end kernels 
    253261 
    254262  END SUBROUTINE compute_heldsz 
  • codes/icosagcm/trunk/src/physics/physics.f90

    r953 r1046  
    113113 
    114114!$OMP PARALLEL 
    115     CALL allocate_field(f_du_phys,field_u,type_real,llm, name='du_phys') 
     115    CALL allocate_field(f_du_phys,field_u,type_real,llm, name='du_phys', ondevice=.TRUE.) 
    116116 
    117117    IF(is_mpi_root) PRINT *, 'phys_type = ',phys_type 
     
    119119     
    120120!$OMP END PARALLEL 
    121     IF (phys_type /= phys_none) THEN 
    122        CALL abort_acc("physics /= 'none'") 
     121    IF (phys_type /= phys_none .AND. phys_type /= phys_HS94) THEN 
     122       CALL abort_acc("only phys_type == 'phys_none' or 'phys_HS94' supported") 
    123123    END IF 
    124124  END SUBROUTINE init_physics 
     
    133133       CALL swap_geometry(ind) 
    134134       du=f_du_phys(ind) 
     135 
     136       !$acc kernels default(present) async 
    135137       du(:,ll_begin:ll_end) = 0. 
     138       !$acc end kernels 
     139           
    136140    END DO 
    137141  END SUBROUTINE zero_du_phys 
     
    141145    TYPE(t_field),POINTER :: f_u(:) ! velocity field before/after call to physics 
    142146    REAL(rstd), DIMENSION(:,:), POINTER :: u, du 
    143     INTEGER :: ind 
     147    INTEGER :: ind, ij 
     148 
    144149    DO ind=1,ndomain 
    145150       IF (.NOT. assigned_domain(ind)) CYCLE 
     
    148153       du=f_du_phys(ind) 
    149154       u=f_u(ind) 
    150        du(:,ll_begin:ll_end) = du(:,ll_begin:ll_end) + coef*u(:,ll_begin:ll_end) 
     155 
     156       !$acc parallel loop default(present) async 
     157       DO ij = ij_begin, ij_end 
     158          du(ij,ll_begin:ll_end) = du(ij,ll_begin:ll_end) + coef*u(ij,ll_begin:ll_end) 
     159       END DO 
     160 
    151161    END DO 
    152162  END SUBROUTINE add_du_phys 
     
    228238    USE wind_mod 
    229239    USE output_field_mod 
    230     CALL transfert_request(f_du_phys,req_e1_vect) 
     240 
     241    CALL transfert_request(f_du_phys,req_e1_vect)     
     242    CALL update_host_field(f_du_phys) 
     243 
    231244    CALL un2ulonlat(f_du_phys, f_buf_ulon, f_buf_ulat, (1./(dt*itau_out))) 
    232245    CALL output_field("dulon_phys",f_buf_ulon) 
Note: See TracChangeset for help on using the changeset viewer.