MPI hangs on MPI_Send for large messages

The details of the Cube class aren’t relevant here: consider a simpler version #include <mpi.h> #include <cstdlib> using namespace std; int main(int argc, char *argv[]) { int size, rank; const int root = 0; int datasize = atoi(argv[1]); MPI_Init(&argc, &argv); MPI_Comm_size(MPI_COMM_WORLD, &size); MPI_Comm_rank(MPI_COMM_WORLD, &rank); if (rank != root) { int nodeDest = rank + 1; … Read more

writing a matrix into a single txt file with mpi

So it’s not a good idea to write large amounts of data as text. It’s really, really, slow, it generates unnecessarily large files, and it’s a pain to deal with. Large amounts of data should be written as binary, with only summary data for humans written as text. Make the stuff the computer is going … Read more

MPI_Type_create_subarray and MPI_Gather

So this is a little more subtle, and requires some understanding of how the Gather collective places complex types. If you look at most examples of MPI_Gather, they’re of 1-d arrays, and it’s fairly easy to interpret what should happen; you’re getting (say) 10 ints from each process, and Gather is smart enough to put … Read more

Probe seems to consume the CPU

Yes; most MPI implementations, for the sake of performance, busy-wait on blocking operations. The assumption is that the MPI job is the only thing going on that we care about on the processor, and if the task is blocked waiting for communications, the best thing to do is to continually poll for that communication to … Read more

Parallel Algorithms for Generating Prime Numbers (possibly using Hadoop’s map reduce)

Here’s an algorithm that is built on mapping and reducing (folding). It expresses the sieve of Eratosthenes      P = {3,5,7, …} \ U {{p2, p2+2p, p2+4p, …} | p in P} for the odd primes (i.e without the 2). The folding tree is indefinitely deepening to the right, like this: where each prime number … Read more

How to compile an MPI included c program using cmake

OpenMP Is this a question about OpenMP? Then all you have to do is compile with -fopenmp which you can do by appending it to CMAKE_C_FLAGS, for example: SET(CMAKE_C_FLAGS “${CMAKE_C_FLAGS} -fopenmp) MPI For MPI, you have to find mpi first find_package(MPI) #make it REQUIRED, if you want then add it’s header files to your search … Read more