MPI和MemoryLeaks和mpi_wait()带有异步发送和recv

发布于 2025-01-23 09:15:17 字数 1979 浏览 1 评论 0原文

我是MPI编程的新手,我正在尝试创建一个程序,该程序将在环中的流程之间执行2条通信。

我在mpi_finalize()语句上遇到了MemoryLeaks错误。稍后,我发现我可以使用-fsanitize = address -fno-omit-frame-pointer flags来帮助我调试泄漏的位置。

现在,我遇到了一个非常奇怪的(至少对我来说)错误。

这是我的代码:

        MPI_Request request_s1, request_s2, request_r1, request_r2;

        // receiving 2 elems from the left neighbor, which i shall be needing
        if (0 > MPI_Irecv(lefties, EXTENT, MPI_DOUBLE, my_left, 1, MPI_COMM_WORLD, &request_r1)) {
            return 2;
        }

        // receiving 2 elems from my right neighbor which i will be appending at the end of my input
        if (0 > MPI_Irecv(righties, EXTENT, MPI_DOUBLE, my_right, 1, MPI_COMM_WORLD, &request_r2)) {
            return 2;
        }

        // sending the first 2 elems which will be required by the left neighbor
        if (0 > MPI_Isend(my_output_buffer, EXTENT, MPI_DOUBLE, my_left, 1, MPI_COMM_WORLD, &request_s1)) {
            return 2;
        }

        // sending the last 2 elems to my right neighbor
        if (0 > MPI_Isend(&my_output_buffer[displacement - EXTENT], EXTENT, MPI_DOUBLE, my_right, 1, MPI_COMM_WORLD, &request_s2)) {
            return 2;
        }

        MPI_Wait(&request_r2, MPI_STATUS_IGNORE);
        MPI_Wait(&request_r1, MPI_STATUS_IGNORE);

我遇到的错误是

[my_machine:18353] *** An error occurred in MPI_Wait
[my_machine:18359] *** reported by process [204079105,1]
[my_machine:18359] *** on communicator MPI_COMM_WORLD
[my_machine:18359] *** MPI_ERR_TRUNCATE: message truncated
[my_machine:18359] *** MPI_ERRORS_ARE_FATAL (processes in this communicator will now abort,
[my_machine:18359] ***    and potentially your MPI job)
[my_machine:18353] 1 more process has sent help message help-mpi-btl-base.txt / btl:no-nics
[my_machine:18353] Set MCA parameter "orte_base_help_aggregate" to 0 to see all help / error messages

,我不知道如何从这里进步。

I am new to MPI programming and I am trying to create a program that would perform 2-way communication between processes in a ring.

I was getting MemoryLeaks errors at the MPI_Finalize() statement. Later I found out that I could use the -fsanitize=address -fno-omit-frame-pointer flags to help me debug where the leaks could be.

Now I get a very bizarre (at least for me) error.

Here's my code:

        MPI_Request request_s1, request_s2, request_r1, request_r2;

        // receiving 2 elems from the left neighbor, which i shall be needing
        if (0 > MPI_Irecv(lefties, EXTENT, MPI_DOUBLE, my_left, 1, MPI_COMM_WORLD, &request_r1)) {
            return 2;
        }

        // receiving 2 elems from my right neighbor which i will be appending at the end of my input
        if (0 > MPI_Irecv(righties, EXTENT, MPI_DOUBLE, my_right, 1, MPI_COMM_WORLD, &request_r2)) {
            return 2;
        }

        // sending the first 2 elems which will be required by the left neighbor
        if (0 > MPI_Isend(my_output_buffer, EXTENT, MPI_DOUBLE, my_left, 1, MPI_COMM_WORLD, &request_s1)) {
            return 2;
        }

        // sending the last 2 elems to my right neighbor
        if (0 > MPI_Isend(&my_output_buffer[displacement - EXTENT], EXTENT, MPI_DOUBLE, my_right, 1, MPI_COMM_WORLD, &request_s2)) {
            return 2;
        }

        MPI_Wait(&request_r2, MPI_STATUS_IGNORE);
        MPI_Wait(&request_r1, MPI_STATUS_IGNORE);

The error I get is

[my_machine:18353] *** An error occurred in MPI_Wait
[my_machine:18359] *** reported by process [204079105,1]
[my_machine:18359] *** on communicator MPI_COMM_WORLD
[my_machine:18359] *** MPI_ERR_TRUNCATE: message truncated
[my_machine:18359] *** MPI_ERRORS_ARE_FATAL (processes in this communicator will now abort,
[my_machine:18359] ***    and potentially your MPI job)
[my_machine:18353] 1 more process has sent help message help-mpi-btl-base.txt / btl:no-nics
[my_machine:18353] Set MCA parameter "orte_base_help_aggregate" to 0 to see all help / error messages

and I have no clue how to progress from here.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(1

谈下烟灰 2025-01-30 09:15:17
  1. 您似乎正在重用您的请求变量。不。如果创建一个,则必须等待它。
  2. 使用mpi_request_null初始化请求变量的初始化,如果您正在等待未创建的请求。
  3. 0> mpi_whatewhate成语很奇怪。而是:mpi_success!= mpi_whate
  4. 但是,即使那可能没有工作,因为默认值是例程不会返回错误,而是中止程序。
  5. 如果没有看到其余的代码,我可能完全无法分辨出来。
  1. You seem to be reusing your request variables. Don't. If one is created, you have to wait for it.
  2. It wouldn't hurt to initialize the request variables with MPI_REQUEST_NULL, in case you're waiting for a request that was not created.
  3. The 0>MPI_whatever idiom is strange. Instead: MPI_SUCCESS!=MPI_Whatever.
  4. But even that may not be work because the default is that routines do not return on error, but abort the program.
  5. And it may be something else entirely which I can't tell without seeing the rest of the code.
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文