diff --git a/Makefile b/Makefile index 1eab8e13727c0038641ee26273015fbf66e93aa6..472a3e029b0f1bae331c5c26786eab1944d1f4dc 100755 --- a/Makefile +++ b/Makefile @@ -1,11 +1,13 @@ .PHONY: all #all: TEST1 TEST2 TEST3 TEST4 dot convert -all: TEST3 dot convert +all: TEST3 TEST5 TEST6 dot convert TEST1=./tests/simple_test1.c TEST2=./tests/simple_test2.c TEST3=./tests/split_bloc.c TEST4=./tests/pragma_test.c +TEST5=./tests/if_test.c +TEST6=./tests/if_test2.c PLUGIN=plugin.cpp CXX=g++_810 @@ -29,6 +31,10 @@ TEST3: libplugin.so $(TEST3) $(MAKE) -C tests TEST3 TEST4: libplugin.so $(TEST4) $(MAKE) -C tests TEST4 +TEST5: libplugin.so $(TEST5) + $(MAKE) -C tests TEST5 +TEST6: libplugin.so $(TEST6) + $(MAKE) -C tests TEST6 .PHONY: dot dot: diff --git a/plugin.cpp b/plugin.cpp index 2227273a688a008ba3458305baab2961714ae1c0..7d93cb14a52e4e6d7ebf9866fb47a6ece90b6e1d 100755 --- a/plugin.cpp +++ b/plugin.cpp @@ -109,17 +109,11 @@ class split_count_pass : public gimple_opt_pass //writing corresponding MPI Call in corresponding basic block edit_all_aux_value(fun,(int*)NULL); write_mpi_code(fun); - //print_bb_aux(fun); + /* Skip system header functions */ if ( !in_system_header_at( fun->function_start_locus ) ) cfgviz_dump( fun, function_name(fun), 1 ) ; - //edit_all_aux_value(fun,(int*)LAST_AND_UNUSED_MPI_COLLECTIVE_CODE); - //write_mpi_code(fun); - //bitmap_pdf(fun); - //bitmap_pdf_union(fun); - //bitmap_iterated_pdf_union(fun); - //bitmap_mpi_iterated_pdf_union(fun); detect_potential_deadlock(fun); return 0; } diff --git a/tests/Makefile b/tests/Makefile index c5c173cb874246322d38bf52a3f84c5d8ac3b0d1..05d8c198a6e1156b75cd9943d6fed3307636f36a 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -1,9 +1,11 @@ -all: TEST1 TEST2 TEST3 TEST4 +all: TEST1 TEST2 TEST3 TEST4 TEST5 TEST6 TEST1=simple_test1.c TEST2=simple_test2.c TEST3=split_bloc.c TEST4=pragma_test.c +TEST5=if_test.c +TEST6=if_test2.c PLUGIN=plugin.cpp CXX=g++_810 @@ -21,6 +23,10 @@ TEST3: ../libplugin.so $(TEST3) $(MPICC) $(TEST3) $(CFLAGS) -o $@ -fplugin=$< TEST4: ../libplugin.so $(TEST4) $(MPICC) $(TEST4) $(CFLAGS) -o $@ -fplugin=$< +TEST5: ../libplugin.so $(TEST5) + $(MPICC) $(TEST5) $(CFLAGS) -o $@ -fplugin=$< +TEST6: ../libplugin.so $(TEST6) + $(MPICC) $(TEST6) $(CFLAGS) -o $@ -fplugin=$< dot: mv *.dot ../graphs/ diff --git a/tests/if_test.c b/tests/if_test.c new file mode 100644 index 0000000000000000000000000000000000000000..ef39e1602886d3e4f28dd139ce6a7a92823c3c02 --- /dev/null +++ b/tests/if_test.c @@ -0,0 +1,46 @@ +#include <stdio.h> +#include <stdlib.h> + +#include <mpi.h> + +#pragma ProjetCA mpicoll_check mpi_call + +void mpi_call(int c) +{ + MPI_Barrier(MPI_COMM_WORLD); + + if(c<10) + { + printf("je suis dans le if (c=%d)\n", c); + MPI_Barrier(MPI_COMM_WORLD); + + } + else + { + printf("je suis dans le else (c=%d)\n", c); + MPI_Barrier(MPI_COMM_WORLD); + } +} + + +int main(int argc, char * argv[]) +{ + MPI_Init(&argc, &argv); + + int i; + int a = 2; + int b = 3; + int c=0; + + for(i=0; i<10; i++) + { + + mpi_call(c); + c+= (a+b); + } + + printf("c=%d\n", c); + + MPI_Finalize(); + return 1; +} diff --git a/tests/if_test2.c b/tests/if_test2.c new file mode 100644 index 0000000000000000000000000000000000000000..00c396a0e7ed048593f2c5a3d560e3dac8c7c377 --- /dev/null +++ b/tests/if_test2.c @@ -0,0 +1,50 @@ +#include <stdio.h> +#include <stdlib.h> + +#include <mpi.h> + +#pragma ProjetCA mpicoll_check mpi_call + +void mpi_call(int c) +{ + MPI_Barrier(MPI_COMM_WORLD); + + if(c<10) + { + printf("je suis dans le if (c=%d)\n", c); + MPI_Barrier(MPI_COMM_WORLD); + if (c > 5) + { + printf("je suis dans le if imbriqué (c=%d)\n", c); + MPI_Barrier(MPI_COMM_WORLD); + } + } + else + { + printf("je suis dans le else (c=%d)\n", c); + MPI_Barrier(MPI_COMM_WORLD); + } +} + + +int main(int argc, char * argv[]) +{ + MPI_Init(&argc, &argv); + + int i; + int a = 2; + int b = 3; + int c=0; + + for(i=0; i<10; i++) + { + + mpi_call(c); + c+= (a+b); + } + + printf("c=%d\n", c); + + MPI_Finalize(); + return 1; +}