make write(...., position=append) faster in fortran

Viewed 149

I know optimization questions are difficult to answer. However, I will try to get an answer here:

I am trying to write some values to a file in a quite complex raytracing program (over 100+ subroutines) This is happening inside a subroutine as seen below.

The program itself is very fast, but as soon as I reach the append it slows down dramatically. Is there some way I can make it quicker?

subroutine iterate_e_ring(i, k)
use otherfile, only: other_subroutine;
implicit none
integer(I2B), intent(in) :: i, k   ! element number and iteration counter
real(BW), dimension(3) :: converge  !Convergence check by Ole Müller
character*150 :: filename

call other_subroutine(x,y,z)
converge(1)= ...
converge(2)= ...
converge(3)= ...


   open(unit=120,file='converge.txt',action='write',position="append")
            write(120, *) real(converge(:))
   close(unit=120)

end subroutine iterate_e_ring; 
0 Answers
Related