Note that there are some explanatory texts on larger screens.

plurals
  1. POWhy is MPI_Bsend not returning error even when the buffer is insufficient to accommodate all the messages
    text
    copied!<p>I am trying to implement a logical ring with MPI; where every process receives a message from process with id one less than that of current process and forwards to the next process in cyclic fashion. My aim is to traffic buffer such that it loses some messages or maybe puts them in out of order.<br> A cycle of communication will finish when a message dispatched by root node comes back again to root.<br> here is the code that I have tried: I am just including relevant parts of it.</p> <pre><code>if(procId!=root) { sleep(100); while(1) { tm = MPI_Wtime(); MPI_Irecv( &amp;message, STR_LEN, MPI_CHAR, ((procId-1)&gt;=0?(procId-1):(numProc-1)),RETURN_DATA_TAG, MPI_COMM_WORLD,&amp;receiveRequest); MPI_Wait(&amp;receiveRequest,&amp;status); printf("%d: Received\n",procId); if(!strncmp(message,"STOP",4)&amp;&amp;(procId==(numProc-1))) break; MPI_Ssend( message, STR_LEN, MPI_CHAR, (procId+1)%numProc, SEND_DATA_TAG, MPI_COMM_WORLD); if(!strncmp(message,"STOP",4)) break; printf("%d: Sent\n",procId); } } else { for(iter=0;iter&lt;benchmarkSize;iter++) { //Synthesize the message message[STR_LEN-1] = '\0'; iErr = MPI_Bsend( message, STR_LEN, MPI_CHAR, (root+1)%numProc, SEND_DATA_TAG, MPI_COMM_WORLD); if (iErr != MPI_SUCCESS) { char error_string[BUFSIZ]; int length_of_error_string; MPI_Error_string(iErr, error_string, &amp;length_of_error_string); fprintf(stderr, "%3d: %s\n", procId, error_string); } tm = MPI_Wtime(); while(((MPI_Wtime()-tm)*1000)&lt;delay); printf("Root: Sending\n"); } for(iter=0;iter&lt;benchmarkSize;iter++) { MPI_Recv(message,STR_LEN,MPI_CHAR, (numProc-1),RETURN_DATA_TAG,MPI_COMM_WORLD,&amp;status); //We should not wait for the messages to be received but wait for certain amount of time //Extract the fields in the message if(((prevRcvdSeqNum+1)!=atoi(seqNum))&amp;&amp;(prevRcvdSeqNum!=0)) outOfOrderMsgs++; prevRcvdSeqNum = atoi(seqNum); printf("Seq Num: %d\n",atoi(seqNum)); rcvdMsgs++; printf("Root: Receiving\n"); } MPI_Isend( "STOP", 4, MPI_CHAR, (root+1)%numProc, SEND_DATA_TAG, MPI_COMM_WORLD,&amp;sendRequest); MPI_Wait(&amp;sendRequest,&amp;status); /*This is to ask all other processes to terminate, when the work is done*/ } </code></pre> <p>Now, I have these questions: 1) Why is it that when I inject some sleep in the other processes(I mean other than root) of the ring; NO receive is taking place?<br> 2) Even when the buffer size is only one, how is it that root node is able to dispatch messages through MPI_Bsend without an error? for example the case when it needs to send total 10 messages at a rate of 1000 per second and with buffer size of 1. MPI_Bsend is able to dispatch all the messages without any error of "buffer full"; irrespective of the presence of sleep() in other processes of the ring! Thanks a ton!</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload