diff --git a/paddle/fluid/framework/variable_helper.h b/paddle/fluid/framework/variable_helper.h index 4cdfba29249cc..8e50302f10987 100644 --- a/paddle/fluid/framework/variable_helper.h +++ b/paddle/fluid/framework/variable_helper.h @@ -22,7 +22,7 @@ namespace framework { class Variable; -void InitializeVariable(Variable* var, proto::VarType::Type var_type); +TEST_API void InitializeVariable(Variable* var, proto::VarType::Type var_type); void CopyVariable(const Variable& src_var, Variable* dst_var); } // end namespace framework diff --git a/paddle/fluid/platform/timer.h b/paddle/fluid/platform/timer.h index 1da141876a8ae..ab029577fbdd1 100644 --- a/paddle/fluid/platform/timer.h +++ b/paddle/fluid/platform/timer.h @@ -16,6 +16,7 @@ limitations under the License. */ #include #include "paddle/phi/backends/dynload/port.h" +#include "paddle/utils/test_macros.h" #ifdef _WIN32 static unsigned sleep(unsigned seconds) { @@ -34,16 +35,16 @@ class Timer { // Reset() will be called during initialization // all timing variables will be set 0 in Reset() Timer() { Reset(); } - void Reset(); - void Start(); - void Pause(); + TEST_API void Reset(); + TEST_API void Start(); + TEST_API void Pause(); // Resume will get current system time void Resume(); int Count(); // return elapsed time in us double ElapsedUS(); // return elapsed time in ms - double ElapsedMS(); + TEST_API double ElapsedMS(); // return elapsed time in sec double ElapsedSec(); diff --git a/test/cpp/fluid/benchmark/CMakeLists.txt b/test/cpp/fluid/benchmark/CMakeLists.txt index a6b5fe0d21572..0b14b812af9f9 100644 --- a/test/cpp/fluid/benchmark/CMakeLists.txt +++ b/test/cpp/fluid/benchmark/CMakeLists.txt @@ -1,17 +1,4 @@ -cc_test( - op_tester - SRCS op_tester.cc - DEPS timer - framework_proto - proto_desc - lod_tensor - op_registry - device_context - scope - ${GLOB_OP_LIB} - ${GLOB_OPERATOR_DEPS} - phi - common) +paddle_test(op_tester SRCS op_tester.cc DEPS common) if(WITH_ONNXRUNTIME AND WIN32) # Copy onnxruntime for some c++ test in Windows, since the test will diff --git a/test/cpp/fluid/benchmark/op_tester.cc b/test/cpp/fluid/benchmark/op_tester.cc index 162a07bb68971..a685fc98689f6 100644 --- a/test/cpp/fluid/benchmark/op_tester.cc +++ b/test/cpp/fluid/benchmark/op_tester.cc @@ -24,7 +24,6 @@ limitations under the License. */ #include "paddle/fluid/platform/init.h" #include "paddle/fluid/platform/profiler.h" #include "paddle/fluid/platform/timer.h" -#include "paddle/fluid/pybind/pybind.h" // phi #include "paddle/phi/kernels/declarations.h" diff --git a/test/cpp/new_executor/standalone_executor_test.cc b/test/cpp/new_executor/standalone_executor_test.cc index 68df9dff0d7db..5a2cb41831f7d 100644 --- a/test/cpp/new_executor/standalone_executor_test.cc +++ b/test/cpp/new_executor/standalone_executor_test.cc @@ -62,7 +62,6 @@ USE_OP_ITSELF(sgd); USE_OP_ITSELF(squared_l2_norm); USE_OP_ITSELF(memcpy_h2d); USE_OP_ITSELF(memcpy_d2h); -USE_OP_ITSELF(fetch_v2); PD_DECLARE_KERNEL(full, GPU, ALL_LAYOUT); PD_DECLARE_KERNEL(uniform_raw, GPU, ALL_LAYOUT); @@ -75,7 +74,6 @@ PD_DECLARE_KERNEL(concat_grad, GPU, ALL_LAYOUT); PD_DECLARE_KERNEL(matmul, GPU, ALL_LAYOUT); PD_DECLARE_KERNEL(add_raw, KPS, ALL_LAYOUT); PD_DECLARE_KERNEL(add, KPS, ALL_LAYOUT); -PD_DECLARE_KERNEL(add, CPU, ALL_LAYOUT); PD_DECLARE_KERNEL(multiply, KPS, ALL_LAYOUT); PD_DECLARE_KERNEL(multiply_grad, GPU, ALL_LAYOUT); PD_DECLARE_KERNEL(divide, KPS, ALL_LAYOUT);