用 MPI_Wtime() 替换对 Clock() 的调用后立即崩溃
我有一个正在本地计算机上开发的 MPI 程序,但需要在远程计算机上运行。我使用clock()
来测量时间,但发现它在远程计算机上运行得不够好(由于完全不同的架构),我替换了一些对clock的调用()
和 MPI_Wtime()
,产生了所需的结果。该程序仍然在本地和远程计算机上运行。
但是,我只是用 MPI_Wtime()
替换了对 clock()
的所有其他调用,现在在本地计算机上启动程序会立即导致进程停止退出代码-1073741819。即使我在 main() 的第一行放置了一个 cout ,也没有输出,所以我相当确定这不是我的编程错误,但是我不知道出了什么问题。
源代码中的更改如何导致程序在执行更改的代码(或任何代码)之前失败?
I have an MPI program that I'm developing on a local computer, but need to run on a remote machine. I used clock()
to measure time, but after discovering that it doesn't work well enough on the remote machine (due to a completely different architecture), I replaced a few calls to clock()
with MPI_Wtime()
, which yielded the required results. The program still runs on both the local and remote machines.
However, I just went and replaced all the other calls to clock()
with MPI_Wtime()
, and now launching the program on the local machine immediately causes the processes to stop with exit code -1073741819. Even if I put a cout
in the very first line of main()
, there's no output, so I'm fairly sure it's not a programming fault on my part, but I have no idea what's wrong.
How can changes in the source code cause a program to fail before the changed code (or any code, for that matter) is executed?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您是否从静态对象的构造函数中调用
MPI_Wtime()
?它们在main()
之前运行。Are you calling
MPI_Wtime()
from the constructor of a static object? These run beforemain()
.该 cout 是由“endl”或“flush”操纵器冲洗的吗?如果没有,程序可能会崩溃,但你永远不会知道,因为缓冲的输出将会丢失。
Was that cout flushed by an 'endl' or 'flush' manipulator? If not, the program may have crashed afterwards but you'd never know because the buffered output would be lost.