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

fix UNIX cmake problem (#31113)

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