Skip to content

Commit

Permalink
Merge pull request #260 from firesim/simulation_outputs
Browse files Browse the repository at this point in the history
simulation_outputs support for marshal install
  • Loading branch information
joonho3020 authored Jan 21, 2023
2 parents 8e02b02 + 4c96028 commit 5fbd65c
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
13 changes: 13 additions & 0 deletions boards/default/installers/firesim/firesim.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,13 @@ def install(targetCfg, opts):

if 'outputs' in jCfg:
wls[slot]["outputs"] = [f.as_posix() for f in jCfg['outputs']]

if 'firesim' in jCfg:
if 'simulation_outputs' in jCfg['firesim']:
wls[slot]["simulation_outputs"] = [f.as_posix() for f in jCfg['firesim']['simulation_outputs']]
if 'simulation_inputs' in jCfg['firesim']:
wls[slot]["simulation_inputs"] = [f.as_posix() for f in jCfg['firesim']['simulation_inputs']]

fsCfg['workloads'] = wls
else:
# Single-node run
Expand All @@ -77,6 +84,12 @@ def install(targetCfg, opts):
if 'outputs' in targetCfg:
fsCfg["common_outputs"] = [f.as_posix() for f in targetCfg['outputs']]

if 'firesim' in targetCfg:
if 'simulation_outputs' in targetCfg['firesim']:
fsCfg["common_simulation_outputs"] = [f.as_posix() for f in targetCfg['firesim']['simulation_outputs']]
if 'simulation_inputs' in targetCfg['firesim']:
fsCfg["common_simulation_inputs"] = [f.as_posix() for f in targetCfg['firesim']['simulation_inputs']]

with open(str(fsTargetDir / "README"), 'w') as readme:
readme.write(readmeTxt)
readme.write(os.path.relpath(targetCfg['cfg-file'], start=str(fsTargetDir)) + "\n")
Expand Down
13 changes: 13 additions & 0 deletions wlutil/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,13 @@
# List of files to copy out of the image after running it. Files will
# be flattened into results dir. [guest_src0, guest_src1, ...]
'outputs',
# To indicate that a certain value associated with this key is only
# used for firesim.
'firesim',
# List of simulation outputs to copy after running firesim.
'simulation_outputs',
# List of simulation inputs to copy before running firesim.
'simulation_inputs',
# Path to script to run on the guest every time it boots
'run',
# An inline command to run at startup (cannot be set along with 'run')
Expand Down Expand Up @@ -474,6 +481,12 @@ def __init__(self, cfgFile=None, cfgDict=None):
if 'outputs' in self.cfg:
self.cfg['outputs'] = [pathlib.Path(f) for f in self.cfg['outputs']]

if 'firesim' in self.cfg:
if 'simulation_outputs' in self.cfg['firesim']:
self.cfg['firesim']['simulation_outputs'] = [pathlib.Path(f) for f in self.cfg['firesim']['simulation_outputs']]
if 'simulation_inputs' in self.cfg['firesim']:
self.cfg['firesim']['simulation_inputs'] = [pathlib.Path(f) for f in self.cfg['firesim']['simulation_inputs']]

if 'out-dir' in self.cfg:
self.cfg['out-dir'] = wlutil.getOpt('image-dir') / self.cfg['out-dir']
else:
Expand Down

0 comments on commit 5fbd65c

Please sign in to comment.