-
Notifications
You must be signed in to change notification settings - Fork 1
Ariel Redirect IO
The SPEC benchmark suite is a standard set of benchmarks used by academia and industry to evaluate processor designs. As such, we are interested in supporting it for SST.
If you examine the commands that SPEC executes, you'll see many of the benchmarks expect their input from stdin. (You can find these commands with specinvoke
, as described in step 12 on this page.
However, Ariel does not support reading from standard input, but it shouldn't be hard to add it. Ariel take the executable as a parameter and forks it to begin its execution. We just need to set up the files before hand, as any student taking their first systems class would do.
How do we add an argument to Ariel? Let's use the apparg
params for reference. We need add the param to the component interface. It seems the param should also exist in the pin3 frontend. So we'll also add the param there as well.
-
arielcpu.h
- add theappstdin
param -
frontend/pin3/pin3frontend.h
- add theappstdin
param
We need only look at frontend/pin3/pin3frontend.{h,cc}
from here on out.
-
Pin3Frontend::init
callsforkPINChild
during phase 0 of initialization. We don't want to mess with the launcher (which specifies the pin executable and the pintool. That leaves execute_args and execute_env to work with. Those parameters probably aren't a good place for our redirection stuff. -
execute_args
andexecute_env
are set in the constructor. We should make a new struct containing information on I/O redirects and also create it in the struct. Then, we will add it to theforkPINchild
interface. -
Pin3Frontend::forkPINChild
- First builds a string
full_execute_line
. This line copies in the args fromargs
. -
full_execute_line
is only used for debugging purposes - Next,
fork()
is called on line 333. - If everything goes well, the parent process returns the child pid on line 380, and the child process begins execution at 382.
-
execvp
is called on 398 orexecve
is called on 497. - we should make our changes on line 383.
fd = creat, close(1), dup(fd), close(fd)
- First builds a string
The .h
file needs the a struct containing redirect information. For now, it should include just the file names of the input and output files. If an input file is specified, we should check that it exists. We will create the output files if they don't exist, and overwrite the file in the case of >
.
- Add param to interface ->
appstdin
- Add struct to frontend
.h
file to hold redirect information ->std::string stdin_file
- During Ariel init, put redirect info from param to struct -> line 74
- Change interface to forkPINChild to accept struct
- Use info in struct to redirect input
- Test that file was opened successfully
- Successful build after changes
- Create simple program to test functionality
- Clean up all the printf's starting with "Patrick"
- Fix bug where infile is deleted and the sum is 0.
- Do stdout
- Do stderr
- Support append for stdout and stderr.
- Support for appending to stdout/stderr files
-
Where is there a copy of the interface Ariel in frontend/pin3/pin3frontend.h?
-
There is no warning/error if the command is too long (more than 16347 chars). In
pin3frontend.cc:310-322
. This should be fixed. -
Calling
output->fatal
from the child doesn't seem to stop the simulation.
- Add safety features for overwriting files
This feature is related to Command Parsing.