Skip to content

Week 05 (February 5)

Donna Calhoun edited this page Feb 8, 2018 · 11 revisions

Tuesday

  • (demo4) MPI_Reduce, MPI_Allreduce and MPI_Bcast (broadcast)

  • Parallel I/O : Reading from the command line (see routine

  • More on MPI_Send/MPI_Recv; using tags

  • (demo5) Communicate array from node 0 to node 1 using tags

  • (demo6_bug) Find the bug(s)!!

  • (demo6) Communicate array from node 0 to all other processors (fixed).

Thursday

Using Git version control

If you’d like to have the latest demonstration codes easily available, you can "clone" them from the Git repository.

First, make sure you have the Git version control system. To see if you have it, try

$ which git

If nothing is returned (or git is not found), you will need to install it. You can easily install it through HomeBrew (OSX), apt-get (Ubuntu Linux), yum (RedHat) or some other package manager.

Once you have git installed, do the following.

$ cd
$ mkdir codes    # or any name you'd like
$ cd codes
$ git clone https://github.com/donnaaboise/ME471-571.git

To see that you have everything, try the following

$ cd ME471-571
$ ls

You should see the top level directories

README.md  Week_02/  Week_04/  Week_06/  Week_08/  Week_10/  Week_12/  Week_14/  lectures/
Week_01/   Week_03/  Week_05/  Week_07/  Week_09/  Week_11/  Week_13/  Week_15/  src/

A few commonly used Git version control commands

To always make sure you have the latest code, use the pull command to "pull" the latest code from the Git cloud repository.

$ git pull

One of four things will happen.

(1) You get

$ git pull
Already up-to-date.

This means what it says (:-)).

(2) You get something like :

remote: Counting objects: 4, done.
remote: Compressing objects: 100% (2/2), done.
remote: Total 4 (delta 1), reused 4 (delta 1), pack-reused 0
Unpacking objects: 100% (4/4), done.
From https://github.com/donnaaboise/ME471-571
   e3bdcc7..a589708  master     -> origin/master
Updating e3bdcc7..a589708
Fast-forward
 Week_05/Thurs/Makefile | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
 create mode 100644 Week_05/Thurs/Makefile

This means that there were updates to the file Makefile in the repository, but that these changes can be "fast-forwarded". This happens when you haven’t made any changes to your copy of Makefile, so your version can be safely updated and there is no risk of losing any of your work.

(3) You have made changes to your version of 'Makefile'. If no subsequent changes have been made in the repository version, (i.e. your version is the most recent), the nothing will happen when you pull from the repository.

(4) You make changes to your version of Makefile AND the owner of the cloud repository also makes changes to the cloud version. In this case, when you pull, the two versions will have to be merged. Usually, an editor will come up with a "merge" message, which you can edit. The output looks like this:

$ git pull
remote: Counting objects: 5, done.
remote: Compressing objects: 100% (2/2), done.
remote: Total 5 (delta 2), reused 5 (delta 2), pack-reused 0
Unpacking objects: 100% (5/5), done.
From https://github.com/donnaaboise/ME471-571
   a589708..835c45c  master     -> origin/master
Merge made by the 'recursive' strategy.

Git can be hard to use initially, but is an incredibly powerful way of maintaining code repositories. The GitHub site (an online code repository) is also probably the most widely used site for coding efforts underway all over the world).

Using Make

Codes can be easily compiled using Makefiles. For example, from your version of the online demonstrations, try the following

$ cd Week_05/Thurs

Clone this wiki locally