未验证 提交 c3417fd2 编写于 作者: R ronnywang 提交者: GitHub

[CustomDevice] fix custom cpu unittests failure when multiple python exist in CI (#52923)

* [CustomDevice] fix custom cpu unittests failure when multiple python exist in CI

* Update test_custom_op_setup.py
上级 1080d4fc
...@@ -19,10 +19,12 @@ if(WITH_CUSTOM_DEVICE AND NOT WITH_GPU) ...@@ -19,10 +19,12 @@ if(WITH_CUSTOM_DEVICE AND NOT WITH_GPU)
START_BASH START_BASH
test_fleet_launch_custom_device.sh test_fleet_launch_custom_device.sh
ENVS ENVS
PYTHONPATH=""
FLAGS_allocator_strategy=naive_best_fit FLAGS_allocator_strategy=naive_best_fit
PADDLE_BINARY_DIR=${PADDLE_BINARY_DIR} PADDLE_BINARY_DIR=${PADDLE_BINARY_DIR}
PLUGIN_URL=${PLUGIN_URL} PLUGIN_URL=${PLUGIN_URL}
PLUGIN_TAG=${PLUGIN_TAG}) PLUGIN_TAG=${PLUGIN_TAG}
PYTHON_EXECUTABLE=${PYTHON_EXECUTABLE})
set_tests_properties(test_custom_cpu_plugin PROPERTIES TIMEOUT 120) set_tests_properties(test_custom_cpu_plugin PROPERTIES TIMEOUT 120)
set_tests_properties(test_custom_cpu_profiler_plugin PROPERTIES TIMEOUT 120) set_tests_properties(test_custom_cpu_profiler_plugin PROPERTIES TIMEOUT 120)
......
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
import copy import copy
import os import os
import subprocess import subprocess
import sys
import tempfile import tempfile
import time import time
import unittest import unittest
...@@ -154,8 +155,11 @@ class TestProcessGroup(TestMultipleCustomCPU): ...@@ -154,8 +155,11 @@ class TestProcessGroup(TestMultipleCustomCPU):
&& git fetch origin \ && git fetch origin \
&& git checkout {} -b dev \ && git checkout {} -b dev \
&& cd backends/custom_cpu \ && cd backends/custom_cpu \
&& mkdir build && cd build && cmake .. && make -j8'.format( && mkdir build && cd build && cmake .. -DPython_EXECUTABLE={} && make -j8'.format(
self.temp_dir.name, os.getenv('PLUGIN_URL'), os.getenv('PLUGIN_TAG') self.temp_dir.name,
os.getenv('PLUGIN_URL'),
os.getenv('PLUGIN_TAG'),
sys.executable,
) )
os.system(cmd) os.system(cmd)
......
...@@ -31,8 +31,11 @@ class TestCustomCPUPlugin(unittest.TestCase): ...@@ -31,8 +31,11 @@ class TestCustomCPUPlugin(unittest.TestCase):
&& git fetch origin \ && git fetch origin \
&& git checkout {} -b dev \ && git checkout {} -b dev \
&& cd backends/custom_cpu \ && cd backends/custom_cpu \
&& mkdir build && cd build && cmake .. && make -j8'.format( && mkdir build && cd build && cmake .. -DPython_EXECUTABLE={} && make -j8'.format(
self.temp_dir.name, os.getenv('PLUGIN_URL'), os.getenv('PLUGIN_TAG') self.temp_dir.name,
os.getenv('PLUGIN_URL'),
os.getenv('PLUGIN_TAG'),
sys.executable,
) )
os.system(cmd) os.system(cmd)
......
...@@ -29,8 +29,11 @@ class TestCustomCPUProfilerPlugin(unittest.TestCase): ...@@ -29,8 +29,11 @@ class TestCustomCPUProfilerPlugin(unittest.TestCase):
&& git fetch origin \ && git fetch origin \
&& git checkout {} -b dev \ && git checkout {} -b dev \
&& cd backends/custom_cpu \ && cd backends/custom_cpu \
&& mkdir build && cd build && cmake .. && make -j8'.format( && mkdir build && cd build && cmake .. -DPython_EXECUTABLE={} && make -j8'.format(
self.temp_dir.name, os.getenv('PLUGIN_URL'), os.getenv('PLUGIN_TAG') self.temp_dir.name,
os.getenv('PLUGIN_URL'),
os.getenv('PLUGIN_TAG'),
sys.executable,
) )
os.system(cmd) os.system(cmd)
......
...@@ -112,8 +112,11 @@ class TestCustomCPUPlugin(unittest.TestCase): ...@@ -112,8 +112,11 @@ class TestCustomCPUPlugin(unittest.TestCase):
&& git fetch origin \ && git fetch origin \
&& git checkout {} -b dev \ && git checkout {} -b dev \
&& cd backends/custom_cpu \ && cd backends/custom_cpu \
&& mkdir build && cd build && cmake .. && make -j8'.format( && mkdir build && cd build && cmake .. -DPython_EXECUTABLE={} && make -j8'.format(
self.temp_dir.name, os.getenv('PLUGIN_URL'), os.getenv('PLUGIN_TAG') self.temp_dir.name,
os.getenv('PLUGIN_URL'),
os.getenv('PLUGIN_TAG'),
sys.executable,
) )
os.system(cmd) os.system(cmd)
......
...@@ -109,11 +109,12 @@ class TestNewCustomOpSetUpInstall(unittest.TestCase): ...@@ -109,11 +109,12 @@ class TestNewCustomOpSetUpInstall(unittest.TestCase):
&& git fetch origin \ && git fetch origin \
&& git checkout {} -b dev \ && git checkout {} -b dev \
&& cd backends/custom_cpu \ && cd backends/custom_cpu \
&& mkdir build && cd build && cmake .. && make -j8 \ && mkdir build && cd build && cmake .. -DPython_EXECUTABLE={} && make -j8 \
&& cd {}'.format( && cd {}'.format(
self.temp_dir.name, self.temp_dir.name,
os.getenv('PLUGIN_URL'), os.getenv('PLUGIN_URL'),
os.getenv('PLUGIN_TAG'), os.getenv('PLUGIN_TAG'),
sys.executable,
self.cur_dir, self.cur_dir,
) )
os.system(cmd) os.system(cmd)
......
...@@ -23,7 +23,7 @@ pushd ${temp_dir} \ ...@@ -23,7 +23,7 @@ pushd ${temp_dir} \
&& git fetch origin \ && git fetch origin \
&& git checkout ${PLUGIN_TAG} -b dev \ && git checkout ${PLUGIN_TAG} -b dev \
&& pushd backends/custom_cpu \ && pushd backends/custom_cpu \
&& mkdir build && pushd build && cmake .. && make -j8 && popd && popd && popd && popd && mkdir build && pushd build && cmake .. -DPython_EXECUTABLE=${PYTHON_EXECUTABLE} && make -j8 && popd && popd && popd && popd
echo "begin test use custom_cpu" echo "begin test use custom_cpu"
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册