writing vector to File - differences between Gfortran and Ifort

writing vector to File - differences between Gfortran and Ifort

Bild des Benutzers joao n.

Hi All,

I have a code that I'm migrating from gfortran to ifort.

After a number of time steps I write a vector (~ 500 lines) to a file using:

WRITE (unit, *) Time_Steps, vector(:)

In gfortran this gives me the, output file:

Time_1, vector(1), vector(2), .... vector(end)

Time_2, vector(1), vector(2), .... vector(end)

Time_3, vector(1), vector(2), .... vector(end)

....

When running with ifort the output is messed up, with a line break every 5 columns.

Any idea what's happening ?

thanks, jp

p.s I already tried specifying the format but it didn't work...

8 Beiträge / 0 neu
Letzter Beitrag
Nähere Informationen zur Compiler-Optimierung finden Sie in unserem Optimierungshinweis.
Bild des Benutzers Izaak Beekman

I think you most certainly need an edit descriptor if you want the format to have line breaks where you want them. (With an edit descriptor you can specify the number of entities per line by either typing an edit descriptor for each column or using repeat counts, or, if the number of columns is only known at runtime, you can dynamically build an edit descriptor.) The exact output of the default * edit descriptor is processor dependent (processor in the sense as defined by the fortran standard, to mean hardware, compiler etc.) and for ifort, it will put elements on a new line if the line length starts to become too long.

-Zaak
Bild des Benutzers Steve Lionel (Intel)

It's an implementation difference in the default record length for list-directed output. Intel Fortran and its predecessors DEC/Compaq Fortran have used 80 columns for decades. Back in the 1970s this made sense, not so much today.

In compiler version 14 we added the option -wrap-margin- to allow indefinitely long record lengths for list-directed output. There is also an environment variable that can control this.

Steve
Bild des Benutzers joao n.

Hi Steve,

Thanks for your comment but.... it didn't work.

I'm compiling with -fast -wrap-margin and the output is still exactly the same... Any other sugestions ?

thanks for that.

JP

Bild des Benutzers Steve Lionel (Intel)

Show me a small example program that demonstrates the problem, along with the output you get from gfortran. Also, the option I mentioned is new in version 14. In older versions you can open the file with a larger RECL= value and it will use that as the margin.
 

Steve
Bild des Benutzers mecej4

Zitat:

joao n. schrieb:

Thanks for your comment but.... it didn't work.

I'm compiling with -fast -wrap-margin and the output is still exactly the same... Any other sugestions ?

thanks for that.

JP

The option you wanted is -wrap-margin-, not -wrap-margin (note the '-' at the end; think -wrap-margin+).

As Steve said, this option is available with the Version 14 compiler. Older versions will complain that -wrap-margin- is not a recognized option.

 

Bild des Benutzers joao n.

ops...

my mistake, now working perfectly. tks !
 

Bild des Benutzers Lorri Menard (Intel)

On Linux, the correct spelling is -no-wrap-margin

The trailing hyphen is a Windows-ism, and was accidentally accepted by the Linux version of "ifort".

In other words, please update your makefile to use -no-wrap-margin instead.

            thanks!

                       --Lorri

Melden Sie sich an, um einen Kommentar zu hinterlassen.