Review Board 2.0.15


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.

   
Ship it!
Posted (Aug. 26, 2015, 7:36 a.m.)

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?

  1. Did these patches ever get submitted? I don't recall seeing them. Unless something is going to change soon, I'd like to submit this patch.

    Note that I used '$$' to be consistent with shell syntax, not to clash with it... true that it does require quoting if you put it on the command line, but it doesn't if you put it in the .m5/options.py file, and it has the advantage that it's easy to remember.

  2. We have rebased the forking patches and I plan to submit them as soon as I'm back from X-mas holidays. I expect I'll submit the patches around the 11th. I would really like to avoid having two slightly different substitution systems in place, so I'd appreciate it if you could have a look at the patches on GitHub and use the same syntax in this patch.