Skip to content

Commit

Permalink
fix compile error
Browse files Browse the repository at this point in the history
  • Loading branch information
jiweibo committed Jan 22, 2022
1 parent 3c212e9 commit e3a0763
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 9 deletions.
1 change: 1 addition & 0 deletions paddle/fluid/framework/io/shell.cc
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#define GLOG_NO_ABBREVIATED_SEVERITIES // msvc conflict logging with windows.h
#include "paddle/fluid/framework/io/shell.h"

#include "paddle/fluid/platform/enforce.h"
Expand Down
2 changes: 2 additions & 0 deletions paddle/fluid/platform/os_info.cc
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ limitations under the License. */
#include <unistd.h>
#elif defined(_MSC_VER)
#include <processthreadsapi.h>
#else
#include <unistd.h>
#endif
#include "paddle/fluid/platform/macros.h" // import DISABLE_COPY_AND_ASSIGN

Expand Down
2 changes: 1 addition & 1 deletion paddle/pten/backends/dynload/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cc_library(pten_dynamic_loader SRCS dynamic_loader.cc DEPS enforce)
cc_library(pten_dynamic_loader SRCS dynamic_loader.cc DEPS enforce glog gflags)

list(APPEND CUDA_SRCS cublas.cc cublasLt.cc cudnn.cc curand.cc cusolver.cc cusparse.cc nvtx.cc cufft.cc)

Expand Down
11 changes: 7 additions & 4 deletions paddle/pten/backends/dynload/dynamic_loader.cc
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ limitations under the License. */
// TODO(wilber): The pten computing library requires a component to manage flags
// (maybe not use gflags).
#include "gflags/gflags.h"
#include "glog/logging.h"

DEFINE_string(cudnn_dir,
"",
Expand Down Expand Up @@ -546,12 +547,14 @@ void* GetOpDsoHandle(const std::string& dso_name) {

void* GetNvtxDsoHandle() {
#if defined(__APPLE__) || defined(__OSX__)
PADDLE_THROW(platform::errors::Unimplemented("Nvtx do not support Apple."));
PADDLE_THROW(
paddle::platform::errors::Unimplemented("Nvtx do not support Apple."));
#elif defined(_WIN32)
PADDLE_THROW(platform::errors::Unimplemented("Nvtx do not support Windows."));
#elif !defined(PADDLE_WITH_CUDA)
PADDLE_THROW(
platform::errors::Unimplemented("Nvtx do not support without CUDA."));
paddle::platform::errors::Unimplemented("Nvtx do not support Windows."));
#elif !defined(PADDLE_WITH_CUDA)
PADDLE_THROW(paddle::platform::errors::Unimplemented(
"Nvtx do not support without CUDA."));
#else
return GetDsoHandleFromSearchPath(FLAGS_cuda_dir, "libnvToolsExt.so");
#endif
Expand Down
8 changes: 4 additions & 4 deletions paddle/pten/backends/dynload/port.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved.
// Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand All @@ -17,12 +17,12 @@
#include <time.h>

#include <cstdio>
#include <iostream>
#include <memory>
#include <stdexcept>
#include <string>

#define GLOG_NO_ABBREVIATED_SEVERITIES // msvc conflict logging with windows.h
#include "glog/logging.h"

#if !defined(_WIN32)
#include <dlfcn.h> // dladdr
Expand Down Expand Up @@ -50,7 +50,7 @@ static void *dlsym(void *handle, const char *symbol_name) {
found_symbol = GetProcAddress((HMODULE)handle, symbol_name);

if (found_symbol == NULL) {
std::cerr << "Load symbol " << symbol_name << " failed." << std::endl;
LOG(ERROR) << "Load symbol " << symbol_name << " failed.";
throw std::runtime_error(std::string(symbol_name) + " not found.");
}
return reinterpret_cast<void *>(found_symbol);
Expand Down Expand Up @@ -98,7 +98,7 @@ static void ExecShellCommand(const std::string &cmd, std::string *message) {
std::shared_ptr<FILE> pipe(_popen(cmd.c_str(), "r"), _pclose);
#endif // _WIN32
if (!pipe) {
std::cerr << "error running command: " << cmd << std::endl;
LOG(ERROR) << "error running command: " << cmd;
return;
}
while (!feof(pipe.get())) {
Expand Down

1 comment on commit e3a0763

@paddle-bot-old
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Congratulation! Your pull request passed all required CI. You could ask reviewer(s) to approve and merge. 🎉

Please sign in to comment.