I have a time-domain simulator written in Fortran 2003. I have some observables that are written into a file with the purpose of post-prossesing. The software is 2-4 times faster when not saving these outputs.
I want to delay as much as possible the writting of the values to the output file (if possible after the simulation is over). The reason is that during the simulation, there is an automatic procedure which decides if the simulation is stable (thus, no post-processing needed) and exits immediatly (with a STOP). So if the case is stable, I would save a lot of time.
The outline of the code is:
open(newunit=output_file,file=filenm,form='unformatted',buffered='yes',status='replace',buffercount=127,BLOCKSIZE=4194304) do while (.not. end_simul) t=t+h call solve(t,end_simul) call check_early_stop(iExit) if(iExit)STOP 'Early exit' do i=1,number_of_outputs if(selected(i))write(output_file)output_value(i) enddo enddo close(unit=output_file)
RAM memory is not an issue since the program uses less than 1GB of ram while the computer has more than 64GB. I run on a Interlagos Opteron 32-cores. I used the buffercount and blocksize to try and increase the buffer so that it fits all the file and the writting is delayed. I saw very little difference.
All outputs are double precission.
I use "Intel(R) Fortran Intel(R) 64 Compiler XE for applications running on Intel(R) 64, Version 18.104.22.168 Build 20130121". I'm running Debian Wheezy (6).
Any help on how to speed up the writting or delay it is welcome!
Thanks in advance,