Tutorials & Examples

Here we provide brief tutorials and examples for those who are not familiar with working on HPC system. If you are interested in using our resources and not sure where to begin, please have a look at getting started.

Using the command-line interface

Since our operating system is based on GNU/Linux, a command-line interface or command language interpreter (CLI) is the primary mean of interaction with our HPC. In case you are not familiar with the command-line interface, free-online courses at codecademy is a good place to start.

Accessing the Chalawan

The Chalawan Cluster is an isolated system which resides in the NARIT’s internal network. To access the Chalawan using the Internet outside NARIT, first, you need to log into the gateway machine (Skip this step if you are connected directly to the Internet at NARIT). The gateway machine’s IP address and other information are given to you once you get the permission to access the Chalawan Cluster (For application, see getting started). After logging into the gateway machine, then, you can log in to the head node (hostname: castor) to start working.

Queuing System

The Chalawan HPC cluster uses the Open Grid Engine queuing system for scheduling jobs and for managing computational resources in the cluster. This includes all the compute nodes, memory, data storage, and other resources.

Your First Parallel Job

A “Hello World” with MPI

Let’s try running your first Message Passing Interface (MPI) program. The code is written in python which will print the message “hello world” from multiple processes. Create a file hello.py, copy and paste these following lines:

Save the file, then type in the command module load python3.6 (we will explain about module environment below). Then, execute the file with the command mpiexec -n 4 python3 hello.py. If successful, this will print an output like:

Note that the messages are not printed in order of increment. Because the tasks were sent to separated processes and the order of printed messages are that of execution completion, not the execution initiation.

Submitting a Job

Using a job-script is convenience way to interact with the cluster. The script will be sent to the Grid Engine via qsub command. Grid Engine will allocate the resource for all users’ jobs. You can submit any standard shell script (bash, csh, etc), with qsub.

The jobscript.sh file can contain any command you wish to run. It can be the command mpiexec -n 4 python3 hello.py which execute our simple parallel python program. The general command-line for qsub looks like this:

This is an example of a long command with many option and looks complex. Thus, it is convenience to put these options inside a script file; The options starting with #$ will be passed to the Grid Engine. The example below is a script file for running GIZMO:

Here is the explanation of the options we use:

  • -N Name of the job
  • -cwd Execute the job at current working directory. Error message and log file also written here.
  • -pe Parallel environment we wish to use.
  • -o Output filename
  • -e Error filename

Full list of arguments and explanation can be found here or you can type man qsub. We also recommend you to read Sun Grid Engine for beginners by Bioinformatics Platform at Max-Delbrück-Centrum für Molekulare Medizin (MDC).

Data Transfer

SecureCopy (scp)

scp is a basic command used to transfer files. For more information about scp, type man scp or scp --help.

Note: option -r is recursive

To transfer a file from remote (in this case the Castor) to local

To transfer multiple files from remote to local

To transfer a file from local to remote

Using Module Environments

The Modules package provides dynamic modification of the user’s environment via modulefiles. List of all available modules are displayed; when type the command:

To use a module, type the command module load follow by name of modulefile. This will modify the user’s environment. The user can remove the environment setting by unloading the loaded modulefile, or by logging out of the system. To unload a module, use the command module unload modulefile. Many modulefiles can be loaded at the same time by typing, module load modulefile1 modulefile2 .... If you would like to know which module has been loaded, you can use module list. Sometimes, it is convenient to remove all the loaded modulefiles, let’s, which can be done by typing module purge. The example below shows how to load the MUSIC modulefile, list the names, and remove all of them.

Some modulefiles may be conflict with currently loaded modulefiles, so you have to use module switch or module swap module1 module2. For module package documentation type module --help or module -H

List of Modulefiles

List of all available modulefiles can be found here.

Others Tutorial