未验证 提交 44ee251f 编写于 作者: Z Zhou Wei 提交者: GitHub

fix UNIX cmake problem (#31113)

上级 a60d93fb
...@@ -794,16 +794,14 @@ function(py_test TARGET_NAME) ...@@ -794,16 +794,14 @@ function(py_test TARGET_NAME)
if(WITH_COVERAGE AND NOT (WITH_INCREMENTAL_COVERAGE AND "$ENV{PADDLE_GIT_DIFF_PY_FILE}" STREQUAL "")) if(WITH_COVERAGE AND NOT (WITH_INCREMENTAL_COVERAGE AND "$ENV{PADDLE_GIT_DIFF_PY_FILE}" STREQUAL ""))
add_test(NAME ${TARGET_NAME} add_test(NAME ${TARGET_NAME}
COMMAND ${CMAKE_COMMAND} -E env FLAGS_init_allocated_mem=true FLAGS_cudnn_deterministic=true COMMAND ${CMAKE_COMMAND} -E env FLAGS_init_allocated_mem=true FLAGS_cudnn_deterministic=true
FLAGS_cpu_deterministic=true FLAGS_cpu_deterministic=true ${py_test_ENVS}
PYTHONPATH=${PADDLE_BINARY_DIR}/python ${py_test_ENVS}
COVERAGE_FILE=${PADDLE_BINARY_DIR}/python-coverage.data COVERAGE_FILE=${PADDLE_BINARY_DIR}/python-coverage.data
${PYTHON_EXECUTABLE} -m coverage run --branch -p ${py_test_SRCS} ${py_test_ARGS} ${PYTHON_EXECUTABLE} -m coverage run --branch -p ${py_test_SRCS} ${py_test_ARGS}
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
else() else()
add_test(NAME ${TARGET_NAME} add_test(NAME ${TARGET_NAME}
COMMAND ${CMAKE_COMMAND} -E env FLAGS_init_allocated_mem=true FLAGS_cudnn_deterministic=true COMMAND ${CMAKE_COMMAND} -E env FLAGS_init_allocated_mem=true FLAGS_cudnn_deterministic=true
FLAGS_cpu_deterministic=true FLAGS_cpu_deterministic=true ${py_test_ENVS}
PYTHONPATH=${PADDLE_BINARY_DIR}/python ${py_test_ENVS}
${PYTHON_EXECUTABLE} -u ${py_test_SRCS} ${py_test_ARGS} ${PYTHON_EXECUTABLE} -u ${py_test_SRCS} ${py_test_ARGS}
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
endif() endif()
......
...@@ -114,8 +114,8 @@ rem ------pre install python requirement---------- ...@@ -114,8 +114,8 @@ rem ------pre install python requirement----------
where python where python
where pip where pip
pip install wheel --user pip install wheel --user
pip install --force-reinstall -r %work_dir%\python\requirements.txt --user pip install -r %work_dir%\python\unittest_py\requirements.txt --user
pip install --force-reinstall -r %work_dir%\python\unittest_py\requirements.txt --user pip install -r %work_dir%\python\requirements.txt --user
if %ERRORLEVEL% NEQ 0 ( if %ERRORLEVEL% NEQ 0 (
echo pip install requirements.txt failed! echo pip install requirements.txt failed!
exit /b 7 exit /b 7
......
...@@ -10,7 +10,7 @@ add_subdirectory(unittests) ...@@ -10,7 +10,7 @@ add_subdirectory(unittests)
add_subdirectory(book) add_subdirectory(book)
# TODO: support New Custom OP on Mac # TODO: support New Custom OP on Mac
if(Linux) if(LINUX)
add_subdirectory(custom_op) add_subdirectory(custom_op)
endif() endif()
......
...@@ -13,7 +13,7 @@ py_test(test_sysconfig SRCS test_sysconfig.py) ...@@ -13,7 +13,7 @@ py_test(test_sysconfig SRCS test_sysconfig.py)
py_test(test_dispatch SRCS test_dispatch.py) py_test(test_dispatch SRCS test_dispatch.py)
set_tests_properties(test_dispatch PROPERTIES TIMEOUT 180) set_tests_properties(test_dispatch PROPERTIES TIMEOUT 180)
if(NOT Linux) if(NOT LINUX)
return() return()
endif() endif()
......
...@@ -20,20 +20,18 @@ from paddle.utils.cpp_extension import load, get_build_directory ...@@ -20,20 +20,18 @@ from paddle.utils.cpp_extension import load, get_build_directory
from utils import paddle_includes, extra_compile_args from utils import paddle_includes, extra_compile_args
from paddle.utils.cpp_extension.extension_utils import run_cmd from paddle.utils.cpp_extension.extension_utils import run_cmd
# Because the shared lib already exists in the cache dir, # Because Windows don't use docker, the shared lib already exists in the
# it will not be compiled again unless the cache dir is cleared. # cache dir, it will not be compiled again unless the shared lib is removed.
if os.name == 'nt': if os.name == 'nt':
cmd = 'rmdir {} /s/q'.format(get_build_directory()) cmd = 'del {}\\dispatch_op.pyd'.format(get_build_directory())
else: run_cmd(cmd, True)
cmd = 'rm -rf {}'.format(get_build_directory())
run_cmd(cmd, True)
dispatch_op = load( dispatch_op = load(
name='dispatch_op', name='dispatch_op',
sources=['dispatch_test_op.cc'], sources=['dispatch_test_op.cc'],
extra_include_paths=paddle_includes, # add for Coverage CI extra_include_paths=paddle_includes, # add for Coverage CI
extra_cflags=extra_compile_args) # add for Coverage CI extra_cflags=extra_compile_args, # add for Coverage CI
verbose=True)
class TestJitDispatch(unittest.TestCase): class TestJitDispatch(unittest.TestCase):
......
...@@ -22,21 +22,19 @@ from paddle.utils.cpp_extension.extension_utils import run_cmd ...@@ -22,21 +22,19 @@ from paddle.utils.cpp_extension.extension_utils import run_cmd
from utils import paddle_includes, extra_compile_args from utils import paddle_includes, extra_compile_args
from test_simple_custom_op_setup import relu2_dynamic, relu2_static from test_simple_custom_op_setup import relu2_dynamic, relu2_static
# Because the shared lib already exists in the cache dir, # Because Windows don't use docker, the shared lib already exists in the
# it will not be compiled again unless the cache dir is cleared. # cache dir, it will not be compiled again unless the shared lib is removed.
if os.name == 'nt': if os.name == 'nt':
cmd = 'rmdir {} /s/q'.format(get_build_directory()) cmd = 'del {}\\simple_jit_relu2.pyd'.format(get_build_directory())
else: run_cmd(cmd, True)
cmd = 'rm -rf {}'.format(get_build_directory())
run_cmd(cmd, True)
# Compile and load custom op Just-In-Time. # Compile and load custom op Just-In-Time.
custom_module = load( custom_module = load(
name='simple_jit_relu2', name='simple_jit_relu2',
sources=['relu_op_simple.cc', 'relu_op_simple.cu', 'relu_op3_simple.cc'], sources=['relu_op_simple.cc', 'relu_op_simple.cu', 'relu_op3_simple.cc'],
extra_include_paths=paddle_includes, # add for Coverage CI extra_include_paths=paddle_includes, # add for Coverage CI
extra_cflags=extra_compile_args) # add for Coverage CI extra_cflags=extra_compile_args, # add for Coverage CI
verbose=True)
class TestJITLoad(unittest.TestCase): class TestJITLoad(unittest.TestCase):
......
...@@ -323,7 +323,6 @@ def find_cuda_home(): ...@@ -323,7 +323,6 @@ def find_cuda_home():
if six.PY3: if six.PY3:
nvcc_path = nvcc_path.decode() nvcc_path = nvcc_path.decode()
nvcc_path = nvcc_path.rstrip('\r\n') nvcc_path = nvcc_path.rstrip('\r\n')
log_v(nvcc_path)
# for example: /usr/local/cuda/bin/nvcc # for example: /usr/local/cuda/bin/nvcc
cuda_home = os.path.dirname(os.path.dirname(nvcc_path)) cuda_home = os.path.dirname(os.path.dirname(nvcc_path))
except: except:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册