From b5e9ae89bb5a4232875cd354ffe9a091b43bba69 Mon Sep 17 00:00:00 2001 From: Sam Skalicky Date: Wed, 18 Aug 2021 14:28:16 -0700 Subject: [PATCH] [v1.9.x] stop closing opened libs (#20523) * stopped closing opened libs * removed return handling from load * missed one *lib Co-authored-by: Skalicky --- include/mxnet/c_api.h | 2 +- python/mxnet/library.py | 2 +- src/c_api/c_api.cc | 2 ++ src/initialize.cc | 4 ---- src/initialize.h | 2 +- 5 files changed, 5 insertions(+), 7 deletions(-) diff --git a/include/mxnet/c_api.h b/include/mxnet/c_api.h index 67751a497a05..22afd4fda592 100644 --- a/include/mxnet/c_api.h +++ b/include/mxnet/c_api.h @@ -233,7 +233,7 @@ MXNET_DLL const char *MXGetLastError(); /*! * \brief Load library dynamically * \param path to the library .so file - * \param 0 for quiet, 1 for verbose + * \param verbose 0 for quiet, 1 for verbose * \return 0 when success, -1 when failure happens. */ MXNET_DLL int MXLoadLib(const char *path, unsigned verbose); diff --git a/python/mxnet/library.py b/python/mxnet/library.py index e0c60d4588f9..da16af257957 100644 --- a/python/mxnet/library.py +++ b/python/mxnet/library.py @@ -37,7 +37,7 @@ def load(path, verbose=True): Returns --------- - void + None """ #check if path exists if not os.path.exists(path): diff --git a/src/c_api/c_api.cc b/src/c_api/c_api.cc index 569564a934c0..78c7b29a83b0 100644 --- a/src/c_api/c_api.cc +++ b/src/c_api/c_api.cc @@ -1514,6 +1514,8 @@ void registerPasses(void *lib, int verbose, mxnet::ext::msgSize_t msgSize, /*! * \brief Loads dynamic custom library and initializes it * \param path library path + * \param verbose 0 for quiet, 1 for verbose + * \return 0 when success, -1 when failure happens. */ int MXLoadLib(const char *path, unsigned verbose) { API_BEGIN(); diff --git a/src/initialize.cc b/src/initialize.cc index 84195f961f80..e06f90504a7a 100644 --- a/src/initialize.cc +++ b/src/initialize.cc @@ -96,10 +96,6 @@ LibraryInitializer::LibraryInitializer() install_pthread_atfork_handlers(); } -LibraryInitializer::~LibraryInitializer() { - close_open_libs(); -} - bool LibraryInitializer::lib_is_loaded(const std::string& path) const { return loaded_libs.count(path) > 0; } diff --git a/src/initialize.h b/src/initialize.h index f12b2f6e28c2..04e2322961a7 100644 --- a/src/initialize.h +++ b/src/initialize.h @@ -56,7 +56,7 @@ class LibraryInitializer { */ LibraryInitializer(); - ~LibraryInitializer(); + ~LibraryInitializer() = default; /** * @return true if the current pid doesn't match the one that initialized the library