Skip to content

Commit c0165df

Browse files
committed
solve conflict
2 parents 59c7c62 + e7cbc54 commit c0165df

27 files changed

+762
-308
lines changed

autotest/benchmark/test_throughput_performance.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import os
2+
13
import pytest
24
from utils.benchmark_utils import throughput_test
35
from utils.config_utils import get_benchmark_model_list, get_cuda_id_by_workerid, get_cuda_prefix_by_workerid
@@ -92,11 +94,15 @@ def test_throughput_func_tp2(config, run_id, run_config, worker_id):
9294
'tp_num': 1
9395
}])
9496
def test_throughput_prtest_tp1(config, run_id, run_config, worker_id):
97+
device_type = os.environ.get('DEVICE', 'cuda')
98+
if device_type == 'ascend':
99+
env_var = 'ASCEND_RT_VISIBLE_DEVICES='
100+
else:
101+
env_var = 'CUDA_VISIBLE_DEVICES='
95102
result, msg = throughput_test(config,
96103
run_id,
97104
run_config,
98-
cuda_prefix='CUDA_VISIBLE_DEVICES=' +
99-
str(int(get_cuda_id_by_workerid(worker_id)) + 5),
105+
cuda_prefix=f'{env_var}' + str(int(get_cuda_id_by_workerid(worker_id)) + 5),
100106
worker_id=worker_id,
101107
is_smoke=True)
102108

autotest/conftest.py

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,17 @@
1010

1111
@pytest.fixture(scope='session')
1212
def config():
13-
config_path = os.path.join(config_file)
13+
# Use device-specific config file if DEVICE environment variable is set
14+
device = os.environ.get('DEVICE', '')
15+
if device:
16+
device_config_path = f'autotest/config-{device}.yaml'
17+
if os.path.exists(device_config_path):
18+
config_path = device_config_path
19+
else:
20+
config_path = config_file
21+
else:
22+
config_path = config_file
23+
1424
with open(config_path) as f:
1525
env_config = yaml.load(f.read(), Loader=yaml.SafeLoader)
1626
return env_config
@@ -34,8 +44,21 @@ def common_case_config():
3444

3545
def pytest_addoption(parser):
3646
parser.addoption('--run_id', action='store', default='', help='github run_id')
47+
parser.addoption('--device', action='store', default='', help='device config suffix')
48+
49+
50+
def pytest_configure(config):
51+
# Set DEVICE environment variable before test execution
52+
device = config.getoption('--device')
53+
if device:
54+
os.environ['DEVICE'] = device
3755

3856

3957
@pytest.fixture(scope='session')
4058
def run_id(request):
4159
return request.config.getoption('--run_id')
60+
61+
62+
@pytest.fixture(scope='session')
63+
def device(request):
64+
return request.config.getoption('--device')

0 commit comments

Comments
 (0)