UW AMath High Performance Scientific Computing
 
Coursera Edition

This Page

Homework 1ΒΆ

Note: Coursera homework is not submitted or graded.

The goals of this homework are to:

  • Make sure you are familiar with basic Unix commands (see Unix, Linux, and OS X) and an editor, (see Text editors),
  • Start using git (Git) to download course materials,
  • Create your own bitbucket repository to keep your coursework
  • Make sure you have some necessary software installed.

Before tackling this homework, you should read some of the class notes and links they point to. In particular, the following sections are relevant:

For UW students, a primary goal of this homework is to create a bitbucket repository to add files to that can be graded by the course instructors.

Homework done by Coursera students will not be viewed or graded but you may still want to follow these instructions to get yourself set up. Parts not relevant have been deleted from the assignment.

See also the Bitbucket 101 instructions that for more tips on setting up bitbucket accounts and using git.

  1. Make sure you have access to git on the computer you plan to use (see Downloading and installing software for this class). Read the section Git and the documentation linked from there in order to get a sense of how it works.

  2. Clone the class repository following the Instructions for cloning the class repository.

    Make sure you have set the environment variable UWHPSC since this is used below.

  3. Set up your own personal repository on Bitbucket, by carefully following all of the instructions at Creating your own Bitbucket repository. By following these instructions you will also create a clone of the repository and add some files to it.

    Make sure you have set the environment variable MYHPSC since this is used below.

  4. In the clone of your repository, create a subdirectory homework1:

    $ cd $MYHPSC
    $ mkdir homework1

    You should now be able to cd into this directory:

    $ cd homework1

    or later you can get there from anywhere via:

    $ cd $MYHPSC/homework1
  5. Copy some files from the class repository to your own repository by:

    $ cp $UWHPSC/codes/homework1/*  $MYHPSC/homework1
    This should create the files
    • test1.py
    • test2.sh
    • test3.f90

    in the directory $MYHPSC/homework1.

  6. Use git add and git commit to add these three files and commit a snapshot.

  7. Modify test1.py as instructed in the docstring at the top of the file. Try running it via:

    $ python test1.py

    It should give results like the following:

    Code run by Your Name
    Environment variable UWHPSC is /somepath/uwhpsc
    Environment variable MYHPSC is /somepath/myhpsc
    Imported numpy ok
    Imported matplotlib ok
    Imported pylab ok

    Following the instructions, you will add and commit to files, a modified version of test1.py and the output file test1output.txt.

  8. Modify test2.sh as instructed in the comments at the top of the file.

  9. Run this bash shell script via:

    $ bash test2.sh

    This should give output something like the following:

    Environment variable UWHPSC is /somepath/uwhpsc
    Environment variable MYHPSC is /somepath/myhpsc
    
    which ipython returns...
    /somepath/ipython
    
    which gfortran returns...
    /usr/local/bin/gfortran
    
    gfortran --version returns...
    GNU Fortran (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3
    
    [more stuff]
    
    Compiling and running a Fortran code...
     Code run by Your Name
     Successfully ran Fortran 90 program

    Now run it again and redirect the output to a file:

    $ bash test2.sh > test2output.txt

    Add and commit the modified test2.sh and the output files to your repository.

    Note: At the end you should have the following files committed to your repository:

    • $MYHPSC/testfile.txt (created when following Creating your own Bitbucket repository)
    • $MYHPSC/homework1/test1.py
    • $MYHPSC/homework1/test1output.txt
    • $MYHPSC/homework1/test2.sh
    • $MYHPSC/homework1/test2output.txt
    • $MYHPSC/homework1/test3.f90

    Do not check in the file a.out, which was created when the Fortran code was compiled.

    Push them to bitbucket via:

    $ git push

    These files should then also be visible from your bitbucket webpage, by clicking on the “Source” tab, see Bitbucket repositories: viewing changesets, issue tracking.