|
Computer Science 400 Parallel Processing Siena College Fall 2008
|
|
Lab 1: C and Unix on the Siena Cluster
Due: 11:59 PM, Tuesday, September 9, 2008
We have three goals with the first week's lab assignment: to
familiarize you with our cluster system, to introduce you to the Unix
environment, and to introduce you to programming in C. I understand
that this is the first experience with Unix for many of you, so I
expect a lot of questions.
There are several files to turn in for this assignment, due at
11:59 PM, Tuesday, September 9, 2008.
- Send me mail at jteresco@siena.edu with a brief (a couple
sentences) indication of your level of experience programming in C
and with the Unix operating system and its variants. Please include
a list of other operating systems you have used and other
programming languages you have used and your proficiency in each,
and anything else you'd like me to know about your background coming
in. (1 point)
- Identify the function of and experiment with these Unix Commands:
ls cd cp mv rm mkdir pwd
man chmod cat more grep head tail
ln find rmdir wc diff tar
Give a one sentence description of each command in a file unix.txt.
- Emacs (emacs from the Unix command line) is a powerful
text editor. You will want to become familiar with it. Identify
the function of and experiment with these Emacs Commands:
C-x C-s C-x C-c C-x C-f C-x C-w C-g C-a C-e
C-d C-_ C-v M-v C-s C-r M-%
C- before a key means hold down Ctrl and hit that key.
M- indicates the "Meta" key, which on most systems is Esc. To issue a Meta command, hit the Esc key, release
it, then hit the key for the command you wish to issue. Use the
keystrokes rather than the menus. It will save you time in the
long run!
Include a brief description of each Emacs keystroke in your file
unix.txt.
Learn these commands - you will use them often. Hints can be
found in the Unix and Emacs web pages linked from the course
website. Ask others in the lab if you're not sure how to do
something in the Unix environment. Share your tips and tricks with
each other.
- Make a directory in your account for CS 400 work (perhaps "400" or "cs400" might be reasonable). Use the chmod
command to restrict access to this directory so only you can read
the files.
- Copy the C program here that computes the late
penalties for this course to your cluster account. Compile and run
it, redirecting your output to a file late.txt. (1 point)
- This question is postponed! Copy the file /cluster/home/terescoj/shared/make-example.tar to your cluster
account. It is a "tar file" of a small C program that
demonstrates the use of multiple source files and Makefiles.
Extract the files (tar xvf make-example.tar) and compile the
program with make. In a plain text file called make.txt, briefly describe how make uses the rules in the
Makefile to produce the executable main. (1 point)
- Write a C program that takes an arbitrary number of command-line
parameters, each of which should represent an integer value. Print
out the sum of the values provided. Call your C program argadder.c and include a Makefile that guides compilation of
your program into an executable argadder. (3 points)
Hint: See main.c in the make example, and note that the
parameter argc to the main function is a count of how many
command-line strings are included in the argv array of strings.
Also, argv[0] is not the first parameter, it is the program name
itself, and this array entry for the program name is included in the
value of argc.
When you are finished, use the turnin utility on the cluster head
node to submit the files unix.txt, late.txt, make.txt,
argadder.c, and Makefile. Recall the steps to do this are
to set up your turnin for this lab with the command:
turnin setup lab1
Then copy the files into the directory ~/turnin/400/lab1
, then
submit with the command
turnin submit lab1
Please use the exact filenames specified (for this lab and all
semester) to make my job easier when gathering your submissions
together for grading. Also, do not include any extraneous files (such
as emacs backup files, executable files, etc.). You don't want to
annoy your grader with misnamed or missing files just before he grades
your assignment.