波特兰组 FORTRAN pgf90 程序在使用 -fast 编译时失败,使用 -fast -Mnounroll 成功
这段代码愉快地运行了很长一段时间,直到我们最近发现了一个边缘情况,它默默地失败了——没有返回错误。 失败显然相当微妙。我们可以通过以下方式让代码在边缘情况下顺利运行:
1) 使用任何包含 -traceback
或 debug(-g
或 -gopt
)的选项集进行编译;
2)使用-fast -Mnounroll
编译;
3) 优化编译<2;
4)在代码中添加WRITE语句来确定失败的位置;
换句话说,大多数可用于调试故障的工具实际上都会导致故障消失。
我正在探索有关与循环展开或其他优化相关的故障及其解决方案的任何信息。
预先感谢大家。
This code hummed along merrily for a long time, until we recently discovered an edge case where it fails silently-- no errors returned.
The fail is apprently pretty subtle. We can get the code to run uneventfully in the edge case by:
1) compiling with any set of options that includes -traceback
or debug (-g
or -gopt
);
2) compiling with -fast -Mnounroll
;
3) compiling with optimization <2;
4) adding WRITE statements into the code to determine the location of the fail;
In other words, most of the tools useful for debugging the failure-- actually result in the failure disappearing.
I am probing for any information on failures related to loop unrolling or other optimization, and their resolution.
Thank you all in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不熟悉 pgf(哎呀,自从我使用任何 fortran 以来已经有 10 年了),但这里有一些用于追踪(潜在)编译器错误的一般建议:
简化可重现的情况。即尝试使用一段类似的代码重现该问题,该代码删除了所有多余的细节。这很有帮助,因为 a) 您将不再犹豫公开发布代码,b) 如果有人尝试诊断问题,他们会更容易使用更少的周围材料。
与专家交谈:如果您有 pgf 的支持合同,请使用它!他们的网站上有一个支持请求表。如果没有,您可以在用户论坛部分发布您的信息 - 其他人可能有更好的解决方法,或者那里的员工可能可以记录您的问题。
仔细检查您的代码。您是否可能依赖于某种未指定的行为?这种情况会导致您的程序在更改优化级别时切换行为。我并不是说编译器错误是不可能的,但它也可能是您代码中的黑客行为。
希望这有帮助。
I'm not familiar with pgf (heck, it's been 10 years since I used any fortran), but here are some general suggestions for tracking down (potential) compiler bugs:
Simplify a reproducible case. I.e. try to reproduce the problem with a similar looking piece of code that has all the superfluous details removed. This is helpful because a) you'll be less hesitant to release the code publicly, and b) if someone attempts to diagnose the problem, it will be easier for them with less surrounding material.
Talk to the experts: If you have a support contract for pgf, use it! There's a support request form on their site. If not, there's a User Forums section where you might be able to post your information - someone else may have better workaround, or an employee there may be able to log your problem.
Double-check your code. Is it possible that you're relying on some sort of unspecified behavior? This is the sort of thing that would cause your program to switch behavior when changing optimization levels. I'm not saying compiler bugs are impossible, but it could be a hack in your code too.
Hope that's helpful.