使用英特尔 Fortran 编译器避免在列表定向输出中换行 [英] Avoid newline in list-directed output with Intel Fortran compiler
问题描述
我注意到 Fortran 中列表导向输出 write(*,*)
的结果是依赖于编译器的.
I have noticed the results of list-directed output write(*,*)
in Fortran is compiler dependent.
确实,用代码:
program one
real(8), dimension(5):: r1
do i=1,5
r1(i)=sqrt(i*10.0)
end do
write(*,*) (r1(i), i =1,5)
end program one
intel 编译器 ifort 给出被换行符打破的标准输出:
intel compiler ifort gives standard output broken by a newline:
3.16227769851685 4.47213602066040 5.47722530364990
6.32455539703369 7.07106781005859
而 gfortran 给出等效的一行结果:
while gfortran gives the equivalent one line result:
3.1622776601683795 4.4721359549995796 5.4772255750516612 6.3245553203367590 7.0710678118654755
我认为 ifort 每行最多写入 3 个项目(当浮动实数时).有没有办法让 ifort 输出像 gfrotran 一样,即避免换行?理想情况下,我想保留列表导向的输出 (*,*)
指令,所以我正在寻找类似编译器选项的东西,如果有的话.
I think that ifort is writing maximum 3 items per line (when floating real numbers).
Is there any way to make the ifort output be like gfrotran, i.e. avoid the newline?
Ideally, I would like to keep list-directed output (*,*)
instructions, so I am looking for something like a compiler option or so, if any.
推荐答案
自版本 14 起,intel fortran 编译器具有 wrap-margin 功能.默认情况下,记录在 80 个字符后换行.要禁用此限制,您应该指定:
Since verson 14, intel fortran compiler has the wrap-margin function. By default, the record is wrapped after 80 characters. For disabling this restriction, you should specify:
在 Linux 上:-no-wrap-margin
on Linux: -no-wrap-margin
在 Windows 上:/wrap-margin-
on WIndows: /wrap-margin-
查看更多关于 英特尔 Fortran 参考指南
这篇关于使用英特尔 Fortran 编译器避免在列表定向输出中换行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!