Compiling MUMPS 4.9.2 under Microsoft Visual Studio and Intel Fortran with GNU Make

Introduction

MUMPS is a MUltifrontal Massively Parallel sparse direct Solver developed CERFACS, ENSEEIHT-IRIT, and INRIA:

http://graal.ens-lyon.fr/MUMPS/

MUMPS is a free solver but it is necessary to register to download it.

It is relatively easy to compile MUMPS under Unix – it is just necessary to slightly modify Makefile.inc, several version of which come with the MUMPS distribution. For Windows users there is WinMumps

http://sourceforge.net/projects/winmumps/

a set of Visual Studio project files to compile MUMPS.

The goal of this chapter is to consider how to compile MUMPS under Microsoft Visual Studio and Intel Fortran but under GNU Make. This could be more convenient for those who are get used to GNU Make. The number of changes required is relatively small but it is necessary to modify not only Makefile.inc but also makefiles in src, libseq and examples (total four files), as options for cl and ifort on Windows are not fully compatible with Unix counterparts. See Compiling and Linking: Simple Example with Visual C++ for a short overview of typical options for cl.

The modified files can be browsed at /files/config/MUMPS/4.9.2/ and below I will go through the changes and explain them. Below there is description for a serial version of MUMPS 4.9.2. There is also a version of this document for MUMPS 4.8.4. With these files make in the root of the MUMPS distribution should be enough to build the MUMPS library and examples.

Makefile.inc

This is a modified Makefile.INTEL.SEQ. This file should be put in the root of the MUMPS distribution. Below there are lines that have been changed with comments

#LPORDDIR = $(topdir)/PORD/lib/
#IPORD = -I$(topdir)/PORD/include/
#LPORD = -L$(LPORDDIR) -lpord

I do not use PORD, METIS does the job better.

LMETISDIR = ../lib

This is the library where libmetis.lib is located. I assume that you have copied it to the lib in the MUMPS distribution. It this is not the case, please modify accordingly.

LMETIS = libmetis.lib

This is the name of the METIS library.

ORDERINGSF = -Dmetis

I use only METIS.

CC = cl

The C compiler is cl

AR = lib

The librarian is lib.

LIBSEQ = $(topdir)/libseq/libmpiseq.lib

The library has the extension lib

LIBBLAS = mkl_intel_c.lib mkl_intel_thread.lib mkl_core.lib libiomp5md.lib

This are libraries from Intel MKL. cl and ifort usually find them by using the variable LIB.

LIBOTHERS = -link -LIBPATH:$(LMETISDIR)

We do not need pthread on Windows. Here one can specify where the linker should find the libraries. This is working because this is the last macro on the line to compile examples. If you need to specify path to other libraries, for example BLAS, please do it here.

OPTF = -O3 -MD -Dintel_ -DALLOW_NON_INIT -fpp
OPTL =
OPTC = -O2 -MD

These are optimization flags.

LIBM = $(LIBSEQ)

It is necessary to rename the variable LIB. This variable is used by cl and ifort and without it they will not find system libraries as well as MKL libraries.

src/Makefile and libseq/Makefile

Copy these two files in src/ and libseq/ accordingly.

In these two files it is necessary:

1) To rename *.a to *.lib. The libraries on Windows have the extension lib.

2) To change the option -o to write an object file to -Fo. By default cl and ifort give the extension *.obj to object files (not *.o). With -Fo option it is possible to force cl and ifort to compile to *.o.

3) To change flag for the librarian to -out: in lines with $(AR).

examples/Makefile

Copy this file to examples/

In this file in addition to first two changes above it was also necessary to modify $(LIB) to $(LIBM).

Discussion

This is the official MUMPS Discussion List.


Comments are closed.