Skip to content

Commit

Permalink
Merge branch 'legion-prof-rs-test-archive' into 'master'
Browse files Browse the repository at this point in the history
legion_prof_rs: Start testing archive mode

See merge request StanfordLegion/legion!825
  • Loading branch information
elliottslaughter committed Jun 26, 2023
2 parents 4ee0e6e + dd0be8b commit 5b6f90d
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 20 deletions.
15 changes: 15 additions & 0 deletions language/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,20 @@ def run_prof_rs(out_dir, logfiles, verbose, legion_prof_rs):
raise TestFailure(' '.join(cmd), retcode, output.decode('utf-8') if output is not None else None)
return result_dir

def run_prof_rs_archive(out_dir, logfiles, verbose, legion_prof_rs):
result_dir = os.path.join(out_dir, 'legion_prof_rs_archive')
cmd = [legion_prof_rs, '--archive', '--levels', '3', '--zstd-compression', '1', '-o', result_dir,] + logfiles
if verbose: print('Running', ' '.join(cmd))
proc = subprocess.Popen(
cmd,
stdout=None if verbose else subprocess.PIPE,
stderr=None if verbose else subprocess.STDOUT)
output, _ = proc.communicate()
retcode = proc.wait()
if retcode != 0:
raise TestFailure(' '.join(cmd), retcode, output.decode('utf-8') if output is not None else None)
return result_dir

def run_prof_subnode(out_dir, logfiles, verbose, subnodes, py_exe_path):
result_dir = os.path.join(out_dir, 'legion_prof_filter_input')
cmd = [
Expand Down Expand Up @@ -326,6 +340,7 @@ def test_prof(filename, debug, verbose, short, timelimit, py_exe_path, legion_pr
result_py = run_prof(prof_dir, prof_logs, verbose, py_exe_path)
result_rs = run_prof_rs(prof_dir, prof_logs, verbose, legion_prof_rs)
compare_prof_results(verbose, py_exe_path, [result_py, result_rs])
run_prof_rs_archive(prof_dir, prof_logs, verbose, legion_prof_rs)
# we only test subnodes when running on multi-node
if os.environ.get('LAUNCHER'):
result_subnodes_py = run_prof_subnode(prof_dir, prof_logs, verbose, 1, py_exe_path)
Expand Down
44 changes: 24 additions & 20 deletions tools/legion_prof_rs/src/backend/data_source.rs
Original file line number Diff line number Diff line change
Expand Up @@ -278,8 +278,8 @@ impl StateDataSource {

let mut mem_slots = Vec::new();
if node.is_some() {
let mems = mem_groups.get(&group).unwrap();
for (mem_index, mem) in mems.iter().enumerate() {
let mems = mem_groups.get(&group);
for (mem_index, mem) in mems.iter().copied().flatten().enumerate() {
let mem_id = kind_id.child(mem_index as u64);
entry_map.insert(mem_id.clone(), EntryKind::Mem(*mem));
mem_entries.insert(*mem, mem_id);
Expand All @@ -298,15 +298,17 @@ impl StateDataSource {
}
}

let summary_id = kind_id.summary();
entry_map.insert(summary_id, EntryKind::MemKind(group));
if !mem_slots.is_empty() {
let summary_id = kind_id.summary();
entry_map.insert(summary_id, EntryKind::MemKind(group));

kind_slots.push(EntryInfo::Panel {
short_name: kind_name.to_lowercase(),
long_name: format!("{} {}", node_long_name, kind_name),
summary: Some(Box::new(EntryInfo::Summary { color })),
slots: mem_slots,
});
kind_slots.push(EntryInfo::Panel {
short_name: kind_name.to_lowercase(),
long_name: format!("{} {}", node_long_name, kind_name),
summary: Some(Box::new(EntryInfo::Summary { color })),
slots: mem_slots,
});
}
}

// Channels
Expand All @@ -317,8 +319,8 @@ impl StateDataSource {

let mut chan_slots = Vec::new();
if node.is_some() {
let chans = chan_groups.get(node).unwrap();
for (chan_index, chan) in chans.iter().enumerate() {
let chans = chan_groups.get(node);
for (chan_index, chan) in chans.iter().copied().flatten().enumerate() {
let chan_id = kind_id.child(chan_index as u64);
entry_map.insert(chan_id, EntryKind::Chan(*chan));

Expand Down Expand Up @@ -389,15 +391,17 @@ impl StateDataSource {
}
}

let summary_id = kind_id.summary();
entry_map.insert(summary_id, EntryKind::ChanKind(*node));
if !chan_slots.is_empty() {
let summary_id = kind_id.summary();
entry_map.insert(summary_id, EntryKind::ChanKind(*node));

kind_slots.push(EntryInfo::Panel {
short_name: "chan".to_owned(),
long_name: format!("{} Channel", node_long_name),
summary: Some(Box::new(EntryInfo::Summary { color })),
slots: chan_slots,
});
kind_slots.push(EntryInfo::Panel {
short_name: "chan".to_owned(),
long_name: format!("{} Channel", node_long_name),
summary: Some(Box::new(EntryInfo::Summary { color })),
slots: chan_slots,
});
}
}
node_slots.push(EntryInfo::Panel {
short_name: node_short_name,
Expand Down

0 comments on commit 5b6f90d

Please sign in to comment.