Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions utils/process_result.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,16 +249,18 @@ def record_power_internal_error(
pp = int(os.environ.get('PP_SIZE', '1'))
dcp_size = int(os.environ.get('DCP_SIZE', '1'))
pcp_size = int(os.environ.get('PCP_SIZE', '1'))
if pp <= 0 or dcp_size <= 0 or pcp_size <= 0:
raise ValueError("PP_SIZE, DCP_SIZE, and PCP_SIZE must be positive integers.")
num_gpus = tp_size * pp * pcp_size
dp_size = int(os.environ.get('DP_SIZE', '1'))
if pp <= 0 or dcp_size <= 0 or pcp_size <= 0 or dp_size <= 0:
raise ValueError("PP_SIZE, DCP_SIZE, PCP_SIZE, and DP_SIZE must be positive integers.")
num_gpus = tp_size * pp * pcp_size * dp_size

single_node_data = {
'is_multinode': False,
'tp': tp_size,
'pp': pp,
'dcp_size': dcp_size,
'pcp_size': pcp_size,
'dp_size': dp_size,
'ep': ep_size,
'dp_attention': dp_attention,
'tput_per_gpu': float(bmk_result['total_token_throughput']) / num_gpus,
Expand Down
53 changes: 53 additions & 0 deletions utils/test_process_result.py
Original file line number Diff line number Diff line change
Expand Up @@ -459,6 +459,59 @@ def test_throughput_per_gpu_single_node(self, tmp_path, single_node_env_vars):
assert output_data["output_tput_per_gpu"] == pytest.approx(6000.0 / 16)
assert output_data["input_tput_per_gpu"] == pytest.approx(2000.0 / 16)

def test_throughput_per_gpu_single_node_default_dp_size(self, tmp_path, single_node_env_vars):
"""DP_SIZE defaults to 1 when unset, so existing single-node configs are unaffected."""
benchmark_result = {
"model_id": "test-model",
"max_concurrency": 8,
"total_token_throughput": 8000.0,
"output_throughput": 6000.0,
}

result = run_script(tmp_path, single_node_env_vars, benchmark_result)
assert result.returncode == 0, f"Script failed: {result.stderr}"

output_data = json.loads(result.stdout)
assert output_data["dp_size"] == 1
assert output_data["tput_per_gpu"] == pytest.approx(8000.0 / 8)

def test_throughput_per_gpu_single_node_with_dp_size(self, tmp_path, single_node_env_vars):
"""DP_SIZE multiplies the GPU denominator, e.g. --tensor-parallel-size 1
--data-parallel-size 2 running two full-model replicas on 2 GPUs."""
benchmark_result = {
"model_id": "test-model",
"max_concurrency": 8,
"total_token_throughput": 8000.0,
"output_throughput": 6000.0,
}

env = single_node_env_vars.copy()
env.update({"TP": "1", "DP_SIZE": "2"})

result = run_script(tmp_path, env, benchmark_result)
assert result.returncode == 0, f"Script failed: {result.stderr}"

output_data = json.loads(result.stdout)
assert output_data["dp_size"] == 2
assert output_data["tput_per_gpu"] == pytest.approx(8000.0 / 2)
assert output_data["output_tput_per_gpu"] == pytest.approx(6000.0 / 2)
assert output_data["input_tput_per_gpu"] == pytest.approx(2000.0 / 2)

def test_invalid_dp_size_raises_error(self, tmp_path, single_node_env_vars):
benchmark_result = {
"model_id": "test-model",
"max_concurrency": 8,
"total_token_throughput": 8000.0,
"output_throughput": 6000.0,
}

env = single_node_env_vars.copy()
env.update({"DP_SIZE": "0"})

result = run_script(tmp_path, env, benchmark_result)
assert result.returncode != 0
assert "DP_SIZE" in result.stderr

def test_throughput_per_gpu_multinode(self, tmp_path, multinode_env_vars):
"""Test throughput per GPU calculation for multinode."""
benchmark_result = {
Expand Down