Changeset 4719 for palm/trunk/SOURCE/pres.f90
- Timestamp:
- Oct 1, 2020 11:28:33 AM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
palm/trunk/SOURCE/pres.f90
r4717 r4719 25 25 ! ----------------- 26 26 ! $Id$ 27 ! Bugfix of previous commit (div_old discrepancy) 28 ! 29 ! 4717 2020-09-30 22:27:40Z pavelkrc 27 30 ! Fixes and optimizations of OpenMP parallelization, formatting of OpenMP 28 31 ! directives (J. Resler) … … 174 177 REAL(wp) :: ddt_3d !< 175 178 REAL(wp) :: d_weight_pres !< 179 REAL(wp) :: localsum !< 176 180 REAL(wp) :: threadsum !< 177 181 REAL(wp) :: weight_pres_l !< … … 386 390 ENDIF 387 391 388 !$OMP PARALLEL DO PRIVATE (i,j,k) SCHEDULE( STATIC ) 392 localsum = 0.0_wp 393 threadsum = 0.0_wp 394 395 !$OMP PARALLEL PRIVATE (i,j,k) 396 !$OMP DO SCHEDULE( STATIC ) 389 397 !$ACC PARALLEL LOOP COLLAPSE(3) PRIVATE(i, j, k) & 390 398 !$ACC PRESENT(u, v, w, rho_air, rho_air_zw, ddzw, wall_flags_total_0) & … … 401 409 ENDDO 402 410 ENDDO 411 !$OMP END PARALLEL 403 412 404 413 ! … … 407 416 IF ( intermediate_timestep_count == intermediate_timestep_count_max .OR. & 408 417 intermediate_timestep_count == 0 ) THEN 409 threadsum = 0.0_wp410 !$OMP PARALLEL DO PRIVATE (i,j,k) REDUCTION(+:threadsum)SCHEDULE( STATIC )418 !$OMP PARALLEL PRIVATE (i,j,k) FIRSTPRIVATE(threadsum) REDUCTION(+:localsum) 419 !$OMP DO SCHEDULE( STATIC ) 411 420 !$ACC PARALLEL LOOP COLLAPSE(3) PRIVATE(i,j,k) & 412 421 !$ACC REDUCTION(+:threadsum) COPY(threadsum) & … … 419 428 ENDDO 420 429 ENDDO 421 threadsum = threadsum + threadsum * dt_3d * weight_pres_l 430 localsum = localsum + threadsum * dt_3d * weight_pres_l 431 !$OMP END PARALLEL 422 432 ENDIF 423 433 … … 426 436 IF ( intermediate_timestep_count == intermediate_timestep_count_max .OR. & 427 437 intermediate_timestep_count == 0 ) THEN 428 sums_divold_l(0:statistic_regions) = threadsum438 sums_divold_l(0:statistic_regions) = localsum 429 439 ENDIF 430 440 … … 665 675 IF ( conserve_volume_flow .AND. bc_lr_cyc .AND. bc_ns_cyc .AND. nxr == nx ) THEN 666 676 667 !$OMP PARALLEL DO PRIVATE (j,k) REDUCTION ( volume_flow_l(1))677 !$OMP PARALLEL DO PRIVATE (j,k) REDUCTION (+:volume_flow_l(1)) 668 678 DO j = nys, nyn 669 679 DO k = nzb+1, nzt … … 677 687 IF ( conserve_volume_flow .AND. bc_ns_cyc .AND. bc_lr_cyc .AND. nyn == ny ) THEN 678 688 679 !$OMP PARALLEL DO PRIVATE (i,k) REDUCTION ( volume_flow_l(2))689 !$OMP PARALLEL DO PRIVATE (i,k) REDUCTION (+:volume_flow_l(2)) 680 690 DO i = nxl, nxr 681 691 DO k = nzb+1, nzt … … 736 746 IF ( topography /= 'flat' ) d = 0.0_wp 737 747 738 !$OMP PARALLEL DO PRIVATE (i,j,k) SCHEDULE( STATIC ) 748 localsum = 0.0_wp 749 threadsum = 0.0_wp 750 751 !$OMP PARALLEL PRIVATE (i,j,k) FIRSTPRIVATE(threadsum) REDUCTION(+:localsum) 752 !$OMP DO SCHEDULE( STATIC ) 739 753 !$ACC PARALLEL LOOP COLLAPSE(3) PRIVATE(i, j, k) & 740 754 !$ACC PRESENT(u, v, w, rho_air, rho_air_zw, ddzw, wall_flags_total_0) & … … 753 767 ! 754 768 !-- Compute possible PE-sum of divergences for flow_statistics 755 threadsum = 0.0_wp 756 !$OMP PARALLEL DO PRIVATE (i,j,k) REDUCTION(+:threadsum) SCHEDULE( STATIC ) 769 !$OMP DO SCHEDULE( STATIC ) 757 770 !$ACC PARALLEL LOOP COLLAPSE(3) PRIVATE(i, j, k) & 758 771 !$ACC REDUCTION(+:threadsum) COPY(threadsum) & … … 766 779 ENDDO 767 780 781 localsum = localsum + threadsum 782 !$OMP END PARALLEL 783 768 784 ! 769 785 !-- For completeness, set the divergence sum of all statistic regions to those of the total 770 786 !-- domain 771 sums_divnew_l(0:statistic_regions) = threadsum787 sums_divnew_l(0:statistic_regions) = localsum 772 788 773 789 CALL cpu_log( log_point_s(1), 'divergence', 'stop' )
Note: See TracChangeset
for help on using the changeset viewer.