diff --git a/paddle/framework/CMakeLists.txt b/paddle/framework/CMakeLists.txt index 3ee721ac9371c15deba2f9cef0c4f30ab39c90d3..2cad2e54fa5c0c80d582fa6488bdd889284fbe05 100644 --- a/paddle/framework/CMakeLists.txt +++ b/paddle/framework/CMakeLists.txt @@ -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_library(executor SRCS executor.cc DEPS device_context framework_proto) +cc_test(executor_test SRCS executor_test.cc DEPS executor) diff --git a/paddle/framework/executor.cc b/paddle/framework/executor.cc index 8534e70f48247e04a3eb2e5b059d2fac7a44dd55..7fda2332b872280c836aaf0367219b25b6cf43ab 100644 --- a/paddle/framework/executor.cc +++ b/paddle/framework/executor.cc @@ -40,7 +40,7 @@ class GraphView : public ProgramDescView { void Initialize(const ProgramDesc*) override; }; -static ProgramDescView* Create(bool is_linear) { +ProgramDescView* ProgramDescView::Create(bool is_linear) { if (is_linear) { return new LinearListView(); } else { @@ -91,8 +91,8 @@ static std::unique_ptr g_cuda_device_context = make_unique(platform::GPUPlace(0)); #endif -static Executor* NewLocalExecutor(const platform::Place& place, - const ProgramDesc& pdesc, bool is_linear) { +Executor* NewLocalExecutor(const platform::Place& place, + const ProgramDesc& pdesc, bool is_linear) { platform::DeviceContext* device_context = nullptr; if (platform::is_cpu_place(place)) { device_context = g_cpu_device_context.get(); diff --git a/paddle/framework/executor.h b/paddle/framework/executor.h index 69f0e3f18fc2fee2959752ded052179f93599a46..25ef2d4d48f0f1fdbc00cfe7528a27f625cc12ee 100644 --- a/paddle/framework/executor.h +++ b/paddle/framework/executor.h @@ -26,7 +26,7 @@ class Executor { virtual void Run() = 0; }; -static Executor* NewLocalExecutor(const platform::Place&, const ProgramDesc&); +Executor* NewLocalExecutor(const platform::Place&, const ProgramDesc&, bool); } // namespace framework } // namespace paddle diff --git a/paddle/framework/executor_test.cc b/paddle/framework/executor_test.cc index f8a41b12ad218f8fb895710687c7477419bbac29..c046ae315826918028139d1c7ddb8d1061064022 100644 --- a/paddle/framework/executor_test.cc +++ b/paddle/framework/executor_test.cc @@ -15,4 +15,12 @@ limitations under the License. */ #include "paddle/framework/executor.h" #include "gtest/gtest.h" -TEST(Executor, Init) {} \ No newline at end of file +using namespace paddle::platform; +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