Producer-consumer scheme with MPI
Below is a simple implementation of the producer-consumer parallel strategy with MPI. It’s just a dummy example, and could probably be improved greatly, but it is a nice illustration of the producer-consumer model, as well as uses for MPI_ANY_SOURCE, MPI_ANY_TAG, and MPI_Status. #include <stdio.h> #include <mpi.h> #include <time.h> #include <stdlib.h> #include <math.h> // Producer-consumer scheme