Skip to content

Commit

Permalink
Merge pull request #525 from FESOM/refactoring_FCT_OMP_BUGFIX
Browse files Browse the repository at this point in the history
Refactoring fct omp bugfix
  • Loading branch information
suvarchal committed Oct 27, 2023
2 parents 449c57a + 5cdb7c8 commit 7209162
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
9 changes: 4 additions & 5 deletions src/ice_fct.F90
Original file line number Diff line number Diff line change
Expand Up @@ -504,7 +504,7 @@ subroutine ice_fem_fct(tr_array_id, ice, partit, mesh)
! it takes memory and time. For every element
! we need its antidiffusive contribution to
! each of its 3 nodes

!$OMP PARALLEL DO
!$ACC DATA CREATE(icoef, elnodes)

!$ACC PARALLEL LOOP GANG VECTOR DEFAULT(PRESENT)
Expand All @@ -513,20 +513,18 @@ subroutine ice_fem_fct(tr_array_id, ice, partit, mesh)
tmin(n) = 0.0_WP
end do
!$ACC END PARALLEL LOOP

!$OMP END PARALLEL DO
! Auxiliary elemental operator (mass matrix- lumped mass matrix)

!$ACC KERNELS
icoef = 1
!$ACC END KERNELS

!$ACC PARALLEL LOOP GANG VECTOR DEFAULT(PRESENT)
do n=1,3 ! three upper nodes
! Cycle over rows row=elnodes(n)
icoef(n,n)=-2
end do
!$ACC END PARALLEL LOOP

!$OMP PARALLEL DEFAULT(SHARED) PRIVATE(n, q, elem, elnodes, row, vol, flux, ae)
!$OMP DO

Expand Down Expand Up @@ -1117,7 +1115,7 @@ subroutine ice_TG_rhs_div(ice, partit, mesh)
! Computes the rhs in a Taylor-Galerkin way (with upwind type of
! correction for the advection operator)
! In this version I tr to split divergent term off, so that FCT works without it.

!$OMP PARALLEL DO
!$ACC PARALLEL LOOP GANG VECTOR DEFAULT(PRESENT)
do row=1, myDim_nod2D
!! row=myList_nod2D(m)
Expand All @@ -1135,6 +1133,7 @@ subroutine ice_TG_rhs_div(ice, partit, mesh)
#endif
end do
!$ACC END PARALLEL LOOP
!$OMP END PARALLEL DO

!$OMP PARALLEL DEFAULT(SHARED) PRIVATE(diff, entries, um, vm, vol, dx, dy, n, q, row, elem, elnodes, c1, c2, c3, c4, cx1, cx2, cx3, cx4, entries2)
!$OMP DO
Expand Down
2 changes: 1 addition & 1 deletion src/oce_ale.F90
Original file line number Diff line number Diff line change
Expand Up @@ -2495,7 +2495,7 @@ subroutine vert_vel_ale(dynamics, partit, mesh)
end do
!$OMP END PARALLEL DO

!$OMP PARALLEL DO DEFAULT(SHARED) PRIVATE(n, nz, nzmin, nzmax)
!$OMP PARALLEL DO DEFAULT(SHARED) PRIVATE(n, nz, nzmin, nzmax, c1, c2)
do n=1, myDim_nod2D+eDim_nod2D
nzmin = ulevels_nod2D(n)
nzmax = nlevels_nod2D(n)-1
Expand Down

0 comments on commit 7209162

Please sign in to comment.