## page was renamed from Assignments/CaveatsAndWarnings ## page was renamed from CaveatsAndWarnings #acl All:read <> <> = Missing Libraries on An alamode Machine = Occasionally, you will login to an `alamode` machine and some course provided code will fail to run due some '''very bizarre''' reasons {{{ ctb60-12$ ~khellman/SIMGRADING/Random 12345 /usr/lib/libssl.so: No such file or directory }}} Of course, `libssl.so` is there: {{{ ctb60-12$ file /usr/lib/libssl.so /usr/lib/libssl.so.1.1 /usr/lib/libssl.so: symbolic link to libssl.so.1.1 /usr/lib/libssl.so.1.1: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), statically linked, BuildID[sha1]=5a12e36d18f5fd2e5519bd1f7741bcc6907bb3ad, stripped }}} This seems to be resolved by '''using a different''' `alamode` machine. `ctb60-12` won't be fixed until it gets a reboot :( <> = Trace File Arguments Are Not Always Files = In practically all programming assignments, at least one command line argument is a file from which `SIM` should read random values from (in lieu of using a library specific pRNG). The [[Assignments/TraceFiles|TraceFiles]] page has sample files for use in development. '''Beware''' that `grader.sh` scripts don't usually provide a static regular file as these arguments! Instead they use input redirection to connect a program generating '''a possibly infinite''' sequence of values to your `SIM`. This means that if you attempt to read all random values into an array or list, your `SIM` is going to "hang" --- it will dutifully read in an infinite collection of `double`s until you exhaust machine memory. '''Also''' you can't open the trace file argument more than once, nor can you close it and then reopen it. An easy way to manage this is to create a `TraceFile` object that accepts a filename as a constructor parameter and provides a single `getRandom()` member function that returns a floating point value. Of simply write a `getRandom( tracefile )` global function that accepts an open file descriptor (object, pointer, handle, the terminology depends on the language) and returns the next `double` from the file. == Why are things so complicated you ask? == By using redirection as the source for your `SIM` random numbers, `grader.sh` can be written with tests to be sure the random numbers are being used properly,<> it is easy to incorporate pRNG '''streams''' into the mix without worrying about which language a student is using, and by providing fake sequence of random values... {{{ $ ./SIM <(yes 0.5) }}} certain types of '''consistency checks''' can be automated without micro-managing how student programs are written. <>