# Changeset 4233

Ignore:
Timestamp:
Sep 20, 2019 9:55:54 AM (4 years ago)
Message:

OpenACC support added to global_min_max.f90

Location:
palm/trunk/SOURCE
Files:
2 edited

Unmodified
Added
Removed
• ## palm/trunk/SOURCE/global_min_max.f90

 r4182 ! ----------------- ! \$Id\$ ! OpenACC support added ! ! 4182 2019-08-22 15:20:23Z scharf ! Corrected "Former revisions" section ! REAL(wp) ::  fmin_l(2)  !< #endif #if defined( _OPENACC ) REAL(wp)     ::  red        !< scalar for reduction with OpenACC INTEGER(iwp) ::  count_eq   !< counter for locations of maximum #endif REAL(wp), OPTIONAL ::  value1  !< !-- Determine absolute array maximum IF ( mode == 'abs' )  THEN #if defined( _OPENACC ) red = 0.0_wp !\$ACC PARALLEL LOOP COLLAPSE(3) PRIVATE(i, j, k) & !\$ACC PRESENT(ar) COPY(red) REDUCTION(MAX: red) DO  k = k1, k2 DO  j = j1, j2 DO  i = i1, i2 IF ( ABS( ar(i,j,k) ) > red )  THEN red = ABS( ar(i,j,k) ) ENDIF ENDDO ENDDO ENDDO fmax_l(1) = red ! !--    Determine the maximum's position and count how often it is found. count_eq = 0 !\$ACC PARALLEL LOOP COLLAPSE(3) PRIVATE(i, j, k) & !\$ACC PRESENT(ar) COPY(fmax_ijk_l(1:3), count_eq) & !\$ACC REDUCTION(+:count_eq) DO  k = k1, k2 DO  j = j1, j2 DO  i = i1, i2 IF ( ABS( ar(i,j,k) ) == red )  THEN fmax_ijk_l(1) = i fmax_ijk_l(2) = j fmax_ijk_l(3) = k count_eq = count_eq + 1 ENDIF ENDDO ENDDO ENDDO IF ( count_eq == 1 ) THEN ! !--       We found a single maximum element and correctly got its position. Transfer its !--       value to handle the negative case correctly. !\$ACC UPDATE HOST(ar(fmax_ijk_l(1):fmax_ijk_l(1),fmax_ijk_l(2),fmax_ijk_l(3))) ELSE ! !--       We found no maximum element (?) or multiple, so the position is not correct. !--       Copy the full array to the host and determine the maximum sequentially... !\$ACC UPDATE HOST(ar(i1:i2,j1:j2,k1:k2)) #endif ! ENDDO #if defined( _OPENACC ) ! !--       Close ELSE case from above ENDIF #endif ! !--    Set a flag in case that the determined value is negative.
• ## palm/trunk/SOURCE/timestep.f90

 r4182 ! ----------------- ! \$Id\$ ! OpenACC data update host removed ! ! 4182 2019-08-22 15:20:23Z scharf ! Corrected "Former revisions" section ! CALL cpu_log( log_point(12), 'calculate_timestep', 'start' ) !\$ACC UPDATE & !\$ACC HOST(u(nzb:nzt+1,nysg:nyng,nxlg:nxrg)) & !\$ACC HOST(v(nzb:nzt+1,nysg:nyng,nxlg:nxrg)) & !\$ACC HOST(w(nzb:nzt+1,nysg:nyng,nxlg:nxrg)) & !\$ACC HOST(kh(nzb:nzt+1,nysg:nyng,nxlg:nxrg)) & !\$ACC HOST(km(nzb:nzt+1,nysg:nyng,nxlg:nxrg)) ! !-- In case of Galilei-transform not using the geostrophic wind as translation
Note: See TracChangeset for help on using the changeset viewer.