A parallel version of run_mums

This text and example files are contributed by Carlo de Falco

The files are at /files/contrib/carlo.defalco/

I assume that you have already read Sample code in C++ to run MUMPS. The goal in this section is to compare two codes to run the mumps solver in serial and in parallel.  We would like to develop a command line tool that will read a matrix and a right-hand side

mpiexex -n 4 run_mumps_par matrix rhs

in the Matrix Market format and then writes the solution of the system of linear equations in file rhs.solution also in the Matrix Market format. All IO in this exa

The code is presented in run_mumps_par.cpp and is briefly explained below. It is assumed that you have already browsed the MUMPS documentation and you are familiar with the basics of MPI.

The only differences with the serial version (run_mumps.cpp) are calls to initialize and clean up MPI.

0) Init MPI.

1) The SparseMatrix mat is initialized from the file matrix (first argument in the command line). Here the only difference with run_mumps.cpp is that the flag IsSymmetric must be broadcast to all processes after the host is done loading data:

MPI::COMM_WORLD.Bcast (&IsSymmetric, 1, MPI::INT, 0);

2) Converting matrix to the MUMPS representation is done all on the host so this part is included within

if (rank == 0) { ... }

3) The rhs is also loaded by the host.

4) In this example the analysis/factorization/solution phases are not separated so MUMPS is invoked with:

#define JOB_SOLVE 6
id.job = JOB_SOLVE;
dmumps_c (&id);

5) Output of the solution is handled by the host.

6) After cleaning up MUMPS memory MPI is finalized.

The compilation is different as MPI libraries need to be included so in the makefile something like this must be done:

MPIINCLOC = /opt/openmpi/1.4.3/include
CPP = /opt/openmpi/1.4.3/bin/mpicxx
LIBSCALAPACK = /opt/scalapack/lib/libscalapack.a /opt/blacs/lib/blacs.a \

run_mumps_par : run_mumps_par.o matrices.o
$(CPP) $(FLAGS) -o $@ $@.o matrices.o -L$(LIBLOC)\

run_mumps.o: run_mumps.cpp auxiliary.h matrices.h
$(CPP) $(FLAGS) -I. -I$(INCLOC) -I$(MPIINCLOC) -c run_mumps.cpp

a full Makefile written for 32b OSX, openmpi 1.4.3 and the g++-4.2 compiler is included.

Comments are closed.