Gfortran 版本 4.1.2 和 4.2.3
大家好,我正在将我的代码从在 ubuntu 上运行的集群部署到具有相同硬件的集群上,但使用的是 Red Hat,并且看起来较旧的 gfortran 编译器。源代码实际上是由 ifort 编译的,但由于它没有安装在 red had 集群上,因此我可能必须切换到 gfortran。
现在的问题是代码无法编译。在类型中存在“可分配”的东西,我可以在我的代码部分中修复它,但其他人也有其他贡献,没有准备好使他们的代码适应旧标准。
我的问题:
- 我如何部署到其他系统上,希望不要做太多改变?
- 当使用相同版本的编译,只是不同的颠覆时,还有什么让我惊讶的呢?
- 我怎样才能保证类似的事情不再发生?该代码应该可以部署到各种系统上,而无需诉诸暴力。
谢谢你的建议和鼓励
Hey everybody, i am deploying my code from a cluster running on ubuntu onto a cluster with identical hardware, but with red hat and as it seems older gfortran compiler. The source is actually compiled by ifort, but since it is not installed on the red had cluster, i may have to switch to gfortran.
Now the problem is that the code does not compile. There is this thing with "allocatable" inside a type that i could fix in my portion of the code, but there are also other contributions by other people not as ready to adapt their code to the older standard.
My question :
- How do i deploy nonetheless onto the other system, hopefully without changing much?
- What other surprised wait for me when using the compile from the same version, just different subversion?
- How do i enforce that something like this does not happen again? The code should be deployable onto a variety of systems without resorting to violence.
Thanks for your advice and cheers
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
gfortran 从 4.0 版本开始。版本 4.1 和 4.2 很旧,缺少许多功能,并且可能存在错误。您可能会遇到代码使用的其他缺失功能。我建议,如果可能的话,将编译器升级到当前的稳定版本,即 4.5。
支持所有版本的 gfortran 会给你的代码带来很多限制。最好确定最早可用的版本并将该信息添加到文档中。对于我的代码,该版本是 4.3,因为我广泛使用了 ISO C 绑定。
gfortran wiki,http://gcc.gnu.org/wiki/GFortran,有一个变更日志按版本可以帮助您确定您需要哪个版本。唯一可靠的方法就是测试。
如果您想强制执行版本要求,可以从 Fortran 内部进行测试。您可以运行一个小型测试程序作为 make 过程的一部分,如果 gfortran 版本太早则中止。
以下代码片段显示了从 Fortran 程序输出 gfortran 版本号的两种方法。将程序命名为文件类型“.F90”,以便 gfortran 调用预处理器。
gfortran started with version 4.0. Versions 4.1 and 4.2 are old and missing many features and may have bugs. You may run into additional missing features that are used by your code. I suggest, if at all possible, getting the compiler upgraded to the current stable version, which is 4.5.
Supporting all versions of gfortran will lead to many restrictions on your code. It might be better to identify the earliest version that works and add that information to the documentation. For my code, that version is 4.3 since I make extensive use of the ISO C Binding.
The gfortran wiki, http://gcc.gnu.org/wiki/GFortran, has a changelog by version that might help you identify which version you need. The only sure way is to test.
If you want to enforce a version requirement, you can test from within Fortran. You could run a small test program as part of the make process and abort if the gfortran version is too early.
The following code fragment shows two ways of outputting the gfortran version number from a Fortran program. Name the program with filetype ".F90" so that gfortran will invoke the preprocessor.
我认为你有3个选择:
您的开发机器
在您的部署上执行
机器;我不知道这是不是
可能与您的设置有关,但它是
如果你还没有的话值得研究一下
已经这样做了。
其中我认为(1)可能比较困难;如果是的话我会选择(3)。如果这是不可能的,那么它必须是(2)——我没有看到任何其他选择。
现在回答您的问题:
I think you have 3 choices:
your development machine for
execution on your deployment
machine; I don't know if this is
possible with your setup but it is
worth investigating if you haven't
already done so.
Of these I think that (1) might be difficult; if it is then I'd go for (3). If that is not possible, then it has to be (2) -- I don't see any other options.
Now to answer your questions: