Skip to content
Extraits de code Groupes Projets
Valider 894a183a rédigé par Nicolas MARIE's avatar Nicolas MARIE
Parcourir les fichiers

rename plugin.cpp, add plugin parameters

- rename plugin.cpp to mpi_collective_plugin
- add plugin parameters to display plugin infos & enable graph dump
- change plugin name from libplugin.so to mpicoll_check.so
- fixe make file recusion problems
parent 546d53a9
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
CC=mpicc CC=mpicc
CXX=mpicxx CXX=mpicxx
FLAGS=-Wall -Wextra -Werror -fPIC -fno-rtti FLAGS=-Wall -Wextra -Werror -fPIC -fno-rtti
TEST_FLAGS=-Wall -Wextra -fPIC #-Werror TEST_FLAGS=-Wall -Wextra
LDFLAGS=-shared LDFLAGS=-shared
INCLUDE=-I ./include INCLUDE=-I ./include
PLUGIN_INCLUDE=$(INCLUDE) -I $(shell $(CC) -print-file-name=plugin)/include PLUGIN_INCLUDE=$(INCLUDE) -I $(shell $(CC) -print-file-name=plugin)/include
PLUGIN_FLAGS=-fplugin=$(LIBD)/libplugin.so
# Options dependant flags # Options dependant flags
OPTI_FLAGS=-O2 OPTI_FLAGS=-O2
DEBUG_FLAGS=-g -Og DEBUG_FLAGS=-g -Og
...@@ -22,6 +21,8 @@ FLAGS+=$(DEBUG_FLAGS) ...@@ -22,6 +21,8 @@ FLAGS+=$(DEBUG_FLAGS)
#GDB_GCC=-wrapper gdb,--args #GDB_GCC=-wrapper gdb,--args
PLUGIN_NAME=mpicoll_check
# Directories # Directories
SRCD=src SRCD=src
OBJD=obj OBJD=obj
...@@ -34,7 +35,10 @@ DOTD=dot ...@@ -34,7 +35,10 @@ DOTD=dot
# Files # Files
SRCS=$(notdir $(wildcard $(SRCD)/*.cpp)) SRCS=$(notdir $(wildcard $(SRCD)/*.cpp))
OBJS=$(addprefix $(OBJD)/, $(SRCS:cpp=o)) OBJS=$(addprefix $(OBJD)/, $(SRCS:cpp=o))
TARGET=$(LIBD)/$(PLUGIN_NAME).so
PLUGIN_FLAGS=-fplugin=$(TARGET) #-fplugin-arg-$(PLUGIN_NAME)-dumpgraph -fplugin-arg-$(PLUGIN_NAME)-showinfo
.PHONY: all .PHONY: all
...@@ -47,7 +51,7 @@ all: ...@@ -47,7 +51,7 @@ all:
plugin: plugin:
mkdir -p $(OBJD) mkdir -p $(OBJD)
mkdir -p $(LIBD) mkdir -p $(LIBD)
$(MAKE) $(LIBD)/libplugin.so $(MAKE) $(TARGET)
.PHONY: test .PHONY: test
test: test:
...@@ -70,7 +74,8 @@ test: ...@@ -70,7 +74,8 @@ test:
.PHONY: dots .PHONY: dots
dots: dots:
touch $(DOTD)/lock.dot touch $(DOTD)/lock.dot
$(MAKE) $(shell find $(DOTD) -name "*.dot" | sed 's/\.dot/\.svg/') $(MAKE) $(shell find $(DOTD) -name "*.dot" | sed 's/\.dot/\.svg/') \
$(DOTD)/lock.svg
$(TESTD)/%: $(TESTSRCD)/%.c $(TESTD)/%: $(TESTSRCD)/%.c
$(CC) $(GDB_GCC) $(TEST_FLAGS) $(PLUGIN_FLAGS) $^ -o $@ || echo "(exit 1)" $(CC) $(GDB_GCC) $(TEST_FLAGS) $(PLUGIN_FLAGS) $^ -o $@ || echo "(exit 1)"
...@@ -78,7 +83,7 @@ $(TESTD)/%: $(TESTSRCD)/%.c ...@@ -78,7 +83,7 @@ $(TESTD)/%: $(TESTSRCD)/%.c
$(OBJD)/%.o: $(SRCD)/%.cpp $(OBJD)/%.o: $(SRCD)/%.cpp
$(CXX) $(FLAGS) $(PLUGIN_INCLUDE) -c $^ -o $@ $(CXX) $(FLAGS) $(PLUGIN_INCLUDE) -c $^ -o $@
$(LIBD)/libplugin.so: $(OBJS) $(TARGET): $(OBJS)
$(CXX) $(FLAGS) $(LDFLAGS) $^ -o $@ $(CXX) $(FLAGS) $(LDFLAGS) $^ -o $@
# removing test scince plugin was rebuild # removing test scince plugin was rebuild
rm -rf $(TESTD) rm -rf $(TESTD)
......
...@@ -160,4 +160,6 @@ void verify_mpicoll_list(void *event_data, void *data); ...@@ -160,4 +160,6 @@ void verify_mpicoll_list(void *event_data, void *data);
extern vec<tree> *fun_vec; //function vector in pragma. extern vec<tree> *fun_vec; //function vector in pragma.
extern vec<location_t> *loc_vec; //function of the location of the token extern vec<location_t> *loc_vec; //function of the location of the token
extern bool dumpgraph;
#endif #endif
...@@ -85,10 +85,14 @@ unsigned int pass_mpi_collective::execute(function *fun) ...@@ -85,10 +85,14 @@ unsigned int pass_mpi_collective::execute(function *fun)
calc_dom_data(); calc_dom_data();
label_collec(fun); label_collec(fun);
if(dumpgraph)
{
label_dom(fun); label_dom(fun);
label_post_dom(fun); label_post_dom(fun);
label_dom_front(fun); label_dom_front(fun);
label_post_dom_front(fun); label_post_dom_front(fun);
}
mark_edge(fun); mark_edge(fun);
rank_collective(fun); rank_collective(fun);
...@@ -101,7 +105,10 @@ unsigned int pass_mpi_collective::execute(function *fun) ...@@ -101,7 +105,10 @@ unsigned int pass_mpi_collective::execute(function *fun)
//bitmap_head pdf = get_frontier_from_pds(fun, &pdbitmap); //bitmap_head pdf = get_frontier_from_pds(fun, &pdbitmap);
//debug_bitmap(&pdf); //debug_bitmap(&pdf);
if(dumpgraph)
{
cfgviz_dump(fun, "_split"); cfgviz_dump(fun, "_split");
}
raise_warning_mpi_rank(fun); raise_warning_mpi_rank(fun);
raise_warning_mpi_order(fun); raise_warning_mpi_order(fun);
......
...@@ -36,15 +36,29 @@ void print_plugin_infos(struct plugin_name_args *plugin_info, ...@@ -36,15 +36,29 @@ void print_plugin_infos(struct plugin_name_args *plugin_info,
vec<tree> *fun_vec; vec<tree> *fun_vec;
vec<location_t> *loc_vec; vec<location_t> *loc_vec;
bool dumpgraph;
bool showinfo;
/* Main entry point for plugin */ /* Main entry point for plugin */
int int
plugin_init(struct plugin_name_args *plugin_info, plugin_init(struct plugin_name_args *plugin_info,
struct plugin_gcc_version *version) struct plugin_gcc_version *version)
{ {
bool debug; dumpgraph = false;
debug = false; showinfo = false;
for(int i = 0; i < plugin_info->argc ; ++i)
{
if(strcmp(plugin_info->argv[i].key, "dumpgraph") == 0){
dumpgraph = true;
}
if(strcmp(plugin_info->argv[i].key, "showinfo") == 0){
showinfo = true;
}
}
if (debug) if (showinfo)
{ {
print_plugin_infos(plugin_info, version); print_plugin_infos(plugin_info, version);
} }
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Veuillez vous inscrire ou vous pour commenter