Opened 17 years ago

Last modified 17 years ago

#27 closed defect

send-recv deadlock — at Version 1

Reported by: Stephen Siegel Owned by: zirkel
Priority: major Milestone:
Component: examples Version: 1.0
Keywords: deadlock send recv message-passing diffusion Cc:

Description (last modified by Stephen Siegel)

To do a message-passing data exchange, you need to send first, receive second. Otherwise deadlock will ensue. In diffusion example, the receives happen first (check for this in other examples as well):

void exchange_ghost_cells() {
  if(left >= 0) send(v[1], left, 0);
  if(right < nprocs){
	recv(v[nxl+1], right, 0);
   	send(v[nxl], right, 0);
  }
  if(left >= 0) recv(v[0], left, 0);
}

I guess in this case it won't deadlock because of the boundaries, but it will force sequentialization.

Change History (1)

comment:1 by Stephen Siegel, 17 years ago

Description: modified (diff)
Note: See TracTickets for help on using tickets.