Skip to content

Commit

Permalink
fixed compile problems when compiling with OpenMP but still using one…
Browse files Browse the repository at this point in the history
… thread
  • Loading branch information
mvertens committed Aug 12, 2024
1 parent 076c4eb commit f009062
Showing 1 changed file with 16 additions and 20 deletions.
36 changes: 16 additions & 20 deletions phy/mod_nctools.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1268,8 +1268,8 @@ subroutine ncpack(vnm,dims,fld,msk,mskflg,sfac,offs)
fldmax = -abs(fillr8)

if (mskflg == 1) then
!$omp parallel do reduction(min:fldmin) reduction(max:fldmax)
!$omp private(j,i,ij,ijk)
!$omp parallel do private(j,i,ij,ijk) &
!$omp reduction(min:fldmin) reduction(max:fldmax)
do k = 1,kd
do j = 1,jj
do i = 1,ii
Expand All @@ -1284,8 +1284,8 @@ subroutine ncpack(vnm,dims,fld,msk,mskflg,sfac,offs)
end do
!$omp end parallel do
else if (mskflg == 2) then
!$omp parallel do reduction(min:fldmin) reduction(max:fldmax)
!$omp private(j,i,ij,ijk)
!$omp parallel do private(j,i,ij,ijk) &
!$omp reduction(min:fldmin) reduction(max:fldmax)
do k = 1,kd
do j = 1,jj
do i = 1,ii
Expand All @@ -1300,8 +1300,8 @@ subroutine ncpack(vnm,dims,fld,msk,mskflg,sfac,offs)
end do
!$omp end parallel do
else
!$omp parallel do reduction(min:fldmin) reduction(max:fldmax)
!$omp private(j,i,ijk)
!$omp parallel do private(j,i,ij,ijk) &
!$omp reduction(min:fldmin) reduction(max:fldmax)
do k = 1,kd
do j = 1,jj
do i = 1,ii
Expand Down Expand Up @@ -1350,8 +1350,7 @@ subroutine ncpack(vnm,dims,fld,msk,mskflg,sfac,offs)

! --- Prepare and write output field
if (mskflg == 1) then
!$omp parallel do
!$omp private(j,i,ij)
!$omp parallel do private(j,i,ij)
do k = 1,kd
do j = 1,jj
do i = 1,ii
Expand All @@ -1366,8 +1365,7 @@ subroutine ncpack(vnm,dims,fld,msk,mskflg,sfac,offs)
end do
!$omp end parallel do
else if (mskflg == 2) then
!$omp parallel do
!$omp private(j,i,ij,ijk)
!$omp parallel do private(j,i,ij,ijk)
do k = 1,kd
do j = 1,jj
do i = 1,ii
Expand All @@ -1383,8 +1381,7 @@ subroutine ncpack(vnm,dims,fld,msk,mskflg,sfac,offs)
end do
!$omp end parallel do
else
!$omp parallel do
!$omp private(j,i,ijk)
!$omp parallel do private(j,i,ijk)
do k = 1,kd
do j = 1,jj
do i = 1,ii
Expand Down Expand Up @@ -1446,8 +1443,8 @@ subroutine ncpack(vnm,dims,fld,msk,mskflg,sfac,offs)
fldmin = abs(fillr8)
fldmax = -abs(fillr8)
if (mskflg == 1) then
!$omp parallel do reduction(min:fldmin) reduction(max:fldmax) &
!$omp private(j,i,ij,ijk)
!$omp parallel do private(j,i,ij,ijk) &
!$omp reduction(min:fldmin) reduction(max:fldmax)
do k = 1,kd
do j = 1,jj
do i = 1,ii
Expand All @@ -1462,8 +1459,8 @@ subroutine ncpack(vnm,dims,fld,msk,mskflg,sfac,offs)
end do
!$omp end parallel do
else if (mskflg == 2) then
!$omp parallel do reduction(min:fldmin) reduction(max:fldmax) &
!$omp private(j,i,ij,ijk)
!$omp parallel do private(j,i,ij,ijk) &
!$omp reduction(min:fldmin) reduction(max:fldmax)
do k = 1,kd
do j = 1,jj
do i = 1,ii
Expand All @@ -1478,8 +1475,8 @@ subroutine ncpack(vnm,dims,fld,msk,mskflg,sfac,offs)
end do
!$omp end parallel do
else
!$omp parallel do reduction(min:fldmin) reduction(max:fldmax) &
!$omp private(j,i,ijk)
!$omp parallel do private(j,i,ijk) &
!$omp reduction(min:fldmin) reduction(max:fldmax)
do k = 1,kd
do j = 1,jj
do i = 1,ii
Expand Down Expand Up @@ -1914,8 +1911,7 @@ subroutine nccopa(vnm,dims,fld,msk,sfac,offs)

! --- Prepare and write output field
do k = 1,kd
!$omp parallel do
!$omp private(i,ij,ijk)
!$omp parallel do private(i,ij,ijk)
do j = 1,jj
do i = 1,ii
ij = i+nbdy+(idm+2*nbdy)*(j+nbdy-1)
Expand Down

0 comments on commit f009062

Please sign in to comment.