Differences between revisions 24 and 25
Revision 24 as of 2020-10-26 19:42:30
Size: 1004
Editor: khellman
Comment:
Revision 25 as of 2023-09-30 15:47:30
Size: 1988
Editor: khellman
Comment: Add example of trace slicing with sed
Deletions are marked like this. Additions are marked like this.
Line 23: Line 23:

On a Linux or Mac (FreeBSD) system, you can use `bash(1)` process redirection to select different sequences of values from the files. Suppose
you know your `SIM` accepts the first argument as a pRNG stream and rarely uses more than 9000 $u$s, then
{{{
$ ./SIM <(sed -n 'X,$p')
}}}
replacing `X` with 1, 9000, 18000, 27000, ... would provide a different sequence of random values to your `SIM` for each `X` used. (The `sed(1)` commandline parameters are for (`-n`) don't print out lines by default, (`X,$`) consider only line numbers `X` through the end of file, and (`p`) print out all considered lines.)

On a Windows system (I am an intentionally inexperienced at these devices) there may be an elegant solution at the command line but I'm unaware of it. Consider reading an environmental variable, maybe `TRACEOFFSET=27000` in your code and simply skip through that many entries when opening up `uniform-0-1-*.dat`. This solution would also certainly work on `*nix`.

Here are some sample trace files for use in your simulation assignments.

The naming pattern uniform-X-Y-Z.dat is a Uniform(X,Y) distribution; a P represents a decimal point in the naming convention. Z is simply a "globbing" parameter to collect different trace file sets into smaller ZIP file downloads.

These really are random numbers, you may mix and match between Z sets. If you combine files be sure to combine like distributions.

This archive contains seven different sequences of Uniform(0,1)

The unzip(1L) utility can be used to inspect and unroll these archive files, eg:

$ unzip -l sim-traces-00.zip

On a Linux or Mac (FreeBSD) system, you can use bash(1) process redirection to select different sequences of values from the files. Suppose you know your SIM accepts the first argument as a pRNG stream and rarely uses more than 9000 $u$s, then

$ ./SIM <(sed -n 'X,$p')

replacing X with 1, 9000, 18000, 27000, ... would provide a different sequence of random values to your SIM for each X used. (The sed(1) commandline parameters are for (-n) don't print out lines by default, (X,$) consider only line numbers X through the end of file, and (p) print out all considered lines.)

On a Windows system (I am an intentionally inexperienced at these devices) there may be an elegant solution at the command line but I'm unaware of it. Consider reading an environmental variable, maybe TRACEOFFSET=27000 in your code and simply skip through that many entries when opening up uniform-0-1-*.dat. This solution would also certainly work on *nix.

Assignments/TraceFiles (last edited 2023-09-30 15:47:30 by khellman)