Silverfrost Forums

Welcome to our forums

32 bit computer-fortran program

27 Jan 2012 11:42 #9522

I'm writing a binary file in Fortran for some purpose.

The binary file has a fixed format and I'm done with the writing and all works.

The problem I have is on my 32 bit system as well as on my 64 bit system the binary file that is writing (using my program) is done in 5-6 seconds for a particular test problem.

But for another 32 bit computer the program just goes on for 20 minutes!

On another 32 bit computer it goes for 5 minutes.

I have been researchinbg the solution to this and it seems it is to do with the hard disk rpm being different for the computers where the program is being tested.

My own computer (where it takes 1-2 seconds the hard disk rpm is 15,000 rpm). Could anyone advise what is the reason for this?

30 Jan 2012 6:08 #9528

Please can anyone help?

30 Jan 2012 10:22 #9529

Can you give some more indication of the write task being performed. What is the size of the written file ? Could it be a write permission error? You should use task manager (Ctl+alt+del then select task manager) and monitor the number of bytes written by the process. It could be memory pageing delays; check peak working set and commit size, especially in relation to physical memory. You can compare this to that expected from the .map file. The process write is also buffered by the disk I/O cacheing, which is also indicated in task manager. For the programs taking 5 minutes and 20 minutes, it is worth understanding the speed of the writing to disk. There could be something else stopping the process. I would be surprised if the write is taking a uniform time over 20 minutes; it all depends on the access speed to the disk (network disk?) Let us know some more info.

John

30 Jan 2012 12:08 #9531

The size of the file being written is 21.3MB . It is a binary file.

All machines are connected to network.

What else could cause such slowness?

I did not get your point of memory pageing delays. I mean how to check this?

30 Jan 2012 12:13 #9532

Another info besides the above:

  1. The machine which it takes >20 minutes has spindle speed of hard disk of 7500 rpm and I/O transfer rate of 300 MB/second

  2. My own machine has spindle speed of 15000 rpm and I/O transfer rate of 600 MB/second (which it takes 6 bseconds to write the 21 MB file)

30 Jan 2012 12:27 #9533

I suggested you use task manager and the .map file to get the information I asked about. My question about program size was to check if paging could be causing the delay. If the file is only 21 mb in size, it is a small file and should be written in about 1 second. Your disk speed of 15,000 rpm is very fast, as I am only familiar with 5,400 and 7,500 rpm disks, although this is irrelevant given the small size of the file being written. Disk speed does not explain 5 or 20 minutes !

John

30 Jan 2012 12:32 #9534

Again, use task manager to monitor as the bytes are read and written. Hop[efully watching this may show when the delay takes place (opening, preparing the data, writing or closing)

You could also insert timed reports of what the program is using, using something similar to SUBROUTINE PNOU (NAME) ! ! Transmits message to screen plus elapse time ! character (len=), intent (in) :: name ! INCLUDE 'sapccom.ins' CHARACTER NAMBUF45, LINE80 EXTERNAL DATEC, TIMEC, ELAPSE_SECOND, FNOU ! REAL8 elapse, elapse0 SAVE elapse0 ! CALL DATEC (DATBUF) CALL TIMEC (TIMBUF) ! IF (NAME.EQ.'START') THEN CALL ELAPSE_SECOND (elapse0) ELSE CALL ELAPSE_SECOND (elapse) elapse = elapse - elapse0 NAMBUF = NAME WRITE (LINE,1001) NAMBUF, TIMBUF, DATBUF, elapse CALL FNOU (LINE) END IF 1001 FORMAT (1X,A42,A,' on ',A,F10.2) RETURN ! END

30 Jan 2012 6:45 #9538

Thanks a lot for the reply....How to generate the .map file? Please can you help?

31 Jan 2012 6:55 #9542

SLINK option

31 Jan 2012 10:25 #9543

Thanks a lot for your help and the hint regarding time being taken to open and close the file. Infact, I was opening and closing the file each time a chunk of data was prepeared.

I changed the code such that the file was opned and closed only once during the whole process and that made th difference.

The binary file is generated almost instantaneously in any system I test.

Thanks again

1 Feb 2012 11:02 #9560

Just for knowledge, please can anyone (or John if possible) advise why opening and closing a file would take so much time ? (the file was being opened and closed several hundred (or a few thousand) times when it was taking >10 minutes for whole process...

2 Feb 2012 1:55 #9564

Each time you open the file, the file buffer is initialised. I think it is a direct access file, however the file system must read to the end of the file. Each time you close the file, if changed, the file buffers are updated to disk and I thionk the buffers are released. If you say there is an average of 10 mb (0-21 mb) and you do it 2,000 times, that's a total of 10 gb of reading and 10gb of writing. so the delay

2 Feb 2012 6:02 #9567

Thanks John..

Please login to reply.