Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
29375 Discussions

Difference compiler f90 (env. UNIX) et ifort (Env. Windows)

GENOT_B_
Beginner
915 Views

Hello,

 

First of all, I am not a professionnel in fortran programming... But hereafter my problem.

I have developped a program in which i read an unformated file via:

      OPEN(26,FILE='test',FORM='UNFORMATTED',STATUS='OLD',ACCESS='DIRECT',IOSTAT=IO,RECL=4)

and then

      READ(26,REC=1,IOSTAT=IOS)NUMFL

to read the first value which is an integer coded on 4 bytes (that's why RECL=4)

This sturcture is well compiled by f90 compiler and in UNIX environment. It works weel and the read value is correct.

 

Now, I would like to work in Windows 7 environment and so with ifort compiler.... The same program is well compiled too but the first reading value is not the right one. I suppose that it is a pb of compiler option but I do not understand clearly what I have to modify. For information, I tried ifort compilation option like as "assume:byterecl" and "integer-size:32" (seperatly or cumulted) but it still does not work.

 

Thanks in advance for your help.

0 Kudos
1 Reply
mecej4
Honored Contributor III
915 Views

The conventions used (w.r.t. type of file, record-length units, etc.) for writing the file must be compatible with the conventions used to read the file. That is why unformatted Fortran files are not always portable and, when porting works, more information regarding the conventions needs to be available than just the file itself.

Where was the file written? On Linux? Which compiler was used to compiler the program that wrote the file? What were the compiler options used, what clauses were used to open the file for writing, and what did the WRITE statements state? Do you know the size of the file and can you show a hex-dump of the first few bytes?

If the file is not huge and you don't mind giving the public access to it, you may attach the file to your reply.

0 Kudos
Reply