Skip to content

Commit a99297b

Browse files
authored
Fixes possible race condition. (#124)
1 parent 4b17b50 commit a99297b

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/main.f90

+5
Original file line numberDiff line numberDiff line change
@@ -323,6 +323,7 @@ program cans
323323
! post-process and write initial condition
324324
!
325325
write(fldnum,'(i7.7)') istep
326+
!$acc wait ! not needed but to prevent possible future issues
326327
!$acc update self(u,v,w,p)
327328
include 'out1d.h90'
328329
include 'out2d.h90'
@@ -514,14 +515,17 @@ program cans
514515
end if
515516
write(fldnum,'(i7.7)') istep
516517
if(mod(istep,iout1d) == 0) then
518+
!$acc wait
517519
!$acc update self(u,v,w,p)
518520
include 'out1d.h90'
519521
end if
520522
if(mod(istep,iout2d) == 0) then
523+
!$acc wait
521524
!$acc update self(u,v,w,p)
522525
include 'out2d.h90'
523526
end if
524527
if(mod(istep,iout3d) == 0) then
528+
!$acc wait
525529
!$acc update self(u,v,w,p)
526530
include 'out3d.h90'
527531
end if
@@ -541,6 +545,7 @@ program cans
541545
call out0d(trim(datadir)//'log_checkpoints.out',3,var)
542546
end if
543547
end if
548+
!$acc wait
544549
!$acc update self(u,v,w,p)
545550
call load_all('w',trim(datadir)//trim(filename),MPI_COMM_WORLD,ng,[1,1,1],lo,hi,u,v,w,p,time,istep)
546551
if(.not.is_overwrite_save) then

0 commit comments

Comments
 (0)