用 MPI_Wtime() 替换对 Clock() 的调用后立即崩溃

发布于 2024-09-05 07:03:08 字数 406 浏览 5 评论 0原文

我有一个正在本地计算机上开发的 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

若言繁花未落 2024-09-12 07:03:08

您是否从静态对象的构造函数中调用MPI_Wtime()?它们在 main() 之前运行。

Are you calling MPI_Wtime() from the constructor of a static object? These run before main().

仅冇旳回忆 2024-09-12 07:03:08

该 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文