Thread: MPI Problem gives segmentation fault

  1. #1
    Registered User
    Join Date
    Sep 2009
    Posts
    4

    MPI Problem gives segmentation fault

    I have been breaking my head over the following code since morning, I get a segmentation error everytime!

    Apparently, there is some problem in the pointer that I am passing through MPI_Isend and MPI_Ireceive that gives me a segmentation fault. I really donot know what. I have also tried passing &world[start][0] and so on.
    Last edited by confused_coder; 09-07-2009 at 09:35 PM.

  2. #2
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,336
    Do you plan to return anything from your initialize function?

  3. #3
    Registered User
    Join Date
    Sep 2009
    Posts
    4
    yes...since I am allocating space to the 2D array in the intialize function, I need to return the pointer to the space

  4. #4
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,336
    Quote Originally Posted by confused_coder View Post
    yes...since I am allocating space to the 2D array in the intialize function, I need to return the pointer to the space
    Good. Then do so.

  5. #5
    Registered User
    Join Date
    Sep 2009
    Posts
    4
    I have a "return world; " statement at the end of the function!

  6. #6
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,336
    Oh, so that's an indentation error and not an actual error. Ah.

    Anyway, I can pretty much personally guarantee that "world+((start)*(N+2))" is so far out of range that it's not even funny. The only time that's valid is if start is zero; if start is one it points to one past your array, and if start is bigger it's even worse. (Remember that world is not actually a two-dimensional array, so trying to do pointer arithmetic as though it were is Just Not Going to Work.)

  7. #7
    Registered User
    Join Date
    Sep 2009
    Posts
    4
    Hi...i solved it
    I am supposed to send &request, and not request. I was declaring it as MPI_Request *request and sending request.

    After all those pointer considerations!

    Thanks a lot for your time, I am deleting the code since this is an assignment for me!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Segmentation fault problem
    By odedbobi in forum Linux Programming
    Replies: 1
    Last Post: 11-19-2008, 03:36 AM
  2. Strange segmentation fault
    By Ron in forum C Programming
    Replies: 24
    Last Post: 06-15-2008, 02:10 PM
  3. Segmentation Fault hmm?
    By pobri19 in forum C Programming
    Replies: 4
    Last Post: 05-03-2008, 07:51 AM
  4. Re: Segmentation fault
    By turkish_van in forum C Programming
    Replies: 8
    Last Post: 01-20-2007, 05:50 PM
  5. [C++] Segmentation Fault {Novice C++ Programmer}
    By INFERNO2K in forum C++ Programming
    Replies: 24
    Last Post: 06-08-2005, 07:44 PM