Changeset 4445 for LMDZ6/branches


Ignore:
Timestamp:
Feb 28, 2023, 7:32:27 PM (15 months ago)
Author:
Laurent Fairhead
Message:

Updated routine for GPU port

File:
1 edited

Legend:

Unmodified
Added
Removed
  • LMDZ6/branches/Portage_acc/libf/dyn3d/replay3d.F90

    r4113 r4445  
    2121        grossismx, grossismy, dzoomx, dzoomy,taux,tauy
    2222  USE mod_const_mpi, ONLY: comm_lmdz
    23 
     23#ifdef _OPENACC
     24    USE openacc
     25#endif
    2426
    2527
     
    8890  INTEGER :: an, mois, jour
    8991  REAL :: heure
     92  REAL(kind=8) :: elapsed_time, mean_elapsed=0.  ! real time in seconds
     93
    9094
    9195  !   Initialisations:
    9296  !   ----------------
    93 
     97#ifdef _OPENACC
     98    INTEGER :: numdev
     99
     100    !$acc init
     101
     102    ! get the number of NVIDIA devices on this node
     103    numdev = acc_get_num_devices(ACC_DEVICE_NVIDIA)
     104    PRINT *, 'init_physics : number of available GPU devices', numdev
     105    IF (numdev < 1) STOP "Error: there are no devices available on this host. ABORTING"
     106    CALL acc_init(ACC_DEVICE_NVIDIA)
     107    numdev = acc_get_device_num(ACC_DEVICE_NVIDIA)
     108    PRINT *, 'init_physics : GPU device id = ', numdev
     109#endif
    94110
    95111  !----------------------------------------------------------------------
     
    187203! Boucle en temps sur l'appel à la parametrisation
    188204!---------------------------------------------------------------------
     205!      ntime = 97
     206      write(6,*)'number of loops to do = '
     207      read(5,*) ntime
    189208      DO it=1,ntime
    190          print*,'Pas de temps ',it,klon,klev
    191          call call_param_replay(klon,klev)
     209!         print*,'Pas de temps ',it,klon,klev
     210         call call_param_replay(klon,klev,elapsed_time)
     211         mean_elapsed=mean_elapsed+elapsed_time/real(ntime)
    192212      ENDDO
    193 
     213      write(6,*)'Mean elapsed time = ',mean_elapsed
    194214
    195215END PROGRAM replay3d
Note: See TracChangeset for help on using the changeset viewer.