Building FreeFEM++ with Intel® Software Tools for Developers

FreeFEM++ is a package that targeted for researchers who needs a powerful tool for solving partial differential equations.

It can be found at http://www.freefem.org/

By default build instructions for FreeFEM++ uses open-source products http://www.freefem.org/ff++/linux.php .

Intel provides for software developers a wonderful product Intel® Parallel Studio XE. It can be used to get additional optimizations and performance of FreeFEM++ on Intel platforms.

Prework

Let's download Intel Parallel Studio XE and install it to <IPSXE_install_dir>.

Currently version 2018 Update 1 is released and will be used.

Prepare build directories structure:

	$ mkdir FreeFEM++
	$ cd FreeFEM++

Download FreeFED++:

	$ wget http://www.freefem.org/ff++/ftp/freefem++-3.59.tar.gz 

And unzip it

	$ tar -xzvf ./freefem++-3.59.tar.gz
	$ cd freefem++-3.59/ 

Building

We will use Intel(R) Composer, Intel(R) Math Kernel Library(Intel(R) MKL) and Intel(R) MPI Library (Intel(R) MPI):

$ source <IPSXE_install_dir>/bin/psxevars.sh intel64

FreeFEM++ for building uses traditional autotools way: configure - make. So let's setup it with Intel tools (single line will be given below):

$ export OPTF=-xCOMMON-AVX512 
$ export CC=icc 
$ export CFLAGS=$OPTF 
$ export CXX=icpc 
$ export CXXFLAGS=$OPTF 
$ export FC=ifort 
$ export FCFLAGS=$OPTF 
$ export F77=ifort 
$ export FFLAGS=$OPTF 
$ ./configure --enable-download --with-mpiinc=-I${I_MPI_ROOT}/intel64/include --with-mpilibs="-L${I_MPI_ROOT}/intel64/lib/release_mt -L${I_MPI_ROOT}/intel64/lib -lmpicxx -lmpifort -lmpi -lmpigi -ldl -lrt -lpthread" --with-mpilibsc="-L${I_MPI_ROOT}/intel64/lib/release_mt -L${I_MPI_ROOT}/intel64/lib -lmpicxx -lmpifort -lmpi -lmpigi -ldl -lrt -lpthread"

Where icc is Intel® C compiler, icpc - Intel® C++ compiler, ifort - Intel® Fortran Compiler.

We are using --with-mpiinc and --with-mpilbs to notify FreeFEM++ how to build packages with Intel® MPI Library. Unfortunately traditional mpiicc, mpiicpc and mpiifort cause compatibility issues.

The same with single line is:

	$ CC=icc CFLAGS=-axCOMMON-AVX512 CXX=icpc CXXFLAGS=-axCOMMON-AVX512 FC=ifort FCFLAGS=-axCOMMON-AVX512 F77=ifort FFLAGS=-axCOMMON-AVX512 ./configure --enable-download --with-mpiinc=-I${I_MPI_ROOT}/intel64/include --with-mpilibs="-L${I_MPI_ROOT}/intel64/lib/release_mt -L${I_MPI_ROOT}/intel64/lib -lmpicxx -lmpifort -lmpi -lmpigi -ldl -lrt -lpthread" --with-mpilibsc="-L${I_MPI_ROOT}/intel64/lib/release_mt -L${I_MPI_ROOT}/intel64/lib -lmpicxx -lmpifort -lmpi -lmpigi -ldl -lrt -lpthread"

Also as we are using -xCOMMON-AVX512, so we need to set system default compiler to icc:

	$ alias cpp=icpc

And now we can build it all

	$ make

Unfortunately parallel build (-j<n>) is not supported, so it will take some time.

Conclusion

Enjoy your FreeFEM++ with Intel® Software Tools for developers!

Para obter informações mais completas sobre otimizações do compilador, consulte nosso aviso de otimização.