# Working on a remote HPC system ```{instructor-note} Total: 30min (Teaching:30Min | Discussion:0min | Breaks:0min | Exercises:0Min) ``` ```{prereq} - An active user account on one of the clusters - Basic UNIX knowledge - Familiar with the the UNIX terminal ``` ```{objectives} - Questions - What is an HPC system? - How does an HPC system work? - How do I log on to a remote HPC system? - keypoints - An HPC system is a set of networked machines. - Connect to a remote HPC system. - Understand the general HPC system architecture. - HPC systems typically provide login nodes and a set of worker nodes. - The resources found on independent (worker) nodes can vary in volume and type (amount of RAM, processor architecture, availability of network mounted file systems, etc.). - Files saved on one node are available on all nodes. ``` ## Get a user account and access to a project `````{tabs} ````{tab} SAGA/Fram/Betzy https://www.sigma2.no/how-apply-user-account ```` ````{tab} Fox https://research.educloud.no/ ```` ````` ## Logging in The first step in using a cluster is to establish a connection from our laptop to the cluster, via the Internet and/or your organization's network. We use a program called the Secure SHell (or ssh) client for this. Make sure you have an SSH client installed on your laptop. Refer to the [UNIX intro to HPC](https://training.pages.sigma2.no/tutorials/unix-for-hpc/) section for more details. ![Connect to cluster](/images/connect-to-remote.svg) ```{instructor-note} Remind what ssh is ``` ```{warning} If you are on a Windows version that does not have a terminal then please install [https://gitforwindows.org/](https://gitforwindows.org/) to get an terminal ``` ### Test if ssh is installed before proceeding ```{exercise} Check ssh version [user@laptop ~]$ ssh -V OpenSSH_x.x xx, OpenSSL xxx xxx **ssh installed and OK to continue** ``` ```{danger} [user@laptop ~]$ ssh -V Command 'ssh' not found **Not OK inform instructor** ``` ### Go ahead and log in to the cluster: Remember to replace `MY_USER` with the username supplied by the instructors. You may be asked for your password. ```{warning} The characters you type after the password prompt are not displayed on the screen. Normal output will resume once you type the passward and press `Enter`. ``` `````{tabs} ````{tab} SAGA ```{literalinclude} snippets/saga/12-login.txt :language: bash ``` ```` ````{tab} FRAM ```{literalinclude} snippets/fram/12-login.txt :language: bash ``` ```` ````{tab} BETZY ```{literalinclude} snippets/betzy/12-login.txt :language: bash ``` ```` ````{tab} FOX ```{literalinclude} snippets/fox/12-login.txt :language: bash ``` ```` ````` You are logging in using a program known as the secure shell or `ssh`. This establishes a temporary encrypted connection between your laptop and `compute cluster`. The word before the `@` symbol, e.g. `MY_USER_NAME` here, is the user account name that you have permission to use on the cluster. ## Where are we? Very often, many users are tempted to think of a high-performance computing installation as one giant, magical machine. Sometimes, people will assume that the computer they've logged onto is the entire computing cluster. So what's really happening? What computer have we logged on to? The name of the current computer we are logged onto can be checked with the `hostname` command. (You may also notice that the current hostname is also part of our prompt!) `````{tabs} ````{tab} SAGA ```{literalinclude} snippets/saga/12-hostname.txt :language: bash ``` ```` ````{tab} FRAM ```{literalinclude} snippets/fram/12-hostname.txt :language: bash ``` ```` ````{tab} BETZY ```{literalinclude} snippets/betzy/12-hostname.txt :language: bash ``` ```` ````{tab} FOX ```{literalinclude} snippets/fox/12-hostname.txt :language: bash ``` ```` ````` ## What's in your home directory? The system administrators may have configured your home directory with some helpful files, folders, and links (shortcuts) to space reserved for you on other filesystems. Take a look around and see what you can find. Home directory contents vary from user to user. Please discuss any differences you spot with your neighbors. *Hint:* The shell commands `pwd` and `ls` may come in handy. Use `pwd` to **p**rint the **w**orking **d**irectory path: `````{tabs} ````{tab} SAGA ```{literalinclude} snippets/saga/12-pwd.txt :language: bash ``` ```` ````{tab} FRAM ```{literalinclude} snippets/fram/12-pwd.txt :language: bash ``` ```` ````{tab} BETZY ```{literalinclude} snippets/betzy/12-pwd.txt :language: bash ``` ```` ````{tab} FOX ```{literalinclude} snippets/fox/12-pwd.txt :language: bash ``` ```` ````` The deepest layer should differ: MY_USER_NAME is uniquely yours. Are there differences in the path at higher levels? You can run `ls` to **l**i**s**t the directory contents, though it's possible nothing will show up (if no files have been provided). To be sure, use the `-a` flag to show hidden files, too. ```console [MY_USER_NAME@CLUSTER_NAME ~]$ ls -a ``` At a minimum, this will show the current directory as `.`, and the parent directory as `..`. If both of you have empty directories, they will look identical. If you or your neighbor has used the system before, there may be differences. What are you working on? ## Nodes Login nodes and compute nodes Individual computers that compose a cluster are typically called *nodes* (although you will also hear people call them *servers*, *computers* and *machines*). On a cluster, there are different types of nodes for different types of tasks. The node where you are right now is called the *head node*, *login node*, *landing pad*, or *submit node*. A login node serves as an access point to the cluster. As a gateway, it is well suited for uploading and downloading files, setting up software, and running quick tests. It should never be used for doing actual work. The real work on a cluster gets done by the *worker* (or *compute*) *nodes*. Worker nodes come in many shapes and sizes, but generally are dedicated to long or hard tasks that require a lot of computational resources. All interaction with the worker nodes is handled by a specialized piece of software called a scheduler (the scheduler used in this lesson is called [Scheduling jobs](https://training.pages.sigma2.no/tutorials/hpc-intro/episodes/13-scheduler.html) ). We'll learn more about how to use the scheduler to submit jobs next, but for now, it can also tell us more information about the worker nodes. For example, we can view all the worker nodes with the `sinfo` command. `````{tabs} ````{tab} SAGA ```{literalinclude} snippets/saga/12-sinfo.txt :language: bash ``` ```` ````{tab} FRAM ```{literalinclude} snippets/fram/12-sinfo.txt :language: bash ``` ```` ````{tab} BETZY * [More details](https://documentation.sigma2.no/hpc_machines/betzy.html) ```{literalinclude} snippets/betzy/12-sinfo.txt :language: bash ``` ```` ````{tab} FOX ```{literalinclude} snippets/fox/12-sinfo.txt :language: bash ``` ```` ````` There are also specialized machines used for managing disk storage, user authentication, and other infrastructure-related tasks. Although we do not typically log on to or interact with these machines directly, they enable a number of key features like ensuring our user account and files are available throughout the HPC system. ## What's in a node? All the nodes in an HPC system have the same components as your own laptop or desktop: *CPUs* (sometimes also called *processors* or *cores*), *memory* (or *RAM*), and *disk* space. CPUs are a computer's tool for actually running programs and calculations. Information about a current task is stored in the computer's memory. Disk refers to all storage that can be accessed like a file system. This is generally storage that can hold data permanently, i.e. data is still there even if the computer has been restarted. While this storage can be local (a hard drive installed inside it), it is more common for nodes to connect to a shared, remote fileserver or cluster of servers. ![Node anatomy](/images/node-hardware.svg) ![GPU](/images/GPU.png) ## Shared file systems This is an important point to remember: files saved on one node (computer) are often available everywhere on the cluster! ![Shared storage](/images/shared-file-system.svg) ## Compare Your Computer, the Head Node and the Worker Node Compare your laptop's number of processors and memory with the numbers you see on the cluster head node and worker node. Discuss the differences with your neighbor. What implications do you think the differences might have on running your research work on the different systems and nodes? ## Differences Between Nodes Many HPC clusters have a variety of nodes optimized for particular workloads. Some nodes may have larger amount of memory, or specialized resources such as Graphical Processing Units (GPUs). With all of this in mind, we will now cover how to talk to the cluster's scheduler, and use it to start running our scripts and programs!