提交 e6fcdd47 编写于 作者: Q qijun

fix wrong including header-file in files in paddle/platform/dynload dir

上级 6fd41f7b
...@@ -15,7 +15,9 @@ limitations under the License. */ ...@@ -15,7 +15,9 @@ limitations under the License. */
#pragma once #pragma once
#include <cublas_v2.h> #include <cublas_v2.h>
#include "paddle/platform/dynamic_loader.h" #include <dlfcn.h>
#include <mutex>
#include "paddle/platform/dynload/dynamic_loader.h"
namespace paddle { namespace paddle {
namespace platform { namespace platform {
......
...@@ -15,7 +15,9 @@ limitations under the License. */ ...@@ -15,7 +15,9 @@ limitations under the License. */
#pragma once #pragma once
#include <cudnn.h> #include <cudnn.h>
#include "paddle/platform/dynamic_loader.h" #include <dlfcn.h>
#include <mutex>
#include "paddle/platform/dynload/dynamic_loader.h"
namespace paddle { namespace paddle {
namespace platform { namespace platform {
......
...@@ -15,7 +15,9 @@ limitations under the License. */ ...@@ -15,7 +15,9 @@ limitations under the License. */
#pragma once #pragma once
#include <curand.h> #include <curand.h>
#include "paddle/platform/dynamic_loader.h" #include <dlfcn.h>
#include <mutex>
#include "paddle/platform/dynload/dynamic_loader.h"
namespace paddle { namespace paddle {
namespace platform { namespace platform {
......
...@@ -12,13 +12,14 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ...@@ -12,13 +12,14 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and See the License for the specific language governing permissions and
limitations under the License. */ limitations under the License. */
#include "dynamic_loader.h" #include "paddle/platform/dynload/dynamic_loader.h"
#include <dlfcn.h> #include <dlfcn.h>
#include <memory> #include <memory>
#include <mutex> #include <mutex>
#include <string> #include <string>
#include "gflags/gflags.h" #include "gflags/gflags.h"
#include "glog/logging.h" #include "glog/logging.h"
#include "paddle/framework/enforce.h"
DEFINE_string(cudnn_dir, "", DEFINE_string(cudnn_dir, "",
"Specify path for loading libcudnn.so. For instance, " "Specify path for loading libcudnn.so. For instance, "
...@@ -72,13 +73,12 @@ static inline void GetDsoHandleFromDefaultPath(std::string& dso_path, ...@@ -72,13 +73,12 @@ static inline void GetDsoHandleFromDefaultPath(std::string& dso_path,
*dso_handle = dlopen(dso_path.c_str(), dynload_flags); *dso_handle = dlopen(dso_path.c_str(), dynload_flags);
if (nullptr == *dso_handle) { if (nullptr == *dso_handle) {
if (dso_path == "libcudnn.dylib") { if (dso_path == "libcudnn.dylib") {
LOG(FATAL) PADDLE_ENFORCE(true,
<< "Note: [Recommend] copy cudnn into /usr/local/cuda/ \n" // NOLINT "Note: [Recommend] copy cudnn into /usr/local/cuda/ \n "
<< "For instance, sudo tar -xzf " "For instance, sudo tar -xzf "
"cudnn-7.5-osx-x64-v5.0-ga.tgz -C " // NOLINT "cudnn-7.5-osx-x64-v5.0-ga.tgz -C /usr/local \n sudo "
<< "/usr/local \n sudo chmod a+r " "chmod a+r /usr/local/cuda/include/cudnn.h "
"/usr/local/cuda/include/cudnn.h " // NOLINT "/usr/local/cuda/lib/libcudnn*");
<< "/usr/local/cuda/lib/libcudnn*";
} }
} }
} }
...@@ -106,22 +106,15 @@ static inline void GetDsoHandleFromSearchPath(const std::string& search_root, ...@@ -106,22 +106,15 @@ static inline void GetDsoHandleFromSearchPath(const std::string& search_root,
GetDsoHandleFromDefaultPath(dlPath, dso_handle, dynload_flags); GetDsoHandleFromDefaultPath(dlPath, dso_handle, dynload_flags);
} }
} }
PADDLE_ENFORCE(nullptr != *dso_handle,
CHECK(nullptr != *dso_handle) << "Failed to find dynamic library: " << dlPath "Failed to find dynamic library: %s ( %s ) \n Please specify "
<< " (" << dlerror() << ") \n" "its path correctly using following ways: \n Method. set "
<< "Please specify its path correctly using " "environment variable LD_LIBRARY_PATH on Linux or "
"following ways: \n" "DYLD_LIBRARY_PATH on Mac OS. \n For instance, issue command: "
"export LD_LIBRARY_PATH=... \n Note: After Mac OS 10.11, "
<< "Method. set environment variable " "using the DYLD_LIBRARY_PATH is impossible unless System "
"LD_LIBRARY_PATH on Linux or " "Integrity Protection (SIP) is disabled.",
<< "DYLD_LIBRARY_PATH on Mac OS. \n" dlPath, dlerror());
<< "For instance, issue command: export "
"LD_LIBRARY_PATH=... \n"
<< "Note: After Mac OS 10.11, using the "
"DYLD_LIBRARY_PATH is impossible "
<< "unless System Integrity Protection (SIP) "
"is disabled.";
} }
void GetCublasDsoHandle(void** dso_handle) { void GetCublasDsoHandle(void** dso_handle) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册