diff --git a/python/paddle/fluid/tests/custom_runtime/CMakeLists.txt b/python/paddle/fluid/tests/custom_runtime/CMakeLists.txt index 3161afd11925f1f075613b9880117e2cd4164835..099b1ddc1c01e733880bdb52dc9aaa437c6ec265 100644 --- a/python/paddle/fluid/tests/custom_runtime/CMakeLists.txt +++ b/python/paddle/fluid/tests/custom_runtime/CMakeLists.txt @@ -1,4 +1,7 @@ if(WITH_CUSTOM_DEVICE AND NOT WITH_GPU) + set(PLUGIN_URL https://github.com/PaddlePaddle/PaddleCustomDevice.git) + set(PLUGIN_TAG d5e5ac1d8e9f7588d4c2998bb3b5ffc66f65af2e) + file( GLOB TEST_OPS RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" @@ -7,13 +10,18 @@ if(WITH_CUSTOM_DEVICE AND NOT WITH_GPU) list(REMOVE_ITEM TEST_OPS test_collective_process_group_xccl) foreach(TEST_OP ${TEST_OPS}) - py_test(${TEST_OP} SRCS ${TEST_OP}.py) + py_test(${TEST_OP} SRCS ${TEST_OP}.py ENVS PLUGIN_URL=${PLUGIN_URL} + PLUGIN_TAG=${PLUGIN_TAG}) endforeach() bash_test_modules( - test_fleet_launch_custom_device START_BASH - test_fleet_launch_custom_device.sh ENVS - PADDLE_BINARY_DIR=${PADDLE_BINARY_DIR}) + test_fleet_launch_custom_device + START_BASH + test_fleet_launch_custom_device.sh + ENVS + PADDLE_BINARY_DIR=${PADDLE_BINARY_DIR} + PLUGIN_URL=${PLUGIN_URL} + PLUGIN_TAG=${PLUGIN_TAG}) set_tests_properties(test_custom_cpu_plugin PROPERTIES TIMEOUT 120) set_tests_properties(test_custom_cpu_profiler_plugin PROPERTIES TIMEOUT 120) diff --git a/python/paddle/fluid/tests/custom_runtime/test_collective_process_group_xccl.py b/python/paddle/fluid/tests/custom_runtime/test_collective_process_group_xccl.py index f2e22a292fed40b2291d879426206427fbdca2c1..db2510d2beb377c981b391da78af4f0fdb619629 100644 --- a/python/paddle/fluid/tests/custom_runtime/test_collective_process_group_xccl.py +++ b/python/paddle/fluid/tests/custom_runtime/test_collective_process_group_xccl.py @@ -136,7 +136,12 @@ class TestProcessGroup(TestMultipleCustomCPU): def setUp(self): # compile so and set to current path cur_dir = os.path.dirname(os.path.abspath(__file__)) - cmd = 'rm -rf PaddleCustomDevice && git clone https://github.com/PaddlePaddle/PaddleCustomDevice.git && cd PaddleCustomDevice/backends/custom_cpu && mkdir build && cd build && cmake .. && make -j8' + cmd = 'rm -rf PaddleCustomDevice \ + && git clone {} \ + && cd PaddleCustomDevice/backends/custom_cpu \ + && git checkout {} -b dev \ + && mkdir build && cd build && cmake .. && make -j8'.format( + os.getenv('PLUGIN_URL'), os.getenv('PLUGIN_TAG')) os.system(cmd) # set environment for loading and registering compiled custom kernels diff --git a/python/paddle/fluid/tests/custom_runtime/test_custom_cpu_plugin.py b/python/paddle/fluid/tests/custom_runtime/test_custom_cpu_plugin.py index 07e225160407fe7aa1048e7b87c9fdee964c51fc..371f0018a0f8d0403485e778a34c2763024efc8c 100644 --- a/python/paddle/fluid/tests/custom_runtime/test_custom_cpu_plugin.py +++ b/python/paddle/fluid/tests/custom_runtime/test_custom_cpu_plugin.py @@ -24,7 +24,12 @@ class TestCustomCPUPlugin(unittest.TestCase): def setUp(self): # compile so and set to current path cur_dir = os.path.dirname(os.path.abspath(__file__)) - cmd = 'rm -rf PaddleCustomDevice && git clone https://github.com/PaddlePaddle/PaddleCustomDevice.git && cd PaddleCustomDevice/backends/custom_cpu && mkdir build && cd build && cmake .. && make -j8' + cmd = 'rm -rf PaddleCustomDevice \ + && git clone {} \ + && cd PaddleCustomDevice/backends/custom_cpu \ + && git checkout {} -b dev \ + && mkdir build && cd build && cmake .. && make -j8'.format( + os.getenv('PLUGIN_URL'), os.getenv('PLUGIN_TAG')) os.system(cmd) # set environment for loading and registering compiled custom kernels diff --git a/python/paddle/fluid/tests/custom_runtime/test_custom_cpu_profiler_plugin.py b/python/paddle/fluid/tests/custom_runtime/test_custom_cpu_profiler_plugin.py index 7a8356ed932f02dd694df7a84b346f635e307f36..34bdb067c67c5d2e3ebaf0b5168d8ab5684d924c 100644 --- a/python/paddle/fluid/tests/custom_runtime/test_custom_cpu_profiler_plugin.py +++ b/python/paddle/fluid/tests/custom_runtime/test_custom_cpu_profiler_plugin.py @@ -24,7 +24,12 @@ class TestCustomCPUProfilerPlugin(unittest.TestCase): def setUp(self): # compile so and set to current path cur_dir = os.path.dirname(os.path.abspath(__file__)) - cmd = 'rm -rf PaddleCustomDevice && git clone https://github.com/PaddlePaddle/PaddleCustomDevice.git && cd PaddleCustomDevice/backends/custom_cpu && mkdir build && cd build && cmake .. && make -j8' + cmd = 'rm -rf PaddleCustomDevice \ + && git clone {} \ + && cd PaddleCustomDevice/backends/custom_cpu \ + && git checkout {} -b dev \ + && mkdir build && cd build && cmake .. && make -j8'.format( + os.getenv('PLUGIN_URL'), os.getenv('PLUGIN_TAG')) os.system(cmd) # set environment for loading and registering compiled custom kernels diff --git a/python/paddle/fluid/tests/custom_runtime/test_fleet_launch_custom_device.sh b/python/paddle/fluid/tests/custom_runtime/test_fleet_launch_custom_device.sh index 680234301727bf065b2c4ff2713598644cbee6d3..5570c629dd96545cedfa2dd52630c898c382c0ab 100644 --- a/python/paddle/fluid/tests/custom_runtime/test_fleet_launch_custom_device.sh +++ b/python/paddle/fluid/tests/custom_runtime/test_fleet_launch_custom_device.sh @@ -16,7 +16,11 @@ set -e -rm -rf PaddleCustomDevice && git clone https://github.com/PaddlePaddle/PaddleCustomDevice.git && pushd PaddleCustomDevice/backends/custom_cpu && mkdir build && pushd build && cmake .. && make -j8 && popd && popd +rm -rf PaddleCustomDevice && \ +git clone ${PLUGIN_URL} \ +&& pushd PaddleCustomDevice/backends/custom_cpu \ +&& git checkout ${PLUGIN_TAG} -b dev \ +&& mkdir build && pushd build && cmake .. && make -j8 && popd && popd echo "begin test use custom_cpu"