MPI Odd/Even Compare-Split Deadlock
        Posted  
        
            by 
                erebel55
            
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by erebel55
        
        
        
        Published on 2012-04-07T03:19:45Z
        Indexed on 
            2012/04/07
            5:30 UTC
        
        
        Read the original article
        Hit count: 254
        
I'm trying to write an MPI version of a program that runs an odd/even compare-split operation on n randomly generated elements.
Process 0 should generated the elements and send nlocal of them to the other processes, (keeping the first nlocal for itself). From here, process 0 should print out it's results after running the CompareSplit algorithm. Then, receive the results from the other processes run of the algorithm. Finally, print out the results that it has just received.
I have a large chunk of this already done, but I'm getting a deadlock that I can't seem to fix. I would greatly appreciate any hints that people could give me.
Here is my code http://pastie.org/3742474
Right now I'm pretty sure that the deadlock is coming from the Send/Recv at lines 134 and 151. I've tried changing the Send to use "tag" instead of myrank for the tag parameter..but when I did that I just keep getting a "MPI_ERR_TAG: invalid tag" for some reason.
Obviously I would also run the algorithm within the processors > 0 but I took that part out for now, until I figure out what is going wrong.
Any help is appreciated.
© Stack Overflow or respective owner