Niagara Quickstart: Difference between revisions

From Alliance Doc
Jump to navigation Jump to search
No edit summary
 
(156 intermediate revisions by 10 users not shown)
Line 1: Line 1:
=System information=
<languages />
<translate>


Hardware characteristics of the Niagara supercomputer can be found [[Niagara|on this page]].
=Specifications= <!--T:1-->


= Logging in =
<!--T:2-->
The Niagara cluster is a large cluster of 1548 Lenovo SD350 servers each with 40 Intel "Skylake" cores at 2.4 GHz.
The peak performance of the cluster is 3.02 PFlops delivered / 4.75 PFlops theoretical.  It is the 53rd fastest supercomputer on the [https://www.top500.org/list/2018/06/?page=1 TOP500 list of June 2018].   


Access to Niagara is via ssh (secure shell) only.  
<!--T:104-->
Each node of the cluster has 188 GiB / 202 GB RAM per node (at least 4 GiB/core for user jobs).  Being designed for large parallel workloads, it has a fast interconnect consisting of EDR InfiniBand in a Dragonfly+ topology with Adaptive Routing.  The compute nodes are accessed through a queueing system that allows jobs with a minimum of 15 minutes and a maximum of 24 hours and favours large jobs.


To access SciNet systems, first open a terminal window (e.g. [[Connecting with MobaXTerm|MobaXTerm]] or [[Connecting with PuTTY|PuTTY]] on Windows), then ssh into the Niagara login nodes with your CC credentials:
<!--T:105-->
See the [https://support.scinet.utoronto.ca/education/go.php/370/content.php/cid/1383/ Intro to Niagara] recording


<source lang="bash">
<!--T:106-->
$ ssh -Y MYCCUSERNAME@niagara.scinet.utoronto.ca</source>
More detailed hardware characteristics of the Niagara supercomputer can be found [[Niagara|on this page]].


or
= Getting started on Niagara = <!--T:209-->


<source lang="bash">$ ssh -Y MYCCUSERNAME@niagara.computecanada.ca</source>
<!--T:4-->
Access to Niagara is not enabled automatically for everyone with an Alliance account, but anyone with an active Alliance account can get their access enabled.
If you have an active Alliance account but you do not have access to Niagara yet (e.g. because you are a new user and belong to a group whose primary PI does not have an allocation as granted in the annual [https://www.computecanada.ca/research-portal/accessing-resources/resource-allocation-competitions Alliance RAC]), go to the [https://ccdb.computecanada.ca/services/opt_in opt-in page on the CCDB site].  After clicking the "Join" button on that page, it usually takes only one or two business days for access to be granted. 


The Niagara login nodes are where you develop, edit, compile, prepare and submit jobs.
<!--T:210-->
Please read this document carefully.  The [https://docs.scinet.utoronto.ca/index.php/FAQ FAQ] is also a useful resource.  If at any time you require assistance, or if something is unclear, please do not hesitate to [mailto:niagara@computecanada.ca contact us].


These login nodes are not part of the Niagara compute cluster, but have the same architecture, operating system, and software stack as the compute npdes.
== Logging in == <!--T:3-->
Niagara runs CentOS 7, which is a type of Linux.  You will need to be familiar with Linux systems to work on Niagara.  If you are not it will be worth your time to review
the [[Linux introduction]] or to attend a local "Linux Shell" workshop.  


The optional <code>-Y</code> in the commands above is needed to open windows from the Niagara command-line onto your local X server.
<!--T:5-->
As with all SciNet and Alliance compute systems, access to Niagara is done via ssh (secure shell) only. As of January 22 2022, authentication is only allowed via SSH keys. Please refer to [[SSH_Keys|this page]] to generate your SSH key pair and make sure you use them securely.  


To run on Niagara's compute nodes, you must submit a batch job to the scheduler.
<!--T:228-->
Open a terminal window (e.g. [[Connecting with PuTTY|PuTTY]] on Windows or [[Connecting with MobaXTerm|MobaXTerm]]), then ssh into the Niagara login nodes with your CC credentials:


For more information on user migration to Niagara see [[#Migration_to_Niagara|below]].
<!--T:6-->
<source lang="bash">
$ ssh -i /path/to/ssh_private_key -Y MYCCUSERNAME@niagara.scinet.utoronto.ca</source>


= Migration to Niagara =
<!--T:7-->
or


== Migration for Existing Users of the GPC ==
<!--T:8-->
<source lang="bash">$ ssh -i /path/to/ssh_private_key -Y MYCCUSERNAME@niagara.computecanada.ca</source>


Niagara is replacing the General Purpose Cluster (GPC) and the Tightly Coupled Cluster (TCS) at SciNet.  The TCS was decommissioned last fall, and GPC will be decommissioned very soon: the compute nodes of the GPC will be decommissioned on April 21, 2018, while the storage attached to the GPC will be decommissioned on May 9, 2018.
<!--T:9-->
 
The Niagara login nodes are where you develop, edit, compile, prepare and submit jobs.
Active GPC Users got access to the new system, Niagara, on April 9, 2018.
 
Users' home and project folder were last copied over from the GPC to Niagara on April 5th, 2018, except for files whose name start with a period that were in their home directories (these files were never synced). 
 
It is the user's responsibility to copy over data generated on the GPC after April 5th, 2018.
 
Data stored in scratch has also not been transfered automatically. Users are to clean up their scratch space on the GPC as much as possible (remember it's temporary data!). Then they can transfer what they need using datamover nodes.
 
To enable this transfer, there will be a short period during which you can have access to Niagara as well as to the GPC storage resources. This period will end on May 9, 2018.
 
To copy substantial amounts of data (i.e.,more than 10 GB), please use the datamovers of both the GPC (called <tt>gpc-logindm01</tt> and <tt>gpc-logindm02</tt>) and the Niagara datamovers (called <tt>nia-dm1</tt> and <tt>nia-dm2</tt>).  For instance, to copy a directory <code>abc</code> from your GPC scratch to your Niagara scratch directory, you can do the following:
<source>
$ ssh CCUSERNAME@niagara.computecanada.ca
$ ssh nia-dm1
$ cp -r SCINETUSERNAME@gpc-logindm01:\$SCRATCH/abc $SCRATCH/abc
</source>
For many of you, CCUSERNAME amd SCINETUSERNAME will be the same. Make sure you use the slash (\) before the first $SCRATCH; it cause the value of scratch on the remote node (i.e., here, gpc-logindm01) to be used.  Note that the gpc-logindm01 will ask for your SciNet password.
 
You can also go the other way:
<source>
$ ssh SCINETUSERNAME@login.scinet.utoronto.ca
$ ssh gpc-logindm01
$ cp -r $SCRATCH/abc CCUSERNAME@nia-dm1:\$SCRATCH/abc
</source>
Again, pay attention to the slash in front of the last occurrence of <tt>$SCRATCH</tt>.


If you are using <tt>rsync</tt>, we advice to refrain from using the <tt>-a</tt> flags, and if using <tt>cp</tt>, refrain from using the <tt>-a</tt> and <tt>-p</tt> flags.
<!--T:10-->
These login nodes are not part of the Niagara compute cluster, but have the same architecture, operating system, and software stack.


== For Non-GPC Users ==
<!--T:11-->
The optional <code>-Y</code> is needed to open windows from the Niagara command-line onto your local X server.


Those of you new to SciNet, but with 2018 RAC allocations on Niagara, will have your accounts created and ready for you to login.
<!--T:12-->
To run on Niagara's compute nodes, you must submit a batch job.


New, non-RAC users: we are still working out the procedure to get access. If you can't wait, for now, you can follow the old route of requesting a SciNet Consortium Account on the [https://ccdb.computecanada.ca/me/facilities CCDB site].
<!--T:107-->
If you cannot log in, be sure first to check the [https://docs.scinet.utoronto.ca System Status] on this site's front page.


= Storage Systems and Locations =
== Your various directories == <!--T:28-->
By virtue of your access to Niagara you are granted storage space on the system.  There are several directories available to you, each indicated by an associated environment variable


== Home and scratch ==
=== home and scratch === <!--T:29-->


Users have a home and scratch directory on the system, whose locations will be given by
<!--T:30-->
You have a home and scratch directory on the system, whose locations are of the form


<!--T:31-->
<code>$HOME=/home/g/groupname/myccusername</code>
<code>$HOME=/home/g/groupname/myccusername</code>


<!--T:32-->
<code>$SCRATCH=/scratch/g/groupname/myccusername</code>
<code>$SCRATCH=/scratch/g/groupname/myccusername</code>


For example:
<!--T:33-->
where groupname is the name of your PI's group, and myccusername is your CC username.  For example:
</translate>
<source lang="bash">nia-login07:~$ pwd
<source lang="bash">nia-login07:~$ pwd
/home/s/scinet/rzon
/home/s/scinet/rzon
nia-login07:~$ cd $SCRATCH
nia-login07:~$ cd $SCRATCH
nia-login07:rzon$ pwd
nia-login07:rzon$ pwd
/scratch/s/scinet/rzon</source>
/scratch/s/scinet/rzon</source>
<translate>
<!--T:211-->
NOTE: home is read-only on compute nodes.


== Project location ==
=== project and archive === <!--T:34-->


Users from groups with a RAC allocation will also have a project directory on Niagara.
<!--T:35-->
Users from groups with [https://www.computecanada.ca/research-portal/accessing-resources/resource-allocation-competitions RAC storage allocation] will also have a project and possibly an archive directory.


<!--T:36-->
<code>$PROJECT=/project/g/groupname/myccusername</code>
<code>$PROJECT=/project/g/groupname/myccusername</code>


<!--T:108-->
<code>$ARCHIVE=/archive/g/groupname/myccusername</code>
<!--T:109-->
NOTE: Currently archive space is available only via [https://docs.scinet.utoronto.ca/index.php/HPSS HPSS], and is not accessible on the Niagara login, compute, or datamover nodes.
<!--T:37-->
'''''IMPORTANT: Future-proof your scripts'''''
'''''IMPORTANT: Future-proof your scripts'''''


Use the environment variables (HOME, SCRATCH, PROJECT) instead of the actual paths!  The paths may change in the future.
<!--T:38-->
When writing your scripts, use the environment variables (<tt>$HOME</tt>, <tt>$SCRATCH</tt>, <tt>$PROJECT</tt>, <tt>$ARCHIVE</tt>) instead of the actual paths!  The paths may change in the future.
 
=== Storage and quotas === <!--T:39-->


== Storage Limits on Niagara ==
<!--T:212-->
You should familiarize yourself with the [[Data_management_at_Niagara#Purpose_of_each_file_system | various file systems]], what purpose they serve, and how to properly use them.  This table summarizes the various file systems.  See the [[Data_management_at_Niagara | Data management at Niagara]] page for more details.


<!--T:40-->
{| class="wikitable"
{| class="wikitable"
! location
! location
! quota
!colspan="2"| quota
!align="right"| block size
!align="right"| block size
! expiration time
! expiration time
! backed up
! backed up
! on login
! on login nodes
! on compute
! on compute nodes
|-
|-
| $HOME
| $HOME
| 100 GB
|colspan="2"| 100 GB per user
|align="right"| 1 MB
|align="right"| 1 MB
|  
|  
Line 114: Line 132:
| read-only
| read-only
|-
|-
| $SCRATCH
|rowspan="2"| $SCRATCH
| 25 TB
|colspan="2"| 25 TB per user
|align="right"| 16 MB
|align="right" rowspan="2" | 16 MB
| 2 months
|rowspan="2"| 2 months
| no
|rowspan="2"| no
| yes
|rowspan="2"| yes
| yes
|rowspan="2"| yes
|-
|align="right"|50-500TB per group
|align="right"|[[Data_management#Quotas_and_purging | depending on group size]]
|-
|-
| $PROJECT
| $PROJECT
| by group allocation
|colspan="2"| by group allocation
|align="right"| 16 MB
|align="right"| 16 MB
|  
|  
Line 131: Line 152:
|-
|-
| $ARCHIVE
| $ARCHIVE
| by group allocation
|colspan="2"| by group allocation
|align="right"|  
|align="right"|  
|
|
Line 139: Line 160:
|-
|-
| $BBUFFER
| $BBUFFER
| ?
|colspan="2"| 10 TB per user
|align="right"| 1 MB
|align="right"| 1 MB
| very short
| very short
| no
| no
| ?
| yes
| ?
| yes
|}
|}


<ul>
=== Moving data to Niagara === <!--T:213-->
<li>Compute nodes do not have local storage.</li>
<li>Archive space is on [https://wiki.scinet.utoronto.ca/wiki/index.php/HPSS HPSS], which will be, but is not yet, attached to Niagara.</li>
<li>Backup means a recent snapshot, not an achive of all data that ever was.</li>
<li><p><code>$BBUFFER</code> stands for the Burst Buffer, a functionality that is still being set up.  This will be a faster parallel storage tier for temporary data.</p></li></ul>


== Moving data ==
<!--T:214-->
If you need to move data to Niagara for analysis, or when you need to move data off of Niagara, use the following guidelines:
* If your data is less than 10GB, move the data using the login nodes.
* If your data is greater than 10GB, move the data using the datamover nodes nia-datamover1.scinet.utoronto.ca and nia-datamover2.scinet.utoronto.ca .


How users should move data onto and off of the Niagara system depends on how big that data is.
<!--T:215-->
Details of how to use the datamover nodes can be found on the [[Data_management_at_Niagara#Moving_data | Data management at Niagara]] page.


To move amounts less than 10GB, you can go through the login nodes. These are the only Niagara login nodes visible from outside Niagara. You can use scp or rsync to niagara.scinet.utoronto.ca or niagara.computecanada.ca (there is no difference). Transfers done in this way will time out for amounts larger than about 10GB.
= Loading software modules = <!--T:48-->


To move amounts of data larger than 10GB, you should go through the datamover node. Datamover nodes are not reachable from the outside, so to do so, from a Niagara login node, first ssh into <code>nia-dm1</code> or <code>nia-dm2</code>, and initiate transfer from the datamovers.
<!--T:216-->
This means that the other side of the transfer (e.g. your machine) must be reachable from the outside.
You have two options for running code on Niagara: use existing software, or [[Niagara_Quickstart#Compiling_on_Niagara:_Example | compile your own]]. This section focuses on the former.


If you do this often, consider using [[Globus]], a web-based tool for data transfer.
<!--T:50-->
Other than essentials, all installed software is made available [[Using_modules | using module commands]]. These modules set environment variables (PATH, etc.), allowing multiple, conflicting versions of a given package to be available.  A detailed explanation of the module system can be [[Using_modules | found on the modules page]].


You may also want to move data to [https://wiki.scinet.utoronto.ca/wiki/index.php/HPSS HPSS/Archive/Nearline], but this functionality will be implemented later. Storage space on HPSS is allocated through the annual [https://www.computecanada.ca/research-portal/accessing-resources/resource-allocation-competitions Compute Canada RAC allocation].
<!--T:217-->
 
= Software and Libraries =
 
== Modules ==
 
Other than essentials, all installed software is made available [[Using Modules|using module commands]]. These modules set environment variables (<code>PATH</code>, etc.) This allows multiple, conflicting versions of a given package to be available. <tt> module spider</tt> shows the available software.
 
For example:
 
<source lang="bash">nia-login07:~$ module spider
---------------------------------------------------
The following is a list of the modules currently av
---------------------------------------------------
  CCEnv: CCEnv
 
  NiaEnv: NiaEnv/2018a
 
  anaconda2: anaconda2/5.1.0
 
  anaconda3: anaconda3/5.1.0
 
  autotools: autotools/2017
    autoconf, automake, and libtool
 
  boost: boost/1.66.0
 
  cfitsio: cfitsio/3.430
 
  cmake: cmake/3.10.2 cmake/3.10.3
 
  ...</source>
 
<ul>
Common module subcommands are:
Common module subcommands are:
<li><code>module load &lt;module-name&gt;</code>: use particular software</li>
<li><code>module load &lt;module-name&gt;</code>: use particular software</li>
Line 203: Line 192:
<li><code>module spider</code> (or <code>module spider &lt;module-name&gt;</code>): list available software packages</li>
<li><code>module spider</code> (or <code>module spider &lt;module-name&gt;</code>): list available software packages</li>
<li><code>module avail</code>: list loadable software packages</li>
<li><code>module avail</code>: list loadable software packages</li>
<li><code>module list</code>: list loaded modules</li></ul>
<li><code>module list</code>: list loaded modules</li>


On Niagara, there are really two software stacks:
<!--T:218-->
Along with modifying common environment variables, such as PATH, and LD_LIBRARY_PATH, these modules also create a SCINET_MODULENAME_ROOT environment variable, which can be used to access commonly needed software directories, such as /include and /lib.


<!--T:219-->
There are handy abbreviations for the module commands. <code>ml</code> is the same as <code>module list</code>, and <code>ml <module-name></code> is the same as <code>module load <module-name></code>.
== Software stacks: NiaEnv and CCEnv == <!--T:220-->
<!--T:53-->
On Niagara, there are two available software stacks:
<!--T:54-->
<ol style="list-style-type: decimal;">
<ol style="list-style-type: decimal;">
<li><p>A [[Modules specific to Niagara|Niagara software stack]] tuned and compiled for this machine. This stack is available by default, but if not, can be reloaded with</p>
<li><p>A [[Modules_specific_to_Niagara | Niagara software stack]] tuned and compiled for this machine. This stack is available by default, but if not, can be reloaded with</p>
<source lang="bash">module load NiaEnv</source></li>
<code>module load NiaEnv</code></li>
<li><p>The same [[Modules|software stack available on Compute Canada's General Purpose clusters]] [https://docs.computecanada.ca/wiki/Graham Graham] and [https://docs.computecanada.ca/wiki/Cedar Cedar], compiled (for now) for a previous generation of CPUs:</p>
<li><p>The standard [[Available software|Alliance software stack]] which is available on Alliance's other clusters (including [[Graham]], [[Cedar]], [[Narval]], and [[Beluga]]):</p>
<source lang="bash">module load CCEnv</source>
<code>module load CCEnv arch/avx512</code>
<p>If you want the same default modules loaded as on Cedar and Graham, then afterwards also <code>module load StdEnv</code>.</p></li></ol>
<br>(without the <tt>arch/avx512</tt> module, you'd get the modules for a previous generation of CPUs)
<p>Or, if you want the same default modules loaded as on Cedar, Graham, and Beluga, then do
</p><p>
<code>module load CCEnv arch/avx512 StdEnv/2018.3</code>
</p>
</li></ol>


Note: the <code>*Env</code> modules are '''''sticky'''''; remove them by <code>--force</code>.
== Tips for loading software == <!--T:56-->


== Tips for loading software ==
<!--T:57-->
We advise '''''against''''' loading modules in your .bashrc.<br> This could lead to very confusing behaviour under certain circumstances.


We advise '''''against''''' loading modules in your .bashrc on Niagara. This can lead to very confusing behaviour under certain circumstances. Instead, load modules by hand when needed, or by sourcing a separate script, and load run-specific modules inside your job submission script.
<!--T:155-->
Our guidelines for .bashrc files can be found [https://docs.scinet.utoronto.ca/index.php/Bashrc_guidelines here]


Short names give default versions; e.g. <code>intel</code> → <code>intel/2018.2</code>.  It is usually better to be explicit about the versions, for future reproducibility.
<!--T:156-->
Instead, load modules by hand when needed, or by sourcing a separate script.


There are some handy abbreviations of the module command:
<!--T:157-->
Load run-specific modules inside your job submission script.


<pre class="sh">
<!--T:58-->
        ml module list
Short names give default versions; e.g. <code>intel</code> <code>intel/2018.2</code>.  It is usually better to be explicit about the versions, for future reproducibility.
        ml NAME → module load NAME  # if NAME is an existing module
        ml X → module X
</pre>


<!--T:61-->
Modules sometimes require other modules to be loaded first.
Modules sometimes require other modules to be loaded first.


<!--T:62-->
Solve these dependencies by using <code>module spider</code>.
Solve these dependencies by using <code>module spider</code>.


== Module spider ==
= Available compilers and interpreters = <!--T:221-->
 
Oddly named, the module subcommand spider is the search-and-advice facility for modules.
 
Suppose one wanted to load the openmpi module.  Upon trying to load the module, one may get the following message:
<source lang="bash">nia-login07:~$ module load openmpi
Lmod has detected the error:  These module(s) exist but cannot be loaded as requested: "openmpi"
  Try: "module spider openmpi" to see how to load the module(s).</source>
So while that fails, following the advice that the command outputs, the next command would be:
<source lang="bash">nia-login07:~$ module spider openmpi
------------------------------------------------------------------------------------------------------
  openmpi:
------------------------------------------------------------------------------------------------------
    Versions:
        openmpi/2.1.3
        openmpi/3.0.1
        openmpi/3.1.0rc3
 
------------------------------------------------------------------------------------------------------
  For detailed information about a specific "openmpi" module (including how to load the modules) use
  the module s full name.
  For example:
 
    $ module spider openmpi/3.1.0rc3
------------------------------------------------------------------------------------------------------</source>
So this gives just more details suggestions on using the <tt>spider</tt> command. Following the advice again, one would type:
<source lang="bash">nia-login07:~$ module spider openmpi/3.1.0rc3
------------------------------------------------------------------------------------------------------
  openmpi: openmpi/3.1.0rc3
------------------------------------------------------------------------------------------------------
    You will need to load all module(s) on any one of the lines below before the "openmpi/3.1.0rc3"
    module is available to load.


      NiaEnv/2018a  gcc/7.3.0
<!--T:222-->
      NiaEnv/2018a  intel/2018.2
* For most compiled software, one should use the Intel compilers (<tt>icc</tt> for C, <tt>icpc</tt> for C++, and <tt>ifort</tt> for Fortran). Loading an <tt>intel</tt> module makes these available.  
</source>
* The GNU compiler suite (<tt>gcc, g++, gfortran</tt>) is also available, if you load one of the <tt>gcc</tt> modules.
These are concrete instructions on how to load this particular openmpi module. Following these leads to a successful loading of the module.
* Open source interpreted, interactive software is also available:
<source lang="bash">nia-login07:~$ module load NiaEnv/2018a  intel/2018.2  # note: NiaEnv is usually already loaded
** [[Python]]
nia-login07:~$ module load openmpi/3.1.0rc3</source>
** [[R]]
<source lang="bash">nia-login07:~$ module list
** Julia
Currently Loaded Modules:
** Octave
   1) NiaEnv/2018a (S)  2) intel/2018.2  3) openmpi/3.1.0.rc3
    
Please visit the [[Python]] or [[R]] page for details on using these tools. For information on running MATLAB applications on Niagara, visit [[MATLAB| this page]].


  Where:
= Using Commercial Software = <!--T:67-->
  S:  Module is Sticky, requires --force to unload or purge</source>


= Can I Run Commercial Software? =
<!--T:223-->
May I use commercial software on Niagara?


* Possibly, but you have to bring your own license for it.
<!--T:68-->
* SciNet and Compute Canada have an extremely large and broad user base of thousands of users, so we cannot provide licenses for everyone's favorite software.
* Possibly, but you have to bring your own license for it.  You can connect to an external license server using [https://docs.scinet.utoronto.ca/index.php/SSH_Tunneling ssh tunneling].
* Thus, the only commercial software installed on Niagara is software that can benefit everyone: Compilers, math libraries and debuggers.
* SciNet and Alliance have an extremely large and broad user base of thousands of users, so we cannot provide licenses for everyone's favorite software.
* That means no Matlab, Gaussian, IDL,  
* Thus, the only commercial software installed on Niagara is software that can benefit everyone: compilers, math libraries and debuggers.
* Open source alternatives like Octave, Python, R are available.
* That means no [[MATLAB]], Gaussian, IDL,  
* Open source alternatives like Octave, [[Python]], and [[R]] are available.
* We are happy to help you to install commercial software for which you have a license.
* We are happy to help you to install commercial software for which you have a license.
* In some cases, if you have a license, you can use software in the Compute Canada stack.
* In some cases, if you have a license, you can use software in the Alliance stack.
The list of commercial software which is installed on Niagara, for which you will need a license to use, can be found on the [https://docs.scinet.utoronto.ca/index.php/Commercial_software commercial software page].


= Compiling on Niagara: Example =
= Compiling on Niagara: Example = <!--T:69-->


<!--T:70-->
Suppose one want to compile an application from two c source files, main.c and module.c, which use the Gnu Scientific Library (GSL). This is an example of how this would be done:
Suppose one want to compile an application from two c source files, main.c and module.c, which use the Gnu Scientific Library (GSL). This is an example of how this would be done:
 
</translate>
<source lang="bash">nia-login07:~$ module list
<source lang="bash">nia-login07:~$ module list
Currently Loaded Modules:
Currently Loaded Modules:
Line 303: Line 283:


nia-login07:~$ ls
nia-login07:~$ ls
main.c module.c
appl.c module.c


nia-login07:~$ icc -c -O3 -xHost -o main.o main.c
nia-login07:~$ icc -c -O3 -xHost -o appl.o appl.c
nia-login07:~$ icc -c -O3 -xHost -o module.o module.c
nia-login07:~$ icc -c -O3 -xHost -o module.o module.c
nia-login07:~$ icc  -o main module.o main.o -lgsl -mkl
nia-login07:~$ icc  -o appl module.o appl.o -lgsl -mkl


nia-login07:~$ ./main</source>
nia-login07:~$ ./appl
</source>
<translate>


<!--T:71-->
Note:
Note:
* The optimization flags <tt>-O3 -xHost</tt> allow the Intel compiler to use instructions specific to the architecture CPU that is present (instead of for more generic x86_64 CPUs).
* The optimization flags <tt>-O3 -xHost</tt> allow the Intel compiler to use instructions specific to the architecture CPU that is present (instead of for more generic x86_64 CPUs).
* The GSL requires a cblas implementation, for is contained in the Intel Math Kernel Library (MKL). Linking with this library is easy when using the intel compiler, it just requires the <tt>-mkl</tt> flags.
* Linking with this library is easy when using the intel compiler, it just requires the <tt>-mkl</tt> flags.
* If compiling with gcc, the optimization flags would be <tt>-O3 -march=native</tt>.  For the way to link with the MKL, it is suggested to use the [https://software.intel.com/en-us/articles/intel-mkl-link-line-advisor MKL link line advisor].
* If compiling with gcc, the optimization flags would be <tt>-O3 -march=native</tt>.  For the way to link with the MKL, it is suggested to use the [https://software.intel.com/en-us/articles/intel-mkl-link-line-advisor MKL link line advisor].


= Testing =
= Testing = <!--T:72-->


<!--T:73-->
You really should test your code before you submit it to the cluster to know if your code is correct and what kind of resources you need.
You really should test your code before you submit it to the cluster to know if your code is correct and what kind of resources you need.


<!--T:74-->
<ul>
<ul>
<li><p>Small test jobs can be run on the login nodes.</p>
<li>Small test jobs can be run on the login nodes.
<p>Rule of thumb: couple of minutes, taking at most about 1-2GB of memory, couple of cores.</p></li>
<p>Rule of thumb: tests should run no more than a couple of minutes, taking at most about 1-2GB of memory, and use no more than a couple of cores.</p>
<li><p>You can run the the ddt debugger on the login nodes after <code>module load ddt</code>.</p></li>
</li>
<li><p>Short tests that do not fit on a login node, or for which you need a dedicated node, request an<br />
<li>
interactive debug job with the salloc command</p>
<p>You can run the ddt debugger on the login nodes after <code>module load ddt</code>.</p>
<source lang="bash">nia-login07:~$ salloc -pdebug --nodes N --time=1:00:00</source>
</li>
<p>where N  is the number of nodes. The duration of your interactive debug session can be at most one hour, can use at most 4 nodes, and each user can only have one such session at a time.</p>
<li>
Alternatively, on Niagara, you can use the command
<p>Short tests that do not fit on a login node, or for which you need a dedicated node, request an interactive debug job with the debug command:</p>
<source lang="bash">nia-login07:~$ debugjob N</source>
<source lang="bash">nia-login07:~$ debugjob N</source>
where N is the number of nodes, If N=1, this gives an interactive session one 1 hour, when N=4 (the maximum), it give you 30 minutes.
<p>where N is the number of nodes, If N=1, this gives an interactive session one 1 hour, when N=4 (the maximum), it gives you 30 minutes.</p><p>  Finally, if your debugjob process takes more than 1 hour, you can request an interactive job from the regular queue using the salloc command.  Note, however, that this may take some time to run, since it will be part of the regular queue, and will be run when the scheduler decides.</p>
</li></ul>
<source lang="bash">nia-login07:~$ salloc --nodes N --time=M:00:00</source>
<p>here N is again the number of nodes, and M is the number of hours you wish the job to run.</p>
<p>If you need to use graphics while testing your code through salloc, e.g. when using a debugger such as DDT or DDD, you have the following options, please visit the
[[Testing_With_Graphics | Testing with graphics]] page.</p>
</li>
</ul>


= Submitting jobs =
= Submitting jobs = <!--T:75-->


<!--T:76-->
<ul>
<ul>
<li><p>Niagara uses SLURM as its job scheduler.</p></li>
<li><p>Niagara uses SLURM as its job scheduler.</p></li>
<li><p>You submit jobs from a login node by passing a script to the sbatch command:</p>
<li><p>You submit jobs from a login node by passing a script to the sbatch command:</p>
<source lang="bash">nia-login07:~$ sbatch jobscript.sh</source></li>
<source lang="bash">nia-login07:scratch$ sbatch jobscript.sh</source></li>
<li><p>This puts the job in the queue. It will run on the compute nodes in due course.</p></li>
<li><p>This puts the job in the queue. It will run on the compute nodes in due course.</p></li>
<li><p>Jobs will run under their group's RRG allocation, or, if the group has none, under a RAS allocation (previously called `default' allocation).</p></li></ul>
<li><p>In most cases, you will want to submit from your $SCRATCH directory, so that the output of your compute job can be written out (as mentioned above, $HOME is read-only on the compute nodes).</p>
<li><p>Jobs will run under their group's RRG allocation, or, if the group has none, under a RAS allocation (previously called 'default' allocation).</p></li>
<li><p>Some example job scripts can be found below.</p></li>
</ul>


<!--T:77-->
Keep in mind:
Keep in mind:


<!--T:78-->
<ul>
<ul>
<li><p>Scheduling is by node, so in multiples of 40-cores.</p></li>
<li><p>Scheduling is by node, so in multiples of 40-cores.</p></li>
<li><p>Maximum walltime is 24 hours.</p></li>
<li><p> Your job's maximum walltime is 24 hours.</p></li>
<li><p>Jobs must write to your scratch or project directory (home is read-only on compute nodes).</p></li>
<li><p>Jobs must write to your scratch or project directory (home is read-only on compute nodes).</p></li>
<li><p>Compute nodes have no internet access.</p>
<li><p>Compute nodes have no internet access.</p>
<p>Download data you need beforehand on a login node.</p></li></ul>
<p>[[Data_management_at_Niagara#Moving_data | Move your data]] to Niagara before you submit your job.</p></li></ul>


== Scheduling by Node ==
== Scheduling by node == <!--T:79-->
On many systems that use SLURM, the scheduler will deduce from the specifications of the number of tasks and the number of cpus-per-node what resources should be allocated.  On Niagara things are a bit different.


<!--T:80-->
<ul>
<ul>
<li><p>All job resource requests on Niagara are scheduled as a multiple of '''nodes'''.</p></li>
<li><p>All job resource requests on Niagara are scheduled as a multiple of '''nodes'''.</p></li>
<li>The nodes that your jobs run on are exclusively yours.
<li>The nodes that your jobs run on are exclusively yours, for as long as the job is running on them.
<ul>
<ul>
<li>No other users are running anything on them.</li>
<li>No other users are running anything on them.</li>
<li>You can ssh into them to see how things are going.</li></ul>
<li>You can ssh into them to see how things are going.</li></ul>
</li>
</li>
<li><p>Whatever your requests to the scheduler, it will always be translated into a multiple of nodes.</p></li>
<li><p>Whatever your requests to the scheduler, it will always be translated into a multiple of nodes allocated to your job.</p></li>
<li><p>Memory requests to the scheduler are of no use.</p>
<li><p>Memory requests to the scheduler are of no use. Your job always gets N x 202GB of RAM, where N is the number of nodes and 202GB is the amount of memory on the node.</p></li>
<p>Your job gets N x 202GB of RAM if N is the number of nodes.</p></li>
<li><p>If you run serial jobs you must still use all 40 cores on the node.  Visit the [https://docs.scinet.utoronto.ca/index.php/Running_Serial_Jobs_on_Niagara serial jobs] page for examples of how to do this.</p></li>
<li><p>You should '''use all 40 cores on each of the nodes''' that your job uses.</p>
<li><p>Since there are 40 cores per node, your job should use N x 40 cores. If you do not, we will contact you to help you optimize your workflow.  Or you can [mailto:support@scinet.utoronto.ca contact us] to get assistance.</p></li></ul>
<p>You will be contacted if you don't, and we will help you get more science done.</p></li></ul>


== Hyperthreading: Logical CPUs vs. cores ==
== Limits == <!--T:175-->


Hyperthreading, a technology that leverages more of the physical hardware by pretending there are twice as many logical cores than real once, is enabled on Niagara.
<!--T:176-->
There are limits to the size and duration of your jobs, the number of jobs you can run and the number of jobs you can have queued.  It matters whether a user is part of a group with a [https://www.computecanada.ca/research-portal/accessing-resources/resource-allocation-competitions/ Resources for Research Group allocation] or not. It also matters in which 'partition' the jobs runs. 'Partitions' are SLURM-speak for use cases.  You specify the partition with the <tt>-p</tt> parameter to <tt>sbatch</tt> or <tt>salloc</tt>, but if you do not specify one, your job will run in the <tt>compute</tt> partition, which is the most common case.  


So the OS and scheduler see 80 logical cores.
<!--T:177-->
{| class="wikitable"
!Usage
!Partition
!Running jobs
!Submitted jobs (incl. running)
!Min. size of jobs
!Max. size of jobs
!Min. walltime
!Max. walltime
|-
|Compute jobs with an allocation||compute || 50 || 1000 || 1 node (40 cores) || 1000 nodes (40000 cores)|| 15 minutes || 24 hours
|-
|Compute jobs without allocation ("default")||compute || 50 || 200 || 1 node (40 cores) || 20 nodes (800 cores)|| 15 minutes || 24 hours
|-
|Testing or troubleshooting || debug || 1 || 1 || 1 node (40 cores) || 4 nodes (160 cores)|| N/A || 1 hour
|-
|Archiving or retrieving data in [https://docs.scinet.utoronto.ca/index.php/HPSS HPSS]|| archivelong || 2 per user (max 5 total) || 10 per user || N/A || N/A|| 15 minutes || 72 hours
|-
|Inspecting archived data, small archival actions in [https://docs.scinet.utoronto.ca/index.php/HPSS HPSS] || archiveshort || 2 per user|| 10 per user || N/A || N/A || 15 minutes || 1 hour
|}


80 logical cores vs. 40 real cores typically gives about a 5-10% speedup (Your Mileage May Vary).
<!--T:178-->
Within these limits, jobs will still have to wait in the queue.  The waiting time depends on many factors such as the allocation amount, how much allocation was used in the recent past, the number of nodes and the walltime, and how many other jobs are waiting in the queue.
 
== File Input/Output Tips == <!--T:224-->
 
<!--T:225-->
It is important to understand the file systems, so as to perform your file I/O (Input/Output) responsibly. Refer to the [[Data_management_at_niagara | Data management at Niagara]] page for details about the file systems.
* Your files can be seen on all Niagara login and compute nodes.
* $HOME, $SCRATCH, and $PROJECT all use the parallel file system called GPFS.
* GPFS is a high-performance file system which provides rapid reads and writes to large data sets in parallel from many nodes.
* Accessing data sets which consist of many, small files leads to poor performance on GPFS.
* Avoid reading and writing lots of small amounts of data to disk.  Many small files on the system waste space and are slower to access, read and write.  If you must write many small files, use [https://docs.scinet.utoronto.ca/index.php/User_Ramdisk ramdisk].
* Write data out in a binary format. This is faster and takes less space.
* The [https://docs.scinet.utoronto.ca/index.php/Burst_Buffer Burst Buffer] is better for i/o heavy jobs and to speed up [https://docs.scinet.utoronto.ca/index.php/Checkpoints checkpoints].


Because Niagara is scheduled by node, hyperthreading is actually fairly easy to use:
== Example submission script (MPI) == <!--T:90-->
</translate>
<source lang="bash">
#!/bin/bash
#SBATCH --nodes=2
#SBATCH --ntasks=80
#SBATCH --time=1:00:00
#SBATCH --job-name mpi_job
#SBATCH --output=mpi_output_%j.txt
#SBATCH --mail-type=FAIL
cd $SLURM_SUBMIT_DIR
module load intel/2018.2
module load openmpi/3.1.0
mpirun ./mpi_example
# or "srun ./mpi_example"
</source>
<translate>
<!--T:91-->
Submit this script from your scratch directory with the command:
<source lang="bash">nia-login07:scratch$ sbatch mpi_job.sh</source>


<!--T:226-->
<ul>
<li>First line indicates that this is a bash script.</li>
<li>Lines starting with <code>#SBATCH</code> go to SLURM.</li>
<li>sbatch reads these lines as a job request (which it gives the name <code>mpi_job</code>)</li>
<li>In this case, SLURM looks for 2 nodes (each of which will have 40 cores) on which to run a total of 80 tasks, for 1 hour.<br>(Instead of specifying <tt>--ntasks=80</tt>, you can also ask for <tt>--ntasks-per-node=40</tt>, which amounts to the same.)</li>
<li>Note that the mpifun flag "--ppn" (processors per node) is ignored.</li>
<li>Once it found such a node, it runs the script:
<ul>
<ul>
<li>Ask for a certain number of nodes N for your jobs.</li>
<li>Change to the submission directory;</li>
<li>You know that you get 40xN cores, so you will use (at least) a total of 40xN mpi processes or threads. (mpirun, srun, and the OS will automaticallly spread these over the real cores)</li>
<li>Loads modules;</li>
<li>But you should also test if running 80xN mpi processes or threads gives you any speedup.</li>
<li>Runs the <code>mpi_example</code> application (SLURM will inform mpirun or srun on how many processes to run).
<li>Regardless, your usage will be counted as 40xNx(walltime in years).</li>
</li>
</ul>
<li>To use hyperthreading, just change --ntasks=80 to --ntasks=160, and add --bind-to none to the mpirun command (the latter is necessary for OpenMPI only, not when using IntelMPI).
</ul>
</ul>


== Example submission script (OpenMP) ==
== Example submission script (OpenMP) == <!--T:87-->
 
Suppose you want to run a single nodes, multithreaded application that uses [[OpenMP]]. The job script could look as follows:


</translate>
<source lang="bash">#!/bin/bash
<source lang="bash">#!/bin/bash
#!/bin/bash
#SBATCH --nodes=1
#SBATCH --nodes=1
#SBATCH --cpus-per-task=40
#SBATCH --cpus-per-task=40
Line 393: Line 456:
#SBATCH --job-name openmp_job
#SBATCH --job-name openmp_job
#SBATCH --output=openmp_output_%j.txt
#SBATCH --output=openmp_output_%j.txt
 
#SBATCH --mail-type=FAIL
cd $SLURM_SUBMIT_DIR
cd $SLURM_SUBMIT_DIR
 
module load intel/2018.2
module load intel/2018.2
 
export OMP_NUM_THREADS=$SLURM_CPUS_PER_TASK
export OMP_NUM_THREADS=$SLURM_CPUS_PER_TASK
 
./openmp_example
./openmp_example
# or "srun ./openmp_example".
# or "srun ./openmp_example".
</source>
</source>
Submit this script (if it is called openmp_job.sh) with the command:
<translate>
<source lang="bash">nia-login07:~$ sbatch openmp_job.sh</source>
<!--T:89-->
Submit this script from your scratch directory with the command:
<source lang="bash">nia-login07:scratch$ sbatch openmp_job.sh</source>
* First line indicates that this is a bash script.
* First line indicates that this is a bash script.
* Lines starting with <code>#SBATCH</code> go to SLURM.
* Lines starting with <code>#SBATCH</code> go to SLURM.
* sbatch reads these lines as a job request (which it gives the name <code>openmp_job</code>) .
* sbatch reads these lines as a job request (which it gives the name <code>openmp_ex</code>) .
* In this case, SLURM looks for one node with 40 cores to be run inside one task, for 1 hour.
* In this case, SLURM looks for one node with 40 cores to be run inside one task, for 1 hour.
* Once it found such a node, it runs the script:
* Once it found such a node, it runs the script:
Line 413: Line 479:
** Loads modules (must be done again in the submission script on Niagara);
** Loads modules (must be done again in the submission script on Niagara);
** Sets an environment variable to set the number of threads to 40 (no hyperthreading in this example);
** Sets an environment variable to set the number of threads to 40 (no hyperthreading in this example);
** Runs the <code>openmp_example</code> application.
** Runs the <code>appl_openmp_ex</code> application.
* To use hyperthreading, just change <tt>--cpus-per-task=40</tt> to <tt>--cpus-per-task=80</tt>.
* To use hyperthreading, just change <tt>--cpus-per-task=40</tt> to <tt>--cpus-per-task=80</tt>.


== Example submission script (MPI) ==
== Monitoring queued jobs == <!--T:92-->
Suppose you want to run an [[MPI]] application with 320 processes. The job script could look as follows:
<source lang="bash">#!/bin/bash
#SBATCH --nodes=8
#SBATCH --ntasks=320
#SBATCH --time=1:00:00
#SBATCH --job-name mpi_job
#SBATCH --output=mpi_output_%j.txt


cd $SLURM_SUBMIT_DIR
<!--T:93-->
 
Once the job is incorporated into the queue, there are some command you can use to monitor its progress.
module load intel/2018.2
module load openmpi/3.1.0rc3


mpirun ./mpi_example
<!--T:94-->
# or "srun ./mpi_example"
</source>
Submit this script (if it is called mpi_job.sh) with the command:
<source lang="bash">nia-login07:~$ sbatch mpi_job.sh</source>
<ul>
<ul>
<li><p>First line indicates that this is a bash script.</p></li>
<li><p><code>squeue</code> or <code>sqc</code> (a caching version of squeue) to show the job queue (<code>squeue -u $USER</code> for just your jobs);</p></li>
<li><p>Lines starting with <code>#SBATCH</code> go to SLURM.</p></li>
<li><code>qsum</code> shows a summary of qudue by user
<li><p>sbatch reads these lines as a job request (which it gives the name <code>mpi_job</code>)</p></li>
<li><code>squeue -j JOBID</code> to get information on a specific job
<li><p>In this case, SLURM looks for 8 nodes with 40 cores on which to run 320 tasks, for 1 hour.</p></li>
<p>(alternatively, <code>scontrol show job JOBID</code>, which is more verbose).</p></li>
<li><p>Once it found such a node, it runs the script:</p>
<li><p><code>squeue --start -j JOBID</code> to get an estimate for when a job will run; these tend not to be very accurate predictions.</p></li>
<ul>
<li><p><code>scancel -i JOBID</code> to cancel the job.</p></li>
<li>Change to the submission directory;</li>
<li><p><code>jobperf JOBID</code> to get an instantaneous view of the cpu and memory usage of the nodes of the job while it is running.</p></li>
<li>Loads modules;</li>
<li><p><code>sacct</code> to get information on your recent jobs.</p></li>
<li>Runs the <code>mpi_example</code> application.</li></ul>
</li>
<li>To use hyperthreading, just change <tt>--ntasks=320</tt> to <tt>--ntasks=640</tt></li>.
</ul>
</ul>


= Monitoring queued jobs =
<!--T:103-->
Further instructions for monitoring your jobs can be found on the [https://docs.scinet.utoronto.ca/index.php/Slurm#Monitoring_jobs Slurm page].  The [https://my.scinet.utoronto.ca my.SciNet] site is also a very useful tool for monitoring your current and past usage.
 
= Visualization = <!--T:203-->
Information about how to use visualization tools on Niagara is available on [https://docs.scinet.utoronto.ca/index.php/Visualization Visualization] page.


Once the job is incorporated into the queue, there are some command you can use to monitor its progress.
= Further information = <!--T:204-->


<ul>
<!--T:205-->
<li><p><code>squeue</code> to show the job queue (<code>squeue -u $USER</code> for just your jobs);</p></li>
'''Useful sites'''
<li><p><code>squeue -j JOBID</code> to get information on a specific job</p>
<p>(alternatively, <code>scontrol show job JOBID</code>, which is more verbose).</p></li>
<li><p><code>squeue -j JOBID -o &quot;%.9i %.9P %.8j %.8u %.2t %.10M %.6D %S&quot;</code> to get an estimate for when a job will run.</p></li>
<li><p><code>scancel -i JOBID</code> to cancel the job.</p></li>
<li><p><code>sinfo -pcompute</code> to look at available nodes.</p></li>
<li><p>More utilities like those that were available on the GPC are under development.</p></li></ul>


= Data Management and I/O Tips =
<!--T:206-->
* SciNet: https://www.scinet.utoronto.ca
* Niagara: [[Niagara|Niagara wiki page]]
* System Status: https://docs.scinet.utoronto.ca/index.php/Main_Page
* Training: https://support.scinet.utoronto.ca/education


* $HOME, $SCRATCH, and $PROJECT all use the parallel file system called GPFS.
<!--T:207-->
* Your files can be seen on all Niagara login and compute nodes.
'''Support'''
* GPFS is a high-performance file system which provides rapid reads and writes to large data sets in parallel from many nodes.
Contact our [[Technical support]]
* But accessing data sets which consist of many, small files leads to poor performance.
* Avoid reading and writing lots of small amounts of data to disk.<br />


* Many small files on the system would waste space and would be slower to access, read and write.
</translate>
* Write data out in binary. Faster and takes less space.
* Burst buffer (to come) is better for i/o heavy jobs and to speed up checkpoints.

Latest revision as of 15:34, 11 July 2024

Other languages:

Specifications[edit]

The Niagara cluster is a large cluster of 1548 Lenovo SD350 servers each with 40 Intel "Skylake" cores at 2.4 GHz. The peak performance of the cluster is 3.02 PFlops delivered / 4.75 PFlops theoretical. It is the 53rd fastest supercomputer on the TOP500 list of June 2018.

Each node of the cluster has 188 GiB / 202 GB RAM per node (at least 4 GiB/core for user jobs). Being designed for large parallel workloads, it has a fast interconnect consisting of EDR InfiniBand in a Dragonfly+ topology with Adaptive Routing. The compute nodes are accessed through a queueing system that allows jobs with a minimum of 15 minutes and a maximum of 24 hours and favours large jobs.

See the Intro to Niagara recording

More detailed hardware characteristics of the Niagara supercomputer can be found on this page.

Getting started on Niagara[edit]

Access to Niagara is not enabled automatically for everyone with an Alliance account, but anyone with an active Alliance account can get their access enabled.

If you have an active Alliance account but you do not have access to Niagara yet (e.g. because you are a new user and belong to a group whose primary PI does not have an allocation as granted in the annual Alliance RAC), go to the opt-in page on the CCDB site. After clicking the "Join" button on that page, it usually takes only one or two business days for access to be granted.

Please read this document carefully. The FAQ is also a useful resource. If at any time you require assistance, or if something is unclear, please do not hesitate to contact us.

Logging in[edit]

Niagara runs CentOS 7, which is a type of Linux. You will need to be familiar with Linux systems to work on Niagara. If you are not it will be worth your time to review the Linux introduction or to attend a local "Linux Shell" workshop.

As with all SciNet and Alliance compute systems, access to Niagara is done via ssh (secure shell) only. As of January 22 2022, authentication is only allowed via SSH keys. Please refer to this page to generate your SSH key pair and make sure you use them securely.

Open a terminal window (e.g. PuTTY on Windows or MobaXTerm), then ssh into the Niagara login nodes with your CC credentials:

$ ssh -i /path/to/ssh_private_key -Y MYCCUSERNAME@niagara.scinet.utoronto.ca

or

$ ssh -i /path/to/ssh_private_key -Y MYCCUSERNAME@niagara.computecanada.ca

The Niagara login nodes are where you develop, edit, compile, prepare and submit jobs.

These login nodes are not part of the Niagara compute cluster, but have the same architecture, operating system, and software stack.

The optional -Y is needed to open windows from the Niagara command-line onto your local X server.

To run on Niagara's compute nodes, you must submit a batch job.

If you cannot log in, be sure first to check the System Status on this site's front page.

Your various directories[edit]

By virtue of your access to Niagara you are granted storage space on the system. There are several directories available to you, each indicated by an associated environment variable

home and scratch[edit]

You have a home and scratch directory on the system, whose locations are of the form

$HOME=/home/g/groupname/myccusername

$SCRATCH=/scratch/g/groupname/myccusername

where groupname is the name of your PI's group, and myccusername is your CC username. For example:

nia-login07:~$ pwd
/home/s/scinet/rzon
nia-login07:~$ cd $SCRATCH
nia-login07:rzon$ pwd
/scratch/s/scinet/rzon

NOTE: home is read-only on compute nodes.

project and archive[edit]

Users from groups with RAC storage allocation will also have a project and possibly an archive directory.

$PROJECT=/project/g/groupname/myccusername

$ARCHIVE=/archive/g/groupname/myccusername

NOTE: Currently archive space is available only via HPSS, and is not accessible on the Niagara login, compute, or datamover nodes.

IMPORTANT: Future-proof your scripts

When writing your scripts, use the environment variables ($HOME, $SCRATCH, $PROJECT, $ARCHIVE) instead of the actual paths! The paths may change in the future.

Storage and quotas[edit]

You should familiarize yourself with the various file systems, what purpose they serve, and how to properly use them. This table summarizes the various file systems. See the Data management at Niagara page for more details.

location quota block size expiration time backed up on login nodes on compute nodes
$HOME 100 GB per user 1 MB yes yes read-only
$SCRATCH 25 TB per user 16 MB 2 months no yes yes
50-500TB per group depending on group size
$PROJECT by group allocation 16 MB yes yes yes
$ARCHIVE by group allocation dual-copy no no
$BBUFFER 10 TB per user 1 MB very short no yes yes

Moving data to Niagara[edit]

If you need to move data to Niagara for analysis, or when you need to move data off of Niagara, use the following guidelines:

  • If your data is less than 10GB, move the data using the login nodes.
  • If your data is greater than 10GB, move the data using the datamover nodes nia-datamover1.scinet.utoronto.ca and nia-datamover2.scinet.utoronto.ca .

Details of how to use the datamover nodes can be found on the Data management at Niagara page.

Loading software modules[edit]

You have two options for running code on Niagara: use existing software, or compile your own. This section focuses on the former.

Other than essentials, all installed software is made available using module commands. These modules set environment variables (PATH, etc.), allowing multiple, conflicting versions of a given package to be available. A detailed explanation of the module system can be found on the modules page.

Common module subcommands are:

  • module load <module-name>: use particular software
  • module purge: remove currently loaded modules
  • module spider (or module spider <module-name>): list available software packages
  • module avail: list loadable software packages
  • module list: list loaded modules
  • Along with modifying common environment variables, such as PATH, and LD_LIBRARY_PATH, these modules also create a SCINET_MODULENAME_ROOT environment variable, which can be used to access commonly needed software directories, such as /include and /lib. There are handy abbreviations for the module commands. ml is the same as module list, and ml <module-name> is the same as module load <module-name>.

    Software stacks: NiaEnv and CCEnv[edit]

    On Niagara, there are two available software stacks:

    1. A Niagara software stack tuned and compiled for this machine. This stack is available by default, but if not, can be reloaded with

      module load NiaEnv
    2. The standard Alliance software stack which is available on Alliance's other clusters (including Graham, Cedar, Narval, and Beluga):

      module load CCEnv arch/avx512
      (without the arch/avx512 module, you'd get the modules for a previous generation of CPUs)

      Or, if you want the same default modules loaded as on Cedar, Graham, and Beluga, then do

      module load CCEnv arch/avx512 StdEnv/2018.3

    Tips for loading software[edit]

    We advise against loading modules in your .bashrc.
    This could lead to very confusing behaviour under certain circumstances.

    Our guidelines for .bashrc files can be found here

    Instead, load modules by hand when needed, or by sourcing a separate script.

    Load run-specific modules inside your job submission script.

    Short names give default versions; e.g. intelintel/2018.2. It is usually better to be explicit about the versions, for future reproducibility.

    Modules sometimes require other modules to be loaded first.

    Solve these dependencies by using module spider.

    Available compilers and interpreters[edit]

    • For most compiled software, one should use the Intel compilers (icc for C, icpc for C++, and ifort for Fortran). Loading an intel module makes these available.
    • The GNU compiler suite (gcc, g++, gfortran) is also available, if you load one of the gcc modules.
    • Open source interpreted, interactive software is also available:

    Please visit the Python or R page for details on using these tools. For information on running MATLAB applications on Niagara, visit this page.

    Using Commercial Software[edit]

    May I use commercial software on Niagara?

    • Possibly, but you have to bring your own license for it. You can connect to an external license server using ssh tunneling.
    • SciNet and Alliance have an extremely large and broad user base of thousands of users, so we cannot provide licenses for everyone's favorite software.
    • Thus, the only commercial software installed on Niagara is software that can benefit everyone: compilers, math libraries and debuggers.
    • That means no MATLAB, Gaussian, IDL,
    • Open source alternatives like Octave, Python, and R are available.
    • We are happy to help you to install commercial software for which you have a license.
    • In some cases, if you have a license, you can use software in the Alliance stack.

    The list of commercial software which is installed on Niagara, for which you will need a license to use, can be found on the commercial software page.

    Compiling on Niagara: Example[edit]

    Suppose one want to compile an application from two c source files, main.c and module.c, which use the Gnu Scientific Library (GSL). This is an example of how this would be done:

    nia-login07:~$ module list
    Currently Loaded Modules:
      1) NiaEnv/2018a (S)
      Where:
       S:  Module is Sticky, requires --force to unload or purge
    
    nia-login07:~$ module load intel/2018.2 gsl/2.4
    
    nia-login07:~$ ls
    appl.c module.c
    
    nia-login07:~$ icc -c -O3 -xHost -o appl.o appl.c
    nia-login07:~$ icc -c -O3 -xHost -o module.o module.c
    nia-login07:~$ icc  -o appl module.o appl.o -lgsl -mkl
    
    nia-login07:~$ ./appl
    

    Note:

    • The optimization flags -O3 -xHost allow the Intel compiler to use instructions specific to the architecture CPU that is present (instead of for more generic x86_64 CPUs).
    • Linking with this library is easy when using the intel compiler, it just requires the -mkl flags.
    • If compiling with gcc, the optimization flags would be -O3 -march=native. For the way to link with the MKL, it is suggested to use the MKL link line advisor.

    Testing[edit]

    You really should test your code before you submit it to the cluster to know if your code is correct and what kind of resources you need.

    • Small test jobs can be run on the login nodes.

      Rule of thumb: tests should run no more than a couple of minutes, taking at most about 1-2GB of memory, and use no more than a couple of cores.

    • You can run the ddt debugger on the login nodes after module load ddt.

    • Short tests that do not fit on a login node, or for which you need a dedicated node, request an interactive debug job with the debug command:

      nia-login07:~$ debugjob N
      

      where N is the number of nodes, If N=1, this gives an interactive session one 1 hour, when N=4 (the maximum), it gives you 30 minutes.

      Finally, if your debugjob process takes more than 1 hour, you can request an interactive job from the regular queue using the salloc command. Note, however, that this may take some time to run, since it will be part of the regular queue, and will be run when the scheduler decides.

      nia-login07:~$ salloc --nodes N --time=M:00:00
      

      here N is again the number of nodes, and M is the number of hours you wish the job to run.

      If you need to use graphics while testing your code through salloc, e.g. when using a debugger such as DDT or DDD, you have the following options, please visit the Testing with graphics page.

    Submitting jobs[edit]

    • Niagara uses SLURM as its job scheduler.

    • You submit jobs from a login node by passing a script to the sbatch command:

      nia-login07:scratch$ sbatch jobscript.sh
      
    • This puts the job in the queue. It will run on the compute nodes in due course.

    • In most cases, you will want to submit from your $SCRATCH directory, so that the output of your compute job can be written out (as mentioned above, $HOME is read-only on the compute nodes).

    • Jobs will run under their group's RRG allocation, or, if the group has none, under a RAS allocation (previously called 'default' allocation).

    • Some example job scripts can be found below.

    Keep in mind:

    • Scheduling is by node, so in multiples of 40-cores.

    • Your job's maximum walltime is 24 hours.

    • Jobs must write to your scratch or project directory (home is read-only on compute nodes).

    • Compute nodes have no internet access.

      Move your data to Niagara before you submit your job.

    Scheduling by node[edit]

    On many systems that use SLURM, the scheduler will deduce from the specifications of the number of tasks and the number of cpus-per-node what resources should be allocated. On Niagara things are a bit different.

    • All job resource requests on Niagara are scheduled as a multiple of nodes.

    • The nodes that your jobs run on are exclusively yours, for as long as the job is running on them.
      • No other users are running anything on them.
      • You can ssh into them to see how things are going.
    • Whatever your requests to the scheduler, it will always be translated into a multiple of nodes allocated to your job.

    • Memory requests to the scheduler are of no use. Your job always gets N x 202GB of RAM, where N is the number of nodes and 202GB is the amount of memory on the node.

    • If you run serial jobs you must still use all 40 cores on the node. Visit the serial jobs page for examples of how to do this.

    • Since there are 40 cores per node, your job should use N x 40 cores. If you do not, we will contact you to help you optimize your workflow. Or you can contact us to get assistance.

    Limits[edit]

    There are limits to the size and duration of your jobs, the number of jobs you can run and the number of jobs you can have queued. It matters whether a user is part of a group with a Resources for Research Group allocation or not. It also matters in which 'partition' the jobs runs. 'Partitions' are SLURM-speak for use cases. You specify the partition with the -p parameter to sbatch or salloc, but if you do not specify one, your job will run in the compute partition, which is the most common case.

    Usage Partition Running jobs Submitted jobs (incl. running) Min. size of jobs Max. size of jobs Min. walltime Max. walltime
    Compute jobs with an allocation compute 50 1000 1 node (40 cores) 1000 nodes (40000 cores) 15 minutes 24 hours
    Compute jobs without allocation ("default") compute 50 200 1 node (40 cores) 20 nodes (800 cores) 15 minutes 24 hours
    Testing or troubleshooting debug 1 1 1 node (40 cores) 4 nodes (160 cores) N/A 1 hour
    Archiving or retrieving data in HPSS archivelong 2 per user (max 5 total) 10 per user N/A N/A 15 minutes 72 hours
    Inspecting archived data, small archival actions in HPSS archiveshort 2 per user 10 per user N/A N/A 15 minutes 1 hour

    Within these limits, jobs will still have to wait in the queue. The waiting time depends on many factors such as the allocation amount, how much allocation was used in the recent past, the number of nodes and the walltime, and how many other jobs are waiting in the queue.

    File Input/Output Tips[edit]

    It is important to understand the file systems, so as to perform your file I/O (Input/Output) responsibly. Refer to the Data management at Niagara page for details about the file systems.

    • Your files can be seen on all Niagara login and compute nodes.
    • $HOME, $SCRATCH, and $PROJECT all use the parallel file system called GPFS.
    • GPFS is a high-performance file system which provides rapid reads and writes to large data sets in parallel from many nodes.
    • Accessing data sets which consist of many, small files leads to poor performance on GPFS.
    • Avoid reading and writing lots of small amounts of data to disk. Many small files on the system waste space and are slower to access, read and write. If you must write many small files, use ramdisk.
    • Write data out in a binary format. This is faster and takes less space.
    • The Burst Buffer is better for i/o heavy jobs and to speed up checkpoints.

    Example submission script (MPI)[edit]

    #!/bin/bash 
    #SBATCH --nodes=2
    #SBATCH --ntasks=80
    #SBATCH --time=1:00:00
    #SBATCH --job-name mpi_job
    #SBATCH --output=mpi_output_%j.txt
    #SBATCH --mail-type=FAIL
     
    cd $SLURM_SUBMIT_DIR
     
    module load intel/2018.2
    module load openmpi/3.1.0
     
    mpirun ./mpi_example
    # or "srun ./mpi_example"
    

    Submit this script from your scratch directory with the command:

    nia-login07:scratch$ sbatch mpi_job.sh
    
    • First line indicates that this is a bash script.
    • Lines starting with #SBATCH go to SLURM.
    • sbatch reads these lines as a job request (which it gives the name mpi_job)
    • In this case, SLURM looks for 2 nodes (each of which will have 40 cores) on which to run a total of 80 tasks, for 1 hour.
      (Instead of specifying --ntasks=80, you can also ask for --ntasks-per-node=40, which amounts to the same.)
    • Note that the mpifun flag "--ppn" (processors per node) is ignored.
    • Once it found such a node, it runs the script:
      • Change to the submission directory;
      • Loads modules;
      • Runs the mpi_example application (SLURM will inform mpirun or srun on how many processes to run).
    • To use hyperthreading, just change --ntasks=80 to --ntasks=160, and add --bind-to none to the mpirun command (the latter is necessary for OpenMPI only, not when using IntelMPI).

    Example submission script (OpenMP)[edit]

    #!/bin/bash
    #!/bin/bash
    #SBATCH --nodes=1
    #SBATCH --cpus-per-task=40
    #SBATCH --time=1:00:00
    #SBATCH --job-name openmp_job
    #SBATCH --output=openmp_output_%j.txt
    #SBATCH --mail-type=FAIL
     
    cd $SLURM_SUBMIT_DIR
     
    module load intel/2018.2
     
    export OMP_NUM_THREADS=$SLURM_CPUS_PER_TASK
     
    ./openmp_example
    # or "srun ./openmp_example".
    

    Submit this script from your scratch directory with the command:

    nia-login07:scratch$ sbatch openmp_job.sh
    
    • First line indicates that this is a bash script.
    • Lines starting with #SBATCH go to SLURM.
    • sbatch reads these lines as a job request (which it gives the name openmp_ex) .
    • In this case, SLURM looks for one node with 40 cores to be run inside one task, for 1 hour.
    • Once it found such a node, it runs the script:
      • Change to the submission directory;
      • Loads modules (must be done again in the submission script on Niagara);
      • Sets an environment variable to set the number of threads to 40 (no hyperthreading in this example);
      • Runs the appl_openmp_ex application.
    • To use hyperthreading, just change --cpus-per-task=40 to --cpus-per-task=80.

    Monitoring queued jobs[edit]

    Once the job is incorporated into the queue, there are some command you can use to monitor its progress.

    • squeue or sqc (a caching version of squeue) to show the job queue (squeue -u $USER for just your jobs);

    • qsum shows a summary of qudue by user
    • squeue -j JOBID to get information on a specific job

      (alternatively, scontrol show job JOBID, which is more verbose).

    • squeue --start -j JOBID to get an estimate for when a job will run; these tend not to be very accurate predictions.

    • scancel -i JOBID to cancel the job.

    • jobperf JOBID to get an instantaneous view of the cpu and memory usage of the nodes of the job while it is running.

    • sacct to get information on your recent jobs.

    Further instructions for monitoring your jobs can be found on the Slurm page. The my.SciNet site is also a very useful tool for monitoring your current and past usage.

    Visualization[edit]

    Information about how to use visualization tools on Niagara is available on Visualization page.

    Further information[edit]

    Useful sites

    Support Contact our Technical support