Skip to content

Commit 972cc30

Browse files
committed
[Custom OP]Remove old custom OP to reduce whl package volume
1 parent c4c178e commit 972cc30

File tree

23 files changed

+16
-1113
lines changed

23 files changed

+16
-1113
lines changed

paddle/fluid/framework/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,7 @@ if(WITH_TESTING AND TEST selected_rows_test)
364364
set_tests_properties(selected_rows_test PROPERTIES TIMEOUT 120)
365365
endif()
366366

367-
# 2.0 New custom op extension mechanism related
367+
##### 2.0 New custom op extension mechanism related #####
368368

369369
# if not deps `layer`, will cause: undefined symbol: _ZN6paddle10imperative7VarBase9name_set_
370370
set(PADDLE_CUSTOM_OP_MODULES custom_tensor op_meta_info custom_operator layer)

paddle/fluid/framework/c/c_api.cc

Lines changed: 0 additions & 53 deletions
This file was deleted.

paddle/fluid/framework/c/c_api.h

Lines changed: 0 additions & 55 deletions
This file was deleted.

paddle/fluid/framework/load_op_lib.h

Lines changed: 0 additions & 120 deletions
This file was deleted.

paddle/fluid/pybind/pybind.cc

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ limitations under the License. */
3434
#include "paddle/fluid/framework/io/fs.h"
3535
#include "paddle/fluid/framework/ir/coalesce_grad_tensor_pass.h"
3636
#include "paddle/fluid/framework/ir/pass_builder.h"
37-
#include "paddle/fluid/framework/load_op_lib.h"
3837
#include "paddle/fluid/framework/lod_rank_table.h"
3938
#include "paddle/fluid/framework/lod_tensor.h"
4039
#include "paddle/fluid/framework/lod_tensor_array.h"
@@ -1753,7 +1752,6 @@ All parameter, weight, gradient are variables in Paddle.
17531752

17541753
m.def("init_gflags", framework::InitGflags);
17551754
m.def("init_glog", framework::InitGLOG);
1756-
m.def("load_op_library", framework::LoadOpLib);
17571755
m.def("load_op_meta_info_and_register_op",
17581756
framework::LoadOpMetaInfoAndRegisterOp);
17591757
m.def("init_devices", []() { framework::InitDevices(); });

python/paddle/fluid/framework.py

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@
5353
'is_compiled_with_cuda',
5454
'is_compiled_with_xpu',
5555
'Variable',
56-
'load_op_library',
5756
'require_version',
5857
'device_guard',
5958
'set_flags',
@@ -5757,33 +5756,6 @@ def _dygraph_place_guard(place):
57575756
_set_dygraph_tracer_expected_place(tmp_place)
57585757

57595758

5760-
def load_op_library(lib_filename):
5761-
"""
5762-
:api_attr: Static Graph
5763-
5764-
Load a dynamic library, including custom operators and kernels.
5765-
When library is loaded, ops and kernels registered in the library
5766-
will be available in PaddlePaddle main process.
5767-
Please note, the type of custom operators can't have the same type
5768-
with the existing operators in the framework.
5769-
5770-
Args:
5771-
lib_filename (str): name of dynamic library.
5772-
5773-
Returns:
5774-
list[str]: new registered custom op names.
5775-
5776-
Examples:
5777-
.. code-block:: python
5778-
5779-
import paddle.fluid as fluid
5780-
#fluid.load_op_library('custom_op.so')
5781-
5782-
"""
5783-
core.load_op_library(lib_filename)
5784-
return OpProtoHolder.instance().update_op_proto()
5785-
5786-
57875759
def switch_device(device):
57885760
global _current_device
57895761
pre_device = _current_device

python/paddle/fluid/tests/CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ endforeach()
99
add_subdirectory(unittests)
1010
add_subdirectory(book)
1111

12-
# TODO: support New Custom OP on Mac
12+
# 2.0 New custom OP can support Windows/Linux now
13+
# TODO: support 2.0 New Custom OP on Mac
1314
if(NOT APPLE)
1415
add_subdirectory(custom_op)
1516
endif()

python/paddle/fluid/tests/custom_op/CMakeLists.txt

Lines changed: 1 addition & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -19,42 +19,6 @@ py_test(test_custom_concat SRCS test_custom_concat.py)
1919
py_test(test_custom_conj SRCS test_custom_conj.py)
2020

2121
# other tests
22+
py_test(test_sysconfig SRCS test_sysconfig.py)
2223
py_test(test_check_abi SRCS test_check_abi.py)
2324
cc_test(test_check_error SRCS test_check_error.cc DEPS gtest)
24-
py_test(test_sysconfig SRCS test_sysconfig.py)
25-
26-
if(NOT LINUX)
27-
return()
28-
endif()
29-
30-
# Old custom OP only support Linux, only run on Linux
31-
py_test(test_custom_op SRCS test_custom_op.py)
32-
py_test(test_jit_load SRCS test_jit_load.py)
33-
py_test(test_setup_install SRCS test_setup_install.py)
34-
py_test(test_setup_build SRCS test_setup_build.py)
35-
36-
set_tests_properties(test_jit_load PROPERTIES TIMEOUT 180)
37-
set_tests_properties(test_setup_install PROPERTIES TIMEOUT 250)
38-
set_tests_properties(test_setup_build PROPERTIES TIMEOUT 180)
39-
40-
41-
if(WITH_ROCM)
42-
hip_library(relu_op_shared SHARED SRCS relu_op.cc relu_op.cu DEPS paddle_framework_shared)
43-
elseif(WITH_GPU)
44-
nv_library(relu_op_shared SHARED SRCS relu_op.cc relu_op.cu DEPS paddle_framework_shared)
45-
else()
46-
cc_library(relu_op_shared SHARED SRCS relu_op.cc DEPS paddle_framework_shared)
47-
endif()
48-
set_target_properties(relu_op_shared PROPERTIES OUTPUT_NAME relu2_op)
49-
target_link_libraries(relu_op_shared ${FLUID_FRAMEWORK_SHARED_LIB})
50-
51-
# remove the linked glog and gflags when compling relu_op_shared
52-
# otherwise, there is running error:
53-
# ERROR: something wrong with flag 'logtostderr' in file
54-
# 'third_party/glog/src/extern_glog/src/logging.cc'.
55-
# One possibility: file 'third_party/glog/src/extern_glog/src/logging.cc'
56-
# is being linked both statically and dynamically into this executable.
57-
get_target_property(TARGET_LIBRARIES relu_op_shared LINK_LIBRARIES)
58-
LIST(REMOVE_ITEM TARGET_LIBRARIES glog)
59-
LIST(REMOVE_ITEM TARGET_LIBRARIES gflags)
60-
set_property(TARGET relu_op_shared PROPERTY LINK_LIBRARIES ${TARGET_LIBRARIES} )

0 commit comments

Comments
 (0)