|
Size: 3256
Comment:
|
← Revision 35 as of 2025-09-18 12:28:15 ⇥
Size: 3062
Comment:
|
| Deletions are marked like this. | Additions are marked like this. |
| Line 4: | Line 4: |
| <<TableOfContents()>> | |
| Line 5: | Line 6: |
| <<Anchor(sshhopping)>> = Ugh, Too Many Passwords for alamode ssh Access = If you don't use Mines VPN software, then `ssh(1)` is your best bet: 1. First, setup `~/.ssh/authorized_keys` properly on your `jumpbox.mines.edu` account {{{ remote$ scp ~/.ssh/id_rsa.pub MINESLOGIN@jumpbox.mines.edu:./remote.pub remote$ ssh MINESLOGIN@jumpbox.mines.edu : : jumpbox$ mkdir ~/.ssh jumpbox$ chmod 700 ~/.ssh jumpbox$ cat remote.pub >> ~/.ssh/authorized_keys jumpbox$ chmod 700 ~/.ssh/authorized_keys }}} 1. Now you should be able to "bunny hop" through `jumpbox` to an alamode machine, if you don't have an `authorized_keys` setup on alamode yet, you are down to just one password... Test: {{{ remote$ ssh -J jumpbox.mines.edu ctb60-13.mines.edu }}} 1. Now is the right time to setup some off-campus aliases in your `remote` machine to make life easier. Pick some `alamode` machine names (let's say you use `ctb60-13`, `ctb60-19`, and `ctb60-07`); everyone seems to have favorite remote login destinations, but for the life of me I don't know why... ''For each machine'', add the following lines to your `~/.ssh/config` file on your personal (`remote`) machine, '''adjusted of course''' for the machine names you've settled on. {{{ # on campus alias Host 13bb HostName ctb60-13.mines.edu User MINESLOGIN |
<<Anchor(randomdat)>> = 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. |
| Line 31: | Line 10: |
| # off campus sweetness Host bb13 Hostname ctb60-13.mines.edu ProxyJump jumpbox.mines.edu User MINESLOGIN }}} Now, from `remote` which is off campus and '''not''' on the Mines VPN, you should be able to do {{{ remote$ ssh bb13 }}} And connect directly to `ctb60-13.mines.edu`, but possibly with a password required. |
'''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. |
| Line 43: | Line 14: |
| 1. If you '''were''' asked for a password, then setup `authorized_keys` in a manner analogous to that on `jumpbox` (notice how I'm using the `ssh` just configured in the previous step): {{{ remote$ scp ~/.ssh/id_rsa.pub bb13:./remote.pub remote$ ssh bb13 : : ctb60-13$ mkdir ~/.ssh ctb60-13$ chmod 700 ~/.ssh ctb60-13$ cat remote.pub >> ~/.ssh/authorized_keys ctb60-13$ chmod 700 ~/.ssh/authorized_keys }}} Since your `${HOME}` is shared across all `alamode` machines, you have to do this on just one `alamode` destination. Test! {{{ remote$ ssh bb13 'hostname; echo Woot\!' ctb60-13.mines.edu Woot! remote$ }}} |
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. |
| Line 62: | Line 16: |
| :) You're welcome. | == 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,<<FootNote(Depending on the system being modeled)>> 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. <<Anchor(missinglibs)>> = 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 :( |
| Line 77: | Line 52: |
| This even works if you bunny hop through `jumpbox` {{{ remote$ ssh -J jumpbox.mines.edu -X ctb60-17.mines.edu ctb60-17$ evince output-1010.pdf }}} = Beware the VSCode IDE installed on alamode (Fall 2018) = The integrated terminal in the VSCode has been shown to be '''whacky''' when running Python code. If you choose to use this IDE, you are strongly advised to use a separate terminal window to test your `SIM`. |
Contents
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 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 doubles until you exhaust machine memory.
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,1 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.
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
Grrr, I can't see the PDFs generated by grader.sh
Use a PDF viewer installed on the alamode images. Some examples include gview or evince; but xpdf is by the far the fastest.
$ xpdf output-1010.pdf
If you are ssh(1)ing into alamode, use the -X option.
remote-with-vpn$ ssh -X ctb60-13.mines.edu ctb60-13$ gview output-1010.pdf
Depending on the system being modeled (1)