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

test energy runs multi run #1513

Open
wants to merge 2 commits into
base: master
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
33 changes: 14 additions & 19 deletions spynnaker_integration_tests/test_power_monitoring/test_power_mon.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@

import os
import numpy
import sqlite3
import unittest
import pyNN.spiNNaker as p
from spinn_front_end_common.interface.provenance import ProvenanceReader
from spinn_front_end_common.utilities.report_functions import EnergyReport
Expand All @@ -25,7 +23,7 @@

n_neurons = 200 # number of neurons in each population
neurons_per_core = n_neurons / 2
run_times = [5000]
run_times = [10, 20, 30]
# parameters for population 1 first run
input_class = p.SpikeSourcePoisson
start_time = 0
Expand All @@ -35,11 +33,6 @@


class TestPowerMonitoring(BaseTestCase):
def query_provenance(self, query, *args):
prov_file = ProvenanceReader.get_last_run_database_path()
with sqlite3.connect(prov_file) as prov_db:
prov_db.row_factory = sqlite3.Row
return list(prov_db.execute(query, args))

def do_run(self):
synfire_run.do_run(n_neurons, neurons_per_core=neurons_per_core,
Expand All @@ -52,19 +45,21 @@ def do_run(self):
hist = numpy.histogram(spikes[:, 1], bins=[0, 5000, 10000])
self.assertIsNotNone(hist, "must have a histogram")
# Did we build the report file like we asked for in config file?
self.assertIn(EnergyReport._SUMMARY_FILENAME,
self.assertIn(EnergyReport.file_name(1),
os.listdir(SpynnakerDataView.get_run_dir_path()))
self.assertIn(EnergyReport.file_name(2),
os.listdir(SpynnakerDataView.get_run_dir_path()))
self.assertIn(EnergyReport.file_name(3),
os.listdir(SpynnakerDataView.get_run_dir_path()))
# Did we output power provenance data, as requested?
num_chips = None
for row in self.query_provenance(
"SELECT the_value "
"FROM power_provenance "
"WHERE description = 'Num_chips' LIMIT 1"):
num_chips = row["the_value"]
self.assertIsNotNone(num_chips, "power provenance was not written")
exec_times = set()
with ProvenanceReader() as reader:
for row in reader.execute(
"SELECT the_value "
"FROM power_provenance "
"WHERE description = 'Exec time (seconds)'"):
exec_times.add(row[0])
self.assertEqual(exec_times, set([0.01, 0.03, 0.06]))

@unittest.skip(
"https://github.com/SpiNNakerManchester/"
"SpiNNFrontEndCommon/issues/866")
def test_power_monitoring(self):
self.runsafe(self.do_run)
Loading