Commit ee5567c4 authored by Sandeep's avatar Sandeep Committed by Robert Kimball

fix a bug on finalize when uninitialized bool (#2498)

* fix a bug on finalize when uninitialized bool

* change this_init_comm -> m_init_comm

move init to header
parent 278632dd
...@@ -33,7 +33,7 @@ ngraph::Distributed::Distributed() ...@@ -33,7 +33,7 @@ ngraph::Distributed::Distributed()
if (!MLSL::Environment::GetEnv().IsInitialized()) if (!MLSL::Environment::GetEnv().IsInitialized())
{ {
MLSL::Environment::GetEnv().Init(nullptr, nullptr); MLSL::Environment::GetEnv().Init(nullptr, nullptr);
this_init_comm = true; m_init_comm = true;
} }
#elif NGRAPH_DISTRIBUTED_OMPI_ENABLE #elif NGRAPH_DISTRIBUTED_OMPI_ENABLE
int flag = 0; int flag = 0;
...@@ -41,7 +41,7 @@ ngraph::Distributed::Distributed() ...@@ -41,7 +41,7 @@ ngraph::Distributed::Distributed()
if (!flag) if (!flag)
{ {
MPI_Init(NULL, NULL); MPI_Init(NULL, NULL);
this_init_comm = true; m_init_comm = true;
} }
#else #else
throw ngraph_error("Distributed Library not supported/mentioned"); throw ngraph_error("Distributed Library not supported/mentioned");
...@@ -50,7 +50,7 @@ ngraph::Distributed::Distributed() ...@@ -50,7 +50,7 @@ ngraph::Distributed::Distributed()
ngraph::Distributed::~Distributed() ngraph::Distributed::~Distributed()
{ {
if (this_init_comm == true) if (m_init_comm == true)
{ {
finalize(); finalize();
} }
......
...@@ -29,7 +29,7 @@ namespace ngraph ...@@ -29,7 +29,7 @@ namespace ngraph
int get_rank() const; int get_rank() const;
private: private:
bool this_init_comm; bool m_init_comm = false;
void finalize(); void finalize();
}; };
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment