diff --git a/cmake/generic.cmake b/cmake/generic.cmake index 1e9fc878da8b11a33b46654993411c370231a4bf..cba338c2c49f68d245b4ea4df6e7445af34f6ec1 100644 --- a/cmake/generic.cmake +++ b/cmake/generic.cmake @@ -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() diff --git a/paddle/scripts/paddle_build.bat b/paddle/scripts/paddle_build.bat index 8050e881a4832cdea5b548f1b9473c334a7a0354..d516649e44e0baec594901b85bb4f397a7081e43 100644 --- a/paddle/scripts/paddle_build.bat +++ b/paddle/scripts/paddle_build.bat @@ -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 diff --git a/python/paddle/fluid/tests/CMakeLists.txt b/python/paddle/fluid/tests/CMakeLists.txt index 60be92b892fbecdb12cdb408534ad62f3c6445ef..4b6fb6de0d06f41581262a0be01a082b6abc58a5 100644 --- a/python/paddle/fluid/tests/CMakeLists.txt +++ b/python/paddle/fluid/tests/CMakeLists.txt @@ -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() diff --git a/python/paddle/fluid/tests/custom_op/CMakeLists.txt b/python/paddle/fluid/tests/custom_op/CMakeLists.txt index 0daf662f551ecbdb5a232c520bedee19408f1613..d7acab4d0332eb51690ec0a8e5ec05b360a2b1d0 100644 --- a/python/paddle/fluid/tests/custom_op/CMakeLists.txt +++ b/python/paddle/fluid/tests/custom_op/CMakeLists.txt @@ -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() diff --git a/python/paddle/fluid/tests/custom_op/test_dispatch.py b/python/paddle/fluid/tests/custom_op/test_dispatch.py index aaca7333561ee65ef6e267a0ce5a48263800a4c2..484eb760bebb72dab12793b1b3a4bdd291d63531 100644 --- a/python/paddle/fluid/tests/custom_op/test_dispatch.py +++ b/python/paddle/fluid/tests/custom_op/test_dispatch.py @@ -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): diff --git a/python/paddle/fluid/tests/custom_op/test_simple_custom_op_jit.py b/python/paddle/fluid/tests/custom_op/test_simple_custom_op_jit.py index 2832e8070d142ab294c69ab3adab382b38d1ce9f..f4d3c4f6597d7457e4a3a258b51d86ba86093575 100644 --- a/python/paddle/fluid/tests/custom_op/test_simple_custom_op_jit.py +++ b/python/paddle/fluid/tests/custom_op/test_simple_custom_op_jit.py @@ -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): diff --git a/python/paddle/utils/cpp_extension/extension_utils.py b/python/paddle/utils/cpp_extension/extension_utils.py index f4a801fe3ec478ddbd543d5929f0456b354cde08..e53df3f083d8c94331b913fe36081ee1f9fe6f1d 100644 --- a/python/paddle/utils/cpp_extension/extension_utils.py +++ b/python/paddle/utils/cpp_extension/extension_utils.py @@ -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: