sim: enable adding pid to output directory name
Review Request #3072 - Created Aug. 23, 2015 and updated
Information | |
---|---|
Steve Reinhardt | |
gem5 | |
default | |
Reviewers | |
Default | |
Changeset 11060:06c8c441324a --------------------------- sim: enable adding pid to output directory name With a fixed output directory name, running concurrent gem5 jobs in the same directory causes jobs to overwrite each other's output. Worse, for some upcoming changes where the output directory is used to hold redirected file I/O, having concurrent jobs share the same directory can cause crashes. This patch enables easier generation of unique output directories by replacing any occurrence of '$$' in the output directory name with the gem5 process ID. PID-specific output dirs can be enabled by default by overriding the 'm5out' default in the user's .m5/options.py file, as described in the comment.
Can you add a note in the --help text about this as well?
Posted (Aug. 28, 2015, 7:21 a.m.)
I think this idea makes sense. I was doing something similar when I added forking, specifically this commit adds a similar mechanism for forked child processes. I ended up using Python's string substitution system and a dictionary with multiple substitution variables. For PIDs, I would've used something like this: "m5out.%(pid)s". This has the additional benefit of not clashing with the shell's substitution system.
I plan to rebase and submit the patches sometime soonish. Would it make sense to try to consistently use the same type of substitution in both cases?