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

Spinncer update #1094

Draft
wants to merge 32 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
c02dc47
using pandas to save csv of all interesting provenance info
pabogdan Mar 9, 2020
0fd046b
fix bug in matching sizes between provenance and placements. added as…
pabogdan Mar 10, 2020
9936834
Merge remote-tracking branch 'origin/master' into spinncer_update
andrewgait Dec 6, 2021
812d530
Add LUT provenance to database
andrewgait Dec 6, 2021
5693672
Fix structured provenance to use vertex slice attributes, not label
andrewgait Dec 7, 2021
b9385d2
Merge remote-tracking branch 'origin/master' into spinncer_update
andrewgait Apr 1, 2022
475f39e
Merge remote-tracking branch 'origin/master' into spinncer_update
andrewgait Apr 20, 2022
bdbb44e
Merge remote-tracking branch 'origin/master' into spinncer_update
andrewgait May 11, 2022
70c488f
Merge remote-tracking branch 'origin/master' into spinncer_update
andrewgait Jul 19, 2022
6849555
Merge weirdness
andrewgait Jul 19, 2022
318fb59
Merge remote-tracking branch 'origin/master' into spinncer_update
andrewgait Jul 21, 2022
dd98f63
Merge remote-tracking branch 'origin/master' into spinncer_update
andrewgait Jul 26, 2022
6e55b9f
Merge remote-tracking branch 'origin/master' into spinncer_update
andrewgait Aug 22, 2022
d5104e7
update structured provenance
andrewgait Aug 22, 2022
92533c6
Merge remote-tracking branch 'origin/master' into spinncer_update
andrewgait Sep 20, 2022
de7abba
Merge remote-tracking branch 'origin/master' into spinncer_update
andrewgait Sep 22, 2022
e301a1c
Merge remote-tracking branch 'origin/master' into spinncer_update
andrewgait Sep 26, 2022
c20ba82
Merge remote-tracking branch 'origin/master' into spinncer_update
andrewgait Sep 29, 2022
6c8cad5
Merge remote-tracking branch 'origin/master' into spinncer_update
andrewgait Sep 30, 2022
e0555d5
Merge remote-tracking branch 'origin/master' into spinncer_update
andrewgait Oct 21, 2022
3ce1a89
Merge remote-tracking branch 'origin/master' into spinncer_update
andrewgait Oct 27, 2022
f762abd
Merge remote-tracking branch 'origin/master' into spinncer_update
andrewgait Nov 30, 2022
ef8103b
Save ITCM
andrewgait Dec 5, 2022
734d2d1
Merge remote-tracking branch 'origin/master' into spinncer_update
andrewgait Jan 17, 2023
1c41975
pylint rename variable
andrewgait Jan 17, 2023
9c4d5e3
Merge remote-tracking branch 'origin/master' into spinncer_update
andrewgait Feb 23, 2023
f7b2532
Missing import
andrewgait Feb 23, 2023
8d6c413
Merge remote-tracking branch 'origin/master' into spinncer_update
andrewgait Jul 7, 2023
c9a379e
Merge remote-tracking branch 'origin/master' into spinncer_update
andrewgait Jul 21, 2023
bac271d
Merge branch 'master' into spinncer_update
andrewgait Aug 2, 2023
7c74dbf
Merge remote-tracking branch 'origin/master' into spinncer_update
andrewgait Sep 26, 2023
01fa262
Merge branch 'master' into spinncer_update
andrewgait Sep 29, 2023
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
4 changes: 2 additions & 2 deletions c_common/front_end_common_lib/src/recording.c
Original file line number Diff line number Diff line change
Expand Up @@ -195,8 +195,8 @@ bool recording_initialize(
sark_heap_max(sv->sdram_heap, 0));
return false;
}
log_info("Allocated %u bytes for recording channel %u at 0x%08x",
space, i, region->data);
// log_info("Allocated %u bytes for recording channel %u at 0x%08x",
// space, i, region->data);
if (recording_flags != NULL) {
*recording_flags = (*recording_flags | (1 << i));
}
Expand Down
10 changes: 5 additions & 5 deletions c_common/front_end_common_lib/src/simulation.c
Original file line number Diff line number Diff line change
Expand Up @@ -197,15 +197,15 @@ static void simulation_control_scp_callback(uint mailbox, UNUSED uint port) {
log_info("Calling pre-exit function");
stored_exit_function();
}
log_info("Exiting");
// log_info("Exiting");
spin1_exit(0);
break;

case CMD_RUNTIME:
log_info("Setting the runtime of this model to %d starting at %d",
msg->arg1, msg->arg3);
log_info("Setting the flag of infinite run for this model to %d",
msg->arg2);
log_info("Setting the runtime of this model to %d starting at %d (flag %d)",
msg->arg1, msg->arg3, msg->arg2);
// log_info("Setting the flag of infinite run for this model to %d",
// msg->arg2);

// resetting the simulation time pointer
*pointer_to_simulation_time = msg->arg1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
from spinn_utilities.log import FormatAdapter
from spinn_utilities.progress_bar import ProgressBar
from spinn_front_end_common.interface.provenance import (
AbstractProvidesProvenanceDataFromMachine)
AbstractProvidesProvenanceDataFromMachine, ProvenanceWriter)

logger = FormatAdapter(logging.getLogger(__name__))

Expand All @@ -38,6 +38,7 @@ def placements_provenance_gatherer(n_placements, placements):
# retrieve provenance data from any cores that provide data
for placement in progress.over(placements):
_add_placement_provenance(placement, errors)
_add_structured_provenance(placement, errors)
if errors:
logger.warning("Errors found during provenance gathering:")
for error in errors:
Expand All @@ -50,11 +51,47 @@ def _add_placement_provenance(placement, errors):
:param list(str) errors:
"""
# retrieve provenance data from any cores that provide data
if isinstance(
placement.vertex, AbstractProvidesProvenanceDataFromMachine):
if isinstance(placement.vertex, AbstractProvidesProvenanceDataFromMachine):
# get data
try:
placement.vertex.get_provenance_data_from_machine(placement)

except Exception: # pylint: disable=broad-except
errors.append(traceback.format_exc())


def _add_structured_provenance(placement, errors):
"""
:param ~.Placement placement:
:param list(str) errors:
"""
# Insert structured provenance data to database for cores that have data
if isinstance(placement.vertex, AbstractProvidesProvenanceDataFromMachine):

# Custom provenance presentation from SpiNNCer
# write provenance to file here in a useful way
columns = ['pop', 'label', 'min_atom', 'max_atom', 'no_atoms',
'fixed_sdram', 'sdram_per_timestep']

pop = placement.vertex.label.split(":")[0]
fixed_sdram = placement.vertex.sdram_required.fixed
sdram_per_timestep = placement.vertex.sdram_required.per_timestep

label = placement.vertex.label
vertex_slice = placement.vertex.vertex_slice
max_atom = vertex_slice.hi_atom
min_atom = vertex_slice.lo_atom
no_atoms = vertex_slice.n_atoms

structured_provenance = [
pop, label, min_atom, max_atom, no_atoms,
fixed_sdram, sdram_per_timestep]

# get data
try:
with ProvenanceWriter() as db:
for n in range(len(columns)):
db.insert_core(placement.x, placement.y, placement.p,
columns[n], structured_provenance[n])
except Exception: # pylint: disable=broad-except
errors.append(traceback.format_exc())
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ def get_provenance_for_router(self, x, y):
f"{ row[0] }: { row[1] }"
for row in self.run_query(query, [int(x), int(y)]))

def get_cores_with_provenace(self):
def get_cores_with_provenance(self):
"""
Gets the cores with provenance.

Expand Down Expand Up @@ -233,10 +233,10 @@ def demo():
print(row)
print("\nCORES WITH LATE SPIKES:")
print(pr.cores_with_late_spikes())
print("\nROUETER (0,0) PROVENANCE:")
print("\nROUTER (0,0) PROVENANCE:")
print(pr.get_provenance_for_router(0, 0))
print("\nCORES WITH PROVENACE")
print(pr.get_cores_with_provenace())
print(pr.get_cores_with_provenance())


if __name__ == '__main__':
Expand Down
21 changes: 21 additions & 0 deletions spinn_front_end_common/interface/provenance/provenance_writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,3 +196,24 @@ def insert_board_provenance(self, connections):
VALUES (?, ?, ?)
""", ((x, y, ipaddress)
for ((x, y), ipaddress) in connections.items()))

def insert_lut(
self, pre_population, post_population, the_type, description,
the_value):
"""
Inserts edge data into the lut_provenance
:param str pre_population: Name of the pre population / vertex
:param str post_population: Name of the post population / vertex
:param str the_type: Class of the rule of the LUT
:param str description: type of value
:param float the_value: data
"""
self.execute(
"""
INSERT OR IGNORE INTO lut_provenance(
pre_population, post_population, the_type, description,
the_value)
VALUES(?, ?, ?, ?, ?)
""",
[pre_population, post_population, the_type, description,
the_value])
10 changes: 10 additions & 0 deletions spinn_front_end_common/utilities/db.sql
Original file line number Diff line number Diff line change
Expand Up @@ -225,3 +225,13 @@ CREATE TABLE IF NOT EXISTS boards_provenance(
ip_addres STRING NOT NULL,
ethernet_x INTEGER NOT NULL,
ethernet_y INTEGER NOT NULL);

---------------------------------------------------------------------
-- A table LUT provenance
CREATE TABLE IF NOT EXISTS lut_provenance(
connector_id INTEGER PRIMARY KEY AUTOINCREMENT,
pre_population STRING NOT NULL,
post_population STRING NOT NULL,
the_type STRING NOT NULL,
description STRING NOT NULL,
the_value FLOAT NOT NULL);
8 changes: 8 additions & 0 deletions unittests/interface/provenance/test_provenance_database.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,14 @@ def test_board(self):
with ProvenanceWriter() as db:
db.insert_board_provenance(data)

def test_lut(self):
with ProvenanceWriter() as db:
db.insert_lut("the pre", "A post", "OneToOne", "foo", 0.5)
with ProvenanceReader() as db:
data = db.run_query("Select * from lut_provenance")
expected = [(1, 'the pre', 'A post', 'OneToOne', 'foo', 0.5)]
self.assertListEqual(expected, data)

def test_log(self):
db1 = LogStoreDB()
db2 = LogStoreDB()
Expand Down