diff --git a/docs/.pages.yml b/docs/.pages.yml index fa74dbc2a..e67e341c6 100644 --- a/docs/.pages.yml +++ b/docs/.pages.yml @@ -7,3 +7,4 @@ nav: - Storage - Data_Transfer - Service_Subscriptions + - Tutorials diff --git a/docs/Batch_Computing/.pages.yml b/docs/Batch_Computing/.pages.yml index 897d624d1..da8072727 100644 --- a/docs/Batch_Computing/.pages.yml +++ b/docs/Batch_Computing/.pages.yml @@ -1,10 +1,10 @@ nav: - Batch_Computing_Guide.md - - Submitting_your_first_job.md - Hardware.md - Job_prioritisation.md - SLURM-Best_Practice.md - Using_GPUs.md - Job_Checkpointing.md - Fair_Share.md + - Checksums.md - "*" diff --git a/docs/Batch_Computing/Batch_Computing_Guide.md b/docs/Batch_Computing/Batch_Computing_Guide.md index 0e205f791..eae8d1adc 100644 --- a/docs/Batch_Computing/Batch_Computing_Guide.md +++ b/docs/Batch_Computing/Batch_Computing_Guide.md @@ -16,7 +16,8 @@ Depending on the needs of your batch jobs, you may need to specify the partition ## Slurm job basics -Please see [Submitting your first job](Submitting_your_first_job.md) for a detailed tutorial with instructions and examples. +Please see [Submitting your first job](Tutorial:_Submitting_your_first_job.md) for a detailed tutorial with instructions and examples. +We also have a [Slurm reference sheet](../Getting_Started/Cheat_Sheets/Slurm-Reference_Sheet.md). ### Batch scripts diff --git a/docs/Batch_Computing/Submitting_your_first_job.md b/docs/Batch_Computing/Submitting_your_first_job.md deleted file mode 100644 index 1e7a6ec11..000000000 --- a/docs/Batch_Computing/Submitting_your_first_job.md +++ /dev/null @@ -1,141 +0,0 @@ ---- -created_at: '2019-01-07T01:10:28Z' -tags: -- slurm -- scheduler -vote_count: 8 -vote_sum: 8 -zendesk_article_id: 360000684396 -zendesk_section_id: 360000189716 ---- - -## Environment Modules - -Modules are a convenient way to provide access to applications on the cluster. They prepare the environment you need to run an application. - -For a full list of module commands run `man module`. - -| Command | Description | -| ---------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `module spider [ ]` | List all modules whose names, including version strings, contain ``. If the `` argument is not supplied, list all available modules. | -| `module show ` | Show the contents of the module given by ``. If only the module name (e.g. `Python`) is given, show the default module of that name. If both name and version are given, show that particular version module. | -| `module load ` | Load the module (name and version) given by ``. If no version is given, load the default version. | -| `module list [ ]` | List all currently loaded modules whose names, including version strings, contain ``. If the `` argument is not supplied, list all currently loaded modules. | - -## Slurm - -Jobs on the HPC are submitted in the form of a *batch script* containing the code you want to run and a header of information needed by our job scheduler *Slurm*. - -## Creating a batch script - -Create a new file and open it with `nano myjob.sl` - -```sl -#!/bin/bash -e - -#SBATCH --job-name=SerialJob # job name (shows up in the queue) -#SBATCH --time=00:01:00 # Walltime (HH:MM:SS) -#SBATCH --mem=512MB # Memory in MB -#SBATCH --qos=debug # debug QOS for high priority job tests - -pwd # Prints working directory -``` - -Copy in the above text and save and exit the text editor with 'ctrl + x'. - -Note: `#!/bin/bash` is expected by Slurm. - -Note: if you are a member of multiple accounts you should add the line - -```sl -#SBATCH --account= -``` - -## Testing - -We recommend testing your job using the debug Quality of Service (QOS). -The debug QOS can be gained by adding the `sbatch` command line option `--qos=debug`. -This adds 5000 to the job priority so raises it above all non-debug jobs, but is limited to one small job per user at a time: no more than 15 minutes and no more than 2 nodes. - -!!! warning - Please do not run your code on the login node. - Any processes running on the login node for long periods of time or using large numbers of CPUs will be terminated. - -## Submitting - -Jobs are submitted to the scheduler using: - -```bash -sbatch myjob.sl -``` - -You should receive an output - -Submitted batch job 1748836 - -`sbatch` can take command line arguments similar to those used in the shell script through SBATCH pragmas - -You can find more details on its use on the [Slurm Documentation](https://slurm.schedmd.com/archive/{{config.extra.slurm}}/sbatch.html) - -## Job Queue - -The currently queued jobs can be checked using - -```bash -squeue -``` - -You can filter to just your jobs by adding the flag - -```bash -squeue -u usr9999 -``` - -You can also filter to just your jobs using - -```bash -squeue --me -``` - -You can find more details on its use on the [Slurm Documentation](https://slurm.schedmd.com/archive/{{config.extra.slurm}}/squeue.html). - -You can check all jobs submitted by you in the past day using: - -```bash -sacct -``` - -Or since a specified date using: - -```bash -sacct -S YYYY-MM-DD -``` - -Each job will show as multiple lines, one line for the parent job and then additional lines for each job step. - -!!! tip - - `sacct -X` Only show parent processes. - - `sacct --state=PENDING/RUNNING/FAILED/CANCELLED/TIMEOUT` Filter jobs by state. - -You can find more details on its use on the [Slurm Documentation](https://slurm.schedmd.com/archive/{{config.extra.slurm}}/sacct.html). - -## Cancelling - -`scancel ` will cancel the job described by ``. -You can obtain the job ID by using `sacct` or `squeue`. - -!!! tip - - `scancel -u [username]` Kill all jobs submitted by you. - - `scancel {[n1]..[n2]}` Kill all jobs with an id between `[n1]` and `[n2]`. - -You can find more details on its use on the [Slurm Documentation](https://slurm.schedmd.com/archive/{{config.extra.slurm}}/scancel.html). - -## Job Output - -When the job completes, or in some cases earlier, two files will be -added to the directory in which you were working when you submitted the -job: - -`slurm-[jobid].out` containing standard output. - -`slurm-[jobid].err` containing standard error. diff --git a/docs/Batch_Computing/Using_GPUs.md b/docs/Batch_Computing/Using_GPUs.md index 66b1768a9..76ddc94a1 100644 --- a/docs/Batch_Computing/Using_GPUs.md +++ b/docs/Batch_Computing/Using_GPUs.md @@ -18,7 +18,7 @@ This page provides generic information about how to access GPUs through the Slur ## Request GPU resources using Slurm -To request a GPU for your [Slurm job](Submitting_your_first_job.md), add +To request a GPU for your [Slurm job](Tutorial:_Submitting_your_first_job.md), add the following option in the header of your submission script: ```sl diff --git a/docs/Getting_Started/Accessing_the_HPCs/VSCode.md b/docs/Getting_Started/Accessing_the_HPCs/VSCode.md index b35fc7729..afc9139c0 100644 --- a/docs/Getting_Started/Accessing_the_HPCs/VSCode.md +++ b/docs/Getting_Started/Accessing_the_HPCs/VSCode.md @@ -83,7 +83,7 @@ Clicking on these will open a connection to that machine, you will then be promp You may find that VSCode is not utilising your preferred versions of software (e.g. when debugging or linting your Python code). -As the NeSI cluster utilises [Environment Modules](../../Batch_Computing/Submitting_your_first_job.md#environment-modules), changing the executable used is not just a matter of changing the path in VSCode configuration, as the libraries required will not be loaded. +As the NeSI cluster utilises [Environment Modules](../../Tutorials/Introduction_To_HPC/Submitting_Your_First_Job.md#environment-modules), changing the executable used is not just a matter of changing the path in VSCode configuration, as the libraries required will not be loaded. The only way to make sure that VSCode has access to a suitable environment, is to load the required modules in your `~/.bashrc` diff --git a/docs/Getting_Started/Cheat_Sheets/Slurm-Reference_Sheet.md b/docs/Getting_Started/Cheat_Sheets/Slurm-Reference_Sheet.md index 39cc74362..5234418f4 100644 --- a/docs/Getting_Started/Cheat_Sheets/Slurm-Reference_Sheet.md +++ b/docs/Getting_Started/Cheat_Sheets/Slurm-Reference_Sheet.md @@ -8,7 +8,7 @@ description: Quick list of the most commonly used Slurm commands, flags, and env --- If you are unsure about using our job scheduler Slurm, more details can -be found on [Submitting_your_first_job](../../Batch_Computing/Submitting_your_first_job.md). +be found on [Batch Computing Guide](../../Batch_Computing/Batch_Computing_Guide.md) and we have a self-paced tutorial on [Submitting your first job](../../Tutorials/Introduction_To_HPC/Submitting_Your_First_Job.md). ## Slurm Commands diff --git a/docs/Interactive_Computing/OnDemand/Apps/JupyterLab/index.md b/docs/Interactive_Computing/OnDemand/Apps/JupyterLab/index.md index f2052402e..8a8adcbbf 100644 --- a/docs/Interactive_Computing/OnDemand/Apps/JupyterLab/index.md +++ b/docs/Interactive_Computing/OnDemand/Apps/JupyterLab/index.md @@ -8,7 +8,7 @@ Jupyter allows you to create notebooks that contain live code, equations, visualisations and explanatory text. There are many uses for Jupyter, including data cleaning, analytics and visualisation, machine learning, numerical simulation, managing -[Slurm job submissions](../../../../Batch_Computing/Submitting_your_first_job.md) +[Slurm job submissions](../../../../Tutorials/Introduction_To_HPC/Submitting_Your_First_Job.md) and workflows and much more. ## Accessing Jupyter on NeSI diff --git a/docs/Tutorials/Introduction_To_HPC/.pages.yml b/docs/Tutorials/Introduction_To_HPC/.pages.yml new file mode 100644 index 000000000..924afebed --- /dev/null +++ b/docs/Tutorials/Introduction_To_HPC/.pages.yml @@ -0,0 +1,9 @@ +--- +nav: + - What is a_HPC_cluster + - Bash_Shell + - Environment_And_Modules + - Submitting_Your_First_Job + - Resources + - Scaling + - "*" diff --git a/docs/Tutorials/Introduction_To_HPC/Bash_Shell.md b/docs/Tutorials/Introduction_To_HPC/Bash_Shell.md new file mode 100644 index 000000000..6e1666f8b --- /dev/null +++ b/docs/Tutorials/Introduction_To_HPC/Bash_Shell.md @@ -0,0 +1,836 @@ +--- +created_at: 2026-01-15 +description: Using the bash shell for file operations on NeSI +status: tutorial +--- + + +!!! objectives + + - "Create, edit, manipulate and remove files from command line" + - "Translate an absolute path into a relative path and vice versa." + - "Use options and arguments to change the behaviour of a shell command." + - "Demonstrate the use of tab completion and explain its advantages." + +!!! info The Unix Shell + + This episode will be a quick introduction to the Unix shell, only the bare minimum required to use the cluster. + The Software Carpentry '[Unix Shell](https://swcarpentry.github.io/shell-novice/)' lesson covers the subject in more depth, we recommend you check it out. + +{% set working_dir = ['nesi', 'nobackup', 'example'] %} +{% set projectcode = "nesi99991" %} +{% set example_script = "sum_array.r" %} + +The part of the operating system responsible for managing files and directories +is called the **file system**. +It organizes our data into files, +which hold information, +and directories (also called 'folders'), +which hold files or other directories. + +Understanding how to navigate the file system using command line is essential for using an HPC. + +The NeSI filesystem looks something like this: + +![The file system is made up of a root directory that contains sub-directories +titled home, nesi, and system files](../../Getting_Started/Getting_Help/Training/fig/NesiFiletree.svg) + +The directories that are relevant to us are. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
LocationDefault StorageDefault FilesBackupAccess Speed
Home is for user-specific files such as configuration files, environment setup, source code, etc./home/<username>20GB1,000,000DailyNormal
Project is for persistent project-related data, project-related software, etc./nesi/project/<projectcode>100GB100,000DailyNormal
Nobackup is a 'scratch space', for data you don't need to keep long term. Old data is periodically deleted from nobackup/nesi/nobackup/<projectcode>10TB1,000,000NoneFast
+ +### Managing your data and storage (backups and quotas) + +NeSI performs backups of the `/home` and `/nesi/project` (persistent) filesystems. However, backups are only captured once per day. So, if you edit or change code or data and then immediately delete it, it likely cannot be recovered. Note, as the name suggests, NeSI does **not** backup the `/nesi/nobackup` filesystem. + +Protecting critical data from corruption or deletion is primarily your +responsibility. Ensure you have a data management plan and stick to the plan to reduce the chance of data loss. Also important is managing your storage quota. To check your quotas, use the `nn_storage_quota` command, eg + +```out +Quota_Location AvailableGiB UsedGiB Use% +project_nesi99991 800 496 62 +nobackup_nesi99991 30720 16189 53 +home_cwal219 20 13 65 +``` + +As well as disk space, 'inodes' are also tracked, this is the *number* of files. + +Notice that the project space for this user is over quota and has been locked, meaning no more data can be added. When your space is locked you will need to move or remove data. Also note that none of the nobackup space is being used. Likely data from project can be moved to nobackup. `nn_storage_quota` uses cached data, and so will no immediately show changes to storage use. + +For more details on our persistent and nobackup storage systems, including data retention and the nobackup autodelete schedule, +please see our [Filesystem and Quota](https://docs.nesi.org.nz/Storage/File_Systems_and_Quotas/NeSI_File_Systems_and_Quotas/) documentation. + + +Directories are like *places* — at any time +while we are using the shell, we are in exactly one place called +our **current working directory**. +Commands mostly read and write files in the +current working directory, i.e. 'here', so knowing where you are before running +a command is important. + +First, let's find out where we are by running the command `pwd` for '**p**rint **w**orking **d**irectory'. + +```sh + pwd +``` + +```out +/home/ +``` + +The output we see is what is known as a 'path'. +The path can be thought of as a series of directions given to navigate the file system. + +At the top is the **root directory** +that holds all the files in a filesystem. + +We refer to it using a slash character, `/`, on its own. +This is what the leading slash in `/home/` is referring to, it is telling us our path starts at the root directory. + +Next is `home`, as it is the next part of the path we know it is inside the root directory, +we also know that home is another directory as the path continues. +Finally, stored inside `home` is the directory with your username. + +!!! note Slashes + Notice that there are two meanings for the `/` character. + When it appears at the front of a file or directory name, + it refers to the root directory. When it appears *inside* a path, + it's just a separator. + +As you may now see, using a bash shell is strongly dependent on the idea that +your files are organized in a hierarchical file system. +Organizing things hierarchically in this way helps us keep track of our work: +it's possible to put hundreds of files in our home directory, +just as it's possible to pile hundreds of printed papers on our desk, +but it's a self-defeating strategy. + +## Listing the contents of directories + +To **l**i**s**t the contents of a directory, we use the command `ls` followed by the path to the directory whose contents we want listed. + +We will now list the contents of the directory we we will be working from. We can +use the following command to do this: + +```sh + ls {{ working_dir[0] }} +``` + +```out +{{ working_dir[1] }} +``` + +You should see a directory called `{{ working_dir[1] }}`, and possibly several other directories. +For the purposes of this workshop you will be working within `{{ working_dir|join('/') }}`. + +!!! tip "Command History" + You can cycle through your previous commands with the and keys. + A convenient way to repeat your last command is to type then enter. + +??? question "`ls` Reading Comprehension" + What command would you type to get the following output + + ```out + original pnas_final pnas_sub + ``` + + ![](../../Getting_Started/Getting_Help/Training/fig/filesystem-challenge.svg) + + 1. `ls pwd` + 2. `ls backup` + 3. `ls /Users/backup` + 4. `ls /backup` + + ??? Solution + 1. No: `pwd` is not the name of a directory. + 2. Possibly: It depends on your current directory (we will explore this more shortly). + 3. Yes: uses the absolute path explicitly. + 4. No: There is no such directory. + +## Moving about + +Currently we are still in our home directory, we want to move into the`project` directory from the previous command. + +The command to **c**hange **d**irectory is `cd` followed by the path to the directory we want to move to. + +The `cd` command is akin to double clicking a folder in a graphical interface. + +We will use the following command: + +```sh + cd {{ working_dir|join('/') }} +``` + +```out + +``` + +You will notice that `cd` doesn't print anything. This is normal. Many shell commands will not output anything to the screen when successfully executed. +We can check we are in the right place by running `pwd`. + +```sh + pwd +``` + + +```out +{{ working_dir|join('/') }} +``` + + +## Creating directories + + + +As previously mentioned, it is general useful to organise your work in a hierarchical file structure to make managing and finding files easier. It is also is especially important when working within a shared directory with colleagues, such as a project, to minimise the chance of accidentally affecting your colleagues work. So for this workshop you will each make a directory using the `mkdir` command within the workshops directory for you to personally work from. + +```sh + mkdir +``` + + +You should then be able to see your new directory is there using `ls`. + +```sh + ls {{ working_dir|join('/') }} +``` + +```sh + {{ example_script }} usr123 usr345 +``` + +## General Syntax of a Shell Command + +We are now going to use `ls` again but with a twist, this time we will also use what are known as **options**, **flags** or **switches**. +These options modify the way that the command works, for this example we will add the flag `-l` for "long listing format". + +```sh + ls -l {{ working_dir|join('/') }} +``` + +{: .language-bash} + +```out +-rw-r-----+ 1 usr9999 {{projectcode}} 460 Nov 18 17:03 +-rw-r-----+ 1 usr9999 {{projectcode}} 460 Nov 18 17:03 {{ example_script }} +drwxr-sr-x+ 3 usr9999 {{projectcode}} 4096 22 Sep 08:40 birds +drwxrws---+ 2 usr123 {{projectcode}} 4096 Nov 15 09:01 usr123 +drwxrws---+ 2 usr345 {{projectcode}} 4096 Nov 15 09:01 usr345 +``` + +We can see that the `-l` option has modified the command and now our output has listed all the files in alphanumeric order, which can make finding a specific file easier. +It also includes information about the file size, time of its last modification, and permission and ownership information. + +Most Unix commands follow this basic structure. +![Structure of a Unix command](../../Getting_Started/Getting_Help/Training/fig/Unix_Command_Struc.svg) + +The **prompt** tells us that the terminal is accepting inputs, prompts can be customised to show all sorts of info. + +The **command**, what are we trying to do. + +**Options** will modify the behavior of the command, multiple options can be specified. +Options will either start with a single dash (`-`) or two dashes (`--`).. +Often options will have a short and long format e.g. `-a` and `--all`. + +**Arguments** tell the command what to operate on (usually files and directories). + +Each part is separated by spaces: if you omit the space +between `ls` and `-l` the shell will look for a command called `ls-l`, which +doesn't exist. Also, capitalization can be important. +For example, `ls -s` will display the size of files and directories alongside the names, +while `ls -S` will sort the files and directories by size. + +Another useful option for `ls` is the `-a` option, lets try using this option together with the `-l` option: + +```sh + ls -la +``` + + +```out +drwxrws---+ 4 usr001 {{projectcode}} 4096 Nov 15 09:00 . +drwxrws---+ 12 root {{projectcode}} 262144 Nov 15 09:23 .. +-rw-r-----+ 1 cwal219 {{projectcode}} 460 Nov 18 17:03 {{ example_script }} +drwxrws---+ 2 usr123 {{projectcode}} 4096 Nov 15 09:01 usr123 +drwxrws---+ 2 usr345 {{projectcode}} 4096 Nov 15 09:01 usr345 +``` + +Single letter options don't usually need to be separate. In this case `ls -la` is performing the same function as if we had typed `ls -l -a`. + +You might notice that we now have two extra lines for directories `.` and `..`. These are hidden directories which the `-a` option has been used to reveal, you can make any file or directory hidden by beginning their filenames with a `.`. + +These two specific hidden directories are special as they will exist hidden inside every directory, with the `.` hidden directory representing your current directory and the `..` hidden directory representing the **parent** directory above your current directory. + + ??? question "Exploring More `ls` Flags" + + You can also use two options at the same time. What does the command `ls` do when used + with the `-l` option? What about if you use both the `-l` and the `-h` option? + + Some of its output is about properties that we do not cover in this lesson (such + as file permissions and ownership), but the rest should be useful + nevertheless. + + ??? question Solution + + The `-l` option makes `ls` use a **l**ong listing format, showing not only + the file/directory names but also additional information, such as the file size + and the time of its last modification. If you use both the `-h` option and the `-l` option, + this makes the file size '**h**uman readable', i.e. displaying something like `5.3K` + instead of `5369`. + +## Relative paths + +You may have noticed in the last command we did not specify an argument for the directory path. +Until now, when specifying directory names, or even a directory path (as above), +we have been using what are known as **absolute paths**, which work no matter where you are currently located on the machine +since it specifies the full path from the top level root directory. + +An **absolute path** always starts at the root directory, which is indicated by a +leading slash. The leading `/` tells the computer to follow the path from +the root of the file system, so it always refers to exactly one directory, +no matter where we are when we run the command. + +Any path without a leading `/` is a **relative path**. + +When you use a relative path with a command +like `ls` or `cd`, it tries to find that location starting from where we are, +rather than from the root of the file system. + +In the previous command, since we did not specify an **absolute path** it ran the command on the relative path from our current directory +(implicitly using the `.` hidden directory), and so listed the contents of our current directory. + +We will now navigate to the parent directory, the simplest way do this is to use the relative path `..`. + +```sh + cd .. +``` + +We should now be back in `{{ working_dir[0] }}`. + +```sh + pwd +``` + + +```out +{{ working_dir[0] }} +``` + + +## Tab completion + + Sometimes file paths and file names can be very long, making typing out the path tedious. + One trick you can use to save yourself time is to use something called **tab completion**. + If you start typing the path in a command and there is only one possible match, + if you hit tab the path will autocomplete (until there are more than one possible matches). + +For example, if you type: + +```sh + cd {{ working_dir|last|slice(0,3) }} +``` + +and then press Tab (the tab key on your keyboard), +the shell automatically completes the directory name for you (since there is only one possible match): + +```sh + cd {{ working_dir|last }}/ +``` + + However, you want to move to your personal working directory. If you hit Tab once you will + likely see nothing change, as there are more than one possible options. Hitting Tab + a second time will print all possible autocomplete options. + +```out +cwal219/ riom/ harrellw/ +``` + +Now entering in the first few characters of the path (just enough that the possible options are no longer ambiguous) and pressing Tab again, should complete the path. + + Now press Enter to execute the command. + +```sh + cd {{ working_dir|last }}/ +``` + +Check that we've moved to the right place by running `pwd`. + +```out +{{ working_dir|join('/') }}/ +``` + + !!! tip "Two More Shortcuts" + + The shell interprets a tilde (`~`) character at the start of a path to + mean "the current user's home directory". For example, if Nelle's home + directory is `/home/nelle`, then `~/data` is equivalent to + `/home/nelle/data`. This only works if it is the first character in the + path: `here/there/~/elsewhere` is *not* `here/there//home/nelle/elsewhere`. + + Another shortcut is the `-` (dash) character. `cd` will translate `-` into + *the previous directory I was in*, which is faster than having to remember, + then type, the full path. This is a *very* efficient way of moving + *back and forth between two directories* -- i.e. if you execute `cd -` twice, + you end up back in the starting directory. + + The difference between `cd ..` and `cd -` is + that the former brings you *up*, while the latter brings you *back*. + + ??? question "Absolute vs Relative Paths" + + Starting from `/home/amanda/data`, + which of the following commands could Amanda use to navigate to her home directory, + which is `/home/amanda`? + + 1. `cd .` + 2. `cd /` + 3. `cd home/amanda` + 4. `cd ../..` + 5. `cd ~` + 6. `cd home` + 7. `cd ~/data/..` + 8. `cd` + 9. `cd ..` + + ## Solution + + 1. No: `.` stands for the current directory. + 2. No: `/` stands for the root directory. + 3. No: Amanda's home directory is `/home/amanda`. + 4. No: this command goes up two levels, i.e. ends in `/home`. + 5. Yes: `~` stands for the user's home directory, in this case `/home/amanda`. + 6. No: this command would navigate into a directory `home` in the current directory if it exists. + 7. Yes: unnecessarily complicated, but correct. + 8. Yes: shortcut to go back to the user's home directory. + 9. Yes: goes up one level. + {: .solution} +{: .challenge} + +!!! question "Relative Path Resolution" + + Using the filesystem diagram below, if `pwd` displays `/Users/thing`, + what will `ls ../backup` display? + + 1. `../backup: No such file or directory` + 2. `2012-12-01 2013-01-08 2013-01-27` + 3. `original pnas_final pnas_sub` + + ![](../../Getting_Started/Getting_Help/Training/fig/filesystem-challenge.svg) + + ??? question Solution + 1. No: there *is* a directory `backup` in `/Users`. + 2. No: this is the content of `Users/thing/backup`, + but with `..`, we asked for one level further up. + 3. Yes: `../backup/` refers to `/Users/backup/`. + +!!! tip "Clearing your terminal" + + If your screen gets too cluttered, you can clear your terminal using the + `clear` command. You can still access previous commands using + and to move line-by-line, or by scrolling in your terminal. + +!!! question "Listing in Reverse Chronological Order" + + By default, `ls` lists the contents of a directory in alphabetical + order by name. The command `ls -t` lists items by time of last + change instead of alphabetically. The command `ls -r` lists the + contents of a directory in reverse order. + Which file is displayed last when you combine the `-t` and `-r` flags? + Hint: You may need to use the `-l` flag to see the + last changed dates. + + ??? question "Solution" + + The most recently changed file is listed last when using `-rt`. This + can be very useful for finding your most recent edits or checking to + see if a new output file was written. + + ??? question "Globbing" + + One of the most powerful features of bash is *filename expansion*, otherwise known as *globbing*. + This allows you to use *patterns* to match a file name (or multiple files), + which will then be operated on as if you had typed out all of the matches. + + `*` is a **wildcard**, which matches zero or more characters. + + Inside the `{{ working_dir|join('/') }}` directory there is a directory called `birds` + + ```sh + cd {{ working_dir|join('/') }}/birds + ls + ``` + + ```out + kaka.txt kakapo.jpeg kea.txt kiwi.jpeg pukeko.jpeg + ``` + + In this example there aren't many files, but it is easy to imagine a situation where you have hundreds or thousads of files you need to filter through, and globbing is the perfect tool for this. Using the wildcard character the command + + ```sh + ls ka* + ``` + + Will return: + + ```out + kaka.txt kakapo.jpeg + ``` + + Since the pattern `ka*` will match `kaka.txt`and `kakapo.jpeg` as these both start with "ka". While the command: + + ```sh + ls *.jpeg + ``` + + Will return: + + ```out + kakapo.jpeg kiwi.jpeg pukeko.jpeg + ``` + + As `*.jpeg` will match `kakapo.jpeg`, `kiwi.jpeg` and `pukeko.jpeg` as they all end in `.jpeg` + You can use multiple wildcards as well with the command: + + ```sh + ls k*a.* + ``` + + Returning: + + ```out + kaka.txt kea.txt + ``` + + As `k*a.*` will match just `kaka.txt` and `kea.txt` + + `?` is also a wildcard, but it matches exactly one character. So the command: + + ```sh + ls ????.* + ``` + + Would return: + + ```out + kaka.txt kiwi.jpeg + ``` + + As `kaka.txt` and `kiwi.jpeg` the only files which have four characters, followed by a `.` then any number and combination of characters. + + When the shell sees a wildcard, it expands the wildcard to create a + list of matching filenames *before* running the command that was + asked for. As an exception, if a wildcard expression does not match + any file, Bash will pass the expression as an argument to the command + as it is. + However, generally commands like `wc` and `ls` see the lists of + file names matching these expressions, but not the wildcards + themselves. It is the shell, not the other programs, that deals with + expanding wildcards. + + +??? question "List filenames matching a pattern" + + Running `ls` in a directory gives the output + `cubane.pdb ethane.pdb methane.pdb octane.pdb pentane.pdb propane.pdb` + + Which `ls` command(s) will + produce this output? + + `ethane.pdb methane.pdb` + + 1. `ls *t*ane.pdb` + 2. `ls *t?ne.*` + 3. `ls *t??ne.pdb` + 4. `ls ethane.*` + + ??? question Solution + The solution is `3.` + `1.` shows all files whose names contain zero or more characters (`*`) + followed by the letter `t`, + then zero or more characters (`*`) followed by `ane.pdb`. + This gives `ethane.pdb methane.pdb octane.pdb pentane.pdb`. + `2.` shows all files whose names start with zero or more characters (`*`) followed by + the letter `t`, + then a single character (`?`), then `ne.` followed by zero or more characters (`*`). + This will give us `octane.pdb` and `pentane.pdb` but doesn't match anything + which ends in `thane.pdb`. + `3.` fixes the problems of option 2 by matching two characters (`??`) between `t` and `ne`. + This is the solution. + `4.` only shows files starting with `ethane.`. + +include in terminal excersise (delete slurm files later on maybe?) + +## Create a text file + +Now let's create a file. To do this we will use a text editor called Nano to create a file called `draft.txt`: + +```sh + nano draft.txt +``` + +??? note "Which Editor?" + + When we say, '`nano` is a text editor' we really do mean 'text': it can + only work with plain character data, not tables, images, or any other + human-friendly media. We use it in examples because it is one of the + least complex text editors. However, because of this trait, it may + not be powerful enough or flexible enough for the work you need to do + after this workshop. On Unix systems (such as Linux and macOS), + many programmers use [Emacs](http://www.gnu.org/software/emacs/) or + [Vim](http://www.vim.org/) (both of which require more time to learn), + or a graphical editor such as + [Gedit](http://projects.gnome.org/gedit/). On Windows, you may wish to + use [Notepad++](http://notepad-plus-plus.org/). Windows also has a built-in + editor called `notepad` that can be run from the command line in the same + way as `nano` for the purposes of this lesson. + + No matter what editor you use, you will need to know where it searches + for and saves files. If you start it from the shell, it will (probably) + use your current working directory as its default location. If you use + your computer's start menu, it may want to save files in your desktop or + documents directory instead. You can change this by navigating to + another directory the first time you 'Save As...' + +Let's type in a few lines of text. +Once we're happy with our text, we can press Ctrl+O +(press the Ctrl or Control key and, while +holding it down, press the O key) to write our data to disk +(we'll be asked what file we want to save this to: +press Return to accept the suggested default of `draft.txt`). + +
screenshot of nano text editor in action
+ +Once our file is saved, we can use Ctrl+X to quit the editor and +return to the shell. + +??? tip "Control, Ctrl, or ^ Key" + + The Control key is also called the 'Ctrl' key. There are various ways + in which using the Control key may be described. For example, you may + see an instruction to press the Control key and, while holding it down, + press the X key, described as any of: + + * `Control-X` + * `Control+X` + * `Ctrl-X` + * `Ctrl+X` + * `^X` + * `C-x` + + In nano, along the bottom of the screen you'll see `^G Get Help ^O WriteOut`. + This means that you can use `Control-G` to get help and `Control-O` to save your + file. + +`nano` doesn't leave any output on the screen after it exits, +but `ls` now shows that we have created a file called `draft.txt`: + +```sh + ls +``` + +```out +draft.txt +``` + +## Copying files and directories + +In a future lesson, we will be running the R script ```{{ working_dir|join('/') }}/{{ example_script }}```, but as we can't all work on the same file at once you will need to take your own copy. This can be done with the **c**o**p**y command `cp`, at least two arguments are needed the file (or directory) you want to copy, and the directory (or file) where you want the copy to be created. We will be copying the file into the directory we made previously, as this should be your current directory the second argument can be a simple `.`. + +```sh + cp {{ working_dir|join('/') }}/{{ example_script }} . +``` + +We can check that it did the right thing using `ls` + +```sh + ls +``` + +```out +draft.txt {{ example_script }} +``` + +## Other File operations + +`cat` stands for concatenate, meaning to link or merge things together. It is primarily used for printing the contents of one or more files to the standard output. +`head` and `tail` will print the first or last lines (head or tail) of the specified file(s). By default it will print 10 lines, but a specific number of lines can be specified with the `-n` option. +`mv` to **m**o**v**e move a file, is used similarly to `cp` taking a source argument(s) and a destination argument. +`rm` will **r**e**m**ove move a file and only needs one argument. + +The `mv` command is also used to rename a file, for example `mv my_fiel my_file`. This is because as far as the computer is concerned *moving and renaming a file are the same operation*. + +In order to `cp` a directory (and all its contents) the `-r` for [recursive](https://en.wikipedia.org/wiki/Recursion) option must be used. +The same is true when deleting directories with `rm` + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
commandnameusage
cpcopycp file1 file2
cp -r directory1/ directory2/
mvmovemv file1 file2
mv directory1/ directory2/
rmremoverm file1 file2
rm -r directory1/ directory2/
+ +For `mv` and `cp` if the destination path (final argument) is an existing directory the file will be placed inside that directory with the same name as the source. + +!!! question "Moving vs Copying" + + When using the `cp` or `rm` commands on a directory the 'recursive' flag `-r` must be used, but `mv` *does not* require it? + + ??? note Solution + + We mentioned previously that as far the computer is concerned, *renaming* is the same operation as *moving*. + Contrary to what the commands name implies, *all moving is actually renaming*. + The data on the hard drive stays in the same place, + only the label applied to that block of memory is changed. + To copy a directory, each *individual file* inside that directory must be read, and then written to the copy destination. + To delete a directory, each *individual file* in the directory must be marked for deletion, + however when moving a directory the files inside are the data inside the directory is not interacted with, + only the parent directory is "renamed" to a different place. + + This is also why `mv` is faster than `cp` as no reading of the files is required. + +## Unsupported command-line options + +If you try to use an option (flag) that is not supported, `ls` and other commands +will usually print an error message similar to: + +```sh +ls -j +``` + +```out +ls: invalid option -- 'j' +Try 'ls --help' for more information. +``` + +## Getting help + +Commands will often have many **options**. Most commands have a `--help` flag, as can be seen in the error above. You can also use the manual pages (aka manpages) by using the `man` command. The manual page provides you with all the available options and their use in more detail. For example, for thr `ls` command: + +```sh + man ls +``` + +```out +Usage: ls [OPTION]... [FILE]... +List information about the FILEs (the current directory by default). +Sort entries alphabetically if neither -cftuvSUX nor --sort is specified. + +Mandatory arguments to long options are mandatory for short options, too. + -a, --all do not ignore entries starting with . + -A, --almost-all do not list implied . and .. + --author with -l, print the author of each file + -b, --escape print C-style escapes for nongraphic characters + --block-size=SIZE scale sizes by SIZE before printing them; e.g., + '--block-size=M' prints sizes in units of + 1,048,576 bytes; see SIZE format below + -B, --ignore-backups do not list implied entries ending with ~ + -c with -lt: sort by, and show, ctime (time of last + modification of file status information); + with -l: show ctime and sort by name; + otherwise: sort by ctime, newest first + -C list entries by columns + --color[=WHEN] colorize the output; WHEN can be 'always' (default + if omitted), 'auto', or 'never'; more info below + -d, --directory list directories themselves, not their contents + -D, --dired generate output designed for Emacs' dired mode + -f do not sort, enable -aU, disable -ls --color + -F, --classify append indicator (one of */=>@|) to entries +...       ...       ... +``` + +To navigate through the `man` pages, +you may use and to move line-by-line, +or try B and Spacebar to skip up and down by a full page. +To search for a character or word in the `man` pages, +use / followed by the character or word you are searching for. +Sometimes a search will result in multiple hits. If so, you can move between hits using N (for moving forward) and Shift+N (for moving backward). + +To **quit** the `man` pages, press Q. + +!!! info "Manual pages on the web" + Of course, there is a third way to access help for commands: + searching the internet via your web browser. + When using internet search, including the phrase `unix man page` in your search + query will help to find relevant results. + GNU provides links to its + [manuals](http://www.gnu.org/manual/manual.html) including the + [core GNU utilities](http://www.gnu.org/software/coreutils/manual/coreutils.html), + which covers many commands introduced within this lesson. + + +!!! keypoints + - "The file system is responsible for managing information on the disk." + - "Information is stored in files, which are stored in directories (folders)." + - "Directories can also store other directories, which then form a directory tree." + - "`cd [path]` changes the current working directory." + - "`ls [path]` prints a listing of a specific file or directory; `ls` on its own lists the current working directory." + - "`pwd` prints the user's current working directory." + - "`cp [file] [path]` copies [file] to [path]" + - "`mv [file] [path]` moves [file] to [path]" + - "`rm [file]` deletes [file]" + - "`/` on its own is the root directory of the whole file system." + - "Most commands take options (flags) that begin with a `-`." + - "A relative path specifies a location starting from the current location." + - "An absolute path specifies a location from the root of the file system." + - "Directory names in a path are separated with `/` on Unix, but `\\` on Windows." + - "`..` means 'the directory above the current one'; `.` on its own means 'the current directory'." diff --git a/docs/Tutorials/Introduction_To_HPC/Environment_And_Modules.md b/docs/Tutorials/Introduction_To_HPC/Environment_And_Modules.md new file mode 100644 index 000000000..7b1e4002a --- /dev/null +++ b/docs/Tutorials/Introduction_To_HPC/Environment_And_Modules.md @@ -0,0 +1,474 @@ +--- +created_at: 2026-01-13 +title: "Environment & Modules" +description: How do we load and unload software packages? +tags: + - software +status: tutorial +--- + + +!!! time "Time: 20 Minutes" + +!!! prerequisite + - Page Link + +!!! objectives + - "Load and use a software package." + - "Explain how the shell environment changes when the module mechanism loads or unloads packages." + +On a high-performance computing system, it is seldom the case that the software +we want to use is available when we log in. It is installed, but we will need +to "load" it before it can run. + +Before we start using individual software packages, however, we should +understand the reasoning behind this approach. The three biggest factors are: + +- software incompatibilities +- versioning +- dependencies + +Software incompatibility is a major headache for programmers. Sometimes the +presence (or absence) of a software package will break others that depend on +it. Two of the most famous examples are Python 2 and 3 and C compiler versions. +Python 3 famously provides a `python` command that conflicts with that provided +by Python 2. Software compiled against a newer version of the C libraries and +then used when they are not present will result in a nasty `'GLIBCXX_3.4.20' +not found` error, for instance. + + + +Software versioning is another common issue. A team might depend on a certain +package version for their research project - if the software version was to +change (for instance, if a package was updated), it might affect their results. +Having access to multiple software versions allows a set of researchers to +prevent software versioning issues from affecting their results. + +Dependencies are where a particular software package (or even a particular +version) depends on having access to another software package (or even a +particular version of another software package). For example, the VASP +materials science software may depend on having a particular version of the +FFTW (Fastest Fourier Transform in the West) software library available for it +to work. + +## Environment + +Before understanding environment modules we first need to understand what is meant by _environment_. + +The environment is defined by it's _environment variables_. + +_Environment Variables_ are writable named-variables. + +We can assign a variable named "FOO" with the value "bar" using the syntax. + +```sh +FOO="bar" +``` + +Convention is to name fixed variables in all caps. + +Our new variable can be referenced using `$FOO`, you could also use `${FOO}`, +enclosing a variable in curly brackets is good practice as it avoids possible ambiguity. + +```sh +$FOO +``` + +```out +-bash: bar: command not found +``` + +We got an error here because the variable is evaluated _in the terminal_ then executed. +If we just want to print the variable we can use the command, + +```sh +echo $FOO +``` + +```out +bar +``` + +We can get a full list of environment variables using the command, + +```sh +env +``` + +```out +[removed some lines for clarity] +EBROOTTCL=/opt/nesi/CS400_centos7_bdw/Tcl/8.6.10-GCCcore-9.2.0 +CPUARCH_STRING=bdw +TERM=xterm-256color +SHELL=/bin/bash +EBROOTGCCCORE=/opt/nesi/CS400_centos7_bdw/GCCcore/9.2.0 +EBDEVELFREETYPE=/opt/nesi/CS400_centos7_bdw/freetype/2.10.1-GCCcore-9.2.0/easybuild/freetype-2.10.1-GCCcore-9.2.0-easybuild-devel +HISTSIZE=10000 +XALT_EXECUTABLE_TRACKING=yes +MODULEPATH_ROOT=/usr/share/modulefiles +LMOD_SYSTEM_DEFAULT_MODULES=NeSI +SSH_CLIENT=192.168.94.65 45946 22 +EBDEVELMETIS=/opt/nesi/CS400_centos7_bdw/METIS/5.1.0-GCCcore-9.2.0/easybuild/METIS-5.1.0-GCCcore-9.2.0-easybuild-devel +LMOD_PACKAGE_PATH=/opt/nesi/share/etc/lmod +``` + +These variables control many aspects of how your terminal, and any software launched from your terminal works. + +## Environment Modules + +Environment modules are the solution to these problems. A _module_ is a +self-contained description of a software package -- it contains the +settings required to run a software package and, usually, encodes required +dependencies on other software packages. + +There are a number of environment module implementations commonly +used on HPC systems: the two most common are _TCL modules_ and _Lmod_. Both of +these use similar syntax and the concepts are the same so learning to use one +will allow you to use whichever is installed on the system you are using. In +both implementations the `module` command is used to interact with environment +modules. An additional sub-command is usually added to the command to specify +what you want to do. For a list of sub-commands you can use `module -h` or +`module help`. As for all commands, you can access the full help on the _man_ +pages with `man module`. + +### Purging Modules + +Depending on how you are accessing the HPC the modules you have loaded by default will be different. So before we start listing our modules we will first use the `module purge` command to clear all but the minimum default modules so that we are all starting with the same modules. + +```sh +module purge +``` + +```out +The following modules were not unloaded: + (Use "module --force purge" to unload all): + + 1) NeSI/zen3 +``` + +Note that `module purge` is informative. It lets us know that all but a minimal default +set of packages have been unloaded (and how to actually unload these if we +truly so desired). + +We are able to unload individual modules, unfortunately within the NeSI system it does not always unload it's dependencies, therefore we recommend `module purge` to bring you back to a state where only those modules needed to perform your normal work on the cluster. + +`module purge` is a useful tool for ensuring repeatable research by guaranteeing that the environment that you build your software stack from is always the same. This is important since some modules have the potential to silently effect your results if they are loaded (or not loaded). + +### Listing Available Modules + +To see available software modules, use `module avail`: + +```sh +module avail +``` + +```out +-------------------------------------------------------------------------- /opt/nesi/lmod/zen3 -------------------------------------------------------------------------- + Amber/24.0-foss-2023a-AmberTools-25.0-CUDA-12.5.0 HTSlib/1.22-GCC-12.3.0 (D) pixi/0.61.0 + AUGUSTUS/3.5.0-gimkl-2022a-patch1 IGV/2.19.4 PLUMED/2.10.0-foss-2023a (D) + AUGUSTUS/3.5.0-gimkl-2022a (D) IGV/2.19.7 (D) pod5/0.3.28-foss-2023a (D) + Basilisk/20250612-gompi-2023a (D) json-fortran/9.0.2-GCC-12.3.0 prokka/1.14.5-GCC-11.3.0 + BayPass/3.0-GCC-12.3.0 (D) JupyterLab/2025.5.0-foss-2023a-4.4.2 (D) prokka/1.14.6-apptainer (D) + BCFtools/1.22-GCC-12.3.0 (D) Kraken2/2.1.6-GCC-12.3.0 (D) pstoedit/4.02-GCCcore-12.3.0 (D) + BCL-Convert/4.2.4 LAMMPS/22Jul2025-foss-2023a-kokkos-CUDA-12.2.2 pybind11/2.9.2-GCCcore-12.3.0 + BiG-SCAPE/1.1.9-gimkl-2022a-Python-3.11.3 LAMMPS/22Jul2025-foss-2023a-kokkos Python-Geo/3.11.6-foss-2023a (D) + +[removed most of the output here for clarity] + +Use "module spider" to find all possible modules and extensions. +Use "module keyword key1 key2 ..." to search for all possible modules matching any of the "keys". +``` + +### Listing Currently Loaded Modules + +You can use the `module list` command to see which modules you currently have +loaded in your environment. On Mahuika you will have a few default modules loaded when you login. + +```sh +module list +``` + +```out +Currently Loaded Modules: + + 1) NeSI/zen3 + +``` + +## Loading and Unloading Software + +You can load software using the `module load` command. In this example we will be using the programming language _R_. + +Initially, R is not loaded. We can test this by using the `which` +command. `which` looks for programs the same way that Bash does, so we can use +it to tell us where a particular piece of software is stored. + +```sh +which R +``` + +```out +/usr/bin/which: no R in (/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/home/cwal219/bin:/home/cwal219/.local/bin:/opt/nesi/bin) +``` + +The important bit here being: + +```out +/usr/bin/which: no R in (...) +``` + +Now lets try loading the R environment module, and try again. + +```sh +module load R +which R +``` + +```out +/opt/nesi/zen3/R/4.3.2-foss-2023a/bin/R +``` + +!!! note "Tab Completion" + + The module command also supports tab completion. You may find this the easiest way to find the right software. + +So, what just happened? + +To understand the output, first we need to understand the nature of the `$PATH` +environment variable. `$PATH` is a special environment variable that controls +where a UNIX system looks for software. Specifically `$PATH` is a list of +directories (separated by `:`) that the OS searches through for a command +before giving up and telling us it can't find it. As with all environment +variables we can print it out using `echo`. + +```sh +echo $PATH +``` + +```out +/opt/nesi/zen3/R/4.3.2-foss-2023a/bin:/opt/nesi/CS400_centos7_bdw/LibTIFF/4.4.0-GCCcore-12.3.0/bin:/opt/nesi/CS400_centos7_bdw/nodejs/18.18.2-GCCcore-12.3.0/bin:/opt/nesi/CS400_centos7_bdw/libgit2/1.6.4-GCC-12.3.0/bin:/opt/nesi/CS400_centos7_bdw/Java/20.0.2:/opt/nesi/CS400_centos7_bdw/Java/20.0.2/bin:/opt/nesi/CS400_centos7_bdw/cURL/8.3.0-GCCcore-12.3.0/bin:/opt/nesi/CS400_centos7_bdw/OpenSSL/1.1/bin:/opt/nesi/CS400_centos7_bdw/SQLite/3.42.0-GCCcore-12.3.0/bin:/opt/nesi/CS400_centos7_bdw/libxml2/2.11.4-GCCcore-12.3.0/bin:/opt/nesi/CS400_centos7_bdw/ncurses/6.4-GCCcore-12.3.0/bin:/opt/nesi/CS400_centos7_bdw/PCRE2/10.42-GCCcore-12.3.0/bin:/opt/nesi/zen3/XZ/5.4.2-GCCcore-12.3.0/bin:/opt/nesi/CS400_centos7_bdw/bzip2/1.0.8-GCCcore-12.3.0/bin:/opt/nesi/CS400_centos7_bdw/FFTW/3.3.10-GCC-12.3.0/bin:/opt/nesi/CS400_centos7_bdw/FlexiBLAS/3.3.1-GCC-12.3.0/bin:/opt/nesi/zen3/OpenMPI/4.1.5-GCC-12.3.0/bin:/opt/nesi/zen3/UCC/1.3.0-GCCcore-12.3.0/bin:/opt/nesi/zen3/UCX/1.18.1-GCCcore-12.3.0/bin:/opt/nesi/CS400_centos7_bdw/numactl/2.0.16-GCCcore-12.3.0/bin:/opt/nesi/CS400_centos7_bdw/binutils/2.40-GCCcore-12.3.0/bin:/opt/nesi/CS400_centos7_bdw/GCCcore/12.3.0/bin:/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/home/cwal219/bin:/opt/nesi/vdt:/home/cwal219/.local/bin:/opt/nesi/bin +``` + +We can improve the readability of this command slightly by replacing the colon delimiters (`:`) with newline (`\n`) characters. + +```sh +echo $PATH | tr ":" "\n" +``` + +??? info "Wait, what did I just run??" + mention pipe and stuff. point to intro bash. + +```out +/opt/nesi/zen3/R/4.3.2-foss-2023a/bin +/opt/nesi/CS400_centos7_bdw/LibTIFF/4.4.0-GCCcore-12.3.0/bin +/opt/nesi/CS400_centos7_bdw/nodejs/18.18.2-GCCcore-12.3.0/bin +/opt/nesi/CS400_centos7_bdw/libgit2/1.6.4-GCC-12.3.0/bin +/opt/nesi/CS400_centos7_bdw/Java/20.0.2 +/opt/nesi/CS400_centos7_bdw/Java/20.0.2/bin +/opt/nesi/CS400_centos7_bdw/cURL/8.3.0-GCCcore-12.3.0/bin +/opt/nesi/CS400_centos7_bdw/OpenSSL/1.1/bin +/opt/nesi/CS400_centos7_bdw/SQLite/3.42.0-GCCcore-12.3.0/bin +/opt/nesi/CS400_centos7_bdw/libxml2/2.11.4-GCCcore-12.3.0/bin +/opt/nesi/CS400_centos7_bdw/ncurses/6.4-GCCcore-12.3.0/bin +/opt/nesi/CS400_centos7_bdw/PCRE2/10.42-GCCcore-12.3.0/bin +/opt/nesi/zen3/XZ/5.4.2-GCCcore-12.3.0/bin +/opt/nesi/CS400_centos7_bdw/bzip2/1.0.8-GCCcore-12.3.0/bin +/opt/nesi/CS400_centos7_bdw/FFTW/3.3.10-GCC-12.3.0/bin +/opt/nesi/CS400_centos7_bdw/FlexiBLAS/3.3.1-GCC-12.3.0/bin +/opt/nesi/zen3/OpenMPI/4.1.5-GCC-12.3.0/bin +/opt/nesi/zen3/UCC/1.3.0-GCCcore-12.3.0/bin +/opt/nesi/zen3/UCX/1.18.1-GCCcore-12.3.0/bin +/opt/nesi/CS400_centos7_bdw/numactl/2.0.16-GCCcore-12.3.0/bin +/opt/nesi/CS400_centos7_bdw/binutils/2.40-GCCcore-12.3.0/bin +/opt/nesi/CS400_centos7_bdw/GCCcore/12.3.0/bin +/usr/local/bin +/usr/bin +/usr/local/sbin +/usr/sbin +/home/cwal219/bin +/home/cwal219/.local/bin +``` + +You'll notice a similarity to the output of the `which` command. However, in this case, +there are a lot more directories at the beginning. When we +ran the `module load` command, it added many directories to the beginning of our +`$PATH`. + +Looking at the first line: `/opt/nesi/CS400_centos7_bdw/R/4.2.1-gimkl-2022a/bin` + +Let's examine what's there: + +```sh +ls /opt/nesi/zen3/R/4.3.2-foss-2023a/bin +``` + +```out +R Rscript +``` + +`module load` "loads" not only the specified software, but it also loads software dependencies. That is, the software that the application you load requires to run. + +To demonstrate, let's use `module list`. + +```sh +module list +``` + +```out +Currently Loaded Modules: + 1) NeSI/zen3 (S) 8) UCC/1.3.0-GCCcore-12.3.0 15) ScaLAPACK/2.2.0-gompi-2023a-fb 22) libxml2/2.11.4-GCCcore-12.3.0 29) libgit2/1.6.4-GCC-12.3.0 + 2) GCCcore/12.3.0 9) OpenMPI/4.1.5-GCC-12.3.0 16) foss/2023a 23) SQLite/3.42.0-GCCcore-12.3.0 30) nodejs/18.18.2-GCCcore-12.3.0 + 3) zlib/1.2.13-GCCcore-12.3.0 10) OpenBLAS/0.3.23-GCC-12.3.0 17) bzip2/1.0.8-GCCcore-12.3.0 24) OpenSSL/1.1 31) LibTIFF/4.4.0-GCCcore-12.3.0 + 4) binutils/2.40-GCCcore-12.3.0 11) FlexiBLAS/3.3.1-GCC-12.3.0 18) XZ/5.4.2-GCCcore-12.3.0 25) cURL/8.3.0-GCCcore-12.3.0 32) R/4.3.2-foss-2023a + 5) GCC/12.3.0 12) FFTW/3.3.10-GCC-12.3.0 19) PCRE2/10.42-GCCcore-12.3.0 26) NLopt/2.7.1-GCC-12.3.0 + 6) numactl/2.0.16-GCCcore-12.3.0 13) gompi/2023a 20) ncurses/6.4-GCCcore-12.3.0 27) GMP/6.2.1-GCCcore-12.3.0 + 7) UCX/1.18.1-GCCcore-12.3.0 14) FFTW.MPI/3.3.10-gompi-2023a 21) libreadline/8.2-GCCcore-12.3.0 28) Java/20.0.2 +``` + +Notice that our initial list of modules has increased by 30. When we loaded R, it also loaded all of it's dependencies along with all the dependencies of those modules. + +Before moving onto the next session lets use `module purge` again to return to the minimal environment. + +```sh +module purge +``` + +```out +The following modules were not unloaded: + (Use "module --force purge" to unload all): + + 1) NeSI/zen3 +``` + +!!! warning "Thinking" + Just because you see a command, you don't have to run it. + Removing `NeSI/zen3` will break your environment. You _do not_ want to run `module --force purge` + +## Software Versioning + +So far, we've learned how to load and unload software packages. However, we have not yet addressed the issue of software versioning. At +some point or other, you will run into issues where only one particular version +of some software will be suitable. Perhaps a key bugfix only happened in a +certain version, or version _X_ broke compatibility with a file format you use. +In either of these example cases, it helps to be very specific about what +software is loaded. + +Let's examine the output of `module avail` more closely. + +```sh +module avail +``` + +```out +-----------------/opt/nesi/CS400_centos7_bdw/modules/all ------------------ + Flye/2.9-gimkl-2020a-Python-3.8.2 (D) PyQt/5.10.1-gimkl-2018b-Python-3.7.3 + fmlrc/1.0.0-GCC-9.2.0 PyQt/5.12.1-gimkl-2018b-Python-2.7.16 + fmt/7.1.3-GCCcore-9.2.0 PyQt/5.12.1-gimkl-2020a-Python-3.8.2 (D) + fmt/8.0.1 (D) pyspoa/0.0.8-gimkl-2018b-Python-3.8.1 + fontconfig/2.12.1-gimkl-2017a Python-Geo/2.7.14-gimkl-2017a + fontconfig/2.13.1-GCCcore-7.4.0 Python-Geo/2.7.16-gimkl-2018b + fontconfig/2.13.1-GCCcore-9.2.0 (D) Python-Geo/3.6.3-gimkl-2017a + forge/19.0 Python-Geo/3.7.3-gimkl-2018b + forge/20.0.2 (D) Python-Geo/3.8.2-gimkl-2020a + FoX/4.1.2-intel-2018b Python-Geo/3.9.5-gimkl-2020a (D) + FragGeneScan/1.31-gimkl-2018b Python-GPU/3.6.3-gimkl-2017a + FreeBayes/1.1.0-gimkl-2017a Python/2.7.14-gimkl-2017a + FreeBayes/1.3.1-GCC-7.4.0 Python/2.7.16-gimkl-2018b + FreeBayes/1.3.2-GCC-9.2.0 (D) Python/2.7.16-intel-2018b + freetype/2.7.1-gimkl-2017a Python/2.7.18-gimkl-2020a + freetype/2.9.1-GCCcore-7.4.0 Python/3.6.3-gimkl-2017a + freetype/2.10.1-GCCcore-9.2.0 (D) Python/3.7.3-gimkl-2018b + FreeXL/1.0.2-gimkl-2017a Python/3.8.1-gimkl-2018b + FreeXL/1.0.5-GCCcore-7.4.0 (D) Python/3.8.2-gimkl-2020a (D) + FreeXL/1.0.5-GCCcore-9.2.0 Python/3.9.5-gimkl-2020a + FriBidi/1.0.10-GCCcore-9.2.0 qcat/1.1.0-gimkl-2020a-Python-3.8.2 + +[removed most of the output here for clarity] + +----------------------------------- /cm/local/modulefiles ----------------------------------- + cluster-tools/8.0 freeipmi/1.5.5 module-git openmpi/mlnx/gcc/64/2.1.2a1 + cmd gcc/6.3.0 module-info shared + cuda-dcgm/1.3.3.1 ipmitool/1.8.18 null + dot lua/5.3.4 openldap + + Where: + D: Default Module + +Use "module spider" to find all possible modules. +Use "module keyword key1 key2 ..." to search for all possible modules matching any of the +"keys". +``` + +Let's take a closer look at the `Python` modules. There are many applications +that are run using python and may fail to run if the wrong version is loaded. +In this case, there are many different versions: `Python/3.6.3-gimkl-2017a`, +`Python/3.7.3-gimkl-2018b` through to the newest versions. + +How do we load each copy and which copy is the default? + +In this case, `Python/3.8.2-gimkl-2020a` has a `(D)` next to it. This indicates that it is the +default — if we type `module load Python`, as we did above, this is the copy that will be +loaded. + +```sh +module load Python +python3 --version +``` + +```out +Python 3.11.6 +``` + +So how do we load the non-default copy of a software package? In this case, the +only change we need to make is be more specific about the module we are +loading. There are many other Python versions. To load a +non-default module, the only change we need to make to our `module load` +command is to add the version number after the `/`. + +```sh +module load Python/3.9.5-gimkl-2020a +``` + +```out +The following have been reloaded with a version change: + 1) Python 3.11.6-foss-2023a => Python/3.9.5-gimkl-2020a +``` + +Notice how the module command has swapped out versions of the Python module. +And now we test which version we are using: + +```sh +python3 --version +``` + +```out +Python 3.9.5 +``` + +We are now left with only those module required to do our work for this project. + +```sh +module list +``` + +```out +Currently Loaded Modules: + 1) NeSI/zen3 (S) 10) gimkl/2020a 19) libreadline/8.0-GCCcore-9.2.0 28) tbb/2019_U9-GCCcore-9.2.0 + 2) GCCcore/9.2.0 11) bzip2/1.0.8-GCCcore-9.2.0 20) libxml2/2.9.10-GCCcore-9.2.0 29) SuiteSparse/5.6.0-gimkl-2020a-METIS-5.1.0 + 3) zlib/1.2.11-GCCcore-9.2.0 12) XZ/5.2.4-GCCcore-9.2.0 21) libxslt/1.1.34-GCCcore-9.2.0 30) Tcl/8.6.10-GCCcore-9.2.0 + 4) binutils/2.32-GCCcore-9.2.0 13) libpng/1.6.37-GCCcore-9.2.0 22) LegacySystemLibs/.crypto7 (H) 31) Tk/8.6.10-GCCcore-9.2.0 + 5) GCC/9.2.0 14) freetype/2.10.1-GCCcore-9.2.0 23) cURL/7.64.0-GCCcore-9.2.0 32) LLVM/10.0.1-GCCcore-9.2.0 + 6) libpmi/1 15) Szip/2.1.1-GCCcore-9.2.0 24) PCRE/8.43-GCCcore-9.2.0 33) OpenSSL/1.1.1k-GCCcore-9.2.0 + 7) impi/2019.6.166-GCC-9.2.0 16) HDF5/1.10.5-gimpi-2020a 25) netCDF/4.7.3-gimpi-2020a 34) Python/3.9.5-gimkl-2020a + 8) gimpi/2020a 17) libjpeg-turbo/2.0.2-GCCcore-9.2.0 26) SQLite/3.31.1-GCCcore-9.2.0 + 9) imkl/2020.0.166-gimpi-2020a 18) ncurses/6.1-GCCcore-9.2.0 27) METIS/5.1.0-GCCcore-9.2.0 +``` + +!!! keypoints + - "Load software with `module load softwareName`." + - "Unload software with `module unload`" + - "The module system handles software versioning and package conflicts for you + automatically." + +!!! postrequisite + - Link to next page diff --git a/docs/Tutorials/Introduction_To_HPC/Parallel.md b/docs/Tutorials/Introduction_To_HPC/Parallel.md new file mode 100644 index 000000000..6a1b0af16 --- /dev/null +++ b/docs/Tutorials/Introduction_To_HPC/Parallel.md @@ -0,0 +1,177 @@ +--- +created_at: 2026-01-16 +--- + + +!!! time "30 minutes" + +!!! objectives + - "Prepare a job submission script for the parallel executable." + +## Methods of Parallel Computing + +To understand the different types of Parallel Computing we first need to clarify some terms. + +![alt text](../../assets/images/clusterDiagram.png) + +**CPU**: Unit that does the computations. + +**Task**: One or more CPUs that share memory. + +**Node**: The physical hardware. The upper limit on how many CPUs can be in a task. + +**Shared Memory**: When multiple CPUs are used within a single task. + +**Distributed Memory**: When multiple tasks are used. + +Which methods are available to you is largely dependent on the nature of the problem and software being used. + +### Shared-Memory (SMP) + +Shared-memory multiproccessing divides work among _CPUs_ or _threads_, all of these threads require access to the same memory. + +Often called *Multithreading*. + +This means that all CPUs must be on the same node, most Mahuika nodes have 72 CPUs. + +Shared memory parallelism is used in our example script `{{ config.extra.example_script }}`. + +Number of threads to use is specified by the Slurm option `--cpus-per-task`. + +### Distributed-Memory (MPI) + +Distributed-memory multiproccessing divides work among _tasks_, a task may contain multiple CPUs (provided they all share memory, as discussed previously). + +Message Passing Interface (MPI) is a communication standard for distributed-memory multiproccessing. While there are other standards, often 'MPI' is used synonymously with Distributed parallelism. + +Each task has it's own exclusive memory, tasks can be spread across multiple nodes, communicating via and _interconnect_. This allows MPI jobs to be much larger than shared memory jobs. It also means that memory requirements are more likely to increase proportionally with CPUs. + +Distributed-Memory multiproccessing predates shared-memory multiproccessing, and is more common with classical high performance applications (older computers had one CPU per node). + +Number of tasks to use is specified by the Slurm option `--ntasks`, because the number of tasks ending up on one node is variable you should use `--mem-per-cpu` rather than `--mem` to ensure each task has enough. + +Tasks cannot share cores, this means in most circumstances leaving `--cpus-per-task` unspecified will get you `2`. + +Using a combination of Shared and Distributed memory is called _Hybrid Parallel_. + +### GPGPU's + +GPUs compute large number of simple operations in parallel, making them well suited for Graphics Processing (hence the name), or any other large matrix operations. + +On NeSI, GPU's are specialised pieces of hardware that you request in addition to your CPUs and memory. + +You can find an up-to-date(ish) list of GPUs available on NeSI in our [Support Documentation](https://docs.nesi.org.nz/Scientific_Computing/The_NeSI_High_Performance_Computers/Available_GPUs_on_NeSI/) + +GPUs can be requested using `--gpus-per-node=:` + +Depending on the GPU type, we *may* also need to specify a partition using `--partition`. + +## GPU Job Example + +Create a new script called `gpu-job.sl` + +```sl +#!/bin/bash -e +#SBATCH --job-name gpu-job +#SBATCH --account {{config.extra.project_code}} +#SBATCH --output %x.out +#SBATCH --mem-per-cpu 2G +#SBATCH --gpu-per-node P100:1 + +module load CUDA +nvidia-smi +``` + +then submit with + +```sh + sbatch gpu-job.sl +``` + +??? question Solution + + ```out + cat gpu-job.out + ``` + + ```out + Tue Mar 12 19:40:51 2024 + +-----------------------------------------------------------------------------+ + | NVIDIA-SMI 525.85.12 Driver Version: 525.85.12 CUDA Version: 12.0 | + |-------------------------------+----------------------+----------------------+ + | GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC | + | Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. | + | | | MIG M. | + |===============================+======================+======================| + | 0 Tesla P100-PCIE... On | 00000000:05:00.0 Off | 0 | + | N/A 28C P0 24W / 250W | 0MiB / 12288MiB | 0% Default | + | | | N/A | + +-------------------------------+----------------------+----------------------+ + + +-----------------------------------------------------------------------------+ + | Processes: | + | GPU GI CI PID Type Process name GPU Memory | + | ID ID Usage | + |=============================================================================| + | No running processes found | + +-----------------------------------------------------------------------------+ + ``` + +### Job Array + +Job arrays are not "multiproccessing" in the same way as the previous two methods. +Ideal for _embarrassingly parallel_ problems, where there are little to no dependencies between the different jobs. + +Can be thought of less as running a single job in parallel and more about running multiple serial-jobs simultaneously. +Often this will involve running the same process on multiple inputs. + +Embarrassingly parallel jobs should be able to scale without any loss of efficiency. If this type of parallelisation is an option, it will almost certainly be the best choice. + +A job array can be specified using `--array` + +If you are writing your own code, then this is something you will probably have to specify yourself. + +## How to Utilise Multiple CPUs + +Requesting extra resources through Slurm only means that more resources will be available, it does not guarantee your program will be able to make use of them. + +Generally speaking, Parallelism is either _implicit_ where the software figures out everything behind the scenes, or _explicit_ where the software requires extra direction from the user. + +### Scientific Software + +The first step when looking to run particular software should always be to read the documentation. +On one end of the scale, some software may claim to make use of multiple cores implicitly, but this should be verified as the methods used to determine available resources are not guaranteed to work. + +Some software will require you to specify number of cores (e.g. `-n 8` or `-np 16`), or even type of paralellisation (e.g. `-dis` or `-mpi=intelmpi`). + +Occasionally your input files may require rewriting/regenerating for every new CPU combintation (e.g. domain based parallelism without automatic partitioning). + +### Writing Code + +Occasionally requesting more CPUs in your Slurm job is all that is required and whatever program you are running will automagically take advantage of the additional resources. +However, it's more likely to require some amount of effort on your behalf. + +It is important to determine this before you start requesting more resources through Slurm + +If you are writing your own code, some programming languages will have functions that can make use of multiple CPUs without requiring you to changes your code. +However, unless that function is where the majority of time is spent, this is unlikely to give you the performance you are looking for. + +*Python: [Multiproccessing](https://docs.python.org/3/library/multiprocessing.html)* (not to be confused with `threading` which is not really parallel.) + +*MATLAB: [Parpool](https://au.mathworks.com/help/parallel-computing/parpool.html)* + +## Summary + +| Name | Other Names | Slurm Option | Pros/cons | +| - | - | - | - | +| Shared Memory Parallelism | Multithreading, Multiproccessing | `--cpus-per-task` | | +| Distrubuted Memory Parallelism | MPI, OpenMPI | `--ntasks` and add `srun` before command | | +| Hybrid | | `--ntasks` and `--cpus-per-task` and add `srun` before command | | +| Job Array | | `--array` | | +| General Purpose GPU | | `--gpus-per-node` | | + + +!!! keypoints + - "Parallel programming allows applications to take advantage of + parallel hardware; serial code will not 'just work.'" + - "There are multiple ways you can run " diff --git a/docs/Tutorials/Introduction_To_HPC/Resources.md b/docs/Tutorials/Introduction_To_HPC/Resources.md new file mode 100644 index 000000000..0e7b4e2c8 --- /dev/null +++ b/docs/Tutorials/Introduction_To_HPC/Resources.md @@ -0,0 +1,408 @@ +--- +created_at: 2026-01-16 +--- + +!!! time "30 Minutes" + + + +!!! objectives + - "Understand how to look up job statistics and profile code." + - "Understand job size implications." + - "Understand problems and limitations involved in using multiple CPUs." + +## What Resources? + +Last time we submitted a job, we did not specify a number of CPUs, and therefore +we were provided the default of `2` (1 _core_). + +As a reminder, our Slurm script `example_job.sl` currently looks like this. + +```sl +#!/bin/bash -e + +#SBATCH --job-name example_job +#SBATCH --account nesi99991 +#SBATCH --mem 300M +#SBATCH --time 00:15:00 + +module purge +module load R/4.3.1-gimkl-2022a +Rscript sum_matrix.r +echo "Done!"``` +``` + +We will now submit the same job again with more CPUs. +We ask for more CPUs using by adding `#SBATCH --cpus-per-task 4` to our script. +Your script should now look like this: + +```sl +#!/bin/bash -e + +#SBATCH --job-name example_job +#SBATCH --account nesi99991 +#SBATCH --mem 300M +#SBATCH --time 00:15:00 +#SBATCH --cpus-per-task 4 + +module purge +module load R/4.3.1-gimkl-2022a +Rscript sum_matrix.r +echo "Done!" +``` + +And then submit using `sbatch` as we did before. + +```sh + sbatch example_job.sl +``` + +```out +Submitted batch job 23137702 +``` + +!!! tip Watch + We can prepend any command with `watch` in order to periodically (default 2 seconds) run a command. e.g. `watch + squeue --me` will give us up to date information on our running jobs. + Care should be used when using `watch` as repeatedly running a command can have adverse effects. + Exit `watch` with ctrl + c. + +Note in squeue, the number under cpus, should be '4'. + +Checking on our job with `sacct`. +Oh no! + +```out +JobID JobName Partition Account AllocCPUS State ExitCode +------------ ---------- ---------- ---------- ---------- ---------- -------- +27323464 my_job large {{ config.extra.project_code }} 4 OUT_OF_ME+ 0:125 +27323464.ba+ batch {{ config.extra.project_code }} 4 OUT_OF_ME+ 0:125 +27323464.ex+ extern {{ config.extra.project_code }} 4 COMPLETED 0:0 +``` + +To understand why our job failed, we need to talk about the resources involved. + +Understanding the resources you have available and how to use them most efficiently is a vital skill in high performance computing. + +Below is a table of common resources and issues you may face if you do not request the correct amount. + + + + + + + + + + + + + + + + + + + + + + + + + + +
Not enoughToo Much
CPU The job will run more slowly than expected, and so may run out of time and get killed for exceeding its time limit.The job will wait in the queue for longer.
+ You will be charged for CPUs regardless of whether they are used or not.
+ Your fair share score will fall more. +
Memory Your job will fail, probably with an 'OUT OF MEMORY' error, segmentation fault or bus error (may not happen immediately).The job will wait in the queue for longer.
+ You will be charged for memory regardless of whether it is used or not.
+ Your fair share score will fall more.
Walltime The job will run out of time and be terminated by the scheduler.The job will wait in the queue for longer.
+ +## Measuring Resource Usage of a Finished Job + +Since we have already run a job (successful or otherwise), this is the best source of info we currently have. +If we check the status of our finished job using the `sacct` command we learned earlier. + +```sh + sacct +``` + +```sh +JobID JobName Alloc Elapsed TotalCPU ReqMem MaxRSS State +--------------- ---------------- ----- ----------- ------------ ------- -------- ---------- +31060451 example_job.sl 2 00:00:48 00:33.548 1G CANCELLED +31060451.batch batch 2 00:00:48 00:33.547 102048K CANCELLED +31060451.extern extern 2 00:00:48 00:00:00 0 CANCELLED +``` + +With this information, we may determine a couple of things. + +Memory efficiency can be determined by comparing ReqMem (requested memory) with MaxRSS (maximum used memory), MaxRSS is given in KB, so a unit conversion is usually required. + +
+ +$$ {Efficiency_{mem} = { MaxRSS \over ReqMem}} $$ + +
+ +So for the above example we see that 0.1GB (102048K) of our requested 1GB meaning the memory efficincy was about 10%. + +CPU efficiency can be determined by comparing TotalCPU(CPU time), with the maximum possible CPU time. The maximum possible CPU time equal to Alloc (number of allocated CPUs) multiplied by Elapsed (Walltime, actual time passed). + +$$ {Efficiency_{cpu} = { TotalCPU \over {Elapsed \times Alloc}}} $$ + +
+ +For the above example 33 seconds of computation was done, + +where the maximum possible computation time was **96 seconds** (2 CPUs multiplied by 48 seconds), meaning the CPU efficiency was about 35%. + +Time Efficiency is simply the Elapsed Time divided by Time Requested. + +
+ +$$ {Efficiency_{time} = { Elapsed \over Requested }} $$ + +
+ +48 seconcds out of 15 minutes requested give a time efficiency of about 5% + +!!! question "Efficiency Exercise" + Calculate for the job shown below, + + ```out + JobID JobName Alloc Elapsed TotalCPU ReqMem MaxRSS State + --------------- ---------------- ----- ----------- ------------ ------- -------- ---------- + 37171050 Example-job 8 00:06:03 00:23:04 32G FAILED + 37171050.batch batch 8 00:06:03 23:03.999 14082672k FAILED + 37171050.extern extern 8 00:06:03 00:00.001 0 COMPLETED + ``` + + a. CPU efficiency. + b. Memory efficiency. + + ??? question Solution + a. CPU efficiency is `( 23 / ( 8 * 6 ) ) x 100` or around **48%**. + b. Memory efficiency is `( 14 / 32 ) x 100` or around **43%**. + +For convenience, NeSI has provided the command `nn_seff ` to calculate **S**lurm **Eff**iciency (all NeSI commands start with `nn_`, for **N**eSI **N**IWA). + +```sh + nn_seff +``` + +```out +Job ID: 27323570 +Cluster: mahuika +User/Group: username/username +State: COMPLETED (exit code 0) +Cores: 1 +Tasks: 1 +Nodes: 1 +Job Wall-time: 5.11% 00:00:46 of 00:15:00 time limit +CPU Efficiency: 141.30% 00:01:05 of 00:00:46 core-walltime +Mem Efficiency: 93.31% 233.29 MB of 250.00 MB +``` + +Knowing what we do now about job efficiency, lets submit the previous job again but with more appropriate resources. + +```sl +#!/bin/bash -e + +#SBATCH --job-name example_job +#SBATCH --account nesi99991 +#SBATCH --mem 300M +#SBATCH --time 00:15:00 +#SBATCH --cpus-per-task 4 + +module purge +module load R/4.3.1-gimkl-2022a +Rscript sum_matrix.r +echo "Done!" +``` + +```sh +sbatch example_job.sl +``` + +Hopefully we will have better luck with this one! + +### A quick description of Simultaneous Multithreading - SMT (aka Hyperthreading) + +Modern CPU cores have 2 threads of operation that can execute independently of one +another. SMT is the technology that allows the 2 threads within one physical core to present +as multiple logical cores, sometimes referred to as virtual CPUS (vCPUS). + +Note: _Hyperthreading_ is Intel's marketing name for SMT. Both Intel and AMD +CPUs have SMT technology. + +Some types of processes can take advantage of multiple threads, and can gain a +performance boost. Some software is +specifically written as multi-threaded. You will need to check or test if your +code can take advantage of threads (we can help with this). + +However, because each thread shares resources on the physical core, +there can be conflicts for resources such as onboard cache. +This is why not all processes get a performance boost from SMT and in fact can +run slower. These types of jobs should be run without multithreading. There +is a Slurm parameter for this: `--hint=nomultithread` + +SMT is why you are provided 2 CPUs instead of 1 as we do not allow +2 different jobs to share a core. This also explains why you will sometimes +see CPU efficiency above 100%, since CPU efficiency is based on core and not thread. + +For more details please see our +[documentation on Hyperthreading](https://docs.nesi.org.nz/Scientific_Computing/Running_Jobs_on_Maui_and_Mahuika/Hyperthreading/) + +## Measuring the System Load From Currently Running Tasks + +On Mahuika, we allow users to connect directly to compute nodes from the +login node. This is useful to check on a running job and see how it's doing, however, we +only allow you to connect to nodes on which you have running jobs. + +The most reliable way to check current system stats is with `htop`. +`htop` is an interactive process viewer that can be launched from command line. + +### Finding job node + +Before we can check on our job, we need to find out where it is running. +We can do this with the command `squeue --me`, and looking under the 'NODELIST' column. + +```sh + squeue --me +``` + +```out +JOBID USER ACCOUNT NAME CPUS MIN_MEM PARTITI START_TIME TIME_LEFT STATE NODELIST(REASON) +26763045 cwal219 {{config.extra.project_code}} test 2 512M large May 11 11:35 14:46 RUNNING wbn144 +``` + +Now that we know the location of the job (wbn189) we can use `ssh` to run `htop` _on that node_. + +```sh + ssh wbn189 -t htop -u $USER +``` + +You may get a message: + +```sh +ECDSA key fingerprint is SHA256:############################################ +ECDSA key fingerprint is MD5:9d:############################################ +Are you sure you want to continue connecting (yes/no)? +``` + +If so, type `yes` and Enter + +You may also need to enter your cluster password. + +If you cannot connect, it may be that the job has finished and you have lost permission to `ssh` to that node. + +### Reading Htop + +You may see something like this, + +```out +top - 21:00:19 up 3:07, 1 user, load average: 1.06, 1.05, 0.96 +Tasks: 311 total, 1 running, 222 sleeping, 0 stopped, 0 zombie +%Cpu(s): 7.2 us, 3.2 sy, 0.0 ni, 89.0 id, 0.0 wa, 0.2 hi, 0.2 si, 0.0 st +KiB Mem : 16303428 total, 8454704 free, 3194668 used, 4654056 buff/cache +KiB Swap: 8220668 total, 8220668 free, 0 used. 11628168 avail Mem + + PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND + 1693 jeff 20 0 4270580 346944 171372 S 29.8 2.1 9:31.89 gnome-shell + 3140 jeff 20 0 3142044 928972 389716 S 27.5 5.7 13:30.29 Web Content + 3057 jeff 20 0 3115900 521368 231288 S 18.9 3.2 10:27.71 firefox + 6007 jeff 20 0 813992 112336 75592 S 4.3 0.7 0:28.25 tilix + 1742 jeff 20 0 975080 164508 130624 S 2.0 1.0 3:29.83 Xwayland + 1 root 20 0 230484 11924 7544 S 0.3 0.1 0:06.08 systemd + 68 root 20 0 0 0 0 I 0.3 0.0 0:01.25 kworker/4:1 + 2913 jeff 20 0 965620 47892 37432 S 0.3 0.3 0:11.76 code + 2 root 20 0 0 0 0 S 0.0 0.0 0:00.02 kthreadd +``` + +Overview of the most important fields: + +- `PID`: What is the numerical id of each process? +- `USER`: Who started the process? +- `RES`: What is the amount of memory currently being used by a process (in + bytes)? +- `%CPU`: How much of a CPU is each process using? Values higher than 100 + percent indicate that a process is running in parallel. +- `%MEM`: What percent of system memory is a process using? +- `TIME+`: How much CPU time has a process used so far? Processes using 2 CPUs + accumulate time at twice the normal rate. +- `COMMAND`: What command was used to launch a process? + +To exit press q. + +Running this command as is will show us information on tasks running on the login node (where we should not be running resource intensive jobs anyway). + +## Running Test Jobs + +As you may have to run several iterations before you get it right, you should choose your test job carefully. +A test job should not run for more than 15 mins. This could involve using a smaller input, coarser parameters or using a subset of the calculations. +As well as being quick to run, you want your test job to be quick to start (e.g. get through queue quickly), the best way to ensure this is keep the resources requested (memory, CPUs, time) small. +Similar as possible to actual jobs e.g. same functions etc. +Use same workflow. (most issues are caused by small issues, typos, missing files etc, your test job is a jood chance to sort out these issues.). +Make sure outputs are going somewhere you can see them. + +!!! tip "Serial Test" + Often a good first test to run, is to execute your job _serially_ e.g. using only 1 CPU. + This not only saves you time by being fast to start, but serial jobs can often be easier to debug. + If you confirm your job works in its most simple state you can identify problems caused by + paralellistaion much more easily. + +You generally should ask for 20% to 30% more time and memory than you think the job will use. +Testing allows you to become more more precise with your resource requests. We will cover a bit more on running tests in the last lesson. + +## Efficient way to run tests jobs using debug QOS (Quality of Service) + +Before submitting a large job, first submit one as a test to make +sure everything works as expected. Often, users discover typos in their submit +scripts, incorrect module names or possibly an incorrect pathname after their job +has queued for many hours. Be aware that your job is not fully scanned for +correctness when you submit the job. While you may get an immediate error if your +SBATCH directives are malformed, it is not until the job starts to run that the +interpreter starts to process the batch script. +NeSI has an easy way for you to test your job submission. One can employ the debug +QOS to get a short, high priority test job. Debug jobs have to run within 15 +minutes and cannot use more that 2 nodes. To use debug QOS, add or change the +following in your batch submit script + +``sh +SBATCH --qos=debug +SBATCH --time=15:00 +``` + +Adding these SBATCH directives will provide your job with the highest priority +possible, meaning it should start to run within a few minutes, provided +your resource request is not too large. + +## Initial Resource Requirements + +As we have just discussed, the best and most reliable method of determining resource requirements is from testing, +but before we run our first test there are a couple of things you can do to start yourself off in the right area. + +### Read the Documentation + +NeSI maintains documentation that does have some guidance on using resources for some software +However, as you noticed in the Modules lessons, we have a lot of software. So it is also advised to search +the web for others that may have written up guidance for getting the most out of your specific software. + +### Ask Other Users + +If you know someone who has used the software before, they may be able to give you a ballpark figure. + + + +!!! postrequisite "Next Steps" + You can use this knowledge to set up the + next job with a closer estimate of its load on the system. + A good general rule + is to ask the scheduler for **30%** more time and memory than you expect the + job to need. + +!!! keypoints + - "As your task gets larger, so does the potential for inefficiencies." + - "The smaller your job (time, CPUs, memory, etc), the faster it will schedule." diff --git a/docs/Tutorials/Introduction_To_HPC/Scaling.md b/docs/Tutorials/Introduction_To_HPC/Scaling.md new file mode 100644 index 000000000..cc60448f7 --- /dev/null +++ b/docs/Tutorials/Introduction_To_HPC/Scaling.md @@ -0,0 +1,60 @@ +--- +title: "Scaling" +teaching: 10 +exercises: 35 +questions: +- "How do we go from running a job on a small number of CPUs to a larger one." +objectives: +- "Understand scaling procedure." +keypoints: +- Start small. +- Test one thing at a time (unit tests). +- Record everything. +--- + +The aim of these tests will be to establish how a jobs requirements change with size (CPUs, inputs) and ultimately figure out the best way to run your jobs. +Unfortunately we cannot assume speedup will be linear (e.g. double CPUs won't usually half runtime, doubling the size of your input data won't necessarily double runtime) therefore more testing is required. This is called *scaling testing*. + +In order to establish an understanding of the scaling properties we may have to repeat this test several times, giving more resources each iteration. + +## Scaling Behavior + +### Amdahl's Law + +Most computational tasks will have a certain amount of work that must be computed serially. + +![Larger fractions of parallel code will have closer to linear scaling performance.](../../Getting_Started/Getting_Help/Training/fig/AmdahlsLaw2.svg) + +Eventually your performance gains will plateau. + +The fraction of the task that can be run in parallel determines the point of this plateau. +Code that has no serial components is said to be "embarrassingly parallel". + +It is worth noting that Amdahl's law assumes all other elements of scaling are happening with 100% efficient, in reality there are additional computational and communication overheads. + +> ## Scaling Exercise +> +> 1. Find your name in the [spreadsheet]({{ site.exercise }}) and modify your `example_job.sl` to request +> "x" `--cpus-per-task`. +> For example `#SBATCH --cpus-per-task 10`. +> 2. Estimate memory requirement based on our previous runs and the cpus requested, memory +> is specified with the `--mem ` flag, it does not accept decimal values, however you may +> specify a unit (`K`|`M`|`G`), if no unit is specified it is assumed to be `M`. +> For example `#SBATCH --mem 1200`. +> 3. Now submit your job, we will include an extra argument `--acctg-freq 1`. +> By default SLURM records job data every 30 seconds. +> This means any job running for less than 30 +> seconds will not have it's memory use recorded. +> Submit the job with `sbatch --acctg-freq 1 example_job.sl`. +> 4. Watch the job with `squeue --me` or `watch squeue --me`. +> 5. On completion of job, use `nn_seff `. +> 6. Record the jobs "Elapsed", "TotalCPU", and "Memory" values in the spreadsheet. (Hint: They are the first +> numbers after the percentage efficiency in output of `nn_seff`). Make sure you have entered the values in the correct format and there is a tick next to each entry. ![Correctly entered data in spreadsheet.](../../Getting_Started/Getting_Help/Training/fig/correct-spreadsheet-entry.png) +> +> > ## Solution +> > +> > [spreadsheet]({{ site.exercise }}) +> {: .solution} +{: .challenge} + +{% include links.md %} diff --git a/docs/Tutorials/Introduction_To_HPC/Submitting_Your_First_Job.md b/docs/Tutorials/Introduction_To_HPC/Submitting_Your_First_Job.md new file mode 100644 index 000000000..7f8919f3e --- /dev/null +++ b/docs/Tutorials/Introduction_To_HPC/Submitting_Your_First_Job.md @@ -0,0 +1,322 @@ +--- +created_at: '2019-01-07T01:10:28Z' +tags: +- slurm +- scheduler +- tutorial +description: Tutorial on how to submit your first Slurm job +status: tutorial +--- +!!! time "10 Minutes" + +!!! prerequisite "" + This tutorial assumes basic familiarity with bash and the terminal. + The first three lessons of the [Software Carpentry Unix Shell lessons](https://swcarpentry.github.io/shell-novice/) covers the information needed. + +!!! objectives + - Run a simple script through the scheduler + - Use the batch system command line tools to monitor the execution of your job + - Inspect the output and error files of your jobs + +## What is a job scheduler? + +An HPC system might have thousands of nodes and thousands of users. +How do we decide who gets what and when? +How do we ensure that a task is run with the resources it needs? +This job is handled by a special piece of software called the scheduler. +On an HPC system, the scheduler manages which jobs run where and when. + +The following illustration compares these tasks of a job scheduler to a waiter in a restaurant. +If you can relate to an instance where you had to wait for a while in a queue to get in to a popular restaurant, then you may now understand why sometimes your job do not start instantly as in your laptop. + +![Queue manager](../../assets/images/restaurant_queue_manager.svg) + +The scheduler used in this lesson is [Slurm](https://slurm.schedmd.com/). +Although Slurm is not used everywhere, running jobs is quite similar regardless of what software is being used. +The exact syntax might change, but the concepts remain the same. + +## What is a batch job? + +Typically, when we enter a command into our terminal, we receive a response immediately in the same terminal. +This is what we call an *interactive session*. + +This is all well for doing small tasks, but what if we want to do several things one after another without without waiting in-between? +Or what if we want to repeat a series of command again later? + +This is where *batch* processing becomes useful, this is where instead of entering commands directly to the terminal we write them down in a text file or script. +Then, the script can be executed by calling it with bash. + +### Writing your first batch script + +Let's try this now, create and open a new file in your current directory called `example_job.sh`. +(If you prefer another text editor than `nano`, feel free to use that) + +```sh +nano example_job.sh +``` + + +```sh +#!/bin/bash -e + +module purge +module load R +Rscript sum_matrix.r +echo "Done!" +``` + +!!! info "shebang" + *shebang* or *shabang*, also referred to as *hashbang* is the character sequence consisting of the number sign (aka: hash) and exclamation mark (aka: bang): `#!` at the beginning of a script. + It is used to describe the interpreter that will be used to run the script. + In this case we will be using the Bash Shell, which can be found at the path `/bin/bash`. + The job scheduler will give you an error if your script does not start with a shebang. + + We recommend using `#!/bin/bash -e` instead of plain `#!/bin/bash`, so that the failure of any command within the script will cause your job to stop immediately rather than attempting to continue on with an unexpected environment or erroneous intermediate data. + +We can now run this script using + +```sh +bash example_job.sh +``` + +```out +The following modules were not unloaded: + (Use "module --force purge" to unload all): + + 1) NeSI/zen3 +Running non-MPI task +Shared Memory Running on 'login01.hpc.nesi.org.nz' with 1 CPU(s) +Summing [ 6.000000e+04 x 4.000000e+04 ] matrix, seed = '0' + 1% done... + 2% done... +... + 98% done... + 99% done... + 100% done... +(Non-MPI) Sums to -29910.135471 +Done! +``` + +You will get the output printed to your terminal as if you had just run those commands one after another. + +!!! info "Cancelling commands" + You can kill a currently running task by pressing the keys `ctrl + c`. + If you just want your terminal back, but want the task to continue running you can ‘background’ it by pressing `ctrl + v`. + Note, a backgrounded task is still attached to your terminal session, and will be killed when you close the terminal (if you need to keep running a task after you log out, have a look at [tmux](https://github.com/tmux/tmux/wiki)). + +### Scheduling your batch job + +Up until now the scheduler has not been involved, our scripts were run directly on the login node. + +First let's rename our batch script to clarify that we intend to run it though the scheduler. + +```sh +mv example_job.sh example_job.sl +``` + +!!! info "File extensions" + A file's extension in this case does not in any way affect how a script is read, it is just another part of the name used to remind users what type of file it is. + Some common conventions: + + - `.sh`: **Sh**ell script + - `.sl`: **Sl**urm script + - `.out`: Commonly used to indicate the file contains the std**out** of some process + - `.err`: Same as `.out` but for std**err** + +In order for the job scheduler to do its job we need to provide a bit more information about our script. +This is done by specifying Slurm parameters in our batch script. +Each of these parameters must be preceded by the special token `#SBATCH` and placed after the shebang, but before the content of the rest of your script. + +![](../../assets/images/parts_slurm_script.svg) + +These parameters tell Slurm things around how the script should be run, like memory, cores and time required. + +All the parameters available can be found by checking `man sbatch` or on the online [Slurm documentation](https://slurm.schedmd.com/). + +| Parameter | Example | Description | +|-------------- | -------------- | -------------- | +| Job name | `#SBATCH --job-name=MyJob` | The name that will appear when using `squeue` or `sacct` | +| Account | `#SBATCH --account=nesi12345` | The account your core hours will be 'charged' to | +| Time | `#SBATCH --time=DD-HH:MM:SS` | Job max walltime | +| Memory | `#SBATCH --mem=1500M` | Memory required per node | +| Output | `#SBATCH --output=%j_output.out` | Path and name of the standard output file | +| Number of tasks | `#SBATCH --ntasks=2` | Will start 2 [MPI tasks](https://docs.nesi.org.nz/Software/Parallel_Computing/Parallel_Computing/#shared-memory-parallelisation) | +| CPUs per task | `#SBATCH --cpus-per-task` | Will request 10 CPUs per task | + +!!! question "Comments" + Comments in UNIX shell scripts (denoted by `#`) are ignored by the bash interpreter. + Why is it that we start our Slurm parameters with `#` if it is going to be ignored? + + Solution: + + Commented lines are ignored by the bash interpreter, but they are *not* ignored by Slurm. + The `#SBATCH` parameters are read by Slurm when we *submit* the job. + When the job starts, the bash interpreter will ignore all lines starting with `#`. + + This is similar to the *shebang* mentioned earlier, when you run your script, the system looks at the `#!`, then uses the program at the subsequent path to interpret the script, in our case `/bin/bash` (the program `bash` found in the `bin` directory). + +Note that just *requesting* these resources does not make your job run faster, nor does it necessarily mean that you will consume all of these resources. +It only means that these are made available to you. +Your job may end up using less memory, or less time, or fewer tasks or nodes, than you have requested, and it will still run. + +It’s best if your requests accurately reflect your job’s requirements. +We’ll talk more about how to make sure that you’re using resources effectively in a later episode of this lesson. + +Now, rather than running our script with `bash` we submit it to the scheduler using the command `sbatch` (**s**lurm **batch**). + +```sh +sbatch example_job.sl +``` + +```out +Submitted batch job 360064 +``` + +And that’s all we need to do to submit a job. +Our work is done – now the scheduler takes over and tries to run the job for us. + +### Checking your running/pending jobs + +While the job is waiting to run, it goes into a list of jobs called the queue. +To check on our job’s status, we check the queue using the command `squeue` (**s**lurm **queue**). +We will need to filter to see only our jobs, by including either the flag `--user ` or `--me`. + +```sh +squeue --me +``` + +```sh +JOBID USER ACCOUNT NAME CPUS MIN_MEM PARTITI START_TIME TIME_LEFT STATE NODELIST(REASON) +231964 yourUsername nesi12345 example_job.sl 1 300M large N/A 1:00 PENDING (Priority) +``` + + +We can see many details about our job, most importantly is it’s STATE, the most common states you might see are.. + +- `PENDING`: The job is waiting in the queue, likely waiting for resources to free up or higher priority jobs to run. +- `RUNNING`: The job has been sent to a compute node and it is processing our commands. +- `COMPLETED`: Your commands completed successfully as far as Slurm can tell (e.g. `exit 0`). +- `FAILED`: (e.g. `exit` not `0`). +- `CANCELLED`: See the next section +- `TIMEOUT`: Your job has running for longer than your `--time` and was killed. +- `OUT_OF_MEMORY`: Your job tried to use more memory that it is allocated (`--mem`) and was killed. + +### Cancelling queued or running jobs + +Sometimes we’ll make a mistake and need to cancel a job. +This can be done with the `scancel` command. + +In order to cancel the job, we will first need its `JobId`, this can be found in the output of `squeue --me`. + +```sh +scancel 231964 +``` + +A clean return of your command prompt indicates that the request to cancel the job was successful. + +Now checking `squeue` again, the job should be gone. + +```sh +squeue --me +``` + +```out +JOBID USER ACCOUNT NAME CPUS MIN_MEM PARTITI START_TIME TIME_LEFT STATE NODELIST(REASON) +``` + +(If it isn’t wait a few seconds and try again). + +!!! question "Cancelling multiple jobs" + We can also cancel all of our jobs at once using the `-u` option. + This will delete all jobs for a specific user (in this case, yourself). + Note that you can only delete your own jobs. + + Try submitting multiple jobs and then cancelling them all. + + Solution: + + First submit a trio of jobs: + + ```sh + sbatch example_job.sl + sbatch example_job.sl + sbatch example_job.sl + ``` + + Then cancel all of them: + + ```sh + scancel --user yourUsername + ``` + + +### Checking finished jobs + +There is another command `sacct` (**s**lurm **acc**oun**t**) that includes jobs that have finished. +By default `sacct` only includes jobs submitted by you, so no need to include additional commands at this point. + +```sh +sacct +``` + +```out +JobID JobName Alloc Elapsed TotalCPU ReqMem MaxRSS State +--------------- ---------------- ----- ----------- ------------ ------- -------- ---------- +31060451 example_job.sl 2 00:00:48 00:33.548 1G CANCELLED +31060451.batch batch 2 00:00:48 00:33.547 102048K CANCELLED +31060451.extern extern 2 00:00:48 00:00:00 0 CANCELLED +``` + +Note that despite the fact that we have only run one job, there are three lines shown, this because each job step is also shown. +This can be suppressed using the flag `-X`. + +!!! info "Where's the output?" + On the login node, when we ran the bash script, the output was printed to the terminal. + Slurm batch job output is typically redirected to a file, by default this will be a file named `slurm-.out` in the directory where the job was submitted, this can be changed with the slurm parameter `--output`. + + +!!! tip "More info on Slurm" + You can use the manual pages for Slurm utilities to find more about their capabilities. + On the command line, these are accessed through the man utility: run `man `. + You can find the same information online by searching: 'man ". + + ```sh + man sbatch + ``` + + There are two additional good sources for quick references on using Slurm: + + - our [Slurm Reference Sheet](../../Getting_Started/Cheat_Sheets/Slurm-Reference_Sheet.md) + - the official [Slurm documentation](https://slurm.schedmd.com/) and [cheatsheet](https://slurm.schedmd.com/pdfs/summary.pdf) + +!!! question "Job environment variables" + When Slurm runs a job, it sets a number of environment variables for the job. + One of these will let us check what directory our job script was submitted from. + The `SLURM_SUBMIT_DIR` variable is set to the directory from which our job was submitted. + Using the `SLURM_SUBMIT_DIR` variable, modify your job so that it prints out the location from which the job was submitted. + + Solution: + + ```sh + nano example_job.sh + cat example_job.sh + ``` + + ```sh + #!/bin/bash -e + #SBATCH --time 00:00:30 + + echo -n "This script is running on " + hostname + + echo "This job was launched in the following directory:" + echo ${SLURM_SUBMIT_DIR} + ``` + +!!! keypoints + - The scheduler handles how compute resources are shared between users + - A job is just a shell script + - Request *slightly* more resources than you need + +!!! postrequisite + - Link to next page diff --git a/docs/Tutorials/Introduction_To_HPC/What_Is_a_HPC_cluster.md b/docs/Tutorials/Introduction_To_HPC/What_Is_a_HPC_cluster.md new file mode 100644 index 000000000..30d7b5087 --- /dev/null +++ b/docs/Tutorials/Introduction_To_HPC/What_Is_a_HPC_cluster.md @@ -0,0 +1,77 @@ +--- +description: Introduction to basic terminology and principles of High Performance Computing +tags: + - training +--- + +## What Is an HPC System? + +The words "cloud", "cluster", and the phrase "high-performance computing" or +"HPC" are used a lot in different contexts and with various related meanings. +So what do they mean? And more importantly, how do we use them in our work? + +A *Remote* computer is one you have no access to physically and must connect via a network (as opposed to *Local*) + +*Cloud* refers to remote computing resources +that are provisioned to users on demand or as needed. + +*HPC*, *High Performance Computer*, *High Performance Computing* or *Supercomputer* are all general terms for a large or powerful computing resource. + +*Cluster* is a more specific term describing a type of supercomputer comprised of multiple smaller computers (nodes) working together. Almost all supercomputers are clusters. + +![NeSI-HPC-Facility](../../Getting_Started/Getting_Help/Training/fig/NeSI-HPC-Facility.jpg) + +## Access + +You will connect to a cluster over the internet either with a web client (Jupyter) or with SSH (**S**ecure **Sh**ell). Your main interface with the cluster will be using command line. + +## Nodes + +Individual computers that compose a cluster are typically called *nodes*. +On a cluster, there are different types of nodes for different +types of tasks. The node where you are now will be different depending on +how you accessed the cluster. + +Most of you (using JupyterHub) will be on an interactive *compute node*. +This is because Jupyter sessions are launched as a job. If you are using SSH to connect to the cluster, you will be on a +*login node*. Both JupyterHub and SSH login nodes serve as an access point to the cluster. + + + +The real work on a cluster gets done by the *compute nodes*. +Compute nodes come in many shapes and sizes, but generally are dedicated to long +or hard tasks that require a lot of computational resources. + +## What's in a Node? + +A node is similar in makeup to a regular desktop or laptop, composed of *CPUs* (sometimes also called *processors* or *cores*), *memory* +(or *RAM*), and *disk* space. Although, where your laptop might have 8 CPUs and 16GB of memory, a compute node will have hundreds of cores and GB of memory. + +* **CPUs** are a computer's tool for running programs and calculations. + +* **Memory** is for short term storage, containing the information currently being operated on by the CPUs. + +* **Disk** is for long term storage, data stored here is permanent, i.e. still there even if the computer has been restarted. +It is common for nodes to connect to a shared, remote disk. + +{% include figure.html url="" max-width="40%" + file="/fig/clusterDiagram.png" + alt="Node anatomy" caption="" %} + +> ## 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). +{: .callout} + +> ## Dedicated Transfer Nodes +> +> If you want to transfer larger amounts of data to or from the cluster, NeSI +> offers dedicated transfer nodes using the Globus service. More information on using Globus for large data transfer to and from +> the cluster can be found here: [Globus Transfer Service](https://docs.nesi.org.nz/Storage/Data_Transfer_Services/Globus_Quick_Start_Guide/) +{: .callout} + +{% include links.md %} +[fshs]: https://en.wikipedia.org/wiki/Filesystem_Hierarchy_Standard diff --git a/docs/Tutorials/Introduction_To_HPC/writing_good_code.md b/docs/Tutorials/Introduction_To_HPC/writing_good_code.md new file mode 100644 index 000000000..089b16355 --- /dev/null +++ b/docs/Tutorials/Introduction_To_HPC/writing_good_code.md @@ -0,0 +1,269 @@ +--- +title: "Writing good code" +teaching: 20 +exercises: 10 +questions: +- "How do we write a good job script." +objectives: +- "Write a script that can be run serial or parallel." +- "Write a script that using SLURM environment variables." +- "Understand the limitations of random number generation." +keypoints: +- "Write your script in a way that is independent of data or environment. (elaborate)" +--- + +When talking about 'a script' we could be referring to multiple things. + +* Slurm/Bash script - Almost everyone will be using one of these to submit their Slurm jobs. +* Work script - If your work involves running another script (usually in a language other than Bash like Python, R or MATLAB) that will have to be invoked in your bash script. + +This section will cover best practice for both types of script. + + + +## Use environment variables + +In this lesson we will take a look at a few of the things to watch out for when writing scripts for use on the cluster. +This will be most relevant to people writing their own code, but covers general practices applicable to everyone. + +There is a lot of useful information contained within environment variable. + +> ## Slurm Environment +> +> For a small demo of the sort of useful info contained within env variables, run the command. +> +> ``` +> sbatch --output "slurm_env.out" --wrap "env | grep" +> ``` +> {: .language-bash} +> +> once the job has finished check the results with, +> +> ``` +> cat slurm_env.out +> ``` +> {: .language-bash} +> +> ``` +> SLURM_JOB_START_TIME=1695513911 +> SLURM_NODELIST=wbn098 +> SLURM_JOB_NAME=wrap +> SLURMD_NODENAME=wbn098 +> SLURM_TOPOLOGY_ADDR=top.s13.s7.wbn098 +> SLURM_PRIO_PROCESS=0 +> SLURM_NODE_ALIASES=(null) +> SLURM_JOB_QOS=staff +> SLURM_TOPOLOGY_ADDR_PATTERN=switch.switch.switch.node +> SLURM_JOB_END_TIME=1695514811 +> SLURM_MEM_PER_CPU=512 +> SLURM_NNODES=1 +> SLURM_JOBID=39572365 +> SLURM_TASKS_PER_NODE=2 +> SLURM_WORKING_CLUSTER=mahuika:hpcwslurmctrl01:6817:9984:109 +> SLURM_CONF=/etc/opt/slurm/slurm.conf +> SLURM_JOB_ID=39572365 +> SLURM_JOB_USER=cwal219 +> __LMOD_STACK_SLURM_I_MPI_PMI_LIBRARY=L29wdC9zbHVybS9saWI2NC9saWJwbWkyLnNv +> SLURM_JOB_UID=201333 +> SLURM_NODEID=0 +> SLURM_SUBMIT_DIR=/scale_wlg_persistent/filesets/home/cwal219 +> SLURM_TASK_PID=8747 +> SLURM_CPUS_ON_NODE=2 +> SLURM_PROCID=0 +> SLURM_JOB_NODELIST=wbn098 +> SLURM_LOCALID=0 +> SLURM_JOB_GID=201333 +> SLURM_JOB_CPUS_PER_NODE=2 +> SLURM_CLUSTER_NAME=mahuika +> SLURM_GTIDS=0 +> SLURM_SUBMIT_HOST=wbn003 +> SLURM_JOB_PARTITION=large +> SLURM_JOB_ACCOUNT=nesi99999 +> SLURM_JOB_NUM_NODES=1 +> SLURM_SCRIPT_CONTEXT=prolog_task +> ``` +> {: .output} +> +> Can you think of some examples as to how these variables could be used in your script? + +> > ## Solution +> > +> > * `SLURM_JOB_CPUS_PER_NODE` could be used to pass CPU numbers directly to any programs being used. +> > * Some other things. +> {: .solution} +{: .challenge} + +> ## Variables in Slurm Header +> +> Environment variables set by Slurm cannot be referenced in the Slurm header. +{: .callout} + +## Default values + +It is good practice to set default values when using environment variables when there is a chance they will be run in an environment where they may not be present. + +``` +FOO="${VARIABLE:-default}" +``` +{: .language-bash} + +`FOO` will be to to the value of `VARIABLE` if is set, otherwise it will be set to `default`. + +As a slight variation on the above example. (`:=` as opposed to `:-`). + +``` +FOO="${VARIABLE:=default}" +``` +{: .language-bash} + +`FOO` will be to to the value of `VARIABLE` if is set, otherwise it will be set to `default`, `VARIABLE` will also be set to `default`. + + + + +``` +num_cpus <- 2 +``` +{: .language-r} + +The number of CPU's being used is fixed in the script. We can save time and reduce chances for making mistakes by replacing this static value with an environment variable. +We can use the environment variable `SLURM_CPUS_PER_TASK`. + +``` +num_cpus <- strtoi(Sys.getenv('SLURM_CPUS_PER_TASK')) +``` +{: .language-r} + +Slurm sets many environment variables when starting a job, see [Slurm Documentation for the full list](https://slurm.schedmd.com/sbatch.html). + +The problem with this approach however, is our code will throw an error if we run it on the login node, or on our local machine or anywhere else that `SLURM_CPUS_PER_TASK` is not set. + +Generally it is best not to diverge your codebase especially if you don't have it under version control, so lets add some compatibility for those use cases. + +``` +num_cpus <- strtoi(Sys.getenv('SLURM_CPUS_PER_TASK', unset = "1")) +``` +{: .language-r} + +Now if `SLURM_CPUS_PER_TASK` variable is not set, 1 CPU will be used. You could also use some other method of detecting CPUs, like `detectCores()`. + +## Interoperability + +windows + mac + linux +headless + interactive + +## Verbose + +Having a printout of job progress is fine for an interactive terminal, but when you aren't seeing the updates in real time anyway, it's just bloat for your output files. + +Let's add an option to mute the updates. + +``` +print_progress <- FALSE +``` +{: .language-r} + + +``` +if (print_progress && percent_complete%%1==0){ + +``` +{: .language-r} + +## Reproduceability + +As this script uses [Pseudorandom number generation](https://en.wikipedia.org/wiki/Pseudorandom_number_generator) there are a few additional factors to consider. +It is desirable that our output be reproducible so we can confirm that changes to the code have not affected it. + +We can do this by setting the seed of the PRNG. That way we will get the same progression of 'random' numbers. + +We are using the environment variable `SLURM_ARRAY_TASK_ID` for reasons we will get to later. We also need to make sure a default seed is set for the occasions when `SLURM_ARRAY_TASK_ID` is not set. + +``` +seed <- strtoi(Sys.getenv('SLURM_ARRAY_TASK_ID', unset = "0")) +set.seed(seed) +``` +{: .language-r} + + +Now your script should look something like this; + +``` +{% include example_scripts/sum_matrix.r %} +``` +{: .language-r} + +## Readability + +Comments! + +## Debugging + +``` +#!/bin/bash -e +``` +{: .language-bash} + +Exit bash script on error + +``` +#!/bin/bash -x +``` +{: .language-bash} + +Print environment. + +``` +env +``` +{: .language-bash} + +Print environment, if someone else has problems replicating the problem, it will likely come down to differences in your environment. + +``` +cat $0 +``` +{: .language-bash} + +Will print your input Slurm script to you output, this can help identify when changes in your submission script leads to errors. + +## Version control + +Version control is when changes to a document are tracked over time. + +In many cases you may be using the same piece of code across multiple environments, in these situations it can be difficult to keep track of changes made and your code can begin to diverge. Setting up version control like Git can save a lot of time. + +### Portability + + + +## Testing + +More often than not, problems come in the form of typos, or other small errors that become apparent within the first few seconds/minutes of script. + +Running on login node? + +Control + c to kill. + +{% include links.md %} diff --git a/docs/assets/images/clusterDiagram.png b/docs/assets/images/clusterDiagram.png new file mode 100644 index 000000000..a7efa81b9 Binary files /dev/null and b/docs/assets/images/clusterDiagram.png differ diff --git a/docs/assets/images/parts_slurm_script.svg b/docs/assets/images/parts_slurm_script.svg new file mode 100644 index 000000000..1897985fc --- /dev/null +++ b/docs/assets/images/parts_slurm_script.svg @@ -0,0 +1,97 @@ + + + +Slurm headershebangkeywordoptionvaluebash commands diff --git a/docs/assets/images/restaurant_queue_manager.svg b/docs/assets/images/restaurant_queue_manager.svg new file mode 100644 index 000000000..5cdada84e --- /dev/null +++ b/docs/assets/images/restaurant_queue_manager.svg @@ -0,0 +1,7038 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + HPC diners + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + Login + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Queue manager + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + The queue + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + } + + + Idle compute node with 6 cores + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Idle compute core + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Reserved + + + + } + + + Reserved compute node with 4 cores + + + + + + + + + + + + + + + + + + + + + + + + + + + + Reserved compute core + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Busy compute core + + + + + + User + + } + + + Busy compute node with 5 cores + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + } + + Compute node with 4 cores + + + + + + Allocated + + + + + + Idle + + + + + + + + + + + + + + + + + + + + + + + + + + Busy + + + + + + Busy + + + CC-BY-2.0, sabryr + + diff --git a/docs/assets/stylesheets/custom_admonations.css b/docs/assets/stylesheets/custom_admonations.css deleted file mode 100644 index c17db867e..000000000 --- a/docs/assets/stylesheets/custom_admonations.css +++ /dev/null @@ -1,748 +0,0 @@ -:root { - --md-admonition-icon--prerequisite: url('data:image/svg+xml;charset=utf-8,') - } - - .md-typeset .admonition.prerequisite, - .md-typeset details.prerequisite { - border-color: rgb(170, 170, 60); - } - .md-typeset .prerequisite > .admonition-title, - .md-typeset .prerequisite > summary { - background-color: rgba(170, 170, 60, 0.1); - } - .md-typeset .prerequisite > .admonition-title::before, - .md-typeset .prerequisite > summary::before { - background-color: rgb(170, 170, 60); - -webkit-mask-image: var(--md-admonition-icon--prerequisite); - mask-image: var(--md-admonition-icon--prerequisite); - } - - .md-typeset .admonition.deprecated, - .md-typeset details.deprecated { - border-color: #ff1744; - } - .md-typeset .deprecated > .admonition-title, - .md-typeset .deprecated > summary { - background-color: #ff17441a; - } - .md-typeset .deprecated > .admonition-title::before, - .md-typeset .deprecated > summary::before { - background-color: #ff1744; - -webkit-mask-image: var(--md-status--deprecated); - mask-image: var(--md-status--deprecated); - } - :root { - --md-admonition-icon--pied-piper: url('data:image/svg+xml;charset=utf-8,') - } - .md-typeset .admonition.pied-piper, - .md-typeset details.pied-piper { - border-color: rgb(43, 155, 70); - } - .md-typeset .pied-piper > .admonition-title, - .md-typeset .pied-piper > summary { - background-color: rgba(43, 155, 70, 0.1); - } - .md-typeset .pied-piper > .admonition-title::before, - .md-typeset .pied-piper > summary::before { - background-color: rgb(43, 155, 70); - -webkit-mask-image: var(--md-admonition-icon--pied-piper); - mask-image: var(--md-admonition-icon--pied-piper); - } - - -:root { - --md-admonition-icon--desktop-download-24: url('data:image/svg+xml;charset=utf-8,') -} -.md-typeset .admonition.desktop-download-24, -.md-typeset details.desktop-download-24 { - border-color: rgb(70,130,180); -} -.md-typeset .desktop-download-24 > .admonition-title, -.md-typeset .desktop-download-24 > summary { - background-color: rgba(70,130,180, 0.1); -} -.md-typeset .desktop-download-24 > .admonition-title::before, -.md-typeset .desktop-download-24 > summary::before { - background-color: rgb(70,130,180); - -webkit-mask-image: var(--md-admonition-icon--desktop-download-24); - mask-image: var(--md-admonition-icon--desktop-download-24); -} - -:root { - --md-admonition-icon--magnifying-glass: url('data:image/svg+xml;charset=utf-8,') -} -.md-typeset .admonition.magnifying-glass, -.md-typeset details.magnifying-glass { - border-color: rgb(255,255,0); -} -.md-typeset .magnifying-glass > .admonition-title, -.md-typeset .magnifying-glass > summary { - background-color: rgba(255,255,0, 0.2); -} -.md-typeset .magnifying-glass > .admonition-title::before, -.md-typeset .magnifying-glass > summary::before { - background-color: rgb(25,25,112); - -webkit-mask-image: var(--md-admonition-icon--magnifying-glass); - mask-image: var(--md-admonition-icon--magnifying-glass); -} - -:root { - --md-admonition-icon--microscope: url('data:image/svg+xml;charset=utf-8,') -} -.md-typeset .admonition.microscope, -.md-typeset details.microscope { - border-color: rgb(128,0,0); -} -.md-typeset .microscope > .admonition-title, -.md-typeset .microscope > summary { - background-color: rgba(128,0,0,0.1); -} -.md-typeset .microscope > .admonition-title::before, -.md-typeset .microscope > summary::before { - background-color: rgb(128,0,0); - -webkit-mask-image: var(--md-admonition-icon--microscope); - mask-image: var(--md-admonition-icon--microscope); -} - - -:root { - --md-admonition-icon--vial-virus: url('data:image/svg+xml;charset=utf-8,') -} -.md-typeset .admonition.vial-virus, -.md-typeset details.vial-virus { - border-color: rgb(0,0,0); -} -.md-typeset .vial-virus > .admonition-title, -.md-typeset .vial-virus > summary { - background-color: rgba(0,0,0,0.1); -} -.md-typeset .vial-virus > .admonition-title::before, -.md-typeset .vial-virus > summary::before { - background-color: rgb(0,0,0); - -webkit-mask-image: var(--md-admonition-icon--vial-virus); - mask-image: var(--md-admonition-icon--vial-virus); -} - -:root { - --md-admonition-icon--database: url('data:image/svg+xml;charset=utf-8,') -} -.md-typeset .admonition.database, -.md-typeset details.database { - border-color: rgb(255,215,0,0.1); -} -.md-typeset .database > .admonition-title, -.md-typeset .database > summary { - background-color: rgba(255,215,0); -} -.md-typeset .database > .admonition-title::before, -.md-typeset .database > summary::before { - background-color: rgb(112,128,144); - -webkit-mask-image: var(--md-admonition-icon--database); - mask-image: var(--md-admonition-icon--database); -} - -:root { - --md-admonition-icon--folder-open: url('data:image/svg+xml;charset=utf-8,') -} -.md-typeset .admonition.folder-open, -.md-typeset details.folder-open { - border-color: rgb(0,100,0,0.1); -} -.md-typeset .folder-open > .admonition-title, -.md-typeset .folder-open > summary { - background-color: rgba(0,100,0,0.1); -} -.md-typeset .folder-open > .admonition-title::before, -.md-typeset .folder-open > summary::before { - background-color: rgb(112,128,144); - -webkit-mask-image: var(--md-admonition-icon--folder-open); - mask-image: var(--md-admonition-icon--folder-open); -} - - -:root { - --md-admonition-icon--backward: url('data:image/svg+xml;charset=utf-8,') -} -.md-typeset .admonition.backward, -.md-typeset details.backward { - border-color: rgb(216,191,216); -} -.md-typeset .backward > .admonition-title, -.md-typeset .backward > summary { - background-color: rgba(216,191,216); -} -.md-typeset .backward > .admonition-title::before, -.md-typeset .backward > summary::before { - background-color: rgb(112,128,144); - -webkit-mask-image: var(--md-admonition-icon--backward); - mask-image: var(--md-admonition-icon--backward); -} - - -:root { - --md-admonition-icon--jupyter: url('data:image/svg+xml;charset=utf-8,Jupyter') -} -.md-typeset .admonition.jupyter, -.md-typeset details.jupyter { - border-color: rgb(47,79,79); -} -.md-typeset .jupyter > .admonition-title, -.md-typeset .jupyter > summary { - background-color: rgba(47,79,79,0.1); -} -.md-typeset .jupyter > .admonition-title::before, -.md-typeset .jupyter > summary::before { - background-color: rgb(255,140,0); - -webkit-mask-image: var(--md-admonition-icon--jupyter); - mask-image: var(--md-admonition-icon--jupyter); -} - - -:root { - --md-admonition-icon--terminal: url('data:image/svg+xml;charset=utf-8,') -} -.md-typeset .admonition.terminal, -.md-typeset details.terminal { - border-color: rgb(105,105,105); -} -.md-typeset .terminal > .admonition-title, -.md-typeset .terminal > summary { - color:rgb(105,105,105); - background-color: rgba(105,105,105); -} -.md-typeset .terminal > .admonition-title::before, -.md-typeset .terminal > summary::before { - background-color: rgb(124,252,0); - -webkit-mask-image: var(--md-admonition-icon--terminal); - mask-image: var(--md-admonition-icon--terminal); -} - -:root { - --md-admonition-icon--r-project: url('data:image/svg+xml;charset=utf-8,') -} -.md-typeset .admonition.r-project, -.md-typeset details.r-project { - border-color: rgb(135,206,235); -} -.md-typeset .r-project > .admonition-title, -.md-typeset .r-project > summary { - color:rgb(135,206,235); - background-color: rgba(135,206,235); -} -.md-typeset .r-project > .admonition-title::before, -.md-typeset .r-project > summary::before { - background-color: rgb(25,25,112); - -webkit-mask-image: var(--md-admonition-icon--r-project); - mask-image: var(--md-admonition-icon--r-project); -} - -:root { - --md-admonition-icon--calendar-days: url('data:image/svg+xml;charset=utf-8,') -} -.md-typeset .admonition.calendar-days, -.md-typeset details.calendar-days { - border-color: rgb(135,206,235); -} -.md-typeset .calendar-days > .admonition-title, -.md-typeset .calendar-days > summary { - color:rgb(25,25,112); - background-color: rgba(135,206,235); -} -.md-typeset .calendar-days > .admonition-title::before, -.md-typeset .calendar-days > summary::before { - background-color: rgb(25,25,11225,25,112); - -webkit-mask-image: var(--md-admonition-icon--calendar-days); - mask-image: var(--md-admonition-icon--calendar-days); -} - -:root { - --md-admonition-icon--bell: url('data:image/svg+xml;charset=utf-8,') -} -.md-typeset .admonition.bell, -.md-typeset details.bell { - border-color: rgb(255,215,0,0.1); -} -.md-typeset .bell > .admonition-title, -.md-typeset .bell > summary { - color:rgb(25,25,112); - background-color: rgba(255,215,0); -} -.md-typeset .bell > .admonition-title::before, -.md-typeset .bell > summary::before { - background-color: rgb(112,128,144); - -webkit-mask-image: var(--md-admonition-icon--bell); - mask-image: var(--md-admonition-icon--bell); -} - -:root { - --md-admonition-icon--comment-dots: url('data:image/svg+xml;charset=utf-8,') -} -.md-typeset .admonition.comment-dots, -.md-typeset details.comment-dots { - border-color: rgb(47,79,79); -} -.md-typeset .comment-dots > .admonition-title, -.md-typeset .comment-dots > summary { - background-color: rgba(47,79,79,0.1); -} -.md-typeset .comment-dots > .admonition-title::before, -.md-typeset .comment-dots > summary::before { - background-color: rgb(255,140,0); - -webkit-mask-image: var(--md-admonition-icon--comment-dots); - mask-image: var(--md-admonition-icon--comment-dots); -} - -:root { - --md-admonition-icon--check-to-slot: url('data:image/svg+xml;charset=utf-8,') - } - .md-typeset .admonition.check-to-slot, - .md-typeset details.check-to-slot { - border-color: rgb(30, 182, 182); - } - .md-typeset .check-to-slot > .admonition-title, - .md-typeset .check-to-slot > summary { - background-color: rgba(114, 228, 152, 0.1); - } - .md-typeset .check-to-slot > .admonition-title::before, - .md-typeset .check-to-slot > summary::before { - background-color: rgb(12, 165, 114); - -webkit-mask-image: var(--md-admonition-icon--check-to-slot); - mask-image: var(--md-admonition-icon--check-to-slot); - } - - -:root { - --md-admonition-icon--square-xmark: url('data:image/svg+xml;charset=utf-8,') - } - .md-typeset .admonition.square-xmark, - .md-typeset details.square-xmark { - border-color: rgb(219, 166, 95); - } - .md-typeset .square-xmark > .admonition-title, - .md-typeset .square-xmark > summary { - background-color: rgba(221, 112, 62, 0.1); - } - .md-typeset .square-xmark > .admonition-title::before, - .md-typeset .square-xmark > summary::before { - background-color: rgb(207, 31, 18); - -webkit-mask-image: var(--md-admonition-icon--square-xmark); - mask-image: var(--md-admonition-icon--square-xmark); - } - - -:root { - --md-admonition-icon--rectangle-list: url('data:image/svg+xml;charset=utf-8,') - } - .md-typeset .admonition.rectangle-list, - .md-typeset details.rectangle-list { - border-color: rgb(168, 216, 153); - } - .md-typeset .rectangle-list > .admonition-title, - .md-typeset .rectangle-list > summary { - background-color: rgba(30, 145, 87, 0.315); - } - .md-typeset .rectangle-list > .admonition-title::before, - .md-typeset .rectangle-list > summary::before { - background-color: rgb(8, 92, 53); - -webkit-mask-image: var(--md-admonition-icon--rectangle-list); - mask-image: var(--md-admonition-icon--rectangle-list); - } - -:root { - --md-admonition-icon--screwdriver-wrench: url('data:image/svg+xml;charset=utf-8,') - } - .md-typeset .admonition.screwdriver-wrench, - .md-typeset details.screwdriver-wrench { - border-color: rgb(140, 141, 141); - } - .md-typeset .screwdriver-wrench > .admonition-title, - .md-typeset .screwdriver-wrench > summary { - background-color: rgba(248, 201, 48, 0.575); - } - .md-typeset .screwdriver-wrench > .admonition-title::before, - .md-typeset .screwdriver-wrench > summary::before { - background-color: rgb(16, 37, 65); - -webkit-mask-image: var(--md-admonition-icon--screwdriver-wrench); - mask-image: var(--md-admonition-icon--screwdriver-wrench); - } - -:root { - --md-admonition-icon--linux: url('data:image/svg+xml;charset=utf-9,') - } - .md-typeset .admonition.linux, - .md-typeset details.linux { - border-color: rgb(207, 127, 36); - } - .md-typeset .linux > .admonition-title, - .md-typeset .linux > summary { - background-color: rgba(235, 204, 66, 0.151); - } - .md-typeset .linux > .admonition-title::before, - .md-typeset .linux > summary::before { - background-color: rgb(15, 37, 65); - -webkit-mask-image: var(--md-admonition-icon--linux); - mask-image: var(--md-admonition-icon--linux); - } - -:root { - --md-admonition-icon--code-compare: url('data:image/svg+xml;charset=utf-9,') - } - .md-typeset .admonition.code-compare, - .md-typeset details.code-compare { - border-color: rgb(207, 127, 36); - } - .md-typeset .code-compare > .admonition-title, - .md-typeset .code-compare > summary { - background-color: rgba(235, 204, 66, 0.151); - } - .md-typeset .code-compare > .admonition-title::before, - .md-typeset .code-compare > summary::before { - background-color: rgb(15, 37, 65); - -webkit-mask-image: var(--md-admonition-icon--code-compare); - mask-image: var(--md-admonition-icon--code-compare); - } - -:root { - --md-admonition-icon--heading: url('data:image/svg+xml;charset=utf-9,') - } - .md-typeset .admonition.heading, - .md-typeset details.heading { - border-color: rgb(207, 127, 36); - } - .md-typeset .heading > .admonition-title, - .md-typeset .heading > summary { - background-color: rgba(236, 221, 84, 0.815); - } - .md-typeset .heading > .admonition-title::before, - .md-typeset .heading > summary::before { - background-color: rgb(15, 37, 65); - -webkit-mask-image: var(--md-admonition-icon--heading); - mask-image: var(--md-admonition-icon--heading); - } - -:root { - --md-admonition-icon--space-awesome: url('data:image/svg+xml;charset=utf-9,') - } - .md-typeset .admonition.space-awesome, - .md-typeset details.space-awesome { - border-color: rgb(207, 127, 36); - } - .md-typeset .space-awesome > .admonition-title, - .md-typeset .space-awesome > summary { - background-color: rgba(235, 204, 66, 0.151); - } - .md-typeset .space-awesome > .admonition-title::before, - .md-typeset .space-awesome > summary::before { - background-color: rgb(15, 37, 65); - -webkit-mask-image: var(--md-admonition-icon--space-awesome); - mask-image: var(--md-admonition-icon--space-awesome); - } - -:root { - --md-admonition-icon--stethoscope: url('data:image/svg+xml;charset=utf-9,') - } - .md-typeset .admonition.stethoscope, - .md-typeset details.stethoscope { - border-color: rgb(226, 74, 213); - } - .md-typeset .stethoscope > .admonition-title, - .md-typeset .stethoscope > summary { - background-color: rgba(77, 24, 61, 0.151); - } - .md-typeset .stethoscope > .admonition-title::before, - .md-typeset .stethoscope > summary::before { - background-color: rgb(15, 37, 65); - -webkit-mask-image: var(--md-admonition-icon--stethoscope); - mask-image: var(--md-admonition-icon--stethoscope); - } - -:root { - --md-admonition-icon--key: url('data:image/svg+xml;charset=utf-9,') - } - .md-typeset .admonition.key, - .md-typeset details.key { - border-color: rgb(235, 184, 90); - } - .md-typeset .key > .admonition-title, - .md-typeset .key > summary { - background-color: rgba(252, 207, 9, 0.151); - } - .md-typeset .key > .admonition-title::before, - .md-typeset .key > summary::before { - background-color: rgb(15, 37, 65); - -webkit-mask-image: var(--md-admonition-icon--key); - mask-image: var(--md-admonition-icon--key); - } - -:root { - --md-admonition-icon--users-line: url('data:image/svg+xml;charset=utf-9,') - } - .md-typeset .admonition.users-line, - .md-typeset details.users-line { - border-color: rgb(110, 226, 247); - } - .md-typeset .users-line > .admonition-title, - .md-typeset .users-line > summary { - background-color: rgba(94, 128, 219, 0.418); - } - .md-typeset .users-line > .admonition-title::before, - .md-typeset .users-line > summary::before { - background-color: rgb(15, 37, 65); - -webkit-mask-image: var(--md-admonition-icon--users-line); - mask-image: var(--md-admonition-icon--users-line); - } - -:root { - --md-admonition-icon--file-code: url('data:image/svg+xml;charset=utf-9,') - } - .md-typeset .admonition.file-code, - .md-typeset details.file-code { - border-color: rgb(235, 184, 90); - } - .md-typeset .file-code > .admonition-title, - .md-typeset .file-code > summary { - background-color: rgba(252, 207, 9, 0.151); - } - .md-typeset .file-code > .admonition-title::before, - .md-typeset .file-code > summary::before { - background-color: rgb(15, 37, 65); - -webkit-mask-image: var(--md-admonition-icon--file-code); - mask-image: var(--md-admonition-icon--file-code); - } - -:root { - --md-admonition-icon--hand-holding-dollar: url('data:image/svg+xml;charset=utf-9,') - } - .md-typeset .admonition.hand-holding-dollar, - .md-typeset details.hand-holding-dollar { - border-color: rgb(148, 233, 152); - } - .md-typeset .hand-holding-dollar > .admonition-title, - .md-typeset .hand-holding-dollar > summary { - background-color: rgba(26, 243, 6, 0.459); - } - .md-typeset .hand-holding-dollar > .admonition-title::before, - .md-typeset .hand-holding-dollar > summary::before { - background-color: rgb(15, 37, 65); - -webkit-mask-image: var(--md-admonition-icon--hand-holding-dollar); - mask-image: var(--md-admonition-icon--hand-holding-dollar); - } - -:root { - --md-admonition-icon--circle-question: url('data:image/svg+xml;charset=utf-9,') - } - .md-typeset .admonition.circle-question, - .md-typeset details.circle-question { - border-color: rgb(163, 84, 9); - } - .md-typeset .circle-question > .admonition-title, - .md-typeset .circle-question > summary { - background-color: rgba(241, 113, 27, 0.459); - } - .md-typeset .circle-question > .admonition-title::before, - .md-typeset .circle-question > summary::before { - background-color: rgb(202, 101, 43); - -webkit-mask-image: var(--md-admonition-icon--circle-question); - mask-image: var(--md-admonition-icon--circle-question); - } - -:root { - --md-admonition-icon--microphone: url('data:image/svg+xml;charset=utf-9,') - } - .md-typeset .admonition.microphone, - .md-typeset details.microphone { - border-color: rgb(233, 220, 148); - } - .md-typeset .microphone > .admonition-title, - .md-typeset .microphone > summary { - background-color: rgba(223, 204, 97, 0.459); - } - .md-typeset .microphone > .admonition-title::before, - .md-typeset .microphone > summary::before { - background-color: rgb(15, 37, 65); - -webkit-mask-image: var(--md-admonition-icon--microphone); - mask-image: var(--md-admonition-icon--microphone); - } - - -:root { - --md-admonition-icon--tower-observation: url('data:image/svg+xml;charset=utf-9,') - } - .md-typeset .admonition.tower-observation, - .md-typeset details.tower-observation { - border-color: rgb(201, 182, 10); - } - .md-typeset .tower-observation > .admonition-title, - .md-typeset .tower-observation > summary { - background-color: rgba(208, 216, 102, 0.459); - } - .md-typeset .tower-observation > .admonition-title::before, - .md-typeset .tower-observation > summary::before { - background-color: rgb(177, 98, 9); - -webkit-mask-image: var(--md-admonition-icon--tower-observation); - mask-image: var(--md-admonition-icon--tower-observation); - } - -:root { - --md-admonition-icon--circle-info: url('data:image/svg+xml;charset=utf-9,') - } - .md-typeset .admonition.circle-info, - .md-typeset details.circle-info { - border-color: rgb(238, 156, 131); - } - .md-typeset .circle-info > .admonition-title, - .md-typeset .circle-info > summary { - background-color: rgba(240, 199, 19, 0.459); - } - .md-typeset .circle-info > .admonition-title::before, - .md-typeset .circle-info > summary::before { - background-color: rgb(235, 98, 80); - -webkit-mask-image: var(--md-admonition-icon--circle-info); - mask-image: var(--md-admonition-icon--circle-info); - } - -:root { - --md-admonition-icon--python: url('data:image/svg+xml;charset=utf-9,') - } - .md-typeset .admonition.python, - .md-typeset details.python { - border-color: rgb(112, 201, 10); - } - .md-typeset .python > .admonition-title, - .md-typeset .python > summary { - background-color: rgba(54, 143, 13, 0.459); - } - .md-typeset .python > .admonition-title::before, - .md-typeset .python > summary::before { - background-color: rgb(3, 116, 12); - -webkit-mask-image: var(--md-admonition-icon--python); - mask-image: var(--md-admonition-icon--python); - } - -:root { - --md-admonition-icon--quote-right: url('data:image/svg+xml;charset=utf-9,') - } - .md-typeset .admonition.quote-right, - .md-typeset details.quote-right { - border-color: rgb(211, 241, 190); - } - .md-typeset .quote-right > .admonition-title, - .md-typeset .quote-right > summary { - background-color: rgba(205, 231, 176, 0.459); - } - .md-typeset .quote-right > .admonition-title::before, - .md-typeset .quote-right > summary::before { - background-color: rgb(87, 172, 62); - -webkit-mask-image: var(--md-admonition-icon--quote-right); - mask-image: var(--md-admonition-icon--quote-right); - } - -:root { - --md-admonition-icon--image: url('data:image/svg+xml;charset=utf-9,') - } - .md-typeset .admonition.image, - .md-typeset details.image { - border-color: rgb(211, 241, 190); - } - .md-typeset .image > .admonition-title, - .md-typeset .image > summary { - background-color: rgba(205, 231, 176, 0.459); - } - .md-typeset .image > .admonition-title::before, - .md-typeset .image > summary::before { - background-color: rgb(87, 172, 62); - -webkit-mask-image: var(--md-admonition-icon--image); - mask-image: var(--md-admonition-icon--image); - } - - -:root { - --md-admonition-icon--table: url('data:image/svg+xml;charset=utf-9,') - } - .md-typeset .admonition.table, - .md-typeset details.table { - border-color: rgb(211, 241, 190); - } - .md-typeset .table > .admonition-title, - .md-typeset .table > summary { - background-color: rgba(205, 231, 176, 0.459); - } - .md-typeset .table > .admonition-title::before, - .md-typeset .table > summary::before { - background-color: rgb(87, 172, 62); - -webkit-mask-image: var(--md-admonition-icon--table); - mask-image: var(--md-admonition-icon--table); - } - -:root { - --md-admonition-icon--glass-chart: url('data:image/svg+xml;charset=utf-9,') - } - .md-typeset .admonition.glass-chart, - .md-typeset details.glass-chart { - border-color: rgb(157, 204, 226); - } - .md-typeset .glass-chart > .admonition-title, - .md-typeset .glass-chart > summary { - background-color: rgba(90, 174, 189, 0.459); - } - .md-typeset .glass-chart > .admonition-title::before, - .md-typeset .glass-chart > summary::before { - background-color: rgb(30, 46, 184); - -webkit-mask-image: var(--md-admonition-icon--glass-chart); - mask-image: var(--md-admonition-icon--glass-chart); - } - -:root { - --md-admonition-icon--file-export: url('data:image/svg+xml;charset=utf-9,') - } - .md-typeset .admonition.file-export, - .md-typeset details.file-export { - border-color: rgb(243, 234, 103); - } - .md-typeset .file-export > .admonition-title, - .md-typeset .file-export > summary { - background-color: rgba(233, 208, 95, 0.459); - } - .md-typeset .file-export > .admonition-title::before, - .md-typeset .file-export > summary::before { - background-color: rgb(168, 86, 9); - -webkit-mask-image: var(--md-admonition-icon--file-export); - mask-image: var(--md-admonition-icon--file-export); - } - -:root { - --md-admonition-icon--code: url('data:image/svg+xml;charset=utf-9,') - } - .md-typeset .admonition.code, - .md-typeset details.code { - border-color: rgb(243, 234, 103); - } - .md-typeset .code > .admonition-title, - .md-typeset .code > summary { - background-color: rgba(233, 208, 95, 0.459); - } - .md-typeset .code > .admonition-title::before, - .md-typeset .code > summary::before { - background-color: rgb(168, 86, 9); - -webkit-mask-image: var(--md-admonition-icon--code); - mask-image: var(--md-admonition-icon--code); - } - -:root { - --md-admonition-icon--container: url('data:image/svg+xml;charset=utf-9,') - } - .md-typeset .admonition.container, - .md-typeset details.container { - border-color: rgb(223, 216, 154); - } - .md-typeset .container > .admonition-title, - .md-typeset .container > summary { - background-color: rgba(241, 228, 33, 0.459); - } - .md-typeset .container > .admonition-title::before, - .md-typeset .container > summary::before { - background-color: rgb(143, 100, ); - -webkit-mask-image: var(--md-admonition-icon--container); - mask-image: var(--md-admonition-icon--container); - } -9 diff --git a/docs/assets/stylesheets/footer.css b/docs/assets/stylesheets/footer.css deleted file mode 100644 index 14dc199dc..000000000 --- a/docs/assets/stylesheets/footer.css +++ /dev/null @@ -1,31 +0,0 @@ -#new-footer { - font-family: Lato; - font-size: 12px; - font-weight: 400; - background-color: #101010; -} - -#partners { - height: auto; - background-color: #101010; -} - -#partners #logos img { - height: 40px; - margin: 10px; -} - -#partners #logos { - padding: 10px; - text-align: center; -} - -#partners #logos .nesi-footer-logo img { - margin-right: 100px; - height: 60px; -} - -#partners #logos img { - height: 40px; - margin: 10px; -} \ No newline at end of file diff --git a/docs/assets/stylesheets/theme.css b/docs/assets/stylesheets/theme.css index 0cd427aeb..b137117df 100644 --- a/docs/assets/stylesheets/theme.css +++ b/docs/assets/stylesheets/theme.css @@ -1,38 +1,42 @@ -:root{ - --nesi-grey : #414f5c; +:root { + --nesi-grey: #414f5c; --nesi-grey--light: #94a5ad; - --nesi-yellow :#fcce06; + --nesi-yellow: #fcce06; --nesi-purple: rgb(202, 159, 213); - --nesi-orange : rgb(244, 121, 37); - --nesi-blue : #4fbaed; - --nesi-red:#ef315e; + --nesi-orange: rgb(244, 121, 37); + --nesi-blue: #4fbaed; + --nesi-red: #ef315e; --nesi-green: #cce310; - --reannz-blue : rgb(0,185, 228); - --reannz-blue--shade-negative1:rgb(0, 127, 156); - --reannz-blue--dark: rgb(0,28, 54); + --reannz-blue: rgb(0, 185, 228); + --reannz-blue--shade-negative1: rgb(0, 127, 156); + --reannz-blue--dark: rgb(0, 28, 54); --reannz-blue--dark-shade1: #2c485d; - --reannz-grey : rgb(195,200, 200); - --reannz-black : rgb(25,25, 25); + --reannz-grey: rgb(195, 200, 200); + --reannz-black: rgb(25, 25, 25); --reannz-green: rgb(190, 184, 6); --reannz-green--dark: rgb(0, 170, 136); --reannz-orange: rgb(241, 128, 0); --reannz-purple: rgb(132, 121, 183); - [data-md-color-scheme="default"]{ - --md-primary-fg-color: var(--reannz-blue--dark); - --md-accent-fg-color: var(--reannz-blue); + [data-md-color-scheme="default"] { + --md-primary-fg-color: var(--reannz-blue--dark); + --md-accent-fg-color: var(--reannz-blue); } - /* --md-accent-bg-color: rgb(210,227,235); */ + /* --md-accent-bg-color: rgb(210,227,235); */ [data-md-color-scheme="slate"] { - --md-primary-fg-color: var(--reannz-blue--dark); - --md-accent-fg-color: var(--reannz-blue--darkish); + --md-primary-fg-color: var(--reannz-blue--dark); + --md-accent-fg-color: var(--reannz-blue--darkish); .nt-card-image>img { filter: brightness(0) invert(1); } } + + --md-status--tutorial: url('data:image/svg+xml;charset=utf-8, '); + --md-admonition-icon--prerequisite: url('data:image/svg+xml;charset=utf-8,'); + --md-admonition-icon--time: url('data:image/svg+xml;charset=utf-8, '); } /* Logo biggification */ /* COMMENTED OUT FOR REANNZ LOGO */ @@ -41,65 +45,58 @@ margin: -2rem; } */ +.md-status--tutorial::after { + mask-image: var(--md-status--tutorial); + -webkit-mask-image: var(--md-status--tutorial); +} + /* Version table stuff */ -.md-tag.md-tag-ver{ +.md-tag.md-tag-ver { color: var(--md-code-fg-color); } + .md-tag.md-tag-ver-shown { - outline: var(--md-primary-fg-color) 2px solid; + outline: var(--md-primary-fg-color) 2px solid; } .md-tag-ver-warn { text-decoration: line-through; } + .md-typeset__table { width: 100%; } + .md-typeset__table table:not([class]) { display: table } + /* convenience class. Not sure if it is used */ -.hidden{ - display: none; +.hidden { + display: none; } + /* Get support button */ -.md-button-support{ +.md-button-support { position: absolute; margin: -2rem 0 0 1rem; width: 80%; text-align: center; font-size: 0.7rem; } + /* Don't duplicate header title */ -.md-nav--primary > .md-nav__title { - display: none; +.md-nav--primary>.md-nav__title { + display: none; } + /* fix neotiri card colors */ - /* Make button more buttony */ +/* Make button more buttony */ .md-button--primary { box-shadow: grey 2px 2px 2px; } -/* prerequisite custom admonition */ -:root { - --md-admonition-icon--prerequisite: url('data:image/svg+xml;charset=utf-8,') -} - -.md-typeset .admonition.prerequisite, -.md-typeset details.prerequisite { - border-color: var(--reannz-green); -} -.md-typeset .prerequisite > .admonition-title, -.md-typeset .prerequisite > summary { - background-color: rgba(190, 184, 6, 0.1); /*above color*/ -} -.md-typeset .prerequisite > .admonition-title::before, -.md-typeset .prerequisite > summary::before { - background-color: var(--reannz-green); - -webkit-mask-image: var(--md-admonition-icon--prerequisite); - mask-image: var(--md-admonition-icon--prerequisite); -} /* Footer */ #new-footer { font-family: Lato; @@ -109,38 +106,41 @@ background-color: var(--reannz-black); } -/* e.g. inactive link text */ +/* e.g. inactive link text */ .md-typeset a { - color: var(--reannz-blue--shade-negative1); + color: var(--reannz-blue--shade-negative1); } + .md-typeset a:hover { - color: var(--reannz-blue); + color: var(--reannz-blue); } + /* Make deprecated logo stand out */ span.md-status.md-status--deprecated { - filter: invert(50%) sepia(100%) saturate(1000%) hue-rotate(330deg) brightness(70%) contrast(1000%); + filter: invert(50%) sepia(100%) saturate(1000%) hue-rotate(330deg) brightness(70%) contrast(1000%); } /* Warning symbols for licence server */ -.badge-licence-noup{ - padding: 0; - color: red; - cursor: default; +.badge-licence-noup { + padding: 0; + color: red; + cursor: default; } -.badge-licence-lowup{ - padding: 0; - color: yellow; - cursor: default; + +.badge-licence-lowup { + padding: 0; + color: yellow; + cursor: default; } /* Make cards look right */ .md-typeset .grid.cards { - display: grid; - grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); - gap: 1rem; - margin: 0 auto; - width: 100%; + display: grid; + grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); + gap: 1rem; + margin: 0 auto; + width: 100%; } .cards>a>img { @@ -179,17 +179,32 @@ span.md-status.md-status--deprecated { color: rgba(0, 0, 0, 0.87); } +/* Turirial deader */ +.tutorial-banner { + background: aquamarine; + color: blueviolet; + font-family: inherit; + padding: 0.01em; + margin: 0; + border-radius: 0.8em; +} + +.tutorial-banner>p { + margin: 0; + padding: 0.2em 0.5em; +} + +/* Calendar */ #calendar-banner { background: #fffae6; border-bottom: 1px solid #ccc; font-size: 1.2em; text-align: center; + z-index: 9999; } - - #calendar-banner button { position: absolute; top: 4px; @@ -197,3 +212,114 @@ span.md-status.md-status--deprecated { font-size: 2em; cursor: pointer; } + +/* custom admonition */ +/* prereq */ + +.md-typeset .admonition.prerequisite, +.md-typeset details.prerequisite { + border-color: var(--reannz-green); +} + +.md-typeset .prerequisite>.admonition-title, +.md-typeset .prerequisite>summary { + background-color: rgba(190, 184, 6, 0.1); + /*above color*/ +} + +.md-typeset .prerequisite>.admonition-title::before, +.md-typeset .prerequisite>summary::before { + background-color: var(--reannz-green); + -webkit-mask-image: var(--md-admonition-icon--prerequisite); + mask-image: var(--md-admonition-icon--prerequisite); +} + +/* postreq */ +.md-typeset .admonition.postrequisite, +.md-typeset details.postrequisite { + border-color: rgb(170, 170, 60); +} + +.md-typeset .postrequisite>.admonition-title, +.md-typeset .postrequisite>summary { + background-color: rgba(170, 170, 60, 0.1); +} + +.md-typeset .postrequisite>.admonition-title::before, +.md-typeset .postrequisite>summary::before { + background-color: rgb(170, 170, 60); + -webkit-mask-image: var(--md-tabbed-icon--next); + mask-image: var(--md-tabbed-icon--next); +} + +/* deprecated */ +.md-typeset .admonition.deprecated, +.md-typeset details.deprecated { + border-color: #ff1744; +} + +.md-typeset .deprecated>.admonition-title, +.md-typeset .deprecated>summary { + background-color: #ff17441a; +} + +.md-typeset .deprecated>.admonition-title::before, +.md-typeset .deprecated>summary::before { + background-color: #ff1744; + -webkit-mask-image: var(--md-status--deprecated); + mask-image: var(--md-status--deprecated); +} + +/* time */ +.md-typeset .admonition.time, +.md-typeset details.time { + border-color: #610088; +} + +.md-typeset .time>.admonition-title, +.md-typeset .time>summary { + background-color: #b700cf1a; +} + +.md-typeset .time>.admonition-title::before, +.md-typeset .time>summary::before { + background-color: #ff3f66; + -webkit-mask-image: var(--md-admonition-icon--time); + mask-image: var(--md-admonition-icon--time); +} + +/* objectivess */ +.md-typeset .admonition.objectives, +.md-typeset details.time { + border-color: #765981; +} + +.md-typeset .objectives>.admonition-title, +.md-typeset .objectives>summary { + background-color: #5e9b2d1a; +} + +.md-typeset .objectives>.admonition-title::before, +.md-typeset .objectives>summary::before { + background-color: #0e0b0b; + -webkit-mask-image: var(--md-admonition-icon--prerequisite); + mask-image: var(--md-admonition-icon--prerequisite); +} + +/* key[ppoint */ +.md-typeset .admonition.keypoints, +.md-typeset details.keypoints { + border-color: #000000; +} + +.md-typeset .keypoints>.admonition-title, +.md-typeset .keypoints>summary { + background-color: #e990f51a; +} + +.md-typeset .keypoints>.admonition-title::before, +.md-typeset .keypoints>summary::before { + background-color: #3fffff; + -webkit-mask-image: var(--md-admonition-icon--prerequisite); + mask-image: var(--md-admonition-icon--prerequisite); +} diff --git a/docs/redirect_map.yml b/docs/redirect_map.yml index 6b9379383..3de202d39 100644 --- a/docs/redirect_map.yml +++ b/docs/redirect_map.yml @@ -171,4 +171,6 @@ Getting_Started/Accounts-Projects_and_Allocations/Creating_a_NeSI_Account_Profil Software/Parallel_Computing/Parallel_Execution.md : Software/Parallel_Computing/Parallel_Computing.md Software/Parallel_Computing/Job_Arrays.md : Batch_Computing/Job_Arrays.md Getting_Started/FAQs/Login_Troubleshooting.md : Getting_Started/Accessing_the_HPCs/Login_Troubleshooting.md +Batch_Computing/Batch_Computing_ : Batch_Computing/Batch_Computing_Guide.md +Batch_Computing/Submitting_your_first_job.md : Batch_Computing/Tutorial:_Submitting_your_first_job.md Data_Transfer/Filesytem_Mounts_using_SSHFS.md : Data_Transfer/Filesystem_Mounts_using_SSHFS.md diff --git a/mkdocs.yml b/mkdocs.yml index e3a9e5c8b..22ae2892e 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -64,6 +64,13 @@ markdown_extensions: - def_list extra: slurm: slurm-24.11.6 + project_code: nesi99991 + working_directory: ["nesi", "nobackup", "nesi99991", "introhpc2603"] + example_script: "example script" + status: + - deprecated + - new + - tutorial analytics: provider: google property: G-TVQR4R1F40 @@ -98,8 +105,6 @@ plugins: module_name: macro_hooks include_dir: overrides extra_css: - - assets/stylesheets/footer.css - - assets/stylesheets/custom_admonations.css - assets/stylesheets/theme.css extra_javascript: - assets/javascripts/general.js diff --git a/overrides/main.html b/overrides/main.html index cc65e211a..b5b25618a 100644 --- a/overrides/main.html +++ b/overrides/main.html @@ -31,11 +31,12 @@ {% endif %} {% endblock %} {% block content %} -{% if page.meta and page.meta.status and page.meta.status == "deprecated" %} -
-

Page Deprecated

-

Information you find on this page may be out of date and no longer accurate.

-
+{% if page.meta and page.meta.status %} + {% if page.meta.status == "deprecated" %} + {% include "partials/status_deprecated_header.html" %} + {% elif page.meta.status == "tutorial" %} + {% include "partials/status_tutorial_header.html" %} + {% endif %} {% endif %} {{ super() }} diff --git a/overrides/partials/status_deprecated_header.html b/overrides/partials/status_deprecated_header.html new file mode 100644 index 000000000..4a088e6ab --- /dev/null +++ b/overrides/partials/status_deprecated_header.html @@ -0,0 +1,4 @@ +
+

Page Deprecated

+

Information you find on this page may be out of date and no longer accurate.

+
diff --git a/overrides/partials/status_tutorial_header.html b/overrides/partials/status_tutorial_header.html new file mode 100644 index 000000000..5451d0371 --- /dev/null +++ b/overrides/partials/status_tutorial_header.html @@ -0,0 +1 @@ +

Tutorial