Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bugfix] Fix 1-indexing for replica_id in MetricsStore #31

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
19 changes: 9 additions & 10 deletions vidur/metrics/metrics_store.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ def wrapper(self, *args, **kwargs):


class MetricsStore:

def __init__(self, simulation_config: SimulationConfig) -> None:
self._simulation_config = simulation_config
self._config = self._simulation_config.metrics_config
Expand Down Expand Up @@ -176,9 +175,9 @@ def __init__(self, simulation_config: SimulationConfig) -> None:
)

self._cpu_operation_metrics: Dict[CpuOperationMetrics, CDFSketch] = {}
self._cpu_operation_metrics_per_batch: Dict[CpuOperationMetrics, DataSeries] = (
{}
)
self._cpu_operation_metrics_per_batch: Dict[
CpuOperationMetrics, DataSeries
] = {}
for metric_name in CpuOperationMetrics:
self._cpu_operation_metrics[metric_name] = CDFSketch(
metric_name.value,
Expand Down Expand Up @@ -646,7 +645,7 @@ def on_batch_end(
self._on_request_end(time, request)

if self._config.store_utilization_metrics:
self._replica_memory_usage[replica_id - 1].put(time, memory_usage_percent)
self._replica_memory_usage[replica_id].put(time, memory_usage_percent)

for request in batch.requests:
self._update_per_token_execution_times(time, request, batch)
Expand Down Expand Up @@ -685,7 +684,7 @@ def on_replica_schedule(
if not self._config.store_utilization_metrics:
return

self._replica_memory_usage[replica_id - 1].put(time, memory_usage_percent)
self._replica_memory_usage[replica_id].put(time, memory_usage_percent)

@if_write_metrics
def on_replica_stage_schedule(
Expand All @@ -699,9 +698,9 @@ def on_replica_stage_schedule(
if not self._config.store_utilization_metrics:
return

self._replica_busy_time[replica_id - 1][stage_id - 1].put(time, 100)
self._replica_busy_time[replica_id][stage_id - 1].put(time, 100)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we align statge_id also along with replica_id to be 0-indexed? This will help in uniformity.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also while printing the metrics in _store_utilization_metrics we can remove the + 1 from the plot names.

mfu = self._mfu_calculator.get_mfu(batch_stage)
self._replica_mfu[replica_id - 1][stage_id - 1].put(time, mfu)
self._replica_mfu[replica_id][stage_id - 1].put(time, mfu)

if not self._config.store_operation_metrics:
return
Expand Down Expand Up @@ -817,5 +816,5 @@ def on_batch_stage_end(
) -> None:
if not self._config.store_utilization_metrics:
return
self._replica_busy_time[replica_id - 1][stage_id - 1].put(time, 0)
self._replica_mfu[replica_id - 1][stage_id - 1].put(time, 0)
self._replica_busy_time[replica_id][stage_id - 1].put(time, 0)
self._replica_mfu[replica_id][stage_id - 1].put(time, 0)
Loading