Skip to content
This repository was archived by the owner on Mar 3, 2025. It is now read-only.

Commit a01b7b7

Browse files
authored
Dev 0.6 (#4)
* Fix config argument bug * Fix packaging error that was only allowing lapidary to be run from the directory itself. Now can be installed via pip. * Cleaning up the checkpointing engine as I start working on keyframes. - Adding some documentation (docstrings) - Converting random print statements into log messages using the logger modules. - Also moved the LICENSE to the proper place in the directory hierarchy so that it shows up on github. * Fix bug in Spec17 plugin that wasn't allowing for customizable spec locations. - Spec2017Bench now overrides the SPEC17_ROOT variable in the makefile, allowing spec to now build properly. - Added a bit more documentation. * Fixed the bug with early-termination in GDB - It wasn't actually an issue with the signal handler like I thought. It was actually that I wasn't catching a GDB error from parsing the "show language" command. It is now fixed. - Some other minor tweaks. * Legacy bug cleanup. Before we can merge 0.6, we need to do the following things: - Get single simulate and parallel simulate working again (currently I need to test after rebuilding gem5). - Get keyframes fully implemented, which will dramatically increase usability. * Fixed single simulate - Parallel still terminates early for some reason * Parallel simulate is working again! - Need to clean up the stdout/stderr interweaving. - Should also clean up some of the logging infra * Fixed stdout/stderr redirection Tips and tricks: - stdout/stderr should be in text mode (at least for python2.7, I think) - need to seek to 0 to print - can't use io.StringIO because python expects fileno() to be implemented on stdout/stderr * A bit of clean-up * Add some keyframes scaffolding.
1 parent 81b4167 commit a01b7b7

23 files changed

+338
-207
lines changed

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,9 @@ lapidary-code.code-workspace
142142
.vscode/ipch/681ea811cfbf718c/get_fs_base.ipch
143143
.vscode/ipch/681ea811cfbf718c/mmap_address.bin
144144

145-
# Proprietary
145+
# Proprietary/testing related
146146
spec-cpu2017
147147
workspace_lapidary_spec17/
148148
*.bak
149+
log.txt
150+
simulation_results

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
[submodule "gistsnip"]
22
path = gistsnip
33
url = https://github.com/loov/gistsnip.git
4+
[submodule "gem5_master"]
5+
path = gem5_master
6+
url = https://gem5.googlesource.com/public/gem5

.lapidary.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
gem5_path: ./custom_gem5
1+
gem5_path: ./gem5_master
22
gem5_features:
33
syscall_trace: true
44

@@ -7,5 +7,5 @@ libc_path: ./libc/glibc/build/install
77
gem5_flag_config_plugin: ./test/test_configurations.py
88

99
spec2017_config:
10-
spec2017_src_path: ./spec-cpu2017
10+
spec2017_src_path: ../cooldown/spec-cpu2017
1111
workspace_path: ./workspace_lapidary_spec17
File renamed without changes.

gem5_master

Submodule gem5_master added at c288af7

lapidary/checkpoint/CheckpointConvert.py

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,22 +12,40 @@
1212
from time import sleep
1313

1414
from lapidary.utils import *
15-
from lapidary.checkpoint.Checkpoints import GDBCheckpoint
15+
from lapidary.checkpoint.Checkpoints import *
1616

1717
class GDBCheckpointConverter:
1818

19-
def __init__(self, gdb_checkpoint):
19+
def __init__(self, gdb_checkpoint, keyframe=None, diffs=None):
2020
assert isinstance(gdb_checkpoint, GDBCheckpoint)
2121
assert gdb_checkpoint.is_valid_checkpoint()
22+
assert keyframe is None or isinstance(keyframe, Gem5Checkpoint)
2223
self.gdb_checkpoint = gdb_checkpoint
2324
self.mappings = self.gdb_checkpoint.get_mappings()
25+
self.keyframe = keyframe
26+
self.diff_frames = diffs
2427

2528
@staticmethod
2629
def compress_memory_image(file_path):
30+
'''
31+
gem5 can accept either compressed or uncompressed pmem files
32+
(compressed with gzip), as long as they have the same file name.
33+
34+
The only downside is that simulations take longer to start.
35+
'''
2736
subprocess.call(['gzip', '-f', str(file_path)])
2837
gzip_path = Path(str(file_path) + '.gz')
2938
gzip_path.rename(file_path)
3039

40+
41+
def _create_diff_file(self, src_pmem_fp, new_pmem_fp):
42+
if self.keyframe is None:
43+
return new_pmem_file
44+
45+
from diff_match_patch import diff_match_patch
46+
dmp = diff_match_patch()
47+
48+
3149
def create_pmem_file(self):
3250

3351
with self.gdb_checkpoint.get_pmem_file_handle() as pmem_raw,\

lapidary/checkpoint/Checkpoints.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,14 @@ def __str__(self):
6060

6161

6262
class Gem5Checkpoint(GDBCheckpoint):
63-
6463
def is_valid_checkpoint(self):
6564
return super().is_valid_checkpoint(self) and self.pmem_file.exists()
65+
66+
class Gem5DiffCheckpoint(GDBCheckpoint):
67+
68+
def __init__(self, checkpoint_directory):
69+
super().__init__(self, checkpoint_directory)
70+
self.pmem_diff_file = self.pmem_file + '.diff'
71+
72+
def is_valid_checkpoint(self):
73+
return super().is_valid_checkpoint(self) and self.pmem_diff_file.exists()

0 commit comments

Comments
 (0)