在 Windows 下为 Linux 使用 Ifort 编译 Fortran

Compiling Fortran using Ifort for Linux under Windows

我使用 Visual Studio 2010 和 ifort Windows(7、64 位)开发和 运行 一些 Fortran 代码。

大部分编译为 DLL 文件的代码已在 Windows 上进行测试并部署了大约 20 天。 25% 的时间 Windows (Windows 2000 up to Windows 7) and 75% to SUSE Linux。虽然 Windows 解决方案完全由我处理,但 Linux “分支”是由其他人编译的 (它是 100 % 相同的代码)。Linux 分支是用 g95/NAG 编译器编译的。

由于一些我们无法控制的决定,我们将从 NAG 更改为 gfortran。经过一些测试,我们发现与 Windows 和 ifort(无优化,完全调试)相比,使用 gfortran(以及一些优化,如 -o2)编译的代码花费大约两倍的时间完成。我们有机会在 Linux 和 ifort 下编译代码,并获得了 Windows + ifort 的速度。 (NAG 编译代码介于两者之间。)

出于明显的原因,我们想用 ifort 为 Windows 和 Linux 编译代码,所以:

是否可以使用 ifort(使用 cmd 或 Visual Studio 2010)在 Windows 下为 SUSE Linux 编译?

我会为英特尔回答 - 不,你不能在 Windows 中为 Linux 编译(除非使用虚拟机,在这种情况下你真的 运行 Linux,如上所述)。 VM 是一种合理的方法,但您必须在 Linux.

上购买单独的 ifort 许可证

或者,我假设您有一个要测试的 Linux 盒子,在那里构建(您可以从 Windows 盒子通过 SSH 访问它。)是的,您不会有Visual Studio IDE,但我们的一些客户使用 Eclipse (with the Photran plugin) or Code::Blocks 和 Intel Fortran。