New URL for NEMO forge!   http://forge.nemo-ocean.eu

Since March 2022 along with NEMO 4.2 release, the code development moved to a self-hosted GitLab.
This present forge is now archived and remained online for history.
Changeset 7508 for branches/2016/dev_r6519_HPC_4/NEMOGCM/NEMO/OPA_SRC/lib_fortran.F90 – NEMO

Ignore:
Timestamp:
2016-12-19T13:15:59+01:00 (8 years ago)
Author:
mocavero
Message:

changes on code duplication and workshare construct

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2016/dev_r6519_HPC_4/NEMOGCM/NEMO/OPA_SRC/lib_fortran.F90

    r6140 r7508  
    103103      !!----------------------------------------------------------------------- 
    104104      REAL(wp), INTENT(in), DIMENSION(:,:,:) ::   ptab          ! input 3D array 
    105       REAL(wp)                               ::   glob_sum_3d   ! global masked sum 
    106       !! 
    107       INTEGER :: jk 
     105      REAL(wp)                               ::   glob_sum_3d, a, b   ! global masked sum 
     106      !! 
     107      INTEGER :: jk, jj, ji 
    108108      INTEGER :: ijpk ! local variable: size of the 3d dimension of ptab 
    109109      !!----------------------------------------------------------------------- 
     
    112112      ! 
    113113      glob_sum_3d = 0.e0 
     114!$OMP PARALLEL 
     115!$OMP DO schedule(static) private(jk,jj,ji,b) REDUCTION(+:a,glob_sum_3d) 
    114116      DO jk = 1, ijpk 
    115          glob_sum_3d = glob_sum_3d + SUM( ptab(:,:,jk)*tmask_i(:,:) ) 
    116       END DO 
     117      a = 0.e0 
     118      b = 0.e0 
     119         DO jj = 1, jpj 
     120            DO ji = 1, jpi 
     121               b = ptab(ji,jj,jk)*tmask_i(ji,jj) 
     122               a = a + b 
     123           END DO 
     124         END DO 
     125         glob_sum_3d = glob_sum_3d + a 
     126      END DO 
     127!$OMP END PARALLEL 
     128 
    117129      IF( lk_mpp )   CALL mpp_sum( glob_sum_3d ) 
    118130      ! 
Note: See TracChangeset for help on using the changeset viewer.