README.md

Ben Moore-Maley's UQAR Winter School Notes

The Version Control Working Environment

Use Git or Mercurial (hg). We'll be working with Git on UQAR's Gitlasso server.

SSH Keys

Note: Must be connected via UQAR ethernet to have SSH access to Gitlasso. Otherwise HTTPS works fine. These notes are also nearly identical for Github and Bitbucket.

We need to set up ssh keys so that we don't have to type our username/password combo every time we want to connect to the remote repository. In Gitlasso, navigate to Profile > SSH keys. Click the button labeled Add SSH Key. Then set up a local key and copy the contents of id_rsa.pub to the key field in Gitlasso.

$ ssh-keygen
$ cat ~/.ssh/id_rsa.pub

We're now set up to use ssh for connecting to Gitlasso.

Create a New Project

To start a new repo, click the new_project button and provide a name and description. Then create a local repo of the same name.

Now initialize a local repository of the same name.

$ mkdir <project_name>
$ cd <project_name>
$ git init
$ touch README.md
$ git add README.md
$ git commit -m 'First commit'

Now we're ready to push. Copy the project path from Gitlasso and use that to set the local repo origin.

$ git remote add git@<path/to/Gitlasso/repo>.git

And push.

$ git push -u origin master

Now we can modify our local clone of the repo, commit our changes, and push to the project master repository. This is the ideal workflow for collaborative scientific computing projects. Aim to do this several times a day.

$ cat > README.md
## BMM's UQAR Winter School Notes
Ctrl-d
$ git add README.md
$ git commit -m 'Modified README'
$ git push

Working on the Cluster

Log on to the mingan cluster (must be ethernet connected at UQAR)

$ ssh -XY <username>@mingan.uqar.ca

The mingan cluster has several available modules including Matlab, Python, fortran and C compilers, netCDF libraries, etc. Some useful module commands

$ module avail
$ module list
$ module load <module_name>
$ module rm <module_name>

Running Jobs

To demonstrate, sign into Gitlasso and fork the repo

https://gitlasso.uqar.ca/caveenj/meopar_demo

and clone to our working directory on mingan.

$ mkdir meopar_demo
$ cd meopar_demo
$ git@gitlasso.uqar.ca:bmoorema/meopar_demo.git ./

This repo contains C programs that solve the 2-D heat and Laplace equations, as well as a Makefile, post-processing files (GNUplot) and shell-scripts (.sh) for running on the cluster. View the contents of the shell-scripts.

$ cat lanceur_heat2D.sh

#!/bin/sh
#PBS -q default
#PBS -N heat_1_6
#PBS -j oe
#PBS -l walltime=00:15:00
#PBS -l nodes=1:ppn=6
#PBS -l nice=19
module load gcc/4.9.2
module load openmpi/1.8.3_new-gcc-4.9.2

cd $PBS_O_WORKDIR
time mpirun --report-bindings --map-by core --nooversubscribe --mca btl sm,self,tcp ./heat2d

To submit the job use

$ qsub <run_parameters.sh>

and to check the status use

$ qstat -an
$ qpeek <job_number>

For this exercise, we can view the results using GNUplot

$ gnuplot_heat2D.dir
$ gnuplot_laplace.dir

Code Automation

Link to Doug Latornell's code automation lesson.