提交 e42cafb2 编写于 作者: Q qijun

add executor unittest

上级 3481bdc8
...@@ -45,3 +45,4 @@ cc_library(backward SRCS backward.cc DEPS net_op) ...@@ -45,3 +45,4 @@ cc_library(backward SRCS backward.cc DEPS net_op)
cc_test(backward_test SRCS backward_test.cc DEPS backward recurrent_op device_context) cc_test(backward_test SRCS backward_test.cc DEPS backward recurrent_op device_context)
cc_library(executor SRCS executor.cc DEPS device_context framework_proto) cc_library(executor SRCS executor.cc DEPS device_context framework_proto)
cc_test(executor_test SRCS executor_test.cc DEPS executor)
...@@ -40,7 +40,7 @@ class GraphView : public ProgramDescView { ...@@ -40,7 +40,7 @@ class GraphView : public ProgramDescView {
void Initialize(const ProgramDesc*) override; void Initialize(const ProgramDesc*) override;
}; };
static ProgramDescView* Create(bool is_linear) { ProgramDescView* ProgramDescView::Create(bool is_linear) {
if (is_linear) { if (is_linear) {
return new LinearListView(); return new LinearListView();
} else { } else {
...@@ -91,7 +91,7 @@ static std::unique_ptr<platform::CUDADeviceContext> g_cuda_device_context = ...@@ -91,7 +91,7 @@ static std::unique_ptr<platform::CUDADeviceContext> g_cuda_device_context =
make_unique<platform::CUDADeviceContext>(platform::GPUPlace(0)); make_unique<platform::CUDADeviceContext>(platform::GPUPlace(0));
#endif #endif
static Executor* NewLocalExecutor(const platform::Place& place, Executor* NewLocalExecutor(const platform::Place& place,
const ProgramDesc& pdesc, bool is_linear) { const ProgramDesc& pdesc, bool is_linear) {
platform::DeviceContext* device_context = nullptr; platform::DeviceContext* device_context = nullptr;
if (platform::is_cpu_place(place)) { if (platform::is_cpu_place(place)) {
......
...@@ -26,7 +26,7 @@ class Executor { ...@@ -26,7 +26,7 @@ class Executor {
virtual void Run() = 0; virtual void Run() = 0;
}; };
static Executor* NewLocalExecutor(const platform::Place&, const ProgramDesc&); Executor* NewLocalExecutor(const platform::Place&, const ProgramDesc&, bool);
} // namespace framework } // namespace framework
} // namespace paddle } // namespace paddle
...@@ -15,4 +15,12 @@ limitations under the License. */ ...@@ -15,4 +15,12 @@ limitations under the License. */
#include "paddle/framework/executor.h" #include "paddle/framework/executor.h"
#include "gtest/gtest.h" #include "gtest/gtest.h"
TEST(Executor, Init) {} using namespace paddle::platform;
\ No newline at end of file using namespace paddle::framework;
TEST(Executor, Init) {
ProgramDesc pdesc;
CPUPlace cpu_place;
Executor* executor = NewLocalExecutor(cpu_place, pdesc, true);
executor->Run();
}
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册