Mondriaan and MATLAB (July 27, 2010)


This guide is a step-by-step introduction to using Mondriaan together with MATLAB. For more extensive information about Mondriaan, please take a look at the user's guide.


How to download and install Mondriaan

Download the latest version from the Mondriaan software homepage. Uncompress with

This will create a directory Mondriaan3 which contains all the files of the Mondriaan package. To enable MATLAB support, open the file Mondriaan3/mondriaan.mk with a text-editor and look for a line which looks similar to

Change the directory on the right-hand side to your installation directory of MATLAB and remove the # in front of the line, such that it looks similar to

Furthermore make sure that the variable MEXSUFFIX is set to the proper extension for MATLAB binary files for your system (from the Mathworks site):

PlatformMEXSUFFIX
Linux (32-bit)mexglx
Linux (64-bit)mexa64
Apple Macintosh (32-bit)mexmaci
Apple Macintosh (64-bit)mexmaci64
Microsoft Windows (32-bit)mexw32
Microsoft Windows (64-bit)mexw64

For example: on a 32-bit Macintosh system we would have MEXSUFFIX := mexmaci.

Now we are ready to compile Mondriaan, run

which will build Mondriaan, the associated tools, and run all the unit tests of Mondriaan. These should all evaluate to OK, if this is not the case, you may need to take a look at your compiler environment or report a possible Mondriaan bug.

A small example

In this example we will partition a small test matrix using the MATLAB interface of Mondriaan.

To be able to read Matrix Market files, we need the file mmread.m file available here, which should be saved in the Mondriaan3/tools directory.

As test matrix we can use tbdmatlab.mtx.gz from the Mondriaan website. The archive should be extracted to the Mondriaan3/tools directory.

Start MATLAB and navigate to the Mondriaan3/tools directory in the Current Directory subwindow. To read and view tbdmatlab.mtx, issue

We can partition the matrix A among 30 processors with a maximum imbalance of 3% by using the mondriaan function in MATLAB

or

where B is the same matrix as A, only with the real values of all the matrix nonzeros set to the index of the processors to which the nonzero was assigned, s contains partitioning information, and u and v contain the indices of the processors to which the vector components are assigned (for the multiplication u = A*v).

We can also visualise the partitioning process by using mondriaanplot in the following fashion:

where the last parameter (2) is the desired permutation method:

ValueOrdering
0None
1Prefix
2Infix (Separated Block Diagonal)
3Postfix (Bordered Block Diagonal)

This concludes this small tutorial.


Last updated July 27, 2010 by Bas Fagginger Auer.
To Home page Mondriaan package.

Valid HTML 4.01 Strict Valid CSS!