从 power station(4) 移植到 intel fortran 编译器(11/2003)
将fortran代码从power station移植到fortran编译器(2003)时需要注意哪些必要条件?
我观察到,在电站中,所有变量都被视为全局变量(甚至局部变量也)。在 intel fortran(2003) 中,它们具有单独的本地和全局作用域。所以我需要将所有局部变量设置为全局变量。是否有任何选项(从属性)可以在 fortran 2003 中将所有局部变量设置为全局变量。因为我的代码中有数百个变量。任何人都可以提出一个好的解决方案,而不是将所有局部变量分配给全局变量(意味着在 COMMON 块中)?
除此之外,我在将代码从 powerstation 移植到 intel fortran 编译器(11/2003)时还需要注意任何其他问题吗?
What are the necessary conditions I need to takecare while porting the fortran code from power station to fortran compiler(2003)?
What I observed is, In power station all the variables treat as global variables(even local variables also). where as in intel fortran(2003) they have separate scope for local and global. So I need to make all local variables to gloabal. Is there any option(from properties) to make all local variables to global in fortran 2003. Because there are hundered of variables in my code. Instead of assigning all local variables to global(means in COMMON block), can anybody suggest a good solution for it?
Apart from this shall I need to takecare any other issues while porting code from powerstation to intel fortran compiler(11/2003)?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我具体不了解这两个编译器,但如果您必须将所有变量放入公共块中,那就很奇怪了。有什么证据表明所有变量都是全局的?较旧编译器与较新编译器的子程序(子例程和函数)中的局部变量可能存在的问题是变量的值在子程序的调用中是否持续存在。 Fortran 标准仅在使用“save”属性声明变量时保证此行为。一些较旧的编译器使所有变量持久化(静态内存),无论是否使用“保存”。如果程序员省略了“保存”,那么当将旧程序移植到新编译器时,这可能会导致错误。许多较新的编译器提供编译选项以使所有变量持久化(例如,当前英特尔 Fortran 编译器的 /Qsave)。或者您可以将“save”添加到每个子程序中——不带变量的“save”将使所有变量持久化。
I don't know those two compilers specifically, but it would be very strange if you had to put all of your variables into common blocks. What is the evidence that all variables are global? A possible issue with local variables in subprograms (subroutines and functions) with older compilers versus newer compilers is whether the value of a variable persists across invocations of the subprogram. The Fortran standard only guarantees this behavior if the variable is declared with the "save" attribute. Some older compilers made the all variables persistent (static memory), whether or not "save" was used. This can cause bugs when older programs are ported to newer compilers, if the programmer omitted a "save". Many newer compilers provide a compile option to make all variables persistent (e.g., /Qsave with the current Intel Fortran compiler). Or you can add "save" to every subprogram -- "save" with no variables will make all variables persistent.
将 fortran 代码从 power station 移植到 fortran 编译器(2003)时需要注意哪些必要条件?
Fortran Powerstation 只是一个编译器。英特尔的 Visual Fortran 也是如此。
而fortran是一种语言。尽管上述两者确实有一些非标准供应商扩展,但只要您坚持使用标准,移植就应该没有问题(fortran77 标准编译器应该在当今最新的编译器上编译而不会出现错误)。
因此,只有当您使用一些非标准的 MS 特定的东西时,才会出现问题。如果没有看到一些实际的代码,没有人能真正帮助你。
我观察到的是,在电站中所有变量都被视为全局变量(甚至局部变量也)。在 intel fortran(2003) 中,它们具有单独的本地和全局作用域。所以我需要将所有局部变量设置为全局变量。
嗯,不。
我的意思是,你可以说,fortran 中有“全局”和“局部”变量(尽管它们不是这样调用的),但我向你保证,两个编译器都会正确处理它们。我最近使用了 FPS(我可能仍然在某个地方安装了它)并且它们得到了应有的对待。
是否有任何选项(从属性)可以在 fortran 2003 中将所有局部变量设置为全局变量。因为我的代码中有数百个变量。 而不是将所有局部变量分配给全局(意味着在 COMMON 块中)
任何人都可以建议一个好的解决方案吗? 就我个人而言,如果可以的话,我会避免使用 COMMON 块, 。它们很好,但在大多数情况下它们是可以避免的。
除此之外,在将代码从 powerstation 移植到 intel fortran 编译器(11/2003) 时,我还需要注意任何其他问题吗?
重命名库和模块。
英特尔的编译器系列是微软编译器的后代,因此这确实是一种“自然”的方式。然而,在没有看到一些实际数据的情况下,很难这样猜测并给出一般性建议。
ps 不过,可以在 英特尔的软件论坛,还有大量其他用户。他们主要关心从 CVF 到 IVF 的过渡,但我想你偶尔会找到 FPS 用户。虽然,我再说一遍,Fortran 是一种非常标准化的语言。因此,非常便携。考虑到已经说过的内容,从一个编译器跳转到另一个编译器应该不会造成困难。
What are the necessary conditions i need to takecare while porting the fortran code from power station to fortran compiler(2003)?
Fortran Powerstation is just a compiler. So is Intel's Visual Fortran.
While fortran is a language. Although both of the above did have some non standard vendor extensions, as long as you stuck to the Standard you should have no problems porting (fortran77 standard compilant should compile without errors on today's newest compilers).
So the problem arises only if you used some non standard, MS specific stuff. Which no one can really help you with without seeing some actual code.
What I observed is, In power station all the variables treat as global variables(even local variables also). where as in intel fortran(2003) they have separate scope for local and global. So I need to make all local variables to global.
Uhmm, no.
What I mean, you can say, there are "global" and "local" variables in fortran (although they're not called like that) but I assure you, they're treated correctly in and by both compilers. I used both, FPS quite recently (I still maybe have it installed somewhere) and they are treated as they should be.
Is there any option(from properties) to make all local variables to global in fortran 2003. Because there are hundered of variables in my code. Instead of assigning all local variables to global(means in COMMON block), can anybody suggest a good solution for it?
Personally, if you can, I would avoid using COMMON blocks. They're nice, but in most situations they can be avoided.
Apart from this shall I need to takecare any other issues while porting code from powerstation to intel fortran compiler(11/2003)?
Renaming of libraries and modules.
Intel's line of compilers is a descendant of MS's, so it is really a "natural" way to go. However, without seeing some actual data, it is hard to guess like this and give general advice.
p.s. Some "general advice" however can be found on Intel's sofware forums, also with a mass of other users. They're mostly concerned with transition from CVF to IVF, but I guess you could find a FPS user now and then. Although, I repeat, fortran is a very standardized language. And as such, very portable. Jumping from one compiler to another should not present a difficulty taking into account the already said.