Skip to content

Commit

Permalink
dont write power monitor core to database
Browse files Browse the repository at this point in the history
  • Loading branch information
Christian-B committed Dec 6, 2024
1 parent 6c5a7f8 commit 4bca0b4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -107,20 +107,23 @@ def compute_energy_used(checkpoint: Optional[int] = None) -> PowerUsed:
n_frames = _calculate_n_frames(machine)

active_cores: Dict[Tuple[int, int], int] = defaultdict(int)
power_cores: Dict[Tuple[int, int], int] = {}
n_active_cores = 0
for pl in FecDataView.iterate_placemements():
if not isinstance(pl.vertex, AbstractHasAssociatedBinary):
continue
vertex: AbstractHasAssociatedBinary = cast(
AbstractHasAssociatedBinary, pl.vertex)
if (vertex.get_binary_start_type() != ExecutableType.SYSTEM and
not isinstance(vertex, ChipPowerMonitorMachineVertex)):
active_cores[(pl.x, pl.y)] += 1
n_active_cores += 1
if vertex.get_binary_start_type() != ExecutableType.SYSTEM:
if isinstance(vertex, ChipPowerMonitorMachineVertex):
power_cores[(pl.x, pl.y)] = pl.p
else:
active_cores[(pl.x, pl.y)] += 1
n_active_cores += 1
n_active_chips = len(active_cores)

run_chip_active_time = _extract_cores_active_time(
checkpoint, active_cores, version)
checkpoint, active_cores, power_cores, version)
load_chip_active_time = _make_extra_monitor_core_use(
data_loading_ms, machine, version.n_scamp_cores + 2,
version.n_scamp_cores + 1)
Expand Down Expand Up @@ -178,14 +181,15 @@ def _extract_router_packets(

def _extract_cores_active_time(
checkpoint: Optional[int], active_cores: Dict[Tuple[int, int], int],
power_cores: Dict[Tuple[int, int], int],
version: AbstractVersion) -> ChipActiveTime:
sampling_frequency = get_config_int("EnergyMonitor", "sampling_frequency")

chip_activity: ChipActiveTime = {}
with BufferDatabase() as buff_db:
for (x, y), n_cores in active_cores.items():
# Find the core that was used on this chip for power monitoring
p = buff_db.get_power_monitor_core(x, y)
p = power_cores[(x, y)]
# Get time per sample in seconds (frequency in microseconds)
time_for_recorded_sample_s = sampling_frequency / _US_PER_SECOND
data, _missing = buff_db.get_recording(x, y, p, RECORDING_CHANNEL)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,6 @@ def generate_data_specification(
# End-of-Spec:
spec.end_specification()

self.__write_recording_metadata(placement)

def _write_configuration_region(self, spec: DataSpecificationGenerator):
"""
Write the data needed by the C code to configure itself.
Expand Down Expand Up @@ -222,8 +220,3 @@ def _deduce_sdram_requirements_per_timer_tick(self) -> int:
n_entries = math.floor(FecDataView.get_hardware_time_step_us() /
recording_time)
return int(math.ceil(n_entries * RECORDING_SIZE_PER_ENTRY))

def __write_recording_metadata(self, placement: Placement) -> None:
with ProvenanceWriter() as db:
db.insert_monitor_value(
placement.x, placement.y, PROVENANCE_CORE_KEY, placement.p)

0 comments on commit 4bca0b4

Please sign in to comment.