Skip to content
Snippets Groups Projects
Commit 309c6f36 authored by Juan Escobar's avatar Juan Escobar
Browse files

Juan 25/08/2021:tools.f90, countjv_device , nvhpc21.X bug on atomic in host ->...

Juan 25/08/2021:tools.f90, countjv_device , nvhpc21.X bug on atomic in host -> switch to version without atomic on HOST
parent 7915cf85
No related branches found
No related tags found
No related merge requests found
......@@ -21,6 +21,7 @@ module mode_tools
! P. Wautelet 28/05/2019: move COUNTJV function to tools.f90
! P. Wautelet 05/06/2019: add Countjv_device
! P. Wautelet 20/06/2019: add Countjv1d, Countjv1d_device and Countjv2d_device subroutines
! J. Escobar 25/08/2021: nvhpc21.X bug on 'atomic' in host -> switch to version without atomic on HOST
implicit none
......@@ -108,6 +109,7 @@ end function Countjv3d
#ifdef MNH_OPENACC
subroutine Countjv1d_device(ltab, i1,ic)
use mode_mppdb, only: mppdb_initialized
use MODE_OPENACC_SET_DEVICE, only : mnh_idevice_type_current, acc_device_nvidia
logical, dimension(:), intent(in) :: ltab ! Mask
integer, dimension(:), intent(out) :: i1 ! Positions of elements with 'true' value
......@@ -118,7 +120,7 @@ subroutine Countjv1d_device(ltab, i1,ic)
!$acc data present( ltab, i1 )
if ( .not. mppdb_initialized ) then
if ( (.not. mppdb_initialized ) .and. (mnh_idevice_type_current .eq. acc_device_nvidia ) ) then
ic = 0
......@@ -151,7 +153,7 @@ ic = 0
!$acc kernels
!To allow comparisons... (i1 is not fully used)
i1(:) = -999
!!$ i1(:) = -999
do ji = 1, size( ltab, 1 )
if ( ltab(ji ) ) then
......@@ -171,6 +173,7 @@ end subroutine Countjv1d_device
subroutine Countjv2d_device(ltab, i1, i2, ic)
use mode_mppdb, only: mppdb_initialized
use MODE_OPENACC_SET_DEVICE, only : mnh_idevice_type_current, acc_device_nvidia
logical, dimension(:,:), intent(in) :: ltab ! Mask
integer, dimension(:), intent(out) :: i1, i2 ! Positions of elements with 'true' value
......@@ -181,7 +184,7 @@ subroutine Countjv2d_device(ltab, i1, i2, ic)
!$acc data present( ltab, i1, i2 )
if ( .not. mppdb_initialized ) then
if ( (.not. mppdb_initialized ) .and. (mnh_idevice_type_current .eq. acc_device_nvidia ) ) then
ic = 0
......@@ -192,8 +195,6 @@ ic = 0
! i1(:) = -999
! i2(:) = -999
!Warning: if "independent" is set, content of i1, i2 and i3 can vary between 2
! different runs of this subroutine BUT final result should be the same
!Comment the following line + atomic directives to have consistent values for debugging
......@@ -244,6 +245,7 @@ end subroutine Countjv2d_device
subroutine Countjv3d_device(ltab, i1, i2, i3, ic)
use mode_mppdb, only: mppdb_initialized
use MODE_OPENACC_SET_DEVICE, only : mnh_idevice_type_current, acc_device_nvidia
logical, dimension(:,:,:), intent(in) :: ltab ! Mask
integer, dimension(:), intent(out) :: i1, i2, i3 ! Positions of elements with 'true' value
......@@ -254,7 +256,7 @@ subroutine Countjv3d_device(ltab, i1, i2, i3, ic)
!$acc data present( ltab, i1, i2, i3 )
if ( .not. mppdb_initialized ) then
if ( (.not. mppdb_initialized ) .and. (mnh_idevice_type_current .eq. acc_device_nvidia ) ) then
ic = 0
......@@ -266,8 +268,6 @@ ic = 0
! i2(:) = -999
! i3(:) = -999
!Warning: if "independent" is set, content of i1, i2 and i3 can vary between 2
! different runs of this subroutine BUT final result should be the same
!Comment the following line + atomic directives to have consistent values for debugging
......@@ -297,9 +297,9 @@ ic = 0
!$acc kernels
!To allow comparisons... (i1/i2/i3 are not fully used)
i1(:) = -999
i2(:) = -999
i3(:) = -999
!!$ i1(:) = -999
!!$ i2(:) = -999
!!$ i3(:) = -999
do jk = 1, size( ltab, 3 )
do jj = 1, size( ltab, 2 )
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment