====== Week 4 ====== ~~NOTOC~~ ===== Homework ===== * Written HW: Ben-Ari p. 39: * Exercises 2, 3, and 4 * Due: today (11:59pm, if that helps) ===== Programming Assignment 2 ===== * UPC Exercises 1.1 through 1.7 * Due: Wed, Feb 20 * Here's a link to a PDF of Ch. 1: [[https://www.cs.vassar.edu/~cs377/private/|private]] * Hints * For timing your C/UPC programs, add the following to your code #include int main() { clock_t startTime = clock(); // your code to compute the C->F temperature conversions here // . // . clock_t endTime = clock(); double cpuTime = ((double) (endTime - startTime)) / CLOCKS_PER_SEC; // print cpu time used // . // . } * Here's another reference: \\ http://www.gnu.org/software/libc/manual/html_node/CPU-Time.html ===== UPC ===== * Unified Parallel C * see resources in sidebar * tutorial introduction ==== ssh keys ==== * you need to set up your accounts for ssh'ing between workstations without password prompts * follow these steps to establish a trust connection for your account among our workstations - ''$ ssh-keygen'' \\ //hit enter through all the prompts// - ''$ cd ~/.ssh'' - then type this command: $ cat id_rsa.pub >> authorized_keys * for more information about ssh and public key authentication, see: [[wp>Secure_Shell]] * workstations in Asprey Lab: ''al101'' -- ''al124'' * ssh into other workstations to test your ssh keys * first time you ssh to workstation you will be prompted to confirm it's okay: ''yes'' * subsequent logins to that workstation should be without passwords or prompts! * this is what you need to do before attempting to run your UPC programs ==== setup ==== * create a bin directory if you don't already have one: * ''$ cd'' * ''$ mkdir bin'' * copy my setup script into your bin directory: * ''$ cp ~mlsmith/bin/set-upc-env ~/bin'' * run your setup script: * ''$ source ~/bin/set-upc-env'' * copy the tutorial programs to your account under your course directory: * ''$ cd ~/cs377'' * ''$ cp -r ~mlsmith/cs377-examples/upc ./'' \\ //this will create a ''upc'' directory under your course directory// * now you're ready to compile and run! (see sidebar [[tech_ref|technical reference]]) ===== Lecture Notes ===== * Ben-Ari Ch's 1 and 2 * Ben-Ari slides: {{slides.pdf|PDF}} * resume slide 50 * Formula(number of possible interleavings): * # interleavings = (nk)! / (k!)^n = $\frac{(nk)!} {(k!)^n}$ * where n = # processes and k = # steps / process