You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mxnet.apache.org by zh...@apache.org on 2019/06/05 17:12:02 UTC
[incubator-mxnet] branch v1.4.x updated: Backporting the fix to
v1.4.x branch to prevent the crash in naive engine. (#15154)
This is an automated email from the ASF dual-hosted git repository.
zhasheng pushed a commit to branch v1.4.x
in repository https://gitbox.apache.org/repos/asf/incubator-mxnet.git
The following commit(s) were added to refs/heads/v1.4.x by this push:
new b241c41 Backporting the fix to v1.4.x branch to prevent the crash in naive engine. (#15154)
b241c41 is described below
commit b241c41d66081d330fe08c81b6351cdd76234ec6
Author: Amol Lele <19...@users.noreply.github.com>
AuthorDate: Wed Jun 5 10:11:17 2019 -0700
Backporting the fix to v1.4.x branch to prevent the crash in naive engine. (#15154)
---
src/engine/naive_engine.cc | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/src/engine/naive_engine.cc b/src/engine/naive_engine.cc
index 05b72d2..5472db4 100644
--- a/src/engine/naive_engine.cc
+++ b/src/engine/naive_engine.cc
@@ -62,6 +62,8 @@ class NaiveEngine final : public Engine {
};
NaiveEngine() {
+ objpool_opr_ref_ = common::ObjectPool<NaiveOpr>::_GetSharedRef();
+ objpool_var_ref_ = common::ObjectPool<NaiveVar>::_GetSharedRef();
}
// virtual destructor
virtual ~NaiveEngine() {
@@ -220,6 +222,13 @@ class NaiveEngine final : public Engine {
mshadow::Stream<cpu> cpu_stream_;
// GPU streams
std::vector<mshadow::Stream<gpu>*> streams_;
+ /*!
+ * \brief Holding a shared_ptr to the object pool to prevent it from being destructed too early
+ * See also #309 (https://github.com/dmlc/mxnet/issues/309) and similar fix in threaded_engine.h.
+ * Without this, segfaults seen on CentOS7 in test_operator_gpu.py:test_convolution_multiple_streams
+ */
+ std::shared_ptr<common::ObjectPool<NaiveOpr> > objpool_opr_ref_;
+ std::shared_ptr<common::ObjectPool<NaiveVar> > objpool_var_ref_;
}; // class NaiveEngine
Engine *CreateNaiveEngine() {