Skip to content Skip to navigation Skip to collection information

OpenStax_CNX

You are here: Home » Content » An Introduction to High-Performance Computing (HPC) » Practical 1 - Simple Compilation and Submission

Navigation

Lenses

What is a lens?

Definition of a lens

Lenses

A lens is a custom view of the content in the repository. You can think of it as a fancy kind of list that will let you see content through the eyes of organizations and people you trust.

What is in a lens?

Lens makers point to materials (modules and collections), creating a guide that includes their own comments and descriptive tags about the content.

Who can create a lens?

Any individual member, a community, or a respected organization.

What are tags? tag icon

Tags are descriptors added by lens makers to help label content, attaching a vocabulary that is meaningful in the context of the lens.

This content is ...

In these lenses

  • eScience, eResearch and Computational Problem Solving

    This collection is included inLens: eScience, eResearch and Computational Problem Solving
    By: Jan E. Odegard

    Click the "eScience, eResearch and Computational Problem Solving" link to see all content selected in this lens.

Recently Viewed

This feature requires Javascript to be enabled.
 

Practical 1 - Simple Compilation and Submission

Module by: Tim Stitt Ph.D.. E-mail the author

Summary: In this module you will gain experience in compiling and submitting a simple code on the Monte Rosa system.

Introduction

In this practical you will be required to compile and submit a simple code for execution on Gele. If you require any assistance, please do not hesitate to contact the available support staff.

Objectives

The objectives of this practical are to gain experience in:

  1. compiling a code within the Cray Programming Environment
  2. submitting a job to the Gele batch queuing system
  3. interrogating the execution log files

Compiling a Simple Code

Change to Exercise Directory

cd ../Practicals/Practical_1

Tip:

Each practical will contain source code templates in either Fortran90 or C flavours. Please feel free to choose your language of preference for completing the exercises.

Fortran Example

For this example, use the template code simple.f90 provided in ../Practicals/Practical_1/Fortran90

Briefly view the Fortran90 source code in your editor e.g.

Using Emacs


emacs simple.f90

or

Using Vi


vi simple.f90

Source Code Info:

You will notice that this simple Fortran90 code sums two numbers.

Exercise 1

Compile the simple.f90 code using the Cray Fortran compiler

Solution

ftn -o simple simple.f90

C Example

For this example, use the template code simple.c provided in ../Practicals/Practical_1/C

Briefly view the C source code in your editor e.g.

Using Emacs


emacs simple.c

or

Using Vi


vi simple.c

Source Code Info:

You will notice that the simple C code adds two numbers.

Exercise 2

Compile the simple.c code using the Cray C compiler

Solution

cc -o simple simple.c

Submitting a Job

Exercise 3: Submit Batch Job

Now submit the simple executable to the batch queue system for scheduling and execution.

Solution

Using your editor, create a job script (called submit.script for instance) as follows:

#! /bin/bash
#PBS -l mppwidth=1
#PBS -l walltime=00:01:00
#PBS -V
#PBS -q linksceem

set -ex

cd $PBS_O_WORKDIR

aprun -n 1 ./simple

exit
and submit the script with:
qsub submit.script

Examining Job Logs

Exercise 4: Examining the Job Logs

Once your job has completed execution on the compute nodes, use your editor to view the contents of the job logs.

Solution

For a job with id #12345:


emacs submit.job.e12345
emacs submit.job.o12345
If all is well, you should have no errors in the error log (submit.job.e12345) and a print statement detailing the correct addition of the two numbers in the standard output log (submit.job.o12345).

Exercise 5: Modifying the Source

Modify the simple source code by changing the values of the two numbers to be summed. Re-compile and submit your new job. Verify that the output is correct and no errors appear in the job log.

Collection Navigation

Content actions

Download:

Collection as:

PDF | EPUB (?)

What is an EPUB file?

EPUB is an electronic book format that can be read on a variety of mobile devices.

Downloading to a reading device

For detailed instructions on how to download this content's EPUB to your specific device, click the "(?)" link.

| More downloads ...

Module as:

PDF | EPUB (?)

What is an EPUB file?

EPUB is an electronic book format that can be read on a variety of mobile devices.

Downloading to a reading device

For detailed instructions on how to download this content's EPUB to your specific device, click the "(?)" link.

| More downloads ...

Add:

Collection to:

My Favorites (?)

'My Favorites' is a special kind of lens which you can use to bookmark modules and collections. 'My Favorites' can only be seen by you, and collections saved in 'My Favorites' can remember the last module you were on. You need an account to use 'My Favorites'.

| A lens I own (?)

Definition of a lens

Lenses

A lens is a custom view of the content in the repository. You can think of it as a fancy kind of list that will let you see content through the eyes of organizations and people you trust.

What is in a lens?

Lens makers point to materials (modules and collections), creating a guide that includes their own comments and descriptive tags about the content.

Who can create a lens?

Any individual member, a community, or a respected organization.

What are tags? tag icon

Tags are descriptors added by lens makers to help label content, attaching a vocabulary that is meaningful in the context of the lens.

| External bookmarks

Module to:

My Favorites (?)

'My Favorites' is a special kind of lens which you can use to bookmark modules and collections. 'My Favorites' can only be seen by you, and collections saved in 'My Favorites' can remember the last module you were on. You need an account to use 'My Favorites'.

| A lens I own (?)

Definition of a lens

Lenses

A lens is a custom view of the content in the repository. You can think of it as a fancy kind of list that will let you see content through the eyes of organizations and people you trust.

What is in a lens?

Lens makers point to materials (modules and collections), creating a guide that includes their own comments and descriptive tags about the content.

Who can create a lens?

Any individual member, a community, or a respected organization.

What are tags? tag icon

Tags are descriptors added by lens makers to help label content, attaching a vocabulary that is meaningful in the context of the lens.

| External bookmarks