Static Function Analysis for MPI Collectives Detection
This project involves implementing a static analysis plugin for detecting potential issues in MPI collectives, built as a GCC plugin.
To use the plugin, make sure you have:
- GCC version 12.2.0 (Compatibility with other versions is not guaranteed)
- G++ version 12.2.0 (Compatibility with other versions is not guaranteed)
- MPI (Message Passing Interface)
- Graphviz with
dotcommand (for generating graph images)
gcc_1220 and g++_1220. You should modify the Makefile.
Clone the repository and navigate to the project directory:
git clone https://github.com/mickaelsv/gcc-mpi-plugin
cd gcc-mpi-pluginMake sure 'dot' from graphviz is installed, you can run the following command
sudo apt install graphviz # For Debian/Ubuntu-based systemsOr see this page : Github
Compile the plugin and all six test programs:
makeTo compile the plugin and the 6 test programs.
To compile a specific test program (e.g., testN), use:
make testNSee the tests folder for available test programs.
Compile the plugin in "Debug" mode (enables print statements within functions):
make debugTo generate .png images from .dot files representing the graph:
make graphYou can have 2 different outputs given by the plugin.
For example :
tests/test2.c: In function 'main':
tests/test2.c:26:7: warning: Potential issue: MPI collective MPI_Barrier in block 5
26 | MPI_Barrier(MPI_COMM_WORLD);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~
tests/test2.c:34:5: warning: Potential issue: MPI collective MPI_Barrier in block 7
34 | MPI_Barrier(MPI_COMM_WORLD);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~
tests/test2.c:17:5: warning: Potential issue caused by the following fork in block 2
17 | if(c<10)
| ^
tests/test2.c:19:7: warning: Potential issue caused by the following fork in block 3
19 | if(c <5)
| ^This means that there are potential issues with your MPI collectives.
For example
tests/test4.c:6:9: warning: '#pragma ProjetCA mpicoll_check' function 'main' appears multiple times
6 | #pragma Projet_CA mpicoll_check (main, main, banane)
| ^~~~~~~~~
tests/test4.c:7:9: error: '#pragma ProjetCA mpicoll_check' expected parenthesis for list
7 | #pragma Projet_CA mpicoll_check test1, test2
| ^~~~~~~~~
tests/test4.c:8:9: error: '#pragma ProjetCA mpicoll_check' list must be separated by commas
8 | #pragma Projet_CA mpicoll_check (test3 test4)
| ^~~~~~~~~
tests/test4.c:9:9: error: '#pragma ProjetCA mpicoll_check' missing closing perenthesis
9 | #pragma Projet_CA mpicoll_check (test5, test6
| ^~~~~~~~~
tests/test4.c:10:9: error: '#pragma ProjetCA mpicoll_check' unexpected closing perenthesis
10 | #pragma Projet_CA mpicoll_check test7)
| ^~~~~~~~~
tests/test4.c:11:9: error: '#pragma ProjetCA mpicoll_check' argument is not a name
11 | #pragma Projet_CA mpicoll_check ,
| ^~~~~~~~~
tests/test4.c:12:9: error: '#pragma ProjetCA mpicoll_check' argument is not a name
12 | #pragma Projet_CA mpicoll_check (,
| ^~~~~~~~~
tests/test4.c:13:9: error: '#pragma ProjetCA mpicoll_check' argument is not a name
13 | #pragma Projet_CA mpicoll_check (test8,)
| ^~~~~~~~~
tests/test4.c: In function 'main':
tests/test4.c:17:17: error: '#pragma ProjetCA mpicoll_check' pragma not allowed inside a function definition
17 | #pragma Projet_CA mpicoll_check main
| ^~~~~~~~~
Now starting to examine function main
No potential deadlock found.
At top level:
cc1: warning: '#pragma ProjetCA mpicoll_check' function 'banane' is not declared but referenced in pragma
cc1: warning: '#pragma ProjetCA mpicoll_check' function 'test1' is not declared but referenced in pragma
cc1: warning: '#pragma ProjetCA mpicoll_check' function 'test3' is not declared but referenced in pragma
cc1: warning: '#pragma ProjetCA mpicoll_check' function 'test5' is not declared but referenced in pragma
cc1: warning: '#pragma ProjetCA mpicoll_check' function 'test6' is not declared but referenced in pragma
cc1: warning: '#pragma ProjetCA mpicoll_check' function 'test7' is not declared but referenced in pragma
cc1: warning: '#pragma ProjetCA mpicoll_check' function 'test8' is not declared but referenced in pragmaPragma handling is made to understand a following logic :
- #pragma Projet_CA mpicoll_check (fun1,fun2,...,funN)
- #pragma Projet_CA mpicoll_check fun
Where "fun" is a function in your code. You can use pragma to analyse only some specific functions of your code.
If you wish to use this plugin to analyse your C programs with MPI collectives, check the Makefile, you can either add a TARGET in it to check your code, or you can adapt your own Makefile by using ours.
Remove test executables and the plugin:
make cleanRemove all test executables, the plugin, and .dot and .png graph files:
make clean_allA report and slides are available in the report folder.
It is in French.
- Lallemant Hugo
- Saes-Vincensini Mickaël
src/- Contains the source code for the plugin.tests/- Contains test programs to validate the plugin.graph/- Contains.dotand generated.pngfiles representing analysis graphs.report- Contains the report and presentation of the project.