diff --git a/src/ModelCheckBaseMT.cpp b/src/ModelCheckBaseMT.cpp index 1b54f664724b7fbccd4705bda3bf4617054b4edb..166eed4c21f3b4253ff9582ca0a2bf55a9015944 100644 --- a/src/ModelCheckBaseMT.cpp +++ b/src/ModelCheckBaseMT.cpp @@ -20,6 +20,12 @@ void ModelCheckBaseMT::loadNet() m_graph->setPlace(m_placeName); } +ModelCheckBaseMT::~ModelCheckBaseMT() +{ + cout<<__func__<<endl; +} + + diff --git a/src/ModelCheckBaseMT.h b/src/ModelCheckBaseMT.h index 00d313c616c24e80a58c51cd2e025d68c40aeac8..af8a2d5f8cf867eb840945edff6f7bbe6b10c73b 100644 --- a/src/ModelCheckBaseMT.h +++ b/src/ModelCheckBaseMT.h @@ -7,6 +7,7 @@ public: virtual LDDState * buildInitialMetaState()=0; virtual void buildSucc(LDDState *agregate)=0; void loadNet(); + virtual ~ModelCheckBaseMT(); protected: int m_nb_thread; private: diff --git a/src/ModelCheckerTh.cpp b/src/ModelCheckerTh.cpp index b5ca2cbc586d46e757c1c48df4312877bc5882dc..aedecafb3ed09834f9c093238fbd02db5cbfc080 100644 --- a/src/ModelCheckerTh.cpp +++ b/src/ModelCheckerTh.cpp @@ -185,6 +185,7 @@ void * ModelCheckerTh::Compute_successors() pthread_barrier_wait(&m_barrier_builder); } while (!m_finish); + cout<<"exit thread i"<<id_thread<<endl; } @@ -228,10 +229,15 @@ void ModelCheckerTh::ComputeTh_Succ() } ModelCheckerTh::~ModelCheckerTh() { m_finish=true; + cout<<"Destructor"<<endl; pthread_barrier_wait(&m_barrier_threads); + cout<<"Before builder..."<<endl; pthread_barrier_wait(&m_barrier_builder); + cout<<"After barrier..."<<endl; for (int i = 0; i < m_nb_thread; i++) { + cout<<"thread "<<i<<endl; pthread_join(m_list_thread[i], NULL); } + cout<<"Exit Destructor"<<endl; } diff --git a/src/main.cpp b/src/main.cpp index 985756446af247bfdf81caf0b241f9936012f656..620d144c1bdcacdb2f78fda9d7b2805e8b5547ab 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -127,12 +127,14 @@ int main(int argc, char** argv) MPI_Comm_rank(MPI_COMM_WORLD,&task_id); // - if (n_tasks==1 && !strcmp(argv[1],"otfL")) + if (n_tasks==1 && (!strcmp(argv[1],"otfL") || !strcmp(argv[1],"otfP"))) { - cout<<"Multi-threaded on the fly Model checking (Lace)..."<<endl; + cout<<"Performing on the fly Model checking..."<<endl; + if (!strcmp(argv[1],"otfP")) cout<<"Multi-threaded algorithm based on Pthread library!"<<endl; + else cout<<"Multi-threaded algorithm based on Lace framework!"<<endl; cout<<"Building automata for not(formula)\n"; auto d = spot::make_bdd_dict(); - // d->register_ap("jbhkj"); + spot::twa_graph_ptr af = spot::translator(d).run(not_f); cout<<"Formula automata built.\n"; cout<<"Want to save the graph in a dot file ?"; @@ -147,8 +149,11 @@ int main(int argc, char** argv) spot::print_dot(file, af); file.close(); } - // Initialize SOG builder - ModelCheckLace* mcl=new ModelCheckLace(R,bound,nb_th); + cout<<"Loading net information..."<<endl; + ModelCheckBaseMT* mcl; + if (!strcmp(argv[1],"otfL")) mcl=new ModelCheckLace(R,bound,nb_th); + else + mcl=new ModelCheckerTh(R,bound,nb_th); mcl->loadNet(); auto k = std::make_shared<SogKripkeTh>(d,mcl,R.getListTransitionAP(),R.getListPlaceAP()); @@ -170,62 +175,7 @@ int main(int argc, char** argv) if (auto run = k->intersecting_run(af)) { std::cout << "formula is violated by the following run:\n"<<*run<<endl; - /*run->highlight(5); // 5 is a color number. - fstream file; - file.open("violated.dot",fstream::out); - cout<<"Property is violated!"<<endl; - cout<<"Check the dot file."<<endl; - spot::print_dot(file, k, ".kA"); - file.close();*/ - } - else - std::cout << "formula is verified\n"; - - } - else if (n_tasks==1 && !strcmp(argv[1],"otfP")) - { - cout<<"Multi-threaded on the fly Model checking (Pthread)..."<<endl; - cout<<"Building automata for not(formula)\n"; - auto d = spot::make_bdd_dict(); - - spot::twa_graph_ptr af = spot::translator(d).run(not_f); - cout<<"Formula automata built.\n"; - cout<<"Want to save the graph in a dot file ?"; - char c; - cin>>c; - if (c=='y') - { - fstream file; - string st(formula); - st+=".dot"; - file.open(st.c_str(),fstream::out); - spot::print_dot(file, af); - file.close(); - } - // Initialize SOG builder - ModelCheckerTh* mcl=new ModelCheckerTh(R,bound,nb_th); - mcl->loadNet(); - auto k = - std::make_shared<SogKripkeTh>(d,mcl,R.getListTransitionAP(),R.getListPlaceAP()); ; - - // Performing on the fly Modelchecking - cout<<"Want to save the graph in a dot file ?"; - cin>>c; - if (c=='y') - { - fstream file; - - string st(argv[3]); - st+=".dot"; - file.open(st.c_str(),fstream::out); - spot::print_dot(file, k,"ka"); - file.close(); - } - cout<<"Performing on the fly Modelchecking"<<endl; - - if (auto run = k->intersecting_run(af)) - { - std::cout << "formula is violated by the following run:\n"<<*run<<endl; + cout<<"=================================="<<endl; /*run->highlight(5); // 5 is a color number. fstream file; file.open("violated.dot",fstream::out); @@ -237,9 +187,7 @@ int main(int argc, char** argv) else std::cout << "formula is verified\n"; delete mcl; - } - else if (n_tasks==1) { cout<<"number of task = 1 \n " <<endl;