提交 488a2dd2 编写于 作者: D dzhwinter

with ir node

上级 c7e0ed83
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
#include <string> #include <string>
#include "paddle/fluid/framework/program_desc.h" #include "paddle/fluid/framework/program_desc.h"
#include "paddle/fluid/inference/analysis/data_flow_graph.h" #include "paddle/fluid/inference/analysis/data_flow_graph.h"
#include "paddle/fluid/platform/enforce.h"
namespace paddle { namespace paddle {
namespace inference { namespace inference {
...@@ -60,7 +61,6 @@ struct Argument { ...@@ -60,7 +61,6 @@ struct Argument {
std::unique_ptr<std::string> model_output_store_path; std::unique_ptr<std::string> model_output_store_path;
}; };
#define UNLIKELY(condition) __builtin_expect(static_cast<bool>(condition), 0)
#define ANALYSIS_ARGUMENT_CHECK_FIELD(field__) \ #define ANALYSIS_ARGUMENT_CHECK_FIELD(field__) \
if (UNLIKELY(!(field__))) { \ if (UNLIKELY(!(field__))) { \
LOG(ERROR) << "field " << #field__ << " should be set."; \ LOG(ERROR) << "field " << #field__ << " should be set."; \
......
...@@ -14,7 +14,6 @@ limitations under the License. */ ...@@ -14,7 +14,6 @@ limitations under the License. */
#pragma once #pragma once
#include <sys/stat.h>
#include <cstdio> #include <cstdio>
#include <fstream> #include <fstream>
#include <string> #include <string>
...@@ -26,6 +25,7 @@ limitations under the License. */ ...@@ -26,6 +25,7 @@ limitations under the License. */
#include "paddle/fluid/framework/scope.h" #include "paddle/fluid/framework/scope.h"
#include "paddle/fluid/framework/variable.h" #include "paddle/fluid/framework/variable.h"
#include "paddle/fluid/platform/enforce.h" #include "paddle/fluid/platform/enforce.h"
#include "paddle/fluid/platform/port.h"
namespace paddle { namespace paddle {
namespace inference { namespace inference {
...@@ -124,20 +124,6 @@ T &GetFromScope(const framework::Scope &scope, const std::string &name) { ...@@ -124,20 +124,6 @@ T &GetFromScope(const framework::Scope &scope, const std::string &name) {
return *var->GetMutable<T>(); return *var->GetMutable<T>();
} }
static void ExecShellCommand(const std::string &cmd, std::string *message) {
char buffer[128];
std::shared_ptr<FILE> pipe(popen(cmd.c_str(), "r"), pclose);
if (!pipe) {
LOG(ERROR) << "error running command: " << cmd;
return;
}
while (!feof(pipe.get())) {
if (fgets(buffer, 128, pipe.get()) != nullptr) {
*message += buffer;
}
}
}
static framework::proto::ProgramDesc LoadProgramDesc( static framework::proto::ProgramDesc LoadProgramDesc(
const std::string &model_path) { const std::string &model_path) {
std::ifstream fin(model_path, std::ios::in | std::ios::binary); std::ifstream fin(model_path, std::ios::in | std::ios::binary);
...@@ -159,16 +145,6 @@ static bool FileExists(const std::string &filepath) { ...@@ -159,16 +145,6 @@ static bool FileExists(const std::string &filepath) {
return exists; return exists;
} }
static bool PathExists(const std::string &path) {
struct stat statbuf;
if (stat(path.c_str(), &statbuf) != -1) {
if (S_ISDIR(statbuf.st_mode)) {
return true;
}
}
return false;
}
} // namespace analysis } // namespace analysis
} // namespace inference } // namespace inference
} // namespace paddle } // namespace paddle
......
...@@ -307,10 +307,12 @@ op_library(save_combine_op DEPS lod_tensor) ...@@ -307,10 +307,12 @@ op_library(save_combine_op DEPS lod_tensor)
op_library(load_combine_op DEPS lod_tensor) op_library(load_combine_op DEPS lod_tensor)
op_library(concat_op DEPS concat) op_library(concat_op DEPS concat)
if (NOT WIN32)
# FIXME(thuan): Move CSP operators to paddle/fluid/framework/operators/concurrency # FIXME(thuan): Move CSP operators to paddle/fluid/framework/operators/concurrency
add_subdirectory(concurrency) add_subdirectory(concurrency)
op_library(channel_send_op DEPS concurrency) op_library(channel_send_op DEPS concurrency)
op_library(channel_recv_op DEPS concurrency) op_library(channel_recv_op DEPS concurrency)
endif(NOT WIN32)
list(REMOVE_ITEM GENERAL_OPS ${DEPS_OPS}) list(REMOVE_ITEM GENERAL_OPS ${DEPS_OPS})
......
...@@ -14,15 +14,22 @@ ...@@ -14,15 +14,22 @@
#pragma once #pragma once
#include <cstdio>
#include <stdexcept> #include <stdexcept>
#include <string> #include <string>
#if !defined(_WIN32) #if !defined(_WIN32)
#include <dlfcn.h> // for dladdr #include <dlfcn.h> // for dladdr
#include <execinfo.h> // for backtrace #include <execinfo.h> // for backtrace
#include <sys/stat.h>
#else #else
#include <Shlwapi.h> #include <io.h> // _popen, _pclose
#include <Windows.h> #include <windows.h>
#ifndef S_ISDIR // windows port for sys/stat.h
#define S_ISDIR(mode) (((mode)&S_IFMT) == S_IFDIR)
#endif
static void* dlsym(void* handle, const char* symbol_name) { static void* dlsym(void* handle, const char* symbol_name) {
FARPROC found_symbol; FARPROC found_symbol;
...@@ -34,4 +41,43 @@ static void* dlsym(void* handle, const char* symbol_name) { ...@@ -34,4 +41,43 @@ static void* dlsym(void* handle, const char* symbol_name) {
return reinterpret_cast<void*>(found_symbol); return reinterpret_cast<void*>(found_symbol);
} }
#endif #endif // !_WIN32
static void ExecShellCommand(const std::string &cmd, std::string *message) {
char buffer[128];
#if !defined(_WIN32)
std::shared_ptr<FILE> pipe(popen(cmd.c_str(), "r"), pclose);
#else
std::shared_ptr<FILE> pipe(_popen(cmd.c_str(), "r"), _pclose);
#endif // _WIN32
if (!pipe) {
LOG(ERROR) << "error running command: " << cmd;
return;
}
while (!feof(pipe.get())) {
if (fgets(buffer, 128, pipe.get()) != nullptr) {
*message += buffer;
}
}
}
static bool PathExists(const std::string &path) {
#if !defined(_WIN32)
struct stat statbuf;
if (stat(path.c_str(), &statbuf) != -1) {
if (S_ISDIR(statbuf.st_mode)) {
return true;
}
}
#else
struct _stat statbuf;
if (_stat(path.c_str(), &statbuf) != -1) {
if (S_ISDIR(statbuf.st_mode)) {
return true;
}
}
#endif // !_WIN32
return false;
}
static FILE
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册