Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8881571
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T20:22:30+00:00 2026-06-14T20:22:30+00:00

I’m running into a problem doing an MPI non-blocking send where it causes the

  • 0

I’m running into a problem doing an MPI non-blocking send where it causes the machine to crash with a segmentation fault. All the machines receive the data correctly, but the machine with id 0 crashes during the MPI_Waitall() operation. Can anyone identify what’s causing the problem? Thank you!

Here’s the source code for the program and the error report that I’m getting when running it:

#include <stdio.h>
#include <stdlib.h>
#include <mpi.h>

#define BLOCK_LOW(id,p,n) ((id)*(n)/(p))
#define BLOCK_HIGH(id,p,n) (BLOCK_LOW((id)+1,p,n)-1)
#define BLOCK_SIZE(id,p,n) (BLOCK_HIGH(id,p,n)-BLOCK_LOW(id,p,n)+1)
#define BLOCK_OWNER(id,p,n) (((p)*((id)+1)-1)/(n))

#define LENGTH 100

int main(int argc, char *argv[]) {
    int id, p, i;
    MPI_Request* sendRequests;
    MPI_Status* sendStatuses;
    MPI_Request receiveRequest;
    MPI_Status receiveStatus;

    int array[LENGTH];
    int array2[LENGTH];

    MPI_Init(&argc, &argv);
    MPI_Barrier(MPI_COMM_WORLD);

    for (i = 0; i < LENGTH; i++) {
        array[i] = i * 5;
        array2[i] = 0;
    }


    MPI_Comm_rank(MPI_COMM_WORLD, &id);
    MPI_Comm_size(MPI_COMM_WORLD, &p);

    if (id == 0) {
        sendRequests = malloc((p-1) * sizeof(MPI_Request));

        for (i = 1; i < p; i++) {
            MPI_Isend(array + BLOCK_LOW(i-1, p-1, LENGTH), BLOCK_SIZE(i-1, p-1, LENGTH), MPI_INT, i, 0, MPI_COMM_WORLD, &sendRequests[i-1]);
        }

        MPI_Waitall(p-1, sendRequests, sendStatuses);
    } else {
        MPI_Recv(array2, BLOCK_SIZE(id-1, p-1, LENGTH), MPI_INT, 0, 0, MPI_COMM_WORLD, &receiveStatus);

        for (i = 0; i < BLOCK_SIZE(id-1, p-1, LENGTH); i++) {
            printf("Element %d (%d): %d\n", i, i + BLOCK_LOW(id-1, p-1, LENGTH), array2[i]);
        }
    }

    MPI_Barrier(MPI_COMM_WORLD);
    MPI_Finalize();
    return 0;
}

This is the error I get when I run the code:

[lin12p5:13467] *** Process received signal ***
[lin12p5:13467] Signal: Segmentation fault (11)
[lin12p5:13467] Signal code: Invalid permissions (2)
[lin12p5:13467] Failing at address: 0x400f30
[lin12p5:13467] [ 0] /lib/libpthread.so.0(+0xeff0) [0x7fa96ab4eff0]
[lin12p5:13467] [ 1] /usr/lib/libmpi.so.0(+0x37f01) [0x7fa96bad5f01]
[lin12p5:13467] [ 2] /usr/lib/libmpi.so.0(PMPI_Waitall+0xb3) [0x7fa96bb06b73]
[lin12p5:13467] [ 3] mpi-test(main+0x232) [0x400da6]
[lin12p5:13467] [ 4] /lib/libc.so.6(__libc_start_main+0xfd) [0x7fa96a7fcc8d]
[lin12p5:13467] [ 5] mpi-test() [0x400ab9]
[lin12p5:13467] *** End of error message ***
--------------------------------------------------------------------------
mpirun noticed that process rank 0 with PID 13467 on node lab12p5 exited on signal 11     (Segmentation fault).
--------------------------------------------------------------------------

[lin13p5][[33088,1],1][../../../../../../ompi/mca/btl/tcp/btl_tcp_frag.c:216:mca_btl_tcp_frag_recv] mca_btl_tcp_frag_recv: readv failed: Connection reset by peer (104)
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T20:22:31+00:00Added an answer on June 14, 2026 at 8:22 pm

    You haven’t allocated any space for sendStatuses. You’ll need to malloc() some space like you did for sendRequests. You should also free() these when finished to prevent a memory leak.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am currently running into a problem where an element is coming back from
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a French site that I want to parse, but am running into
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
Let's say I'm outputting a post title and in our database, it's Hello Y&#8217;all
this is what i have right now Drawing an RSS feed into the php,
I am doing a simple coin flipping experiment for class that involves flipping a
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I've tracked down a weird MySQL problem to the two different ways I was

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.