~~NOTOC~~
====== Compiling potfit with MPI parallelization ======
----
//potfit// does support all common MPI implementations for parallel execution. While the build process for an MPI-enabled build is almost the same as a regular build, there are some minor differences you should be aware of.
===== Basics =====
In order to enable MPI support in //potfit// the ''--enable-mpi'' command line option needs to be specified. It will always be assumed that there is an ''mpicc'' command which knows how to handle the current environment properly.
When using ''--enable-mpi'' you cannot specify a compiler with the ''--check-c-compiler'' flag!
A command to compile //potfit// with MPI support might look like this:
./waf configure -i pair -m apot --enable-mpi
Usually you should see output similar to this:
Checking for 'icc' (C compiler) : not found
Checking for 'clang' (C compiler) : not found
Checking for 'gcc' (C compiler) : mpicc
All enabled options will also be listed on the summary of the configuration stage:
potfit has been configured with the following options:
potential model = apot
interaction = pair
math library = mkl
options = mpi
===== Selecting the MPI compiler =====
The selection of the MPI compiler depends on your MPI implementation. For [[https://www.open-mpi.org/|Open MPI]] this behavior is controlled through environment variables, like ''OMPI_CC'', ''OMPI_CFLAGS'' and ''OMPI_LDFLAGS''.
To switch the compiler you can use this command (OpenMPI):
OMPI_CC="clang" ./waf configure -i pair -m apot --enable-mpi
Checking the output, you should see that the ''mpicc'' command has now been identified as a clang compiler:
Checking for 'icc' (C compiler) : not found
Checking for 'clang' (C compiler) : mpicc
To make sure the same value of the environment variables are used for all steps of the //potfit// compilation process please export the variable using you shell.