/* This program performs a short test of MPI_BSEND in a multithreaded environment. It starts a single receiver thread that expects NUMSENDS messages and NUMSENDS sender threads, that use MPI_Bsend to send a message of size MSGSIZE to its right neigbour or rank 0 if (my_rank==comm_size-1), i.e. target_rank = (my_rank+1)%size . After all messages have been received, the receiver thread prints a message, the threads are joined into the main thread and the application terminates. */ #include #include #include #include #define NUMSENDS 32 #define BUFSIZE 100000 #define MSGSIZE 1024 int rank, size; void* receiver(void *ptr){ int k; char buf[MSGSIZE]; for (k=0;k