Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Practical Introduction to Computational Science - Lecture Notes | CHEM 3902, Assignments of Chemistry

Material Type: Assignment; Class: DIRECTED STUDY; Subject: Chemistry; University: University of Pittsburgh; Term: Spring 2009;

Typology: Assignments

Pre 2010

Uploaded on 09/02/2009

koofers-user-k34
koofers-user-k34 🇺🇸

10 documents

1 / 3

Toggle sidebar

Related documents


Partial preview of the text

Download Practical Introduction to Computational Science - Lecture Notes | CHEM 3902 and more Assignments Chemistry in PDF only on Docsity! chem 3902 & engr 2400 “Practical introduction to Computational Science” Homework 1 January 15, 2009 1 “tar” files and running a simple program Copy over the file called “hw1 q1.tar.gz” from the /tmp/chem3902/hw1 directory on the computer cluster markov.cmms.pitt.edu into a directory called hw1 in your home directory (you will have to create this directory hw1). Files with the suffix .tar.gz are called compressed tar files, or a tarball. Tar files are the most common way of packing files together (or archiving them) in Linux. You will first have to uncompress the tar file with the gunzip command. Then extract the resulting file with the tar command. Refer to the man pages for the tar and gunzip commands for the instructions on how to use these commands, and the possible command options necessary for this task. You should get two files called “a.out” and “randgraft.f90” after running the tar command. The latter file is an simple example of a Fortran90 source code, and the former is the executable file that is produced after compiling this source code. We will discuss source code, compilers and executables later in the mini-course, but for this exercise, all that is necessary is to view the source code, and run the executable. Open randgraft.f90 with the pico text editor and look for the variables called MAXi and MAXj. These variables are declared in a statement near the top of this file that looks like MAXi= . Make note of the value that these two variables are set to. Now run the program a.out. You will have to make it executable first (hint: we discussed this at the end of the class in week 2). Run the program and watch the output as it pops up in the shell window. Now run the program again, but redirect the output to an output file called q1 output with the following command: $ a.out > q1_output 1 (NB: the command prompt will hang while the command is running). Check to see that the contents of q1 output are what you expect (having run the command before). At the bottom of this file, append the two values for the MAXi and MAXj variables. summary: At the end of this exercise, you should have a file called q1 output in a directory called hw1 in your home directory. It should contain the output from running the a.out command, followed by two numbers with the values of the MAXi and MAXj variables. 2 File sizes Copy over the file called hw1 q2.data from the /tmp/chem3902/hw1 directory on the computer cluster markov.cmms.pitt.edu into a directory called hw1 in your home directory (this directory should already exist if you have completed question 1). Find out the size of this file by using the ls and du Linux commands. Record the file size of hw1 q2.data in a file called q2 output in three different ways (using a new line for each value). On the first line, include the output from the ls command (hint: you will need to add a command option to ls to get the file size), and in the subsequent lines, include the size of hw1 q2.data in bytes and kilobytes from the du command. Use the du command option --apparent-size for this task. (hint: you will have to read the man page for the du command to format the output in terms of bytes and kilobytes. This command option will have to be used alongside the --apparent-size option) How many bytes are in a kilobyte, according to this output? Write this number at the bottom of your file q2 output. summary: At the end of this exercise, you should have a file called q2 output in a directory called hw1 in your home directory. It should contain four lines that look something like the following -rw-r--r-- 1 richard jordan 3072000 2009-01-15 11:38 hw1_q2.data 3072000 hw1_q2.data 3000 hw1_q2.data 1234 but with different values for the file sizes that correspond to the file hw1 q2.data 3 The find command There is a file called “findthisfile” in some subdirectory under the /tmp directory. Use the Linux command called find to locate this file. The find command has many options; use the man page for find to understand how to use this command. Or, use an online Linux tutorial. Once you have located this file, view it’s contents and record them in a file called q3 output in a directory called hw1 in your home directory. Also in q3 output, report the absolute path location for this file, the name of the user who owns the file, and the group that user is a member of. 2
Docsity logo



Copyright © 2024 Ladybird Srl - Via Leonardo da Vinci 16, 10126, Torino, Italy - VAT 10816460017 - All rights reserved