未验证 提交 7aa7fc49 编写于 作者: Z Zheng-Bicheng 提交者: GitHub

[Test Mv] python/paddle/fluid/tests/custom_op/*.py to test/custom_op (#51948)

上级 45acb717
...@@ -10,5 +10,4 @@ endforeach() ...@@ -10,5 +10,4 @@ endforeach()
add_subdirectory(unittests) add_subdirectory(unittests)
add_subdirectory(cpp_extension) add_subdirectory(cpp_extension)
add_subdirectory(custom_op)
add_subdirectory(custom_runtime) add_subdirectory(custom_runtime)
# New custom OP can support Windows/Linux/Mac now
if(WITH_GPU OR APPLE)
py_test(test_custom_relu_op_setup SRCS test_custom_relu_op_setup.py)
py_test(test_custom_relu_op_jit SRCS test_custom_relu_op_jit.py)
py_test(test_custom_relu_model SRCS test_custom_relu_model.py)
py_test(test_context_pool SRCS test_context_pool.py)
# Compiling shared library will cost some time, but running process is very fast.
set_tests_properties(test_custom_relu_op_setup PROPERTIES TIMEOUT 250)
set_tests_properties(test_custom_relu_op_jit PROPERTIES TIMEOUT 180)
set_tests_properties(test_custom_relu_model PROPERTIES TIMEOUT 180)
set_tests_properties(test_context_pool PROPERTIES TIMEOUT 180)
if($ENV{USE_STANDALONE_EXECUTOR})
# these test will fail in some server due to PR#42149, temporarily set it use old executor.
set_tests_properties(test_custom_relu_op_setup
PROPERTIES ENVIRONMENT FLAGS_USE_STANDALONE_EXECUTOR=0)
set_tests_properties(test_custom_relu_model
PROPERTIES ENVIRONMENT FLAGS_USE_STANDALONE_EXECUTOR=0)
endif()
endif()
if(WITH_GPU AND WITH_DISTRIBUTE)
py_test(test_custom_op_relu_model_static_multidevice
SRCS test_custom_op_relu_model_static_multidevice.py)
set_tests_properties(test_custom_op_relu_model_static_multidevice
PROPERTIES LABELS "RUN_TYPE=EXCLUSIVE" TIMEOUT 180)
endif()
if(WITH_XPU AND WITH_DISTRIBUTE)
set(CUSTOM_XPU_ENVS FLAGS_init_allocated_mem=0)
py_test(test_custom_relu_op_xpu_setup SRCS test_custom_relu_op_xpu_setup.py
ENVS ${CUSTOM_XPU_ENVS})
py_test(test_custom_op_relu_model_static_multidevice
SRCS test_custom_op_relu_model_static_multidevice.py ENVS
${CUSTOM_XPU_ENVS})
set_tests_properties(test_custom_op_relu_model_static_multidevice
PROPERTIES LABELS "RUN_TYPE=EXCLUSIVE" TIMEOUT 180)
endif()
py_test(test_custom_raw_op_kernel_op SRCS test_custom_raw_op_kernel_op.py)
set_tests_properties(test_custom_raw_op_kernel_op PROPERTIES TIMEOUT 180)
py_test(test_custom_tensor_operator SRCS test_custom_tensor_operator.py)
set_tests_properties(test_custom_tensor_operator PROPERTIES TIMEOUT 180)
# CPU custom op tests: only compile .cc file
py_test(test_dispatch_jit SRCS test_dispatch_jit.py)
py_test(test_multi_out_jit SRCS test_multi_out_jit.py)
py_test(test_custom_attrs_jit SRCS test_custom_attrs_jit.py)
py_test(test_custom_concat SRCS test_custom_concat.py)
py_test(test_custom_conj SRCS test_custom_conj.py)
py_test(test_custom_linear SRCS test_custom_linear.py)
py_test(test_custom_simple_slice SRCS test_custom_simple_slice.py)
py_test(test_custom_tanh_double_grad SRCS test_custom_tanh_double_grad.py)
py_test(test_custom_inplace SRCS test_custom_inplace.py)
py_test(test_custom_optional SRCS test_custom_optional.py)
# other tests
py_test(test_sysconfig SRCS test_sysconfig.py)
py_test(test_check_abi SRCS test_check_abi.py)
if(APPLE)
set_tests_properties(test_custom_simple_slice PROPERTIES TIMEOUT 300)
endif()
# Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
...@@ -15,7 +15,7 @@ if(WITH_TESTING) ...@@ -15,7 +15,7 @@ if(WITH_TESTING)
# add_subdirectory(contrib) # add_subdirectory(contrib)
add_subdirectory(cpp) add_subdirectory(cpp)
add_subdirectory(custom_kernel) add_subdirectory(custom_kernel)
# add_subdirectory(custom_op) add_subdirectory(custom_op)
# add_subdirectory(custom_runtime) # add_subdirectory(custom_runtime)
# add_subdirectory(dataset) # add_subdirectory(dataset)
# add_subdirectory(distributed_passes) # add_subdirectory(distributed_passes)
......
if(WITH_TESTING)
# New custom OP can support Windows/Linux/Mac now
if(WITH_GPU OR APPLE)
py_test(test_custom_relu_op_setup SRCS test_custom_relu_op_setup.py)
py_test(test_custom_relu_op_jit SRCS test_custom_relu_op_jit.py)
py_test(test_custom_relu_model SRCS test_custom_relu_model.py)
py_test(test_context_pool SRCS test_context_pool.py)
# Compiling shared library will cost some time, but running process is very fast.
set_tests_properties(test_custom_relu_op_setup PROPERTIES TIMEOUT 250)
set_tests_properties(test_custom_relu_op_jit PROPERTIES TIMEOUT 180)
set_tests_properties(test_custom_relu_model PROPERTIES TIMEOUT 180)
set_tests_properties(test_context_pool PROPERTIES TIMEOUT 180)
if($ENV{USE_STANDALONE_EXECUTOR})
# these test will fail in some server due to PR#42149, temporarily set it use old executor.
set_tests_properties(
test_custom_relu_op_setup PROPERTIES ENVIRONMENT
FLAGS_USE_STANDALONE_EXECUTOR=0)
set_tests_properties(
test_custom_relu_model PROPERTIES ENVIRONMENT
FLAGS_USE_STANDALONE_EXECUTOR=0)
endif()
endif()
if(WITH_GPU AND WITH_DISTRIBUTE)
py_test(test_custom_op_relu_model_static_multidevice
SRCS test_custom_op_relu_model_static_multidevice.py)
set_tests_properties(test_custom_op_relu_model_static_multidevice
PROPERTIES LABELS "RUN_TYPE=EXCLUSIVE" TIMEOUT 180)
endif()
if(WITH_XPU AND WITH_DISTRIBUTE)
set(CUSTOM_XPU_ENVS FLAGS_init_allocated_mem=0)
py_test(test_custom_relu_op_xpu_setup SRCS test_custom_relu_op_xpu_setup.py
ENVS ${CUSTOM_XPU_ENVS})
py_test(test_custom_op_relu_model_static_multidevice
SRCS test_custom_op_relu_model_static_multidevice.py ENVS
${CUSTOM_XPU_ENVS})
set_tests_properties(test_custom_op_relu_model_static_multidevice
PROPERTIES LABELS "RUN_TYPE=EXCLUSIVE" TIMEOUT 180)
endif()
py_test(test_custom_raw_op_kernel_op SRCS test_custom_raw_op_kernel_op.py)
set_tests_properties(test_custom_raw_op_kernel_op PROPERTIES TIMEOUT 180)
py_test(test_custom_tensor_operator SRCS test_custom_tensor_operator.py)
set_tests_properties(test_custom_tensor_operator PROPERTIES TIMEOUT 180)
# CPU custom op tests: only compile .cc file
py_test(test_dispatch_jit SRCS test_dispatch_jit.py)
py_test(test_multi_out_jit SRCS test_multi_out_jit.py)
py_test(test_custom_attrs_jit SRCS test_custom_attrs_jit.py)
py_test(test_custom_concat SRCS test_custom_concat.py)
py_test(test_custom_conj SRCS test_custom_conj.py)
py_test(test_custom_linear SRCS test_custom_linear.py)
py_test(test_custom_simple_slice SRCS test_custom_simple_slice.py)
py_test(test_custom_tanh_double_grad SRCS test_custom_tanh_double_grad.py)
py_test(test_custom_inplace SRCS test_custom_inplace.py)
py_test(test_custom_optional SRCS test_custom_optional.py)
# other tests
py_test(test_sysconfig SRCS test_sysconfig.py)
py_test(test_check_abi SRCS test_check_abi.py)
if(APPLE)
set_tests_properties(test_custom_simple_slice PROPERTIES TIMEOUT 300)
endif()
endif()
...@@ -41,7 +41,7 @@ custom_inplace = load( ...@@ -41,7 +41,7 @@ custom_inplace = load(
) )
# Temporarily assemble custom python API # Temporarily assemble custom python API
import paddle.fluid.core as core from paddle.fluid import core
from paddle.fluid.core import CustomOpKernelContext from paddle.fluid.core import CustomOpKernelContext
from paddle.fluid.framework import in_dygraph_mode from paddle.fluid.framework import in_dygraph_mode
from paddle.fluid.layer_helper import LayerHelper from paddle.fluid.layer_helper import LayerHelper
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册