====== mpha ======
**mpha** is a software developed at TU Berlin for computing chambers induced by a hyperplane arrangement in parallel. It is a combination of
* **[[https://polymake.org/doku.php|polymake]]** for combinatorics, and
* **[[http://cgm.cs.mcgill.ca/~avis/doc/tutorial.html|mts]]** for parallelising reverse search.
===== Prerequisites =====
Please read this very carefully! mpha is highly optimized software dedicated to exceptionally large enumerations on suitable hardware. As a consequence it depends on a number of up-to-date-versions of other software, and the installation requires some diligence.
You need to have **[[https://www.open-mpi.org/|open-mpi]]** or some other mpi implementation and **[[https://polymake.org/doku.php|polymake]]** version at least 3.2 installed. In particular, you need the **[[https://polymake.org/doku.php/reference/callable|polymake callable library]]**, which might not be installed by the package manager of your distribution.
===== Installation =====
Installation can be done with the following three commands:
./configure
ninja -C build/Opt -j #CPU's
ninja -C build/Opt install
There are several options to the ''%%./configure%%'' command that can be viewed with
./configure --help
The most important options are
--with-polymake=/path/to/polymake/installation
--with-mpi=/path/to/mpi/installation
--prefix=/path/to/install/dir
The configure command will extract most of the information needed from polymake’s ''%%polymake-config%%'' command.
The binaries are in the ''%%build/Opt/bin%%'' folder after building and in the ''%%prefix/bin%%'' folder after installation.
* **mpha1**: Runs reverse search single threaded.
* **mpha**: Multithreaded reverse search.
You can test your build by running the testsuite:
perl testsuite.pl
===== Usage =====
Input files are formatted as in **polymake**. You can just use
$HA = new HyperplaneArrangement(...);
$HA->name="some_name";
save($HA);
in **polymake** to generate a valid input file for mpha. You can then call mpha in the following way:
mpirun -np 5 mpha --input some_name.hyar
If you did not run ''%%make install%%'' you can call the binary in the ''%%build/Opt/bin%%'' folder:
mpirun -np 5 ./build/Opt/bin/mpha --input some_name.hyar
There are several options you can invoke to modify the behaviour of mpha:
==== Budgeting options ====
- ''%%-maxnodes%%'' only affects the “bumps” at maxnodes and scale*maxnodes.
- ''%%-scale%%'' sets the scaling factor when we have many jobs available (workers can work longer if we aren’t trying to split jobs)
- ''%%-maxd%%'' sets the max depth to go to when we don’t have enough jobs available (2 is the default, which is aggressive. 0 disables)
- ''%%-lmax%%'' sets the point where -scale is used (if |L| > lmax * numproc)
- ''%%-lmin%%'' sets the point where -maxd is used (if |L| < lmin * numproc)
===== Checkpointing and restarting =====
**mts** supports checkpointing and restarts; if you add options ''%%-checkp file1 -stop file2%%'' then it will periodically check to see if file file2 exists, and if so then it will checkpoint to file1 when convenient (it waits for workers to finish their current jobs first). Then you can restart using option ''%%-restart file1%%'' (and of course can use -checkp & -stop again, but you should give different filenames to the -restart and -checkp options). There is an example in the section below.
===== Sample usage =====
This section contains samples of how to call ''%%mpha1%%'' and ''%%mpha%%'' using the above options. It is assumed that **mpha** was build, but not installed and that the current directory is the root of the source directory.
==== mpha1 ====
./build/Opt/bin/mpha1 --input square.hyar
==== mpha ====
mpirun -np 8 ./build/Opt/bin/mpha --input square.hyar
The following is an example for checkpointing and restarting:
mpirun -np 8 ./build/Opt/bin/mpha -v -stop stop_file -checkp checkp_file --input square.hyar
touch stop_file
Now the state will be written to the file ''%%checkp_file%%'' and after a while the computation stops. Restart it with
mpirun -np 8 ./build/Opt/bin/mpha -v -restart checkp_file --input square.hyar
===== Drawing the reverse search tree =====
''%%mpha1%%'' can output polymake code that one can paste into polymake to obtain the reverse search tree in the edge graph of the secondary polytope. This will not work for large examples, so handle with care. There are three possibilities:
- Give ''%%mpha1%%'' an example without symmetry group:
./build/Opt/bin/mpha1 --make-tree --input square.hyar
This will just draw all nodes in the same color and the edges between them that the reverse search used. 2. Give ''%%mpha1%%'' an example with symmetry group:
./build/Opt/bin/mpha1 --make-tree --input square.hyar
===== Authors =====
**mpha** is joint work of the following two authors:
* **[[http://page.math.tu-berlin.de/~kastner/|Lars Kastner]]**, Department of Mathematics, TU Berlin, Germany
* **[[http://page.math.tu-berlin.de/~panizzut/|Marta Panizzut]]**, Department of Mathematics, TU Berlin, Germany
===== License =====
**mpha** and **polymake** are licensed under the **[[https://www.gnu.org/licenses/old-licenses/gpl-2.0.html|GNU General Public License version 2]]**.
See the files ''%%COPYING%%'' and ''%%LICENSE%%'' in the source for further details.