bondhugula / pluto

Pluto: An automatic polyhedral parallelizer and locality optimizer
http://pluto-compiler.sourceforge.net
MIT License
268 stars 65 forks source link
automatic-parallelization locality loop-optimization polyhedral-model stencils tiling

Pluto

OVERVIEW

Please see http://pluto-compiler.sourceforge.net.

This package includes both the tool pluto and libpluto. The pluto tool is a source-to-source transformer meant to be run via the polycc script, libpluto provides a thread-safe library interface.

Pluto build and
test

Check format with clang-format

LICENSE

Pluto and libpluto are available under the MIT LICENSE. Please see the file LICENSE in the top-level directory for more details.

INSTALLING PLUTO

PREREQUISITES

A Linux distribution. Pluto has been tested on x86 and x86-64 machines running Fedora, Ubuntu, and CentOS.

Pluto includes all polyhedral libraries that it depends on. See pet/README for pet's pre-requisites.

BUILDING PLUTO

Stable release:

$ tar zxvf pluto-0.11.4.tar.gz
$ cd pluto-0.11.4/
$ ./configure [--with-clang-prefix=<clang install location>]
$ make
$ make test

configure can be provided --with-isl-prefix=<isl install location> to build with another isl, otherwise the bundled isl is used.

Development version from Git:

git clone git@github.com:bondhugula/pluto.git
cd pluto/
git submodule init
git submodule update
./autogen.sh
./configure [--enable-debug] [--with-clang-prefix=<clang headers/libs location>]
# Example: on an Ubuntu: --with-clang-prefix=/usr/lib/llvm-14, on a Fedora,
# typically, it's /usr/lib64/llvm14.
make
make check-pluto

polycc is the wrapper script around src/pluto (core transformer) and all other components. polycc runs all of these in sequence on an input C program (with the section to parallelize/optimize marked) and is what a user should use on input. Output generated is OpenMP parallel C code that can be readily compiled and run on shared-memory parallel machines like general-purpose multicores. libpluto.{so,a} is also built and can be found in src/.libs/. make install will install it.

TRYING A NEW EXAMPLE

To run a good number of experiments on a code, it is best to use the setup created for example codes in the examples/ directory. If you do not have ICC (Intel C compiler), uncomment line 9 and comment line 8 of examples/common.mk to use GCC.

COMMAND-LINE OPTIONS

Run

./polycc -h

or see documentation (doc/DOC.txt) for details.

TRYING ANY INCLUDED EXAMPLE CODE

Let's say we are trying the 2-d gauss seidel kernel. In examples/seidel, do make par; this will generate seidel.par.c from seidel.c and also compile it to generate par. Likewise, make tiled for tiled and make orig for orig.

cd examples/seidel

seidel.c: This is the original code (the kernel in this code is extracted). orig is the corresponding executable when compiled with the native compiler (gcc or icc for eg.) with optimization flags, orig_par with the native compiler's auto-parallelization enabled.

seidel.opt.c: This is the transformed code without tiling (this is of not much use, except for seeing benefits of fusion in some cases). opt is the corresponding executable.

seidel.tiled.c: This is Pluto generated code optimized for locality with tiling and other transformations, but not not parallelized - this should be used for sequential execution. tiled is the corresponding executable.

seidel.par.c: This is Pluto parallelized code optimized for locality and parallelism with tiling and other transformations. This code has OpenMP pragmas. par is the corresponding executable.

The executables already have timers; you just have to run them and that will print execution time for the core part of the computation as well.

To run the Pluto parallelized version:

OMP_NUM_THREADS=4 ./par

To run native compiler optimized/auto-parallelized version:

OMP_NUM_THREADS=4 ./orig_par

To run the original unparallelized code:

./orig

To run the locality optimized version generated by Pluto:

./tiled

make clean in the particular example's directory removes all executables as well as generated codes.

To launch a complete verification that compares output of tiled, par with orig for all examples, in examples/, run make check-pluto.

[examples/ ]$ make check-pluto

MORE INFORMATION

BUGS AND ISSUES

Please report bugs and issues at https://github.com/bondhugula/pluto/issues.

For questions and general discussion, please email pluto-development@googlegroups.com after joining the group: https://groups.google.com/g/pluto-development.