Getting Started with HPC
This documentation is for researchers who have an HPC account and need to know how to connect, login, transfer data and run jobs on HPC.
An HPC account is required to log into and use HPC resources. To apply for an HPC account see the Applying for an HPC Account page.
HPC is a collection of computers and disk arrays that are connected via fast networks that allow USC researchers to run programs at a larger scale than they would be able to on a laptop or lab computer.
The schematic below gives you a general idea of how these parts connect.
When using HPC, you will notice several differences from the desktop or laptop environment with which you may be familiar.
- HPC’s interface is command line driven – there is no graphical user interface.
- HPC nodes run the Linux CentOS operating system and not Windows or Mac OS.
- You must submit your programs to a remote batch processing system to run them – although there is a way to test them interactively before they are submitted.
The workflow for using HPC typically consists of the following steps:
- Log into a login (also know as head) node (i.e., hpc-login2.usc.edu or hpc-login3.usc.edu).
- Prepare, install, and transfer all scripts, data, and programs necessary to run your job.
- Request an interactive compute node and test your job interactively.
- Submit your job to the batch processor, where it will run it remotely on a compute node.
- Monitor your job and check your results when it has completed.
1. Log into to HPC
To log into HPC, you will need to use a secure shell client. This is a small application that enables you to connect to a remote computer via SSH (Secure SHell), a cryptographic network protocol.
Windows users will need to download a third-party secure shell client to connect to HPC. You may use the client that works best for you. Here are a few of the most popular clients:
- X-Win32, which is available through the USC software website. This USC-licensed version has a pre-configured connection to HPC.
- PuTTY, which is a popular third-party client that may be downloaded through the developer’s website. When configuring PuTTY, you will need to enable the Connection=>SSH=>X11=>“Enable X forwarding” option to allow HPC to send graphical displays to your laptop.
To connect to HPC using any SSH client, download and install the client and then launch a connection window. You will be asked to provide your USC NetID and password.
NOTE: If you are not using X-Win32, which is preconfigured to connect to HPC, you will need to enter the following hostname in order to connect to HPC: hpc-login2.usc.edu (or hpc-login3.usc.edu).
Mac OS X
Mac OS X users can connect to HPC using the Terminal application that is native on these systems. The Terminal application may be found in the Utilities group on the Mac OS X dashboard or in the Finder menu under Goand then Utilities.
To connect to HPC using Terminal, open a window and type:
where YOUR_USC_NetID is your username for the email that ends in @usc.edu. You will then be prompted to enter your USC NetID password.
To enable graphical displays, you will need to install the X11.app from XQuartz and use the -Y command when logging into HPC, i.e.:
ssh -Y YOUR_USC_NetID@hpc-login2.usc.edu
NOTE: HPC does not manage your USC NetID password. If you are having difficulty using your USC NetID and/or password, please contact the ITS Customer Support Center at 213-740-5555.
After You Connect
Once you have successfully logged in, you will see the following message:
demo1:~ ttrojan$ ssh hpc-login3.usc.edu Last login: Mon Dec 11 12:53:23 2017 from demo1.usc.edu ******************************************************************************** Thursday, November 9, 2017 All users of this computer system acknowledge that activities on it may be subject to monitoring; the privacy of activities on this system cannot be ensured. All computer account users are required to read and abide by the ITS Computing and Usage Policies. Please refer to the web page at: https://policy.usc.edu/technology/ [ttrojan@hpc-login3 ~]$ hostname hpc-login3 [ttrojan@hpc-login3 ~]$
The first time you use SSH to log into HPC, you will see a prompt similar to the text below:
The authenticity of host 'hpc-login3.usc.edu (126.96.36.199)' can't be established. RSA key fingerprint is cb:0e:06:3d:27:23:05:cf:04:9c:af:ae:28:52:7a:41. Are you sure you want to continue connecting (yes/no)?
This message is displayed the first time you try to connect to a new computer. It is asking if you trust this computer before it sets up the configuration for a secure connection. Simply type yes to continue.
To verify that you have logged in, you can use the command hostname, which will output the name of the computer you are on. If you see hpc-login2 or hpc-login3, you have successfully logged in.
2. Prepare, install, and transfer all necessary HPC data and scripts
Once you are logged in you can use software, work with files, run brief tests, or submit PBS scripts to the job queue. The login nodes are a shared resource so be careful not to do tasks that will impact other users. If your usage impacts other users, we may terminate your process without warning.
Preparing and Installing Data and Scripts
HPC maintains software, compilers, and libraries in the directory /usr/usc. These are programs that support distributed computing, are licensed for use on HPC, or are commonly used by HPC researchers. A current listing of software in /usr/usc/ shows the following:
[ttrojan@hpc-login3 ~]$ cd /usr/usc [ttrojan@hpc-login3 usc]$ ls acml fftw iperf mvapich2 R amber gaussian java NAMD root aspera gcc_wrap jdk ncview ruby bazel gflags julia netcdf sas bbcp git lam netcdf-fortran schrodinger bin globus lammps nwdb sgems boost glog leveldb opencv singularity caffe gnu libroadrunner OpenGeos stata cellprofiler graph-tool llvm openmpi subversion CGAL gromacs lmod papi swig clang gurobi lua patchelf taxila cmake hadoop magma perl tdk conf hdf5 mathematica petsc tensorflow cuda hdfview matlab pgi udunits cuDNN hello_usc mkl protobuf valgrind cula hpctoolkit modulefiles python VisIt dict igraph mongo2k qchem dmtcp imp mpich qespresso etc imsl mpich2 qiime fdtd intel mpich-mx QT
As an example, we’ll look at a program named hello_usc. Let’s look at what’s inside /usr/usc/hello_usc/.
[ttrojan@hpc-login3 usc]$ cd /usr/usc/hello_usc/ [ttrojan@hpc-login3 hello_usc]$ ls 1.0 2.0 3.0 default [ttrojan@hpc-login3 hello_usc]$
We have three versions of this program. We keep multiple versions of most software for compatibility. There is also a “version” called default which is a pointer to the HPC-recommended version, usually the most recent version. To see which version default points to, type the command ls –l.
[ttrojan@hpc-login3 hello_usc]$ ls -l total 28 drwxr-xr-x 3 root root 4096 Sep 28 2016 1.0 drwxr-xr-x 3 root root 4096 Sep 28 2016 2.0 drwxr-xr-x 3 root root 4096 Sep 28 2016 3.0 lrwxrwxrwx 2 root root 3 Apr 24 2015 default -> 3.0
Let’s try using the most recent version, 3.0. Within that directory, you should see another directory named bin and two “setup” scripts.
[ttrojan@hpc-login3 hello_usc]$ ls 3.0 bin setup.csh setup.sh
By convention, executable programs are usually installed into a subdirectory named /bin. If you list the contents of this subdirectory, you will find a program named hello_usc.
[ttrojan@hpc-login3 hello_usc]$ ls 3.0/bin/ hello_usc
To use this program on HPC, you must first run a setup script. Setup scripts enable you to run software by modifying your runtime environment. You will find two scripts, setup.sh and setup.csh, for every software version. The .sh and .csh suffixes indicate that the scripts are compatible with the bash and csh shells (and their derivatives), respectively. Each has its own syntax. Bash is the default shell on HPC so unless you have requested to change your default shell, you will always use setup.sh. For more information about Linux shells, see [link].
To use the script, run the command source.
[@hpc-login3 hello_usc]$ hello_usc -bash: hello_usc: command not found [ttrojan@hpc-login3 hello_usc]$ source /usr/usc/hello_usc/3.0/setup.sh [ttrojan@hpc-login3 hello_usc]$ hello_usc Hello USC!!!. I am version 3.0 running on host: hpc-login3
If you decide that you’d like to use a different version of the program, you can log out and log back in to reset your environment.
NOTE: While it is possible to add a source statement to directly to your login script (.bashrc or .cshrc) to automatically set the program version to use with every script, HPC recommends against doing so as they may conflict with each other and cause unexpected behavior. We recommend you put these statements in each specific job script which will be helpful when troubleshooting problems with your environment.
Installing Software on HPC
Researchers are encouraged to install any software, libraries, and packages necessary for their work. HPC has a presentation on how to approach installing software on HPC.
Editing Files on HPC
You can always create files on your personal computer and transfer them to HPC but sometimes it is easiest to create them directly on HPC.
HPC supports the vi/vim, gedit, nano and emacs text editors. Nano is used in HPC training sessions because it is an easy editor to learn. Gedit is a good option if you log in with “X11 forwarding” enabled which is pre-configured on USC’s version of X-Win32 and enabled by XQuartz’s X11.app on Mac OS. Vi/vim, which comes standard on all UNIX/Linux machines, and emacs, which is a popular coding environment, both have steeper learning curves.
To edit a file, simply type the editors name, e.g., nano or gedit, at the command line and then type in your file’s text.
Storing Files on HPC
All HPC account holders are assigned two folders where they can store files and run programs. These are referred to as the home directory and project directory. Your home directory contains exactly 1 gigabyte (GB) of disk space and is strictly for personal configurations and settings. You will always start in your home directory when you log into HPC.
Your project directory is larger and will be the directory you use for most HPC work. This will also be where you will collaborate with your group. Its disk space can vary. Every user will have their own subdirectory within their group’s project directory where they can store data files. Users affiliated with multiple HPC projects will have multiple project directories so they can easily share their files with the appropriate groups.
HPC is a shared resource so there are quotas on usage to help ensure fair access. There are quotas on the number of files written, amount of disk space used, and compute time used.
Disk space quota
To check your assigned disk space quota, type the command myquota. It will return results similar to the following:
------------------------------------------ Disk Quota for /home/rcf-40/ ID 268648 Used Soft Hard Files 1905 100000 101000 Bytes 360.38M 1.00G 1.00G ------------------------------------------ Disk Quota for /home/rcf-proj2/ ID 735 Used Soft Hard Files 645157 1000000 1001000 Bytes 106.90G 1.00T 1.02T ------------------------------------------
In this example, the user has access to two different directories. The first is their home directory which has room for up to 100,000 files and 1GB of data. The second is their project directory which has room for up to 1,000,000 files and 1TB of data. Quotas for project directories are shared amongst all group members. If you exceed these limits, you may receive a “disk quota exceeded” or other type error. If your project directory becomes full, please send email to email@example.com for assistance. Please note that HPC is unable to increase your home directory’s quota.
The myquota command is handy if you forget where your project directory is. You can also use the Checking Your Quotas page to check quotas.
HPC also assigns each project and project member a directory in another location called “staging”. If you need access to a large amount of temporary storage or need a high-performance (parallel) file system, you can keep data in/staging. This area is not backed up and is cleared out about every six months so don’t store data here unless it’s easily reproducible or there is a secondary copy elsewhere.
Compute time quota
To check the amount of compute time you have available you can use the command >mybalance -h. The -h flag gives the results in hours. It will return results similar to:
Name Available ------------------- ---------- lc_
106566.4 lc_ 28212014
Your compute usage is measured in units of core-hours. If you request one cpu core for 1 hour then you consume 1 core x 1 hours = 1 core-hour. If you request 8 cpu cores for 2 two hours then you consume 8 cores x 2 hours = 16 core-hours. Note that if you leave off the -h in the command above, the results will be displayed in core-seconds.
It is a good idea to check this balance before submitting a large job. Your project PI may request additional core-hours at no cost through the project website (link). If you are in multiple research groups make sure that you keep track of which project you request compute time for or you may consume compute resources for one group while doing work for another.
Transferring Data and Scripts
HPC has a dedicated data transfer node (DTN), hpc-transfer.usc.edu, that is configured for fast file transfers. hpc-transfer is also a Globus endpoint. Use hpc-transfer instead of an hpc-login node when logging in to transfer files. Always transfer files into your project or staging directories where you have sufficient disk space.
- Between your laptop and HPC
- From the Internet to HPC
One of the easiest ways to transfer files is to use a utility like FileZilla, a Secure File Transfer Protocol (SFTP) client. It’s also possible to use the command line function scp. You can find a detailed guide on how to install and use these tools at itservices.usc.edu/sftp/. Remember to use hpc-transfer.usc.edu as the hostname when you transfer files.
You can transfer a file from the Internet directly to your project directory on HPC (without first downloading to your laptop). For example, if want to transfer a repository from github, use the command git clone REPOSITORY_URL, where REPOSITORY_URL is the link you copied from github. If you want to transfer a file from a web page, you can use the command wget URL. If you need to transfer data from a private location (i.e., one that requires logging in), the site may or may not allow you to use wget for the transfer.
If you need to frequently transfer files, plan to move large amounts of data, or need assistance transferring data from a private location, feel free to contact us at firstname.lastname@example.org for advice on how to do this efficiently.
3. Request an interactive compute node.
We recommend that you first test your job on a compute node before submitting it remotely so that you’ll be confident that you will have quality results after a job completes. You can do this by requesting an ‘interactive session’; i.e., running a job in interactive mode. This will enable you to request one (or multiple) compute nodes that you can use, just like you use a login node, but without impacting other users.
To request an interactive session, you can use the command qsub -I
qsub –l ‘nodes=1:ppn=16’ –l ‘walltime=1:00:00’ –I
This command will request one node with 16 processors for an hour. The –I flag indicates that you want to log in directly to your compute node.
After running this command you should see a message similar to the following:
qsub: waiting for job job_id_here.hpc-pbs1.hpcc.usc.edu to start
This means that the job scheduler is looking for a compute node with at least 16 processors that will be available for the next hour.
Once your job starts you can test out your programs or scripts to make sure they work properly on HPC. If there is a problem that you can’t resolve, send an email to email@example.com for assistance. Once you are confident that you know how your program will behave, you are ready to try out submitting a job through the batch scheduler.
4. Submit your job.
A job consists of all commands, data, scripts and programs that will be used to obtain results. Jobs are submitted to HPC’s batch processing system (Torque/PBS) which performs the following functions:
- Schedules user-submitted jobs
- Allocates user-requested computing resources
- Processes user-submitted jobs
Jobs submitted to the system are processed remotely. The process is recorded and written to files (output and error) that are made available to the user upon the completion of their job.
NOTE: Head nodes (hpc-login2, hpc-login3, and hpc-transfer) are shared resources that are used by many users simultaneously. Compute nodes are not shared (this may differ on private nodes). You may run short tests on the head nodes but beyond that you will need to use the compute nodes. HPC has only three head nodes and almost 3000 compute nodes!
See Running a job on HPC using PBS for instructions on setting up and submitting a job script.
5. Monitor your job.
There are several commands you can use to monitor a job after it has been submitted.
To see if your job has been queued:
The first thing you’ll want to check is if your job request was queued. To do this, you will use the qstat command:
qstat -u username
qstat -u shows the status of your queued PBS jobs (NOTE: Typing qstat with no arguments will list all queued jobs)
On the login nodes, you can use a wrapper script called myqueue, which automatically passes your user information to qstat and prints the names of the nodes and cores that have been allocated to your job.
Each job is assigned a unique job identifier (Job ID). It is sufficient to use only the numeric portion of the job id when referencing a job or submitting a ticket.
In the example screenshot below, the job “25790377″ has been placed in the “quick” queue (Queue) based on its requested time of 10 minutes (Req’d Time). The job requested 2 nodes (NDS) with 8 cores each (TSK). The elapsed time (Elap Time) is greater than zero, indicating that compute resources were successfully allocated 19 seconds ago. The status (S) of the job is “R”, or running. (Similarly, “Q” means queued, “H” means held, and “C” means completed).
The myqueue command additionally displays the names of the nodes (node identifiers) allocated after the qstat table, here, hpc1020 and hpc1041.
[ttrojan@hpc-login3 ~]$ myqueue Req'd Req'd Elap Job ID Username Queue Jobname SessID NDS TSK Memory Time S Time ----------------------- ----------- -------- ---------------- ------ ----- ------ --------- --------- - --------- 25790377 ttrojan quick hello_usc 0 2 8 -- 00:30:00 R 00:00:28 hpc1013/0-3+hpc1014/0-3
To see when your job will start:
Once your job is assigned an identifier, you can use the showstart command to provide an estimate of when it will start. The start time is computed dynamically and may change as new jobs are queued. This command takes a few minutes to process and will display “INFO: cannot determine start time” until it has finished. If you continue to see the message, go back and review your allocation request, it may be correct syntactically but not logically. If this message persists, send email to firstname.lastname@example.org for assistance.
To check additional information on a job that is already running:
Once you have a Job ID, you can use the commands qstat -f and check job to show detailed information about your job. Once you have the name of you assigned node(s) (also known as Node IDs), you can use the commands pbsnodes and check node to show detailed information about the node(s) on which your job is running.
qstat -f job_id
shows the status of a PBS job
shows the current status of the job
shows the status of the node
shows the detail of nodes
To delete a job from the queue:
If you wish to delete your job from the queue, you can use the qdel command. Your job will remain in the queue for a short while but its status will change to ‘C’ for complete.
See Useful PBS Commands for additional PBS commands used to monitor and interact with your HPC jobs.
If you need additional assistance getting started with HPC, please see our Getting Help page for information on online and in-person HPC assistance.