<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://rcs.ucalgary.ca/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Phillips</id>
	<title>RCSWiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://rcs.ucalgary.ca/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Phillips"/>
	<link rel="alternate" type="text/html" href="https://rcs.ucalgary.ca/Special:Contributions/Phillips"/>
	<updated>2026-04-06T21:54:45Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.43.3</generator>
	<entry>
		<id>https://rcs.ucalgary.ca/index.php?title=Abaqus&amp;diff=631</id>
		<title>Abaqus</title>
		<link rel="alternate" type="text/html" href="https://rcs.ucalgary.ca/index.php?title=Abaqus&amp;diff=631"/>
		<updated>2020-05-31T15:30:11Z</updated>

		<summary type="html">&lt;p&gt;Phillips: /* Full node example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Abaqus]]&lt;br /&gt;
[[Category:Software]]&lt;br /&gt;
[[Category:ARC]]&lt;br /&gt;
&amp;lt;span id=&amp;quot;contents&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
= &amp;lt;span id=&amp;quot;intro&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Introduction =&lt;br /&gt;
[https://www.3ds.com/products-services/simulia/products/abaqus/ Abaqus (external link)] is a commercial suite of programs for finite element analysis, including static, dynamic and thermal analysis of materials, with sophisticated options for handling contacts and nonlinear materials.&lt;br /&gt;
&lt;br /&gt;
Typically, researchers will install Abaqus on their own computers to develop models in a graphical user interface (Abaqus CAE) and then run simulations that exceed their local hardware capabilities on ARC.  Output from runs on ARC is then transferred back to the researchers&#039; own computers for visualization.&lt;br /&gt;
&lt;br /&gt;
The software can be downloaded, upon approval, from the [https://iac01.ucalgary.ca/SDSWeb/ Information Technologies Software Distribution] web site. A student version, for Microsoft Windows computers only, with limitations on model size is available directly from [https://academy.3ds.com/en/software/abaqus-student-edition Dassault Systèmes (external link)].&lt;br /&gt;
&lt;br /&gt;
Abaqus is available to all U of C researchers with an ARC account, but, due to the limited number of licenses it is important to be thoroughly familiar with the licensing restrictions outlined in the next section.&lt;br /&gt;
&lt;br /&gt;
= Licensing considerations =&lt;br /&gt;
&lt;br /&gt;
For many years, Information Technologies has provided a limited number of license tokens for research and teaching versions of the Abaqus software, sometimes supplemented by contributions from researchers. The software contract is typically renewed annually in August.  If you are interested in contributing to the pool of licenses, you can write to the IT Help Desk [mailto:itsupport@ucalgary.ca itsupport@ucalgary.ca] and ask that your email be redirected to the IT software librarian.&lt;br /&gt;
&lt;br /&gt;
The discussion that follows relates only to the research version of the software.  Note that the conditions of use of the teaching licenses prohibits them from being used for research projects.&lt;br /&gt;
&lt;br /&gt;
At the time of this writing in May 2020, there are only 83 research license tokens available.  The number of tokens available at a given time can be seen by running the lmstat command on ARC:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/global/software/abaqus/2019_licensing_only/linux_a64/code/bin/lmstat -c 27001@abaqus.ucalgary.ca -a&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The number of license tokens, t, used for a given job depends on the number of CPU cores, c, requested for Abaqus to use according to the formula t=integer part of (5 * c^0.422).  This formula has been implemented on the [https://deviceanalytics.com/abaqus-token-calculator Abaqus Token Calculator web page (external link)], but, here is a table showing some examples.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin: auto;&amp;quot;&lt;br /&gt;
! Cores&lt;br /&gt;
! Tokens&lt;br /&gt;
|-&lt;br /&gt;
| 8&lt;br /&gt;
| 12&lt;br /&gt;
|-&lt;br /&gt;
| 12&lt;br /&gt;
| 14&lt;br /&gt;
|-&lt;br /&gt;
| 16&lt;br /&gt;
| 16&lt;br /&gt;
|-&lt;br /&gt;
| 20&lt;br /&gt;
| 17&lt;br /&gt;
|-&lt;br /&gt;
| 24&lt;br /&gt;
| 19&lt;br /&gt;
|-&lt;br /&gt;
| 32&lt;br /&gt;
| 21&lt;br /&gt;
|-&lt;br /&gt;
| 36&lt;br /&gt;
| 22&lt;br /&gt;
|-&lt;br /&gt;
| 40&lt;br /&gt;
| 23&lt;br /&gt;
|-&lt;br /&gt;
| 48&lt;br /&gt;
| 25&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Generally speaking, unless you have a small model to process, the more cores you use, the more efficiently the license tokens will be used.  Similarly, using the fastest hardware available will provide the most value for a given number of license tokens.  With those considerations in mind, using a full 40-core compute node, selected by specifying the cpu2019 partition in your batch job (see example scripts below), is preferred .  However, as there is often a shortage of license tokens, you will likely have to use just part of a compute node.&lt;br /&gt;
&lt;br /&gt;
= Running Abaqus batch jobs on ARC =&lt;br /&gt;
Researchers using Abaqus on ARC are expected to be generally familiar with Abaqus capabilities, input file format and the use of restart files.&lt;br /&gt;
&lt;br /&gt;
Like other calculations on ARC systems, Abaqus is run by submitting an appropriate script for batch scheduling using the sbatch command. For more information about submitting jobs, see the ARC [[Running_jobs |Running Jobs]] page.&lt;br /&gt;
&lt;br /&gt;
The scripts below can serve as a template for your own batch job scripts . Modify the variable assignment &#039;&#039;&#039;ABAQUS_COMMAND_FILE=t1-std.inp&#039;&#039;&#039; to reference your own input file of Abaqus commands.  For jobs with a time requirement of five hours or less, such as when testing a new model, the &amp;quot;back-fill&amp;quot; partitions can be requested for reducing the likely waiting time in the input queue. For that purpose you could change the --time and --partition lines to &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#SBATCH --time=05:00:00&lt;br /&gt;
#SBATCH --partition=pawson-bf,apophis-bf,razi-bf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Full node example ==&lt;br /&gt;
When running on a full compute node, specify &#039;&#039;&#039;--mem=0&#039;&#039;&#039; to request all the associated memory on the node. Note that when using the cpu2019 partition (40-core nodes), a full-node Abaqus job will take 23 license tokens.&lt;br /&gt;
&lt;br /&gt;
This script is available on ARC as &#039;&#039;&#039;/global/software/abaqus/scripts/abaqus_2019_full_node.slurm&#039;&#039;&#039; .&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
&lt;br /&gt;
#SBATCH --nodes=1&lt;br /&gt;
#SBATCH --tasks-per-node=40&lt;br /&gt;
#SBATCH --cpus-per-task=1&lt;br /&gt;
#SBATCH --time=24:00:00&lt;br /&gt;
#SBATCH --mem=0&lt;br /&gt;
#SBATCH --partition=cpu2019&lt;br /&gt;
&lt;br /&gt;
# 2019-02-12 DSP - Full-node Abaqus test on Arc (cpu2019 partition) for Abaqus 2019&lt;br /&gt;
&lt;br /&gt;
# For the initial run, RECOVER should be empty.&lt;br /&gt;
# For subsequent restarts RECOVER=&amp;quot;recover&amp;quot; - for Abaqus Explicit runs only.&lt;br /&gt;
RECOVER=&amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Specify the job name for the Abaqus input (with .inp suffix) &lt;br /&gt;
ABAQUS_COMMAND_FILE=t1-std.inp &lt;br /&gt;
&lt;br /&gt;
# Strip off the .inp suffix to give the job name to use on the Abaqus command line. &lt;br /&gt;
ABAQUS_JOB=`basename $ABAQUS_COMMAND_FILE .inp` &lt;br /&gt;
&lt;br /&gt;
# Override the default scratch location:&lt;br /&gt;
# /global/software/abaqus/2019/solver/linux_a64/SMA/site/custom_v6.env&amp;quot;&lt;br /&gt;
SCRATCH=$PWD&lt;br /&gt;
&lt;br /&gt;
# Specify the version of the software to use&lt;br /&gt;
ABAQUS_VERSION=&amp;quot;2019&amp;quot;&lt;br /&gt;
ABAQUS_HOME=&amp;quot;/global/software/abaqus&amp;quot;&lt;br /&gt;
ABAQUS=${ABAQUS_HOME}/Commands/abq2019&lt;br /&gt;
&lt;br /&gt;
# --------------  Report some basic information about this run  --------------&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Running on host: &amp;quot; `hostname`&lt;br /&gt;
echo &amp;quot;Current working directory is `pwd`&amp;quot;&lt;br /&gt;
echo &amp;quot;Using $SCRATCH for ABAQUS temporary files&amp;quot;&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Node list: SLURM_JOB_NODELIST :&amp;quot;&lt;br /&gt;
echo &amp;quot;---------------------&amp;quot;&lt;br /&gt;
echo $SLURM_JOB_NODELIST&lt;br /&gt;
echo &amp;quot;---------------------&amp;quot;&lt;br /&gt;
&lt;br /&gt;
CORES=${SLURM_NTASKS}&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Running on $CORES cores.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Unsetting SLURM_GTIDS is said to be necessary to work with Abaqus&#039; Platform MPI.&lt;br /&gt;
# That was not sufficient to get Abaqus to work on multiple nodes.&lt;br /&gt;
unset SLURM_GTIDS&lt;br /&gt;
&lt;br /&gt;
# Try to avoid &amp;quot;Internal Error: Cannot initialize RDMA protocol&amp;quot;&lt;br /&gt;
export MPI_IC_ORDER=tcp&lt;br /&gt;
&lt;br /&gt;
ENV_FILE=abaqus_v6.env&lt;br /&gt;
&lt;br /&gt;
cat &amp;lt;&amp;lt; EOF &amp;gt; ${ENV_FILE}&lt;br /&gt;
ask_delete = OFF&lt;br /&gt;
mp_file_system = (SHARED, SHARED)&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
NODE_LIST=$(scontrol show hostname ${SLURM_NODELIST} | sort -u)&lt;br /&gt;
&lt;br /&gt;
mp_host_list=&amp;quot;[&amp;quot;&lt;br /&gt;
for host in ${NODE_LIST}; do&lt;br /&gt;
    mp_host_list=&amp;quot;${mp_host_list}[&#039;$host&#039;, ${SLURM_CPUS_ON_NODE}],&amp;quot;&lt;br /&gt;
done&lt;br /&gt;
&lt;br /&gt;
mp_host_list=$(echo ${mp_host_list} | sed -e &amp;quot;s/,$/]/&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;mp_host_list=${mp_host_list}&amp;quot;  &amp;gt;&amp;gt; ${ENV_FILE}&lt;br /&gt;
&lt;br /&gt;
$ABAQUS job=${ABAQUS_JOB} cpus=${CORES} scratch=${SCRATCH} ${RECOVER} interactive&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Finished at `date`&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Partial node example ==&lt;br /&gt;
&lt;br /&gt;
Note that when running on less than a complete compute node, the default Abaqus parallel processing mode based on MPI (Message Passing Interface) does not work properly on ARC. Instead, use &#039;&#039;&#039;mp_mode=THREADS&#039;&#039;&#039; as shown in this example. The number of cores to use is specified by the -&#039;&#039;&#039;-cpus-per-task&#039;&#039;&#039; parameter and you should also specify a non-zero value for the &#039;&#039;&#039;--mem&#039;&#039;&#039; (memory) parameter.&lt;br /&gt;
&lt;br /&gt;
This script is available on ARC as &#039;&#039;&#039;/global/software/abaqus/scripts/abaqus_2019_partial_node.slurm&#039;&#039;&#039; .&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
&lt;br /&gt;
#SBATCH --nodes=1&lt;br /&gt;
#SBATCH --ntasks=1&lt;br /&gt;
#SBATCH --cpus-per-task=20&lt;br /&gt;
#SBATCH --time=24:00:00&lt;br /&gt;
#SBATCH --mem=20g&lt;br /&gt;
#SBATCH --partition=cpu2019&lt;br /&gt;
&lt;br /&gt;
# 2019-02-12 DSP - Partial-node Abaqus test on Arc (cpu2019 partition) for Abaqus 2019&lt;br /&gt;
&lt;br /&gt;
# When running on a partial node, use --cpus-per-task and specify --mem&lt;br /&gt;
&lt;br /&gt;
# Note this is using the Abaqus configuration parameter mp_mode=THREADS&lt;br /&gt;
&lt;br /&gt;
# For the initial run, RECOVER should be empty.&lt;br /&gt;
# For subsequent restarts RECOVER=&amp;quot;recover&amp;quot; - for Abaqus Explicit runs only.&lt;br /&gt;
RECOVER=&amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Specify the job name for the Abaqus input (with .inp suffix) &lt;br /&gt;
ABAQUS_COMMAND_FILE=t1-std.inp &lt;br /&gt;
&lt;br /&gt;
# Strip off the .inp suffix to give the job name to use on the Abaqus command line. &lt;br /&gt;
ABAQUS_JOB=`basename $ABAQUS_COMMAND_FILE .inp` &lt;br /&gt;
&lt;br /&gt;
# Override the default scratch location:&lt;br /&gt;
# /global/software/abaqus/2019/solver/linux_a64/SMA/site/custom_v6.env&amp;quot;&lt;br /&gt;
SCRATCH=$PWD&lt;br /&gt;
&lt;br /&gt;
# Specify the version of the software to use&lt;br /&gt;
ABAQUS_VERSION=&amp;quot;2019&amp;quot;&lt;br /&gt;
ABAQUS_HOME=&amp;quot;/global/software/abaqus&amp;quot;&lt;br /&gt;
ABAQUS=${ABAQUS_HOME}/Commands/abq2019&lt;br /&gt;
&lt;br /&gt;
# --------------  Report some basic information about this run  --------------&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Running on host: &amp;quot; `hostname`&lt;br /&gt;
echo &amp;quot;Current working directory is `pwd`&amp;quot;&lt;br /&gt;
echo &amp;quot;Using $SCRATCH for ABAQUS temporary files&amp;quot;&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Node list: SLURM_JOB_NODELIST :&amp;quot;&lt;br /&gt;
echo &amp;quot;---------------------&amp;quot;&lt;br /&gt;
echo $SLURM_JOB_NODELIST&lt;br /&gt;
echo &amp;quot;---------------------&amp;quot;&lt;br /&gt;
&lt;br /&gt;
CORES=${SLURM_CPUS_PER_TASK}&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Running on $CORES cores.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Unsetting SLURM_GTIDS is said to be necessary to work with Abaqus&#039; Platform MPI.&lt;br /&gt;
# That was not sufficient to get Abaqus to work on multiple nodes.&lt;br /&gt;
unset SLURM_GTIDS&lt;br /&gt;
&lt;br /&gt;
# Try to avoid &amp;quot;Internal Error: Cannot initialize RDMA protocol&amp;quot;&lt;br /&gt;
export MPI_IC_ORDER=tcp&lt;br /&gt;
&lt;br /&gt;
ENV_FILE=abaqus_v6.env&lt;br /&gt;
&lt;br /&gt;
cat &amp;lt;&amp;lt; EOF &amp;gt; ${ENV_FILE}&lt;br /&gt;
ask_delete = OFF&lt;br /&gt;
mp_file_system = (SHARED, SHARED)&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
NODE_LIST=$(scontrol show hostname ${SLURM_NODELIST} | sort -u)&lt;br /&gt;
&lt;br /&gt;
mp_host_list=&amp;quot;[&amp;quot;&lt;br /&gt;
for host in ${NODE_LIST}; do&lt;br /&gt;
    mp_host_list=&amp;quot;${mp_host_list}[&#039;$host&#039;, ${SLURM_CPUS_ON_NODE}],&amp;quot;&lt;br /&gt;
done&lt;br /&gt;
&lt;br /&gt;
mp_host_list=$(echo ${mp_host_list} | sed -e &amp;quot;s/,$/]/&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;mp_host_list=${mp_host_list}&amp;quot;  &amp;gt;&amp;gt; ${ENV_FILE}&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;mp_mode=THREADS&amp;quot; &amp;gt;&amp;gt; ${ENV_FILE}&lt;br /&gt;
&lt;br /&gt;
$ABAQUS job=${ABAQUS_JOB} cpus=${CORES} scratch=${SCRATCH} ${RECOVER} interactive&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Finished at `date`&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
= Support =&lt;br /&gt;
&lt;br /&gt;
Please send any questions regarding using Abaqus on ARC to support@hpc.ucalgary.ca.&lt;/div&gt;</summary>
		<author><name>Phillips</name></author>
	</entry>
	<entry>
		<id>https://rcs.ucalgary.ca/index.php?title=Abaqus&amp;diff=630</id>
		<title>Abaqus</title>
		<link rel="alternate" type="text/html" href="https://rcs.ucalgary.ca/index.php?title=Abaqus&amp;diff=630"/>
		<updated>2020-05-31T15:20:20Z</updated>

		<summary type="html">&lt;p&gt;Phillips: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Abaqus]]&lt;br /&gt;
[[Category:Software]]&lt;br /&gt;
[[Category:ARC]]&lt;br /&gt;
&amp;lt;span id=&amp;quot;contents&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
= &amp;lt;span id=&amp;quot;intro&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Introduction =&lt;br /&gt;
[https://www.3ds.com/products-services/simulia/products/abaqus/ Abaqus (external link)] is a commercial suite of programs for finite element analysis, including static, dynamic and thermal analysis of materials, with sophisticated options for handling contacts and nonlinear materials.&lt;br /&gt;
&lt;br /&gt;
Typically, researchers will install Abaqus on their own computers to develop models in a graphical user interface (Abaqus CAE) and then run simulations that exceed their local hardware capabilities on ARC.  Output from runs on ARC is then transferred back to the researchers&#039; own computers for visualization.&lt;br /&gt;
&lt;br /&gt;
The software can be downloaded, upon approval, from the [https://iac01.ucalgary.ca/SDSWeb/ Information Technologies Software Distribution] web site. A student version, for Microsoft Windows computers only, with limitations on model size is available directly from [https://academy.3ds.com/en/software/abaqus-student-edition Dassault Systèmes (external link)].&lt;br /&gt;
&lt;br /&gt;
Abaqus is available to all U of C researchers with an ARC account, but, due to the limited number of licenses it is important to be thoroughly familiar with the licensing restrictions outlined in the next section.&lt;br /&gt;
&lt;br /&gt;
= Licensing considerations =&lt;br /&gt;
&lt;br /&gt;
For many years, Information Technologies has provided a limited number of license tokens for research and teaching versions of the Abaqus software, sometimes supplemented by contributions from researchers. The software contract is typically renewed annually in August.  If you are interested in contributing to the pool of licenses, you can write to the IT Help Desk [mailto:itsupport@ucalgary.ca itsupport@ucalgary.ca] and ask that your email be redirected to the IT software librarian.&lt;br /&gt;
&lt;br /&gt;
The discussion that follows relates only to the research version of the software.  Note that the conditions of use of the teaching licenses prohibits them from being used for research projects.&lt;br /&gt;
&lt;br /&gt;
At the time of this writing in May 2020, there are only 83 research license tokens available.  The number of tokens available at a given time can be seen by running the lmstat command on ARC:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/global/software/abaqus/2019_licensing_only/linux_a64/code/bin/lmstat -c 27001@abaqus.ucalgary.ca -a&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The number of license tokens, t, used for a given job depends on the number of CPU cores, c, requested for Abaqus to use according to the formula t=integer part of (5 * c^0.422).  This formula has been implemented on the [https://deviceanalytics.com/abaqus-token-calculator Abaqus Token Calculator web page (external link)], but, here is a table showing some examples.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin: auto;&amp;quot;&lt;br /&gt;
! Cores&lt;br /&gt;
! Tokens&lt;br /&gt;
|-&lt;br /&gt;
| 8&lt;br /&gt;
| 12&lt;br /&gt;
|-&lt;br /&gt;
| 12&lt;br /&gt;
| 14&lt;br /&gt;
|-&lt;br /&gt;
| 16&lt;br /&gt;
| 16&lt;br /&gt;
|-&lt;br /&gt;
| 20&lt;br /&gt;
| 17&lt;br /&gt;
|-&lt;br /&gt;
| 24&lt;br /&gt;
| 19&lt;br /&gt;
|-&lt;br /&gt;
| 32&lt;br /&gt;
| 21&lt;br /&gt;
|-&lt;br /&gt;
| 36&lt;br /&gt;
| 22&lt;br /&gt;
|-&lt;br /&gt;
| 40&lt;br /&gt;
| 23&lt;br /&gt;
|-&lt;br /&gt;
| 48&lt;br /&gt;
| 25&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Generally speaking, unless you have a small model to process, the more cores you use, the more efficiently the license tokens will be used.  Similarly, using the fastest hardware available will provide the most value for a given number of license tokens.  With those considerations in mind, using a full 40-core compute node, selected by specifying the cpu2019 partition in your batch job (see example scripts below), is preferred .  However, as there is often a shortage of license tokens, you will likely have to use just part of a compute node.&lt;br /&gt;
&lt;br /&gt;
= Running Abaqus batch jobs on ARC =&lt;br /&gt;
Researchers using Abaqus on ARC are expected to be generally familiar with Abaqus capabilities, input file format and the use of restart files.&lt;br /&gt;
&lt;br /&gt;
Like other calculations on ARC systems, Abaqus is run by submitting an appropriate script for batch scheduling using the sbatch command. For more information about submitting jobs, see the ARC [[Running_jobs |Running Jobs]] page.&lt;br /&gt;
&lt;br /&gt;
The scripts below can serve as a template for your own batch job scripts . Modify the variable assignment &#039;&#039;&#039;ABAQUS_COMMAND_FILE=t1-std.inp&#039;&#039;&#039; to reference your own input file of Abaqus commands.  For jobs with a time requirement of five hours or less, such as when testing a new model, the &amp;quot;back-fill&amp;quot; partitions can be requested for reducing the likely waiting time in the input queue. For that purpose you could change the --time and --partition lines to &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#SBATCH --time=05:00:00&lt;br /&gt;
#SBATCH --partition=pawson-bf,apophis-bf,razi-bf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Full node example ==&lt;br /&gt;
When running on a full compute node, specify &#039;&#039;&#039;--mem=0&#039;&#039;&#039; to request all the associated memory on the node. Note that when using the cpu2019 partition (40-core nodes), a full-node Abaqus job will take 23 license tokens.&lt;br /&gt;
&lt;br /&gt;
This script is available on ARC as /global/software/abaqus/scripts/abaqus_2019_full_node.slurm .&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
&lt;br /&gt;
#SBATCH --nodes=1&lt;br /&gt;
#SBATCH --tasks-per-node=40&lt;br /&gt;
#SBATCH --cpus-per-task=1&lt;br /&gt;
#SBATCH --time=24:00:00&lt;br /&gt;
#SBATCH --mem=0&lt;br /&gt;
#SBATCH --partition=cpu2019&lt;br /&gt;
&lt;br /&gt;
# 2019-02-12 DSP - Full-node Abaqus test on Arc (cpu2019 partition) for Abaqus 2019&lt;br /&gt;
&lt;br /&gt;
# For the initial run, RECOVER should be empty.&lt;br /&gt;
# For subsequent restarts RECOVER=&amp;quot;recover&amp;quot; - for Abaqus Explicit runs only.&lt;br /&gt;
RECOVER=&amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Specify the job name for the Abaqus input (with .inp suffix) &lt;br /&gt;
ABAQUS_COMMAND_FILE=t1-std.inp &lt;br /&gt;
&lt;br /&gt;
# Strip off the .inp suffix to give the job name to use on the Abaqus command line. &lt;br /&gt;
ABAQUS_JOB=`basename $ABAQUS_COMMAND_FILE .inp` &lt;br /&gt;
&lt;br /&gt;
# Override the default scratch location:&lt;br /&gt;
# /global/software/abaqus/2019/solver/linux_a64/SMA/site/custom_v6.env&amp;quot;&lt;br /&gt;
SCRATCH=$PWD&lt;br /&gt;
&lt;br /&gt;
# Specify the version of the software to use&lt;br /&gt;
ABAQUS_VERSION=&amp;quot;2019&amp;quot;&lt;br /&gt;
ABAQUS_HOME=&amp;quot;/global/software/abaqus&amp;quot;&lt;br /&gt;
ABAQUS=${ABAQUS_HOME}/Commands/abq2019&lt;br /&gt;
&lt;br /&gt;
# --------------  Report some basic information about this run  --------------&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Running on host: &amp;quot; `hostname`&lt;br /&gt;
echo &amp;quot;Current working directory is `pwd`&amp;quot;&lt;br /&gt;
echo &amp;quot;Using $SCRATCH for ABAQUS temporary files&amp;quot;&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Node list: SLURM_JOB_NODELIST :&amp;quot;&lt;br /&gt;
echo &amp;quot;---------------------&amp;quot;&lt;br /&gt;
echo $SLURM_JOB_NODELIST&lt;br /&gt;
echo &amp;quot;---------------------&amp;quot;&lt;br /&gt;
&lt;br /&gt;
CORES=${SLURM_NTASKS}&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Running on $CORES cores.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Unsetting SLURM_GTIDS is said to be necessary to work with Abaqus&#039; Platform MPI.&lt;br /&gt;
# That was not sufficient to get Abaqus to work on multiple nodes.&lt;br /&gt;
unset SLURM_GTIDS&lt;br /&gt;
&lt;br /&gt;
# Try to avoid &amp;quot;Internal Error: Cannot initialize RDMA protocol&amp;quot;&lt;br /&gt;
export MPI_IC_ORDER=tcp&lt;br /&gt;
&lt;br /&gt;
ENV_FILE=abaqus_v6.env&lt;br /&gt;
&lt;br /&gt;
cat &amp;lt;&amp;lt; EOF &amp;gt; ${ENV_FILE}&lt;br /&gt;
ask_delete = OFF&lt;br /&gt;
mp_file_system = (SHARED, SHARED)&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
NODE_LIST=$(scontrol show hostname ${SLURM_NODELIST} | sort -u)&lt;br /&gt;
&lt;br /&gt;
mp_host_list=&amp;quot;[&amp;quot;&lt;br /&gt;
for host in ${NODE_LIST}; do&lt;br /&gt;
    mp_host_list=&amp;quot;${mp_host_list}[&#039;$host&#039;, ${SLURM_CPUS_ON_NODE}],&amp;quot;&lt;br /&gt;
done&lt;br /&gt;
&lt;br /&gt;
mp_host_list=$(echo ${mp_host_list} | sed -e &amp;quot;s/,$/]/&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;mp_host_list=${mp_host_list}&amp;quot;  &amp;gt;&amp;gt; ${ENV_FILE}&lt;br /&gt;
&lt;br /&gt;
$ABAQUS job=${ABAQUS_JOB} cpus=${CORES} scratch=${SCRATCH} ${RECOVER} interactive&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Finished at `date`&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
== Partial node example ==&lt;br /&gt;
&lt;br /&gt;
Note that when running on less than a complete compute node, the default Abaqus parallel processing mode based on MPI (Message Passing Interface) does not work properly on ARC. Instead, use &#039;&#039;&#039;mp_mode=THREADS&#039;&#039;&#039; as shown in this example. The number of cores to use is specified by the -&#039;&#039;&#039;-cpus-per-task&#039;&#039;&#039; parameter and you should also specify a non-zero value for the &#039;&#039;&#039;--mem&#039;&#039;&#039; (memory) parameter.&lt;br /&gt;
&lt;br /&gt;
This script is available on ARC as &#039;&#039;&#039;/global/software/abaqus/scripts/abaqus_2019_partial_node.slurm&#039;&#039;&#039; .&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
&lt;br /&gt;
#SBATCH --nodes=1&lt;br /&gt;
#SBATCH --ntasks=1&lt;br /&gt;
#SBATCH --cpus-per-task=20&lt;br /&gt;
#SBATCH --time=24:00:00&lt;br /&gt;
#SBATCH --mem=20g&lt;br /&gt;
#SBATCH --partition=cpu2019&lt;br /&gt;
&lt;br /&gt;
# 2019-02-12 DSP - Partial-node Abaqus test on Arc (cpu2019 partition) for Abaqus 2019&lt;br /&gt;
&lt;br /&gt;
# When running on a partial node, use --cpus-per-task and specify --mem&lt;br /&gt;
&lt;br /&gt;
# Note this is using the Abaqus configuration parameter mp_mode=THREADS&lt;br /&gt;
&lt;br /&gt;
# For the initial run, RECOVER should be empty.&lt;br /&gt;
# For subsequent restarts RECOVER=&amp;quot;recover&amp;quot; - for Abaqus Explicit runs only.&lt;br /&gt;
RECOVER=&amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Specify the job name for the Abaqus input (with .inp suffix) &lt;br /&gt;
ABAQUS_COMMAND_FILE=t1-std.inp &lt;br /&gt;
&lt;br /&gt;
# Strip off the .inp suffix to give the job name to use on the Abaqus command line. &lt;br /&gt;
ABAQUS_JOB=`basename $ABAQUS_COMMAND_FILE .inp` &lt;br /&gt;
&lt;br /&gt;
# Override the default scratch location:&lt;br /&gt;
# /global/software/abaqus/2019/solver/linux_a64/SMA/site/custom_v6.env&amp;quot;&lt;br /&gt;
SCRATCH=$PWD&lt;br /&gt;
&lt;br /&gt;
# Specify the version of the software to use&lt;br /&gt;
ABAQUS_VERSION=&amp;quot;2019&amp;quot;&lt;br /&gt;
ABAQUS_HOME=&amp;quot;/global/software/abaqus&amp;quot;&lt;br /&gt;
ABAQUS=${ABAQUS_HOME}/Commands/abq2019&lt;br /&gt;
&lt;br /&gt;
# --------------  Report some basic information about this run  --------------&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Running on host: &amp;quot; `hostname`&lt;br /&gt;
echo &amp;quot;Current working directory is `pwd`&amp;quot;&lt;br /&gt;
echo &amp;quot;Using $SCRATCH for ABAQUS temporary files&amp;quot;&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Node list: SLURM_JOB_NODELIST :&amp;quot;&lt;br /&gt;
echo &amp;quot;---------------------&amp;quot;&lt;br /&gt;
echo $SLURM_JOB_NODELIST&lt;br /&gt;
echo &amp;quot;---------------------&amp;quot;&lt;br /&gt;
&lt;br /&gt;
CORES=${SLURM_CPUS_PER_TASK}&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Running on $CORES cores.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Unsetting SLURM_GTIDS is said to be necessary to work with Abaqus&#039; Platform MPI.&lt;br /&gt;
# That was not sufficient to get Abaqus to work on multiple nodes.&lt;br /&gt;
unset SLURM_GTIDS&lt;br /&gt;
&lt;br /&gt;
# Try to avoid &amp;quot;Internal Error: Cannot initialize RDMA protocol&amp;quot;&lt;br /&gt;
export MPI_IC_ORDER=tcp&lt;br /&gt;
&lt;br /&gt;
ENV_FILE=abaqus_v6.env&lt;br /&gt;
&lt;br /&gt;
cat &amp;lt;&amp;lt; EOF &amp;gt; ${ENV_FILE}&lt;br /&gt;
ask_delete = OFF&lt;br /&gt;
mp_file_system = (SHARED, SHARED)&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
NODE_LIST=$(scontrol show hostname ${SLURM_NODELIST} | sort -u)&lt;br /&gt;
&lt;br /&gt;
mp_host_list=&amp;quot;[&amp;quot;&lt;br /&gt;
for host in ${NODE_LIST}; do&lt;br /&gt;
    mp_host_list=&amp;quot;${mp_host_list}[&#039;$host&#039;, ${SLURM_CPUS_ON_NODE}],&amp;quot;&lt;br /&gt;
done&lt;br /&gt;
&lt;br /&gt;
mp_host_list=$(echo ${mp_host_list} | sed -e &amp;quot;s/,$/]/&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;mp_host_list=${mp_host_list}&amp;quot;  &amp;gt;&amp;gt; ${ENV_FILE}&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;mp_mode=THREADS&amp;quot; &amp;gt;&amp;gt; ${ENV_FILE}&lt;br /&gt;
&lt;br /&gt;
$ABAQUS job=${ABAQUS_JOB} cpus=${CORES} scratch=${SCRATCH} ${RECOVER} interactive&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Finished at `date`&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
= Support =&lt;br /&gt;
&lt;br /&gt;
Please send any questions regarding using Abaqus on ARC to support@hpc.ucalgary.ca.&lt;/div&gt;</summary>
		<author><name>Phillips</name></author>
	</entry>
	<entry>
		<id>https://rcs.ucalgary.ca/index.php?title=Abaqus&amp;diff=629</id>
		<title>Abaqus</title>
		<link rel="alternate" type="text/html" href="https://rcs.ucalgary.ca/index.php?title=Abaqus&amp;diff=629"/>
		<updated>2020-05-31T15:19:20Z</updated>

		<summary type="html">&lt;p&gt;Phillips: Add example batch scripts&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Abaqus]]&lt;br /&gt;
[[Category:Software]]&lt;br /&gt;
[[Category:ARC]]&lt;br /&gt;
&amp;lt;span id=&amp;quot;contents&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
= &amp;lt;span id=&amp;quot;intro&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Introduction =&lt;br /&gt;
[https://www.3ds.com/products-services/simulia/products/abaqus/ Abaqus (external link)] is a commercial suite of programs for finite element analysis, including static, dynamic and thermal analysis of materials, with sophisticated options for handling contacts and nonlinear materials.&lt;br /&gt;
&lt;br /&gt;
Typically, researchers will install Abaqus on their own computers to develop models in a graphical user interface (Abaqus CAE) and then run simulations that exceed their local hardware capabilities on ARC.  Output from runs on ARC is then transferred back to the researchers&#039; own computers for visualization.&lt;br /&gt;
&lt;br /&gt;
The software can be downloaded, upon approval, from the [https://iac01.ucalgary.ca/SDSWeb/ Information Technologies Software Distribution] web site. A student version, for Microsoft Windows computers only, with limitations on model size is available directly from [https://academy.3ds.com/en/software/abaqus-student-edition Dassault Systèmes (external link)].&lt;br /&gt;
&lt;br /&gt;
Abaqus is available to all U of C researchers with an ARC account, but, due to the limited number of licenses it is important to be thoroughly familiar with the licensing restrictions outlined in the next section.&lt;br /&gt;
&lt;br /&gt;
= Licensing considerations =&lt;br /&gt;
&lt;br /&gt;
For many years, Information Technologies has provided a limited number of license tokens for research and teaching versions of the Abaqus software, sometimes supplemented by contributions from researchers. The software contract is typically renewed annually in August.  If you are interested in contributing to the pool of licenses, you can write to the IT Help Desk [mailto:itsupport@ucalgary.ca itsupport@ucalgary.ca] and ask that your email be redirected to the IT software librarian.&lt;br /&gt;
&lt;br /&gt;
The discussion that follows relates only to the research version of the software.  Note that the conditions of use of the teaching licenses prohibits them from being used for research projects.&lt;br /&gt;
&lt;br /&gt;
At the time of this writing in May 2020, there are only 83 research license tokens available.  The number of tokens available at a given time can be seen by running the lmstat command on ARC:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/global/software/abaqus/2019_licensing_only/linux_a64/code/bin/lmstat -c 27001@abaqus.ucalgary.ca -a&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The number of license tokens, t, used for a given job depends on the number of CPU cores, c, requested for Abaqus to use according to the formula t=integer part of (5 * c^0.422).  This formula has been implemented on the [https://deviceanalytics.com/abaqus-token-calculator Abaqus Token Calculator web page (external link)], but, here is a table showing some examples.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin: auto;&amp;quot;&lt;br /&gt;
! Cores&lt;br /&gt;
! Tokens&lt;br /&gt;
|-&lt;br /&gt;
| 8&lt;br /&gt;
| 12&lt;br /&gt;
|-&lt;br /&gt;
| 12&lt;br /&gt;
| 14&lt;br /&gt;
|-&lt;br /&gt;
| 16&lt;br /&gt;
| 16&lt;br /&gt;
|-&lt;br /&gt;
| 20&lt;br /&gt;
| 17&lt;br /&gt;
|-&lt;br /&gt;
| 24&lt;br /&gt;
| 19&lt;br /&gt;
|-&lt;br /&gt;
| 32&lt;br /&gt;
| 21&lt;br /&gt;
|-&lt;br /&gt;
| 36&lt;br /&gt;
| 22&lt;br /&gt;
|-&lt;br /&gt;
| 40&lt;br /&gt;
| 23&lt;br /&gt;
|-&lt;br /&gt;
| 48&lt;br /&gt;
| 25&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Generally speaking, unless you have a small model to process, the more cores you use, the more efficiently the license tokens will be used.  Similarly, using the fastest hardware available will provide the most value for a given number of license tokens.  With those considerations in mind, using a full 40-core compute node, selected by specifying the cpu2019 partition in your batch job (see example scripts below), is preferred .  However, as there is often a shortage of license tokens, you will likely have to use just part of a compute node.&lt;br /&gt;
&lt;br /&gt;
= Running Abaqus batch jobs on ARC =&lt;br /&gt;
Researchers using Abaqus on ARC are expected to be generally familiar with Abaqus capabilities, input file format and the use of restart files.&lt;br /&gt;
&lt;br /&gt;
Like other calculations on ARC systems, Abaqus is run by submitting an appropriate script for batch scheduling using the sbatch command. For more information about submitting jobs, see the ARC [[Running_jobs |Running Jobs]] page.&lt;br /&gt;
&lt;br /&gt;
The scripts below can serve as a template for your own batch job scripts . Modify the variable assignment &#039;&#039;&#039;ABAQUS_COMMAND_FILE=t1-std.inp&#039;&#039;&#039; to reference your own input file of Abaqus commands.  For jobs with a time requirement of five hours or less, such as when testing a new model, the &amp;quot;back-fill&amp;quot; partitions can be requested for reducing the likely waiting time in the input queue. For that purpose you could change the --time and --partition lines to &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#SBATCH --time=05:00:00&lt;br /&gt;
#SBATCH --partition=pawson-bf,apophis-bf,razi-bf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Full node example ==&lt;br /&gt;
When running on a full compute node, specify &#039;&#039;&#039;--mem=0&#039;&#039;&#039; to request all the associated memory on the node. Note that when using the cpu2019 partition (40-core nodes), a full-node Abaqus job will take 23 license tokens.&lt;br /&gt;
&lt;br /&gt;
This script is available on ARC as /global/software/abaqus/scripts/abaqus_2019_full_node.slurm .&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
&lt;br /&gt;
#SBATCH --nodes=1&lt;br /&gt;
#SBATCH --tasks-per-node=40&lt;br /&gt;
#SBATCH --cpus-per-task=1&lt;br /&gt;
#SBATCH --time=24:00:00&lt;br /&gt;
#SBATCH --mem=0&lt;br /&gt;
#SBATCH --partition=cpu2019&lt;br /&gt;
&lt;br /&gt;
# 2019-02-12 DSP - Full-node Abaqus test on Arc (cpu2019 partition) for Abaqus 2019&lt;br /&gt;
&lt;br /&gt;
# For the initial run, RECOVER should be empty.&lt;br /&gt;
# For subsequent restarts RECOVER=&amp;quot;recover&amp;quot; - for Abaqus Explicit runs only.&lt;br /&gt;
RECOVER=&amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Specify the job name for the Abaqus input (with .inp suffix) &lt;br /&gt;
ABAQUS_COMMAND_FILE=t1-std.inp &lt;br /&gt;
&lt;br /&gt;
# Strip off the .inp suffix to give the job name to use on the Abaqus command line. &lt;br /&gt;
ABAQUS_JOB=`basename $ABAQUS_COMMAND_FILE .inp` &lt;br /&gt;
&lt;br /&gt;
# Override the default scratch location:&lt;br /&gt;
# /global/software/abaqus/2019/solver/linux_a64/SMA/site/custom_v6.env&amp;quot;&lt;br /&gt;
SCRATCH=$PWD&lt;br /&gt;
&lt;br /&gt;
# Specify the version of the software to use&lt;br /&gt;
ABAQUS_VERSION=&amp;quot;2019&amp;quot;&lt;br /&gt;
ABAQUS_HOME=&amp;quot;/global/software/abaqus&amp;quot;&lt;br /&gt;
ABAQUS=${ABAQUS_HOME}/Commands/abq2019&lt;br /&gt;
&lt;br /&gt;
# --------------  Report some basic information about this run  --------------&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Running on host: &amp;quot; `hostname`&lt;br /&gt;
echo &amp;quot;Current working directory is `pwd`&amp;quot;&lt;br /&gt;
echo &amp;quot;Using $SCRATCH for ABAQUS temporary files&amp;quot;&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Node list: SLURM_JOB_NODELIST :&amp;quot;&lt;br /&gt;
echo &amp;quot;---------------------&amp;quot;&lt;br /&gt;
echo $SLURM_JOB_NODELIST&lt;br /&gt;
echo &amp;quot;---------------------&amp;quot;&lt;br /&gt;
&lt;br /&gt;
CORES=${SLURM_NTASKS}&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Running on $CORES cores.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Unsetting SLURM_GTIDS is said to be necessary to work with Abaqus&#039; Platform MPI.&lt;br /&gt;
# That was not sufficient to get Abaqus to work on multiple nodes.&lt;br /&gt;
unset SLURM_GTIDS&lt;br /&gt;
&lt;br /&gt;
# Try to avoid &amp;quot;Internal Error: Cannot initialize RDMA protocol&amp;quot;&lt;br /&gt;
export MPI_IC_ORDER=tcp&lt;br /&gt;
&lt;br /&gt;
ENV_FILE=abaqus_v6.env&lt;br /&gt;
&lt;br /&gt;
cat &amp;lt;&amp;lt; EOF &amp;gt; ${ENV_FILE}&lt;br /&gt;
ask_delete = OFF&lt;br /&gt;
mp_file_system = (SHARED, SHARED)&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
NODE_LIST=$(scontrol show hostname ${SLURM_NODELIST} | sort -u)&lt;br /&gt;
&lt;br /&gt;
mp_host_list=&amp;quot;[&amp;quot;&lt;br /&gt;
for host in ${NODE_LIST}; do&lt;br /&gt;
    mp_host_list=&amp;quot;${mp_host_list}[&#039;$host&#039;, ${SLURM_CPUS_ON_NODE}],&amp;quot;&lt;br /&gt;
done&lt;br /&gt;
&lt;br /&gt;
mp_host_list=$(echo ${mp_host_list} | sed -e &amp;quot;s/,$/]/&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;mp_host_list=${mp_host_list}&amp;quot;  &amp;gt;&amp;gt; ${ENV_FILE}&lt;br /&gt;
&lt;br /&gt;
$ABAQUS job=${ABAQUS_JOB} cpus=${CORES} scratch=${SCRATCH} ${RECOVER} interactive&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Finished at `date`&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
== Partial node example ==&lt;br /&gt;
&lt;br /&gt;
Note that when running on less than a complete compute node, the default Abaqus parallel processing mode based on MPI (Message Passing Interface) does not work properly on ARC. Instead, use mp_mode=THREADS as shown in this example. The number of cores to use is specified by the -&#039;&#039;&#039;-cpus-per-task&#039;&#039;&#039; parameter and you should also specify a non-zero value for the &#039;&#039;&#039;--mem&#039;&#039;&#039; (memory) parameter.&lt;br /&gt;
&lt;br /&gt;
This script is available on ARC as /global/software/abaqus/scripts/abaqus_2019_partial_node.slurm .&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
&lt;br /&gt;
#SBATCH --nodes=1&lt;br /&gt;
#SBATCH --ntasks=1&lt;br /&gt;
#SBATCH --cpus-per-task=20&lt;br /&gt;
#SBATCH --time=24:00:00&lt;br /&gt;
#SBATCH --mem=20g&lt;br /&gt;
#SBATCH --partition=cpu2019&lt;br /&gt;
&lt;br /&gt;
# 2019-02-12 DSP - Partial-node Abaqus test on Arc (cpu2019 partition) for Abaqus 2019&lt;br /&gt;
&lt;br /&gt;
# When running on a partial node, use --cpus-per-task and specify --mem&lt;br /&gt;
&lt;br /&gt;
# Note this is using the Abaqus configuration parameter mp_mode=THREADS&lt;br /&gt;
&lt;br /&gt;
# For the initial run, RECOVER should be empty.&lt;br /&gt;
# For subsequent restarts RECOVER=&amp;quot;recover&amp;quot; - for Abaqus Explicit runs only.&lt;br /&gt;
RECOVER=&amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Specify the job name for the Abaqus input (with .inp suffix) &lt;br /&gt;
ABAQUS_COMMAND_FILE=t1-std.inp &lt;br /&gt;
&lt;br /&gt;
# Strip off the .inp suffix to give the job name to use on the Abaqus command line. &lt;br /&gt;
ABAQUS_JOB=`basename $ABAQUS_COMMAND_FILE .inp` &lt;br /&gt;
&lt;br /&gt;
# Override the default scratch location:&lt;br /&gt;
# /global/software/abaqus/2019/solver/linux_a64/SMA/site/custom_v6.env&amp;quot;&lt;br /&gt;
SCRATCH=$PWD&lt;br /&gt;
&lt;br /&gt;
# Specify the version of the software to use&lt;br /&gt;
ABAQUS_VERSION=&amp;quot;2019&amp;quot;&lt;br /&gt;
ABAQUS_HOME=&amp;quot;/global/software/abaqus&amp;quot;&lt;br /&gt;
ABAQUS=${ABAQUS_HOME}/Commands/abq2019&lt;br /&gt;
&lt;br /&gt;
# --------------  Report some basic information about this run  --------------&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Running on host: &amp;quot; `hostname`&lt;br /&gt;
echo &amp;quot;Current working directory is `pwd`&amp;quot;&lt;br /&gt;
echo &amp;quot;Using $SCRATCH for ABAQUS temporary files&amp;quot;&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Node list: SLURM_JOB_NODELIST :&amp;quot;&lt;br /&gt;
echo &amp;quot;---------------------&amp;quot;&lt;br /&gt;
echo $SLURM_JOB_NODELIST&lt;br /&gt;
echo &amp;quot;---------------------&amp;quot;&lt;br /&gt;
&lt;br /&gt;
CORES=${SLURM_CPUS_PER_TASK}&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Running on $CORES cores.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Unsetting SLURM_GTIDS is said to be necessary to work with Abaqus&#039; Platform MPI.&lt;br /&gt;
# That was not sufficient to get Abaqus to work on multiple nodes.&lt;br /&gt;
unset SLURM_GTIDS&lt;br /&gt;
&lt;br /&gt;
# Try to avoid &amp;quot;Internal Error: Cannot initialize RDMA protocol&amp;quot;&lt;br /&gt;
export MPI_IC_ORDER=tcp&lt;br /&gt;
&lt;br /&gt;
ENV_FILE=abaqus_v6.env&lt;br /&gt;
&lt;br /&gt;
cat &amp;lt;&amp;lt; EOF &amp;gt; ${ENV_FILE}&lt;br /&gt;
ask_delete = OFF&lt;br /&gt;
mp_file_system = (SHARED, SHARED)&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
NODE_LIST=$(scontrol show hostname ${SLURM_NODELIST} | sort -u)&lt;br /&gt;
&lt;br /&gt;
mp_host_list=&amp;quot;[&amp;quot;&lt;br /&gt;
for host in ${NODE_LIST}; do&lt;br /&gt;
    mp_host_list=&amp;quot;${mp_host_list}[&#039;$host&#039;, ${SLURM_CPUS_ON_NODE}],&amp;quot;&lt;br /&gt;
done&lt;br /&gt;
&lt;br /&gt;
mp_host_list=$(echo ${mp_host_list} | sed -e &amp;quot;s/,$/]/&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;mp_host_list=${mp_host_list}&amp;quot;  &amp;gt;&amp;gt; ${ENV_FILE}&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;mp_mode=THREADS&amp;quot; &amp;gt;&amp;gt; ${ENV_FILE}&lt;br /&gt;
&lt;br /&gt;
$ABAQUS job=${ABAQUS_JOB} cpus=${CORES} scratch=${SCRATCH} ${RECOVER} interactive&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Finished at `date`&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
= Support =&lt;br /&gt;
&lt;br /&gt;
Please send any questions regarding using Abaqus on ARC to support@hpc.ucalgary.ca.&lt;/div&gt;</summary>
		<author><name>Phillips</name></author>
	</entry>
	<entry>
		<id>https://rcs.ucalgary.ca/index.php?title=Abaqus&amp;diff=628</id>
		<title>Abaqus</title>
		<link rel="alternate" type="text/html" href="https://rcs.ucalgary.ca/index.php?title=Abaqus&amp;diff=628"/>
		<updated>2020-05-31T15:06:49Z</updated>

		<summary type="html">&lt;p&gt;Phillips: /* Licensing considerations */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Abaqus]]&lt;br /&gt;
[[Category:Software]]&lt;br /&gt;
[[Category:ARC]]&lt;br /&gt;
&amp;lt;span id=&amp;quot;contents&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
= &amp;lt;span id=&amp;quot;intro&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Introduction =&lt;br /&gt;
[https://www.3ds.com/products-services/simulia/products/abaqus/ Abaqus (external link)] is a commercial suite of programs for finite element analysis, including static, dynamic and thermal analysis of materials, with sophisticated options for handling contacts and nonlinear materials.&lt;br /&gt;
&lt;br /&gt;
Typically, researchers will install Abaqus on their own computers to develop models in a graphical user interface (Abaqus CAE) and then run simulations that exceed their local hardware capabilities on ARC.  Output from runs on ARC is then transferred back to the researchers&#039; own computers for visualization.&lt;br /&gt;
&lt;br /&gt;
The software can be downloaded, upon approval, from the [https://iac01.ucalgary.ca/SDSWeb/ Information Technologies Software Distribution] web site. A student version, for Microsoft Windows computers only, with limitations on model size is available directly from [https://academy.3ds.com/en/software/abaqus-student-edition Dassault Systèmes (external link)].&lt;br /&gt;
&lt;br /&gt;
Abaqus is available to all U of C researchers with an ARC account, but, due to the limited number of licenses it is important to be thoroughly familiar with the licensing restrictions outlined in the next section.&lt;br /&gt;
&lt;br /&gt;
= Licensing considerations =&lt;br /&gt;
&lt;br /&gt;
For many years, Information Technologies has provided a limited number of license tokens for research and teaching versions of the Abaqus software, sometimes supplemented by contributions from researchers. The software contract is typically renewed annually in August.  If you are interested in contributing to the pool of licenses, you can write to the IT Help Desk [mailto:itsupport@ucalgary.ca itsupport@ucalgary.ca] and ask that your email be redirected to the IT software librarian.&lt;br /&gt;
&lt;br /&gt;
The discussion that follows relates only to the research version of the software.  Note that the conditions of use of the teaching licenses prohibits them from being used for research projects.&lt;br /&gt;
&lt;br /&gt;
At the time of this writing in May 2020, there are only 83 research license tokens available.  The number of tokens available at a given time can be seen by running the lmstat command on ARC:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/global/software/abaqus/2019_licensing_only/linux_a64/code/bin/lmstat -c 27001@abaqus.ucalgary.ca -a&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The number of license tokens, t, used for a given job depends on the number of CPU cores, c, requested for Abaqus to use according to the formula t=integer part of (5 * c^0.422).  This formula has been implemented on the [https://deviceanalytics.com/abaqus-token-calculator Abaqus Token Calculator web page (external link)], but, here is a table showing some examples.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin: auto;&amp;quot;&lt;br /&gt;
! Cores&lt;br /&gt;
! Tokens&lt;br /&gt;
|-&lt;br /&gt;
| 8&lt;br /&gt;
| 12&lt;br /&gt;
|-&lt;br /&gt;
| 12&lt;br /&gt;
| 14&lt;br /&gt;
|-&lt;br /&gt;
| 16&lt;br /&gt;
| 16&lt;br /&gt;
|-&lt;br /&gt;
| 20&lt;br /&gt;
| 17&lt;br /&gt;
|-&lt;br /&gt;
| 24&lt;br /&gt;
| 19&lt;br /&gt;
|-&lt;br /&gt;
| 32&lt;br /&gt;
| 21&lt;br /&gt;
|-&lt;br /&gt;
| 36&lt;br /&gt;
| 22&lt;br /&gt;
|-&lt;br /&gt;
| 40&lt;br /&gt;
| 23&lt;br /&gt;
|-&lt;br /&gt;
| 48&lt;br /&gt;
| 25&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Generally speaking, unless you have a small model to process, the more cores you use, the more efficiently the license tokens will be used.  Similarly, using the fastest hardware available will provide the most value for a given number of license tokens.  With those considerations in mind, using a full 40-core compute node, selected by specifying the cpu2019 partition in your batch job (see example scripts below), is preferred .  However, as there is often a shortage of license tokens, you will likely have to use just part of a compute node.&lt;br /&gt;
&lt;br /&gt;
= Support =&lt;br /&gt;
&lt;br /&gt;
Please send any questions regarding using Abaqus on ARC to support@hpc.ucalgary.ca.&lt;/div&gt;</summary>
		<author><name>Phillips</name></author>
	</entry>
	<entry>
		<id>https://rcs.ucalgary.ca/index.php?title=Abaqus&amp;diff=627</id>
		<title>Abaqus</title>
		<link rel="alternate" type="text/html" href="https://rcs.ucalgary.ca/index.php?title=Abaqus&amp;diff=627"/>
		<updated>2020-05-31T15:04:23Z</updated>

		<summary type="html">&lt;p&gt;Phillips: /* Licensing considerations */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Abaqus]]&lt;br /&gt;
[[Category:Software]]&lt;br /&gt;
[[Category:ARC]]&lt;br /&gt;
&amp;lt;span id=&amp;quot;contents&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
= &amp;lt;span id=&amp;quot;intro&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Introduction =&lt;br /&gt;
[https://www.3ds.com/products-services/simulia/products/abaqus/ Abaqus (external link)] is a commercial suite of programs for finite element analysis, including static, dynamic and thermal analysis of materials, with sophisticated options for handling contacts and nonlinear materials.&lt;br /&gt;
&lt;br /&gt;
Typically, researchers will install Abaqus on their own computers to develop models in a graphical user interface (Abaqus CAE) and then run simulations that exceed their local hardware capabilities on ARC.  Output from runs on ARC is then transferred back to the researchers&#039; own computers for visualization.&lt;br /&gt;
&lt;br /&gt;
The software can be downloaded, upon approval, from the [https://iac01.ucalgary.ca/SDSWeb/ Information Technologies Software Distribution] web site. A student version, for Microsoft Windows computers only, with limitations on model size is available directly from [https://academy.3ds.com/en/software/abaqus-student-edition Dassault Systèmes (external link)].&lt;br /&gt;
&lt;br /&gt;
Abaqus is available to all U of C researchers with an ARC account, but, due to the limited number of licenses it is important to be thoroughly familiar with the licensing restrictions outlined in the next section.&lt;br /&gt;
&lt;br /&gt;
= Licensing considerations =&lt;br /&gt;
&lt;br /&gt;
For many years, Information Technologies has provided a limited number of license tokens for research and teaching versions of the Abaqus software, sometimes supplemented by contributions from researchers. The software contract is typically renewed annually in August.  If you are interested in contributing to the pool of licenses, you can write to the IT Help Desk [mailto:itsupport@ucalgary.ca itsupport@ucalgary.ca] and ask that your email be redirected to the IT software librarian.&lt;br /&gt;
&lt;br /&gt;
The discussion that follows relates only to the research version of the software.  Note that the conditions of use of the teaching licenses prohibits them from being used for research projects.&lt;br /&gt;
&lt;br /&gt;
At the time of this writing in May 2020, there are only 83 research license tokens available.  The number of tokens available at a given time can be seen by running the lmstat command on ARC:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/global/software/abaqus/2019_licensing_only/linux_a64/code/bin/lmstat -c 27001@abaqus.ucalgary.ca -a&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The number of license tokens, t, used for a given job depends on the number of CPU cores, c, requested for Abaqus to use according to the formula t=integer part of (5 * c^0.422).  This formula has been implemented on the [https://deviceanalytics.com/abaqus-token-calculator Abaqus Token Calculator web page (external link)], but, here is a table showing some examples.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin: auto;&amp;quot;&lt;br /&gt;
! Cores&lt;br /&gt;
! Tokens&lt;br /&gt;
|-&lt;br /&gt;
| 8&lt;br /&gt;
| 12&lt;br /&gt;
|-&lt;br /&gt;
| 12&lt;br /&gt;
| 14&lt;br /&gt;
|-&lt;br /&gt;
| 16&lt;br /&gt;
| 16&lt;br /&gt;
|-&lt;br /&gt;
| 20&lt;br /&gt;
| 17&lt;br /&gt;
|-&lt;br /&gt;
| 24&lt;br /&gt;
| 19&lt;br /&gt;
|-&lt;br /&gt;
| 32&lt;br /&gt;
| 21&lt;br /&gt;
|-&lt;br /&gt;
| 36&lt;br /&gt;
| 22&lt;br /&gt;
|-&lt;br /&gt;
| 40&lt;br /&gt;
| 23&lt;br /&gt;
|-&lt;br /&gt;
| 48&lt;br /&gt;
| 25&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Generally speaking, unless you have a small model to process, the more cores you use, the more efficiently the license tokens will be used.  Similarly, using the fastest hardware available will provide the most value a given number of license tokens.  With those considerations in mind, using a full 40-core compute node, selected by specifying the cpu2019 partition in your batch job (see example scripts below), is preferred .  However, as there is often a shortage of license tokens, you will likely have to use just part of a compute node.&lt;br /&gt;
&lt;br /&gt;
= Support =&lt;br /&gt;
&lt;br /&gt;
Please send any questions regarding using Abaqus on ARC to support@hpc.ucalgary.ca.&lt;/div&gt;</summary>
		<author><name>Phillips</name></author>
	</entry>
	<entry>
		<id>https://rcs.ucalgary.ca/index.php?title=Abaqus&amp;diff=626</id>
		<title>Abaqus</title>
		<link rel="alternate" type="text/html" href="https://rcs.ucalgary.ca/index.php?title=Abaqus&amp;diff=626"/>
		<updated>2020-05-31T15:03:20Z</updated>

		<summary type="html">&lt;p&gt;Phillips: /* Introduction */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Abaqus]]&lt;br /&gt;
[[Category:Software]]&lt;br /&gt;
[[Category:ARC]]&lt;br /&gt;
&amp;lt;span id=&amp;quot;contents&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
= &amp;lt;span id=&amp;quot;intro&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Introduction =&lt;br /&gt;
[https://www.3ds.com/products-services/simulia/products/abaqus/ Abaqus (external link)] is a commercial suite of programs for finite element analysis, including static, dynamic and thermal analysis of materials, with sophisticated options for handling contacts and nonlinear materials.&lt;br /&gt;
&lt;br /&gt;
Typically, researchers will install Abaqus on their own computers to develop models in a graphical user interface (Abaqus CAE) and then run simulations that exceed their local hardware capabilities on ARC.  Output from runs on ARC is then transferred back to the researchers&#039; own computers for visualization.&lt;br /&gt;
&lt;br /&gt;
The software can be downloaded, upon approval, from the [https://iac01.ucalgary.ca/SDSWeb/ Information Technologies Software Distribution] web site. A student version, for Microsoft Windows computers only, with limitations on model size is available directly from [https://academy.3ds.com/en/software/abaqus-student-edition Dassault Systèmes (external link)].&lt;br /&gt;
&lt;br /&gt;
Abaqus is available to all U of C researchers with an ARC account, but, due to the limited number of licenses it is important to be thoroughly familiar with the licensing restrictions outlined in the next section.&lt;br /&gt;
&lt;br /&gt;
= Licensing considerations =&lt;br /&gt;
&lt;br /&gt;
For many years, Information Technologies has provided a limited number of license tokens for research and teaching versions of the Abaqus software, sometimes supplemented by contributions from researchers. The software contract is typically renewed annually in August.  If you are interested in contributing to the pool of licenses, you can write to the IT Help Desk [mailto:itsupport@ucalgary.ca itsupport@ucalgary.ca] and ask that your email be redirected to the IT software librarian.&lt;br /&gt;
&lt;br /&gt;
The discussion that follows relates only to the research version of the software.  Note that the conditions of use of the teaching licenses prohibits them from being used for research projects.&lt;br /&gt;
&lt;br /&gt;
At the time of this writing in May 2020, there are only 83 research license tokens available.  The number of tokens available at a given time can be seen by running the lmstat command on ARC:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/global/software/abaqus/2019_licensing_only/linux_a64/code/bin/lmstat \-c 27001@abaqus.ucalgary.ca -a&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The number of license tokens, t, used for a given job depends on the number of CPU cores, c, requested for Abaqus to use according to the formula t=integer part of (5 * c^0.422).  This formula has been implemented on the [https://deviceanalytics.com/abaqus-token-calculator Abaqus Token Calculator web page (external link)], but, here is a table showing some examples.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin: auto;&amp;quot;&lt;br /&gt;
! Cores&lt;br /&gt;
! Tokens&lt;br /&gt;
|-&lt;br /&gt;
| 8&lt;br /&gt;
| 12&lt;br /&gt;
|-&lt;br /&gt;
| 12&lt;br /&gt;
| 14&lt;br /&gt;
|-&lt;br /&gt;
| 16&lt;br /&gt;
| 16&lt;br /&gt;
|-&lt;br /&gt;
| 20&lt;br /&gt;
| 17&lt;br /&gt;
|-&lt;br /&gt;
| 24&lt;br /&gt;
| 19&lt;br /&gt;
|-&lt;br /&gt;
| 32&lt;br /&gt;
| 21&lt;br /&gt;
|-&lt;br /&gt;
| 36&lt;br /&gt;
| 22&lt;br /&gt;
|-&lt;br /&gt;
| 40&lt;br /&gt;
| 23&lt;br /&gt;
|-&lt;br /&gt;
| 48&lt;br /&gt;
| 25&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Generally speaking, unless you have a small model to process, the more cores you use, the more efficiently the license tokens will be used.  Similarly, using the fastest hardware available will provide the most value a given number of license tokens.  With those considerations in mind, using a full 40-core compute node, selected by specifying the cpu2019 partition in your batch job (see example scripts below), is preferred .  However, as there is often a shortage of license tokens, you will likely have to use just part of a compute node.&lt;br /&gt;
= Support =&lt;br /&gt;
&lt;br /&gt;
Please send any questions regarding using Abaqus on ARC to support@hpc.ucalgary.ca.&lt;/div&gt;</summary>
		<author><name>Phillips</name></author>
	</entry>
	<entry>
		<id>https://rcs.ucalgary.ca/index.php?title=Abaqus&amp;diff=625</id>
		<title>Abaqus</title>
		<link rel="alternate" type="text/html" href="https://rcs.ucalgary.ca/index.php?title=Abaqus&amp;diff=625"/>
		<updated>2020-05-31T15:02:28Z</updated>

		<summary type="html">&lt;p&gt;Phillips: Created Abaqus page&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Abaqus]]&lt;br /&gt;
[[Category:Software]]&lt;br /&gt;
[[Category:ARC]]&lt;br /&gt;
&amp;lt;span id=&amp;quot;contents&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
= &amp;lt;span id=&amp;quot;intro&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Introduction =&lt;br /&gt;
[https://www.3ds.com/products-services/simulia/products/abaqus/ Abaqus (external link)] is a commercial suite of programs for finite element analysis, including static, dynamic and thermal analysis of materials, with sophisticated options for handling contacts and nonlinear materials.&lt;br /&gt;
&lt;br /&gt;
Typically, researchers will install Abaqus on their own computers to develop models in a graphical user interface (Abaqus CAE) and then run simulations that exceed their local hardware capabilities on ARC.  Output from runs on ARC is then transferred back to the researchers&#039; own computers for visualization.&lt;br /&gt;
&lt;br /&gt;
The software can be downloaded, upon approval, from the Information Technologies [https://iac01.ucalgary.ca/SDSWeb/ Software Distribution] web site. A student version, for Microsoft Windows computers only, with limitations on model size is available directly from [https://academy.3ds.com/en/software/abaqus-student-edition Dassault Systèmes (external link)].&lt;br /&gt;
&lt;br /&gt;
Abaqus is available to all U of C researchers with an ARC account, but, due to the limited number of licenses it is important to be thoroughly familiar with the licensing restrictions outlined in the next section.&lt;br /&gt;
&lt;br /&gt;
= Licensing considerations =&lt;br /&gt;
&lt;br /&gt;
For many years, Information Technologies has provided a limited number of license tokens for research and teaching versions of the Abaqus software, sometimes supplemented by contributions from researchers. The software contract is typically renewed annually in August.  If you are interested in contributing to the pool of licenses, you can write to the IT Help Desk [mailto:itsupport@ucalgary.ca itsupport@ucalgary.ca] and ask that your email be redirected to the IT software librarian.&lt;br /&gt;
&lt;br /&gt;
The discussion that follows relates only to the research version of the software.  Note that the conditions of use of the teaching licenses prohibits them from being used for research projects.&lt;br /&gt;
&lt;br /&gt;
At the time of this writing in May 2020, there are only 83 research license tokens available.  The number of tokens available at a given time can be seen by running the lmstat command on ARC:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/global/software/abaqus/2019_licensing_only/linux_a64/code/bin/lmstat \-c 27001@abaqus.ucalgary.ca -a&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The number of license tokens, t, used for a given job depends on the number of CPU cores, c, requested for Abaqus to use according to the formula t=integer part of (5 * c^0.422).  This formula has been implemented on the [https://deviceanalytics.com/abaqus-token-calculator Abaqus Token Calculator web page (external link)], but, here is a table showing some examples.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin: auto;&amp;quot;&lt;br /&gt;
! Cores&lt;br /&gt;
! Tokens&lt;br /&gt;
|-&lt;br /&gt;
| 8&lt;br /&gt;
| 12&lt;br /&gt;
|-&lt;br /&gt;
| 12&lt;br /&gt;
| 14&lt;br /&gt;
|-&lt;br /&gt;
| 16&lt;br /&gt;
| 16&lt;br /&gt;
|-&lt;br /&gt;
| 20&lt;br /&gt;
| 17&lt;br /&gt;
|-&lt;br /&gt;
| 24&lt;br /&gt;
| 19&lt;br /&gt;
|-&lt;br /&gt;
| 32&lt;br /&gt;
| 21&lt;br /&gt;
|-&lt;br /&gt;
| 36&lt;br /&gt;
| 22&lt;br /&gt;
|-&lt;br /&gt;
| 40&lt;br /&gt;
| 23&lt;br /&gt;
|-&lt;br /&gt;
| 48&lt;br /&gt;
| 25&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Generally speaking, unless you have a small model to process, the more cores you use, the more efficiently the license tokens will be used.  Similarly, using the fastest hardware available will provide the most value a given number of license tokens.  With those considerations in mind, using a full 40-core compute node, selected by specifying the cpu2019 partition in your batch job (see example scripts below), is preferred .  However, as there is often a shortage of license tokens, you will likely have to use just part of a compute node.&lt;br /&gt;
= Support =&lt;br /&gt;
&lt;br /&gt;
Please send any questions regarding using Abaqus on ARC to support@hpc.ucalgary.ca.&lt;/div&gt;</summary>
		<author><name>Phillips</name></author>
	</entry>
	<entry>
		<id>https://rcs.ucalgary.ca/index.php?title=ARC_Software&amp;diff=624</id>
		<title>ARC Software</title>
		<link rel="alternate" type="text/html" href="https://rcs.ucalgary.ca/index.php?title=ARC_Software&amp;diff=624"/>
		<updated>2020-05-31T14:48:45Z</updated>

		<summary type="html">&lt;p&gt;Phillips: /* Mathematical Libaries and Applications */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Chemistry =&lt;br /&gt;
&lt;br /&gt;
* [[Gaussian on ARC | Gaussian 16]]&lt;br /&gt;
* [[GROMACS]] - Classical molecular dynamics simulator.&lt;br /&gt;
&lt;br /&gt;
= Computational Fluid Dynamics =&lt;br /&gt;
&lt;br /&gt;
* [[ANSYS]] - Fluent and CFX - commercial CFD software.&lt;br /&gt;
* [[OpenFOAM]] - Open-source toolkit for creating CFD applications.&lt;br /&gt;
&lt;br /&gt;
= Finite Element Modelling =&lt;br /&gt;
* [[ANSYS]] - ANSYS Mechanical - commercial software for finite element-based structural analysis.&lt;br /&gt;
* [[Abaqus]] - Commercial software for finite element-based analysis.&lt;br /&gt;
&lt;br /&gt;
= Geospatial Analysis =&lt;br /&gt;
&lt;br /&gt;
* [[GDAL on ARC | GDAL]]&lt;br /&gt;
&lt;br /&gt;
* [[Geopandas on ARC | Geopandas]]&lt;br /&gt;
&lt;br /&gt;
= Machine Learning =&lt;br /&gt;
&lt;br /&gt;
* [[Tensorflow on ARC | Tensorflow]]&lt;br /&gt;
&lt;br /&gt;
* [[Torch on ARC | PyTorch]]&lt;br /&gt;
&lt;br /&gt;
= Mathematical Libaries and Applications =&lt;br /&gt;
&lt;br /&gt;
* [[MATLAB]] - Commercial general-purpose high-level programming environment for linear algebra, statistics, image processing and a wide range of other calculations.&lt;br /&gt;
* [[Mathematica]] - Commercial general-purpose high-level programming package for both symbolic and numerical calculations.&lt;br /&gt;
&lt;br /&gt;
= Neuroimaging =&lt;br /&gt;
&lt;br /&gt;
* [[FSL on ARC | Freesurfer]]&lt;br /&gt;
&lt;br /&gt;
* [[Statistical Parametric Mapping on ARC | SPM 12]]&lt;br /&gt;
&lt;br /&gt;
= Package Management =&lt;br /&gt;
&lt;br /&gt;
* [[Conda on ARC | Conda]]&lt;br /&gt;
&lt;br /&gt;
= Statistics =&lt;br /&gt;
&lt;br /&gt;
* [[R on ARC | R]]&lt;br /&gt;
&lt;br /&gt;
* [[Stan on ARC | rstan]]&lt;br /&gt;
&lt;br /&gt;
= Reservoir Simulations =&lt;br /&gt;
&lt;br /&gt;
= Bioinformatics =&lt;/div&gt;</summary>
		<author><name>Phillips</name></author>
	</entry>
	<entry>
		<id>https://rcs.ucalgary.ca/index.php?title=ARC_Software&amp;diff=623</id>
		<title>ARC Software</title>
		<link rel="alternate" type="text/html" href="https://rcs.ucalgary.ca/index.php?title=ARC_Software&amp;diff=623"/>
		<updated>2020-05-31T14:48:07Z</updated>

		<summary type="html">&lt;p&gt;Phillips: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Chemistry =&lt;br /&gt;
&lt;br /&gt;
* [[Gaussian on ARC | Gaussian 16]]&lt;br /&gt;
* [[GROMACS]] - Classical molecular dynamics simulator.&lt;br /&gt;
&lt;br /&gt;
= Computational Fluid Dynamics =&lt;br /&gt;
&lt;br /&gt;
* [[ANSYS]] - Fluent and CFX - commercial CFD software.&lt;br /&gt;
* [[OpenFOAM]] - Open-source toolkit for creating CFD applications.&lt;br /&gt;
&lt;br /&gt;
= Finite Element Modelling =&lt;br /&gt;
* [[ANSYS]] - ANSYS Mechanical - commercial software for finite element-based structural analysis.&lt;br /&gt;
* [[Abaqus]] - Commercial software for finite element-based analysis.&lt;br /&gt;
&lt;br /&gt;
= Geospatial Analysis =&lt;br /&gt;
&lt;br /&gt;
* [[GDAL on ARC | GDAL]]&lt;br /&gt;
&lt;br /&gt;
* [[Geopandas on ARC | Geopandas]]&lt;br /&gt;
&lt;br /&gt;
= Machine Learning =&lt;br /&gt;
&lt;br /&gt;
* [[Tensorflow on ARC | Tensorflow]]&lt;br /&gt;
&lt;br /&gt;
* [[Torch on ARC | PyTorch]]&lt;br /&gt;
&lt;br /&gt;
= Mathematical Libaries and Applications =&lt;br /&gt;
&lt;br /&gt;
* [[MATLAB]] - Commercial high-level programming environment for linear algebra, statistics, image processing and a wide range of other calculations&lt;br /&gt;
* [[Mathematica]] - General-purpose high-level programming package for both symbolic and numerical calculations.&lt;br /&gt;
&lt;br /&gt;
= Neuroimaging =&lt;br /&gt;
&lt;br /&gt;
* [[FSL on ARC | Freesurfer]]&lt;br /&gt;
&lt;br /&gt;
* [[Statistical Parametric Mapping on ARC | SPM 12]]&lt;br /&gt;
&lt;br /&gt;
= Package Management =&lt;br /&gt;
&lt;br /&gt;
* [[Conda on ARC | Conda]]&lt;br /&gt;
&lt;br /&gt;
= Statistics =&lt;br /&gt;
&lt;br /&gt;
* [[R on ARC | R]]&lt;br /&gt;
&lt;br /&gt;
* [[Stan on ARC | rstan]]&lt;br /&gt;
&lt;br /&gt;
= Reservoir Simulations =&lt;br /&gt;
&lt;br /&gt;
= Bioinformatics =&lt;/div&gt;</summary>
		<author><name>Phillips</name></author>
	</entry>
	<entry>
		<id>https://rcs.ucalgary.ca/index.php?title=ARC_Software&amp;diff=622</id>
		<title>ARC Software</title>
		<link rel="alternate" type="text/html" href="https://rcs.ucalgary.ca/index.php?title=ARC_Software&amp;diff=622"/>
		<updated>2020-05-31T14:43:33Z</updated>

		<summary type="html">&lt;p&gt;Phillips: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Chemistry =&lt;br /&gt;
&lt;br /&gt;
* [[Gaussian on ARC | Gaussian 16]]&lt;br /&gt;
* [[GROMACS]] - classical molecular dynamics simulator.&lt;br /&gt;
&lt;br /&gt;
= Computational Fluid Dynamics =&lt;br /&gt;
&lt;br /&gt;
* [[ANSYS]] - ANSYS Fluent and CFX - commercial CFD software.&lt;br /&gt;
* [[OpenFOAM]] - Open-course toolkit for creating CFD applications.&lt;br /&gt;
&lt;br /&gt;
= Finite Element Modelling =&lt;br /&gt;
* [[ANSYS]] - ANSYS Mechanical - commercial software for finite element-based structural analysis.&lt;br /&gt;
* [[Abaqus]] - commercial software for finite element-based analysis.&lt;br /&gt;
&lt;br /&gt;
= Geospatial Analysis =&lt;br /&gt;
&lt;br /&gt;
* [[GDAL on ARC | GDAL]]&lt;br /&gt;
&lt;br /&gt;
* [[Geopandas on ARC | Geopandas]]&lt;br /&gt;
&lt;br /&gt;
= Machine Learning =&lt;br /&gt;
&lt;br /&gt;
* [[Tensorflow on ARC | Tensorflow]]&lt;br /&gt;
&lt;br /&gt;
* [[Torch on ARC | PyTorch]]&lt;br /&gt;
&lt;br /&gt;
= Mathematical Libaries and Applications =&lt;br /&gt;
&lt;br /&gt;
* [[MATLAB]] - Using MATLAB on ARC&lt;br /&gt;
* [[Mathematica]] - Using Mathematica on ARC&lt;br /&gt;
&lt;br /&gt;
= Neuroimaging =&lt;br /&gt;
&lt;br /&gt;
* [[FSL on ARC | Freesurfer]]&lt;br /&gt;
&lt;br /&gt;
* [[Statistical Parametric Mapping on ARC | SPM 12]]&lt;br /&gt;
&lt;br /&gt;
= Package Management =&lt;br /&gt;
&lt;br /&gt;
* [[Conda on ARC | Conda]]&lt;br /&gt;
&lt;br /&gt;
= Statistics =&lt;br /&gt;
&lt;br /&gt;
* [[R on ARC | R]]&lt;br /&gt;
&lt;br /&gt;
* [[Stan on ARC | rstan]]&lt;br /&gt;
&lt;br /&gt;
= Reservoir Simulations =&lt;br /&gt;
&lt;br /&gt;
= Bioinformatics =&lt;/div&gt;</summary>
		<author><name>Phillips</name></author>
	</entry>
	<entry>
		<id>https://rcs.ucalgary.ca/index.php?title=ARC_Software&amp;diff=621</id>
		<title>ARC Software</title>
		<link rel="alternate" type="text/html" href="https://rcs.ucalgary.ca/index.php?title=ARC_Software&amp;diff=621"/>
		<updated>2020-05-31T14:42:53Z</updated>

		<summary type="html">&lt;p&gt;Phillips: Added entries for OpenFOAM, ANSYS and Abaqus&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Chemistry =&lt;br /&gt;
&lt;br /&gt;
* [[Gaussian on ARC | Gaussian 16]]&lt;br /&gt;
* [[GROMACS]] - classical molecular dynamics simulator.&lt;br /&gt;
&lt;br /&gt;
= Computational Fluid Dynamics&lt;br /&gt;
&lt;br /&gt;
* [[ANSYS]] - ANSYS Fluent and CFX - commercial CFD software.&lt;br /&gt;
* [[OpenFOAM]] - Open-course toolkit for creating CFD applications.&lt;br /&gt;
&lt;br /&gt;
= Finite Element Modelling&lt;br /&gt;
* [[ANSYS]] - ANSYS Mechanical - commercial software for finite element-based structural analysis.&lt;br /&gt;
* [[Abaqus]] - commercial software for finite element-based analysis.&lt;br /&gt;
&lt;br /&gt;
= Geospatial Analysis =&lt;br /&gt;
&lt;br /&gt;
* [[GDAL on ARC | GDAL]]&lt;br /&gt;
&lt;br /&gt;
* [[Geopandas on ARC | Geopandas]]&lt;br /&gt;
&lt;br /&gt;
= Machine Learning =&lt;br /&gt;
&lt;br /&gt;
* [[Tensorflow on ARC | Tensorflow]]&lt;br /&gt;
&lt;br /&gt;
* [[Torch on ARC | PyTorch]]&lt;br /&gt;
&lt;br /&gt;
= Mathematical Libaries and Applications =&lt;br /&gt;
&lt;br /&gt;
* [[MATLAB]] - Using MATLAB on ARC&lt;br /&gt;
* [[Mathematica]] - Using Mathematica on ARC&lt;br /&gt;
&lt;br /&gt;
= Neuroimaging =&lt;br /&gt;
&lt;br /&gt;
* [[FSL on ARC | Freesurfer]]&lt;br /&gt;
&lt;br /&gt;
* [[Statistical Parametric Mapping on ARC | SPM 12]]&lt;br /&gt;
&lt;br /&gt;
= Package Management =&lt;br /&gt;
&lt;br /&gt;
* [[Conda on ARC | Conda]]&lt;br /&gt;
&lt;br /&gt;
= Statistics =&lt;br /&gt;
&lt;br /&gt;
* [[R on ARC | R]]&lt;br /&gt;
&lt;br /&gt;
* [[Stan on ARC | rstan]]&lt;br /&gt;
&lt;br /&gt;
= Reservoir Simulations =&lt;br /&gt;
&lt;br /&gt;
= Bioinformatics =&lt;/div&gt;</summary>
		<author><name>Phillips</name></author>
	</entry>
	<entry>
		<id>https://rcs.ucalgary.ca/index.php?title=OpenFOAM&amp;diff=620</id>
		<title>OpenFOAM</title>
		<link rel="alternate" type="text/html" href="https://rcs.ucalgary.ca/index.php?title=OpenFOAM&amp;diff=620"/>
		<updated>2020-05-31T14:31:58Z</updated>

		<summary type="html">&lt;p&gt;Phillips: /* Running OpenFOAM batch jobs on ARC */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:OpenFOAM]]&lt;br /&gt;
[[Category:Software]]&lt;br /&gt;
[[Category:ARC]]&lt;br /&gt;
&amp;lt;span id=&amp;quot;contents&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
= &amp;lt;span id=&amp;quot;intro&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Introduction =&lt;br /&gt;
OpenFOAM is a free, open-source, toolkit for creation of computational fluid dynamics (CFD) applications.  It includes solver libraries and pre- and post-processing utilities. Common variants of OpenFOAM include those from openfoam.org and openfoam.com .&lt;br /&gt;
&lt;br /&gt;
Typically, researchers will install OpenFOAM on their own computers to learn how to use the software, run simulations that exceed their local hardware capabilities on ARC and then transfer output data back to their own computers for visualization.&lt;br /&gt;
&lt;br /&gt;
= Running OpenFOAM batch jobs on ARC =&lt;br /&gt;
Researchers using OpenFOAM on ARC are expected to be generally familiar with OpenFOAM capabilities, input file format and the use of restart files.&lt;br /&gt;
&lt;br /&gt;
Like other jobs on ARC, OpenFOAM calculations are run by submitting an appropriate script for batch scheduling using the sbatch command. See documentation on [[Running_jobs|running batch jobs]] for more information.&lt;br /&gt;
&lt;br /&gt;
Several different versions of OpenFOAM have been installed on ARC under /global/software/openfoam, but, some researchers have chosen to install particular versions in their own home directories or take advantage of the wide range of [https://docs.computecanada.ca/wiki/Available_software versions installed on Compute Canada clusters (external link)].&lt;br /&gt;
&lt;br /&gt;
Here is a sample script that was used to test OpenFOAM on ARC with one of the supplied tutorial cases ([http://cfd.direct/openfoam/user-guide/dambreak/ damBreakFine (external link)]), which used interFoam, modified to use the scotch decomposition option.  The job script and input files can be copied and run on ARC with:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cp -R /global/software/openfoam/examples/damBreak/damBreakVeryFine_scotch_template dambreak&lt;br /&gt;
cd dambreak&lt;br /&gt;
sbatch dambreak.slurm&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The version (&amp;quot;6.x&amp;quot;) of OpenFOAM used is from openfoam.org and was built with GNU 4.8.5 compilers and OpenMPI version 2.1.3. OpenFOAM build options used were WM_LABEL_SIZE=64 and FOAMY_HEX_MESH=yes.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
&lt;br /&gt;
#SBATCH --nodes=2&lt;br /&gt;
#SBATCH --ntasks-per-node=40    # number of MPI processes per node - adjust according to the partition&lt;br /&gt;
#SBATCH --mem=0                 # Use --mem=0 to request all the available memory on a node  &lt;br /&gt;
#SBATCH --time=05:00:00         # Maximum run time in hh:mm:ss, or d-hh:mm&lt;br /&gt;
#SBATCH --partition=pawson-bf,apophis-bf,razi-bf,cpu2019&lt;br /&gt;
&lt;br /&gt;
# Check on some basics:&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Running on host: $(hostname)&amp;quot;&lt;br /&gt;
echo &amp;quot;Current working directory is: $(pwd)&amp;quot;&lt;br /&gt;
echo &amp;quot;Starting job at $(date)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Initialize OpenFOAM environment.&lt;br /&gt;
module load openmpi/2.1.3-gnu&lt;br /&gt;
export OMPI_MCA_mpi_cuda_support=0&lt;br /&gt;
&lt;br /&gt;
source /global/software/openfoam/6x_20181025_gcc485_mpi_213gnu/OpenFOAM-6/etc/bashrc FOAMY_HEX_MESH=yes&lt;br /&gt;
&lt;br /&gt;
export FOAM_RUN=$PWD&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Working in $PWD&amp;quot;&lt;br /&gt;
&lt;br /&gt;
CORES=$SLURM_NTASKS&lt;br /&gt;
echo &amp;quot;Running on $CORES cores.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Make a new decomposeParDict file&amp;quot;&lt;br /&gt;
DATE=$(date)&lt;br /&gt;
&lt;br /&gt;
cat &amp;gt; system/decomposeParDict &amp;lt;&amp;lt;EOF&lt;br /&gt;
FoamFile&lt;br /&gt;
{&lt;br /&gt;
    version     2.0;&lt;br /&gt;
    format      ascii;&lt;br /&gt;
    class       dictionary;&lt;br /&gt;
    location    &amp;quot;system&amp;quot;;&lt;br /&gt;
    object      decomposeParDict;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// decomposeParDict created at ${DATE}.&lt;br /&gt;
&lt;br /&gt;
numberOfSubdomains $CORES;&lt;br /&gt;
&lt;br /&gt;
method          scotch;&lt;br /&gt;
&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Forcing new decomposition&amp;quot;&lt;br /&gt;
&lt;br /&gt;
decomposePar -force&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Using mpiexec: $(which mpiexec)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
FOAM=$(which interFoam)&lt;br /&gt;
echo &amp;quot;About to run $FOAM at $(date)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
mpiexec $FOAM -parallel &amp;gt; dambreakveryfine_scotch_arc_${CORES}cores_${SLURM_JOB_ID}.out&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Finished at $(date)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Running reconstructPar at $(date).&amp;quot;&lt;br /&gt;
reconstructPar -newTimes&lt;br /&gt;
echo &amp;quot;Finished reconstructPar at $(date).&amp;quot;&lt;br /&gt;
echo &amp;quot;Manually delete processor directories if reconstruction succeeded. &amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
OpenFOAM can produce large numbers of files per run when many processors (CPU cores) are used.  The reconstructPar command should be used to consolidate the per-processor files into a single directory per time step.  As noted in a comment in the above script, after you have verified that the reconstruction has succeeded you shoulld delete the processor directories.&lt;br /&gt;
&lt;br /&gt;
= Support =&lt;br /&gt;
&lt;br /&gt;
Please send any questions regarding using OpenFOAM on ARC to support@hpc.ucalgary.ca.&lt;/div&gt;</summary>
		<author><name>Phillips</name></author>
	</entry>
	<entry>
		<id>https://rcs.ucalgary.ca/index.php?title=OpenFOAM&amp;diff=619</id>
		<title>OpenFOAM</title>
		<link rel="alternate" type="text/html" href="https://rcs.ucalgary.ca/index.php?title=OpenFOAM&amp;diff=619"/>
		<updated>2020-05-31T14:24:38Z</updated>

		<summary type="html">&lt;p&gt;Phillips: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:OpenFOAM]]&lt;br /&gt;
[[Category:Software]]&lt;br /&gt;
[[Category:ARC]]&lt;br /&gt;
&amp;lt;span id=&amp;quot;contents&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
= &amp;lt;span id=&amp;quot;intro&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Introduction =&lt;br /&gt;
OpenFOAM is a free, open-source, toolkit for creation of computational fluid dynamics (CFD) applications.  It includes solver libraries and pre- and post-processing utilities. Common variants of OpenFOAM include those from openfoam.org and openfoam.com .&lt;br /&gt;
&lt;br /&gt;
Typically, researchers will install OpenFOAM on their own computers to learn how to use the software, run simulations that exceed their local hardware capabilities on ARC and then transfer output data back to their own computers for visualization.&lt;br /&gt;
&lt;br /&gt;
= Running OpenFOAM batch jobs on ARC =&lt;br /&gt;
Researchers using OpenFOAM on ARC are expected to be generally familiar with OpenFOAM capabilities, input file format and the use of restart files.&lt;br /&gt;
&lt;br /&gt;
Like other jobs on ARC, OpenFOAM calculations are run by submitting an appropriate script for batch scheduling using the sbatch command. See documentation on [[Running_jobs|running batch jobs]] for more information.&lt;br /&gt;
&lt;br /&gt;
Several different versions of OpenFOAM have been installed on ARC under /global/software/openfoam, but, some researchers have chosen to install particular versions in their own home directories or take advantage of the wide range of [https://docs.computecanada.ca/wiki/Available_software versions installed on Compute Canada clusters (external link)].&lt;br /&gt;
&lt;br /&gt;
Here is a sample script that was used to test OpenFOAM on ARC with one of the supplied tutorial cases ([http://cfd.direct/openfoam/user-guide/dambreak/ damBreakFine (external link)]), which used interFoam, modified to use the scotch decomposition option.  The job script and input files can be copied from the /global/software/openfoam/examples/damBreak/damBreakVeryFine_scotch_template directory on ARC.&lt;br /&gt;
&lt;br /&gt;
The version (&amp;quot;6.x&amp;quot;) of OpenFOAM used is from openfoam.org and was built with GNU 4.8.5 compilers and OpenMPI version 2.1.3. OpenFOAM build options used were WM_LABEL_SIZE=64 and FOAMY_HEX_MESH=yes.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
&lt;br /&gt;
#SBATCH --nodes=2&lt;br /&gt;
#SBATCH --ntasks-per-node=40    # number of MPI processes per node - adjust according to the partition&lt;br /&gt;
#SBATCH --mem=0                 # Use --mem=0 to request all the available memory on a node  &lt;br /&gt;
#SBATCH --time=05:00:00         # Maximum run time in hh:mm:ss, or d-hh:mm&lt;br /&gt;
#SBATCH --partition=pawson-bf,apophis-bf,razi-bf,cpu2019&lt;br /&gt;
&lt;br /&gt;
# Check on some basics:&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Running on host: $(hostname)&amp;quot;&lt;br /&gt;
echo &amp;quot;Current working directory is: $(pwd)&amp;quot;&lt;br /&gt;
echo &amp;quot;Starting job at $(date)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Initialize OpenFOAM environment.&lt;br /&gt;
module load openmpi/2.1.3-gnu&lt;br /&gt;
export OMPI_MCA_mpi_cuda_support=0&lt;br /&gt;
&lt;br /&gt;
source /global/software/openfoam/6x_20181025_gcc485_mpi_213gnu/OpenFOAM-6/etc/bashrc FOAMY_HEX_MESH=yes&lt;br /&gt;
&lt;br /&gt;
export FOAM_RUN=$PWD&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Working in $PWD&amp;quot;&lt;br /&gt;
&lt;br /&gt;
CORES=$SLURM_NTASKS&lt;br /&gt;
echo &amp;quot;Running on $CORES cores.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Make a new decomposeParDict file&amp;quot;&lt;br /&gt;
DATE=$(date)&lt;br /&gt;
&lt;br /&gt;
cat &amp;gt; system/decomposeParDict &amp;lt;&amp;lt;EOF&lt;br /&gt;
FoamFile&lt;br /&gt;
{&lt;br /&gt;
    version     2.0;&lt;br /&gt;
    format      ascii;&lt;br /&gt;
    class       dictionary;&lt;br /&gt;
    location    &amp;quot;system&amp;quot;;&lt;br /&gt;
    object      decomposeParDict;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// decomposeParDict created at ${DATE}.&lt;br /&gt;
&lt;br /&gt;
numberOfSubdomains $CORES;&lt;br /&gt;
&lt;br /&gt;
method          scotch;&lt;br /&gt;
&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Forcing new decomposition&amp;quot;&lt;br /&gt;
&lt;br /&gt;
decomposePar -force&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Using mpiexec: $(which mpiexec)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
FOAM=$(which interFoam)&lt;br /&gt;
echo &amp;quot;About to run $FOAM at $(date)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
mpiexec $FOAM -parallel &amp;gt; dambreakveryfine_scotch_arc_${CORES}cores_${SLURM_JOB_ID}.out&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Finished at $(date)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Running reconstructPar at $(date).&amp;quot;&lt;br /&gt;
reconstructPar -newTimes&lt;br /&gt;
echo &amp;quot;Finished reconstructPar at $(date).&amp;quot;&lt;br /&gt;
echo &amp;quot;Manually delete processor directories if reconstruction succeeded. &amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
OpenFOAM can produce large numbers of files per run when many processors (CPU cores) are used.  The reconstructPar command should be used to consolidate the per-processor files into a single directory per time step.  As noted in a comment in the above script, after you have verified that the reconstruction has succeeded you shoulld delete the processor directories.&lt;br /&gt;
= Support =&lt;br /&gt;
&lt;br /&gt;
Please send any questions regarding using OpenFOAM on ARC to support@hpc.ucalgary.ca.&lt;/div&gt;</summary>
		<author><name>Phillips</name></author>
	</entry>
	<entry>
		<id>https://rcs.ucalgary.ca/index.php?title=OpenFOAM&amp;diff=618</id>
		<title>OpenFOAM</title>
		<link rel="alternate" type="text/html" href="https://rcs.ucalgary.ca/index.php?title=OpenFOAM&amp;diff=618"/>
		<updated>2020-05-31T14:20:56Z</updated>

		<summary type="html">&lt;p&gt;Phillips: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:OpenFOAM]]&lt;br /&gt;
[[Category:Software]]&lt;br /&gt;
[[Category:ARC]]&lt;br /&gt;
&amp;lt;span id=&amp;quot;contents&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
= &amp;lt;span id=&amp;quot;intro&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Introduction =&lt;br /&gt;
OpenFOAM is a free, open-source, toolkit for creation of computational fluid dynamics (CFD) applications.  It includes solver libraries and pre- and post-processing utilities. Common variants of OpenFOAM include those from openfoam.org and openfoam.com .&lt;br /&gt;
&lt;br /&gt;
Typically, researchers will install OpenFOAM on their own computers to learn how to use the software, run simulations that exceed their local hardware capabilities on ARC and then transfer output data back to their own computers for visualization.&lt;br /&gt;
&lt;br /&gt;
= Running OpenFOAM batch jobs on ARC =&lt;br /&gt;
Researchers using OpenFOAM on ARC are expected to be generally familiar with OpenFOAM capabilities, input file format and the use of restart files.&lt;br /&gt;
&lt;br /&gt;
Like other jobs on ARC, OpenFOAM calculations are run by submitting an appropriate script for batch scheduling using the sbatch command. See documentation on [[Running_jobs|running batch jobs]] for more information.&lt;br /&gt;
&lt;br /&gt;
Several different versions of OpenFOAM have been installed on ARC under /global/software/openfoam, but, some researchers have chosen to install particular versions in their own home directories or take advantage of the wide range of [https://docs.computecanada.ca/wiki/Available_software versions installed on Compute Canada clusters (external link)].&lt;br /&gt;
&lt;br /&gt;
Here is a sample script that was used to test OpenFOAM on ARC with one of the supplied tutorial cases ([http://cfd.direct/openfoam/user-guide/dambreak/ damBreakFine (external link)]), which used interFoam, modified to use the scotch decomposition option.  The job script and input files can be copied from the /global/software/openfoam/examples/damBreak/damBreakVeryFine_scotch_template directory on ARC.&lt;br /&gt;
&lt;br /&gt;
The version (&amp;quot;6.x&amp;quot;) of OpenFOAM used is from openfoam.org and was built with GNU 4.8.5 compilers and OpenMPI version 2.1.3. OpenFOAM build options used were WM_LABEL_SIZE=64 and FOAMY_HEX_MESH=yes.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
&lt;br /&gt;
#SBATCH --nodes=2&lt;br /&gt;
#SBATCH --ntasks-per-node=40    # number of MPI processes per node - adjust according to the partition&lt;br /&gt;
#SBATCH --mem=0                 # Use --mem=0 to request all the available memory on a node  &lt;br /&gt;
#SBATCH --time=05:00:00         # Maximum run time in hh:mm:ss, or d-hh:mm&lt;br /&gt;
#SBATCH --partition=pawson-bf,apophis-bf,razi-bf,cpu2019&lt;br /&gt;
&lt;br /&gt;
# Check on some basics:&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Running on host: $(hostname)&amp;quot;&lt;br /&gt;
echo &amp;quot;Current working directory is: $(pwd)&amp;quot;&lt;br /&gt;
echo &amp;quot;Starting job at $(date)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Initialize OpenFOAM environment.&lt;br /&gt;
module load openmpi/2.1.3-gnu&lt;br /&gt;
export OMPI_MCA_mpi_cuda_support=0&lt;br /&gt;
&lt;br /&gt;
source /global/software/openfoam/6x_20181025_gcc485_mpi_213gnu/OpenFOAM-6/etc/bashrc FOAMY_HEX_MESH=yes&lt;br /&gt;
&lt;br /&gt;
export FOAM_RUN=$PWD&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Working in $PWD&amp;quot;&lt;br /&gt;
&lt;br /&gt;
CORES=$SLURM_NTASKS&lt;br /&gt;
echo &amp;quot;Running on $CORES cores.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Make a new decomposeParDict file&amp;quot;&lt;br /&gt;
DATE=$(date)&lt;br /&gt;
&lt;br /&gt;
cat &amp;gt; system/decomposeParDict &amp;lt;&amp;lt;EOF&lt;br /&gt;
FoamFile&lt;br /&gt;
{&lt;br /&gt;
    version     2.0;&lt;br /&gt;
    format      ascii;&lt;br /&gt;
    class       dictionary;&lt;br /&gt;
    location    &amp;quot;system&amp;quot;;&lt;br /&gt;
    object      decomposeParDict;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// decomposeParDict created at ${DATE}.&lt;br /&gt;
&lt;br /&gt;
numberOfSubdomains $CORES;&lt;br /&gt;
&lt;br /&gt;
method          scotch;&lt;br /&gt;
&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Forcing new decomposition&amp;quot;&lt;br /&gt;
&lt;br /&gt;
decomposePar -force&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Using mpiexec: $(which mpiexec)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
FOAM=$(which interFoam)&lt;br /&gt;
echo &amp;quot;About to run $FOAM at $(date)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
mpiexec $FOAM -parallel &amp;gt; dambreakveryfine_scotch_arc_${CORES}cores_${SLURM_JOB_ID}.out&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Finished at $(date)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Running reconstructPar at $(date).&amp;quot;&lt;br /&gt;
reconstructPar -newTimes&lt;br /&gt;
echo &amp;quot;Finished reconstructPar at $(date).&amp;quot;&lt;br /&gt;
echo &amp;quot;Manually delete processor directories if reconstruction succeeded. &amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Support =&lt;br /&gt;
&lt;br /&gt;
Please send any questions regarding using OpenFOAM on ARC to support@hpc.ucalgary.ca.&lt;/div&gt;</summary>
		<author><name>Phillips</name></author>
	</entry>
	<entry>
		<id>https://rcs.ucalgary.ca/index.php?title=OpenFOAM&amp;diff=617</id>
		<title>OpenFOAM</title>
		<link rel="alternate" type="text/html" href="https://rcs.ucalgary.ca/index.php?title=OpenFOAM&amp;diff=617"/>
		<updated>2020-05-31T14:20:00Z</updated>

		<summary type="html">&lt;p&gt;Phillips: Add table of contents&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:OpenFOAM]]&lt;br /&gt;
[[Category:Software]]&lt;br /&gt;
[[Category:ARC]]&lt;br /&gt;
&amp;lt;span id=&amp;quot;contents&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
= &amp;lt;span id=&amp;quot;intro&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Introduction =&lt;br /&gt;
OpenFOAM is a free, open-source, toolkit for creation of computational fluid dynamics (CFD) applications.  It includes solver libraries and pre- and post-processing utilities. Common variants of OpenFOAM include those from openfoam.org and openfoam.com .&lt;br /&gt;
&lt;br /&gt;
Typically, researchers will install OpenFOAM on their own computers to learn how to use the software, run simulations that exceed their local hardware capabilities on ARC and then transfer output data back to their own computers for visualization.&lt;br /&gt;
&lt;br /&gt;
= Running OpenFOAM batch jobs on ARC =&lt;br /&gt;
Researchers using OpenFOAM on ARC are expected to be generally familiar with OpenFOAM capabilities, input file format and the use of restart files.&lt;br /&gt;
&lt;br /&gt;
Like other jobs on ARC, OpenFOAM calculations are run by submitting an appropriate script for batch scheduling using the sbatch command. See documentation on [Running_jobs|running batch jobs] for more information.&lt;br /&gt;
&lt;br /&gt;
Several different versions of OpenFOAM have been installed on ARC under /global/software/openfoam, but, some researchers have chosen to install particular versions in their own home directories or take advantage of the wide range of [https://docs.computecanada.ca/wiki/Available_software versions installed on Compute Canada clusters (external link)].&lt;br /&gt;
&lt;br /&gt;
Here is a sample script that was used to test OpenFOAM on ARC with one of the supplied tutorial cases ([http://cfd.direct/openfoam/user-guide/dambreak/ damBreakFine (external link)]), which used interFoam, modified to use the scotch decomposition option.  The job script and input files can be copied from the /global/software/openfoam/examples/damBreak/damBreakVeryFine_scotch_template directory on ARC.&lt;br /&gt;
&lt;br /&gt;
The version (&amp;quot;6.x&amp;quot;) of OpenFOAM used is from openfoam.org and was built with GNU 4.8.5 compilers and OpenMPI version 2.1.3. OpenFOAM build options used were WM_LABEL_SIZE=64 and FOAMY_HEX_MESH=yes.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
&lt;br /&gt;
#SBATCH --nodes=2&lt;br /&gt;
#SBATCH --ntasks-per-node=40    # number of MPI processes per node - adjust according to the partition&lt;br /&gt;
#SBATCH --mem=0                 # Use --mem=0 to request all the available memory on a node  &lt;br /&gt;
#SBATCH --time=05:00:00         # Maximum run time in hh:mm:ss, or d-hh:mm&lt;br /&gt;
#SBATCH --partition=pawson-bf,apophis-bf,razi-bf,cpu2019&lt;br /&gt;
&lt;br /&gt;
# Check on some basics:&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Running on host: $(hostname)&amp;quot;&lt;br /&gt;
echo &amp;quot;Current working directory is: $(pwd)&amp;quot;&lt;br /&gt;
echo &amp;quot;Starting job at $(date)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Initialize OpenFOAM environment.&lt;br /&gt;
module load openmpi/2.1.3-gnu&lt;br /&gt;
export OMPI_MCA_mpi_cuda_support=0&lt;br /&gt;
&lt;br /&gt;
source /global/software/openfoam/6x_20181025_gcc485_mpi_213gnu/OpenFOAM-6/etc/bashrc FOAMY_HEX_MESH=yes&lt;br /&gt;
&lt;br /&gt;
export FOAM_RUN=$PWD&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Working in $PWD&amp;quot;&lt;br /&gt;
&lt;br /&gt;
CORES=$SLURM_NTASKS&lt;br /&gt;
echo &amp;quot;Running on $CORES cores.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Make a new decomposeParDict file&amp;quot;&lt;br /&gt;
DATE=$(date)&lt;br /&gt;
&lt;br /&gt;
cat &amp;gt; system/decomposeParDict &amp;lt;&amp;lt;EOF&lt;br /&gt;
FoamFile&lt;br /&gt;
{&lt;br /&gt;
    version     2.0;&lt;br /&gt;
    format      ascii;&lt;br /&gt;
    class       dictionary;&lt;br /&gt;
    location    &amp;quot;system&amp;quot;;&lt;br /&gt;
    object      decomposeParDict;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// decomposeParDict created at ${DATE}.&lt;br /&gt;
&lt;br /&gt;
numberOfSubdomains $CORES;&lt;br /&gt;
&lt;br /&gt;
method          scotch;&lt;br /&gt;
&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Forcing new decomposition&amp;quot;&lt;br /&gt;
&lt;br /&gt;
decomposePar -force&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Using mpiexec: $(which mpiexec)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
FOAM=$(which interFoam)&lt;br /&gt;
echo &amp;quot;About to run $FOAM at $(date)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
mpiexec $FOAM -parallel &amp;gt; dambreakveryfine_scotch_arc_${CORES}cores_${SLURM_JOB_ID}.out&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Finished at $(date)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Running reconstructPar at $(date).&amp;quot;&lt;br /&gt;
reconstructPar -newTimes&lt;br /&gt;
echo &amp;quot;Finished reconstructPar at $(date).&amp;quot;&lt;br /&gt;
echo &amp;quot;Manually delete processor directories if reconstruction succeeded. &amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Support =&lt;br /&gt;
&lt;br /&gt;
Please send any questions regarding using OpenFOAM on ARC to support@hpc.ucalgary.ca.&lt;/div&gt;</summary>
		<author><name>Phillips</name></author>
	</entry>
	<entry>
		<id>https://rcs.ucalgary.ca/index.php?title=OpenFOAM&amp;diff=616</id>
		<title>OpenFOAM</title>
		<link rel="alternate" type="text/html" href="https://rcs.ucalgary.ca/index.php?title=OpenFOAM&amp;diff=616"/>
		<updated>2020-05-31T14:19:12Z</updated>

		<summary type="html">&lt;p&gt;Phillips: OpenFOAM page created.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:OpenFOAM]]&lt;br /&gt;
[[Category:Software]]&lt;br /&gt;
[[Category:ARC]]&lt;br /&gt;
&amp;lt;span id=&amp;quot;contents&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
= &amp;lt;span id=&amp;quot;intro&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Introduction =&lt;br /&gt;
OpenFOAM is a free, open-source, toolkit for creation of computational fluid dynamics (CFD) applications.  It includes solver libraries and pre- and post-processing utilities. Common variants of OpenFOAM include those from openfoam.org and openfoam.com .&lt;br /&gt;
&lt;br /&gt;
Typically, researchers will install OpenFOAM on their own computers to learn how to use the software, run simulations that exceed their local hardware capabilities on ARC and then transfer output data back to their own computers for visualization.&lt;br /&gt;
&lt;br /&gt;
= Running OpenFOAM batch jobs on ARC =&lt;br /&gt;
Researchers using OpenFOAM on ARC are expected to be generally familiar with OpenFOAM capabilities, input file format and the use of restart files.&lt;br /&gt;
&lt;br /&gt;
Like other jobs on ARC, OpenFOAM calculations are run by submitting an appropriate script for batch scheduling using the sbatch command. See documentation on [Running_jobs|running batch jobs] for more information.&lt;br /&gt;
&lt;br /&gt;
Several different versions of OpenFOAM have been installed on ARC under /global/software/openfoam, but, some researchers have chosen to install particular versions in their own home directories or take advantage of the wide range of [https://docs.computecanada.ca/wiki/Available_software versions installed on Compute Canada clusters (external link)].&lt;br /&gt;
&lt;br /&gt;
Here is a sample script that was used to test OpenFOAM on ARC with one of the supplied tutorial cases ([http://cfd.direct/openfoam/user-guide/dambreak/ damBreakFine (external link)]), which used interFoam, modified to use the scotch decomposition option.  The job script and input files can be copied from the /global/software/openfoam/examples/damBreak/damBreakVeryFine_scotch_template directory on ARC.&lt;br /&gt;
&lt;br /&gt;
The version (&amp;quot;6.x&amp;quot;) of OpenFOAM used is from openfoam.org and was built with GNU 4.8.5 compilers and OpenMPI version 2.1.3. OpenFOAM build options used were WM_LABEL_SIZE=64 and FOAMY_HEX_MESH=yes.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
&lt;br /&gt;
#SBATCH --nodes=2&lt;br /&gt;
#SBATCH --ntasks-per-node=40    # number of MPI processes per node - adjust according to the partition&lt;br /&gt;
#SBATCH --mem=0                 # Use --mem=0 to request all the available memory on a node  &lt;br /&gt;
#SBATCH --time=05:00:00         # Maximum run time in hh:mm:ss, or d-hh:mm&lt;br /&gt;
#SBATCH --partition=pawson-bf,apophis-bf,razi-bf,cpu2019&lt;br /&gt;
&lt;br /&gt;
# Check on some basics:&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Running on host: $(hostname)&amp;quot;&lt;br /&gt;
echo &amp;quot;Current working directory is: $(pwd)&amp;quot;&lt;br /&gt;
echo &amp;quot;Starting job at $(date)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Initialize OpenFOAM environment.&lt;br /&gt;
module load openmpi/2.1.3-gnu&lt;br /&gt;
export OMPI_MCA_mpi_cuda_support=0&lt;br /&gt;
&lt;br /&gt;
source /global/software/openfoam/6x_20181025_gcc485_mpi_213gnu/OpenFOAM-6/etc/bashrc FOAMY_HEX_MESH=yes&lt;br /&gt;
&lt;br /&gt;
export FOAM_RUN=$PWD&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Working in $PWD&amp;quot;&lt;br /&gt;
&lt;br /&gt;
CORES=$SLURM_NTASKS&lt;br /&gt;
echo &amp;quot;Running on $CORES cores.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Make a new decomposeParDict file&amp;quot;&lt;br /&gt;
DATE=$(date)&lt;br /&gt;
&lt;br /&gt;
cat &amp;gt; system/decomposeParDict &amp;lt;&amp;lt;EOF&lt;br /&gt;
FoamFile&lt;br /&gt;
{&lt;br /&gt;
    version     2.0;&lt;br /&gt;
    format      ascii;&lt;br /&gt;
    class       dictionary;&lt;br /&gt;
    location    &amp;quot;system&amp;quot;;&lt;br /&gt;
    object      decomposeParDict;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// decomposeParDict created at ${DATE}.&lt;br /&gt;
&lt;br /&gt;
numberOfSubdomains $CORES;&lt;br /&gt;
&lt;br /&gt;
method          scotch;&lt;br /&gt;
&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Forcing new decomposition&amp;quot;&lt;br /&gt;
&lt;br /&gt;
decomposePar -force&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Using mpiexec: $(which mpiexec)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
FOAM=$(which interFoam)&lt;br /&gt;
echo &amp;quot;About to run $FOAM at $(date)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
mpiexec $FOAM -parallel &amp;gt; dambreakveryfine_scotch_arc_${CORES}cores_${SLURM_JOB_ID}.out&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Finished at $(date)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Running reconstructPar at $(date).&amp;quot;&lt;br /&gt;
reconstructPar -newTimes&lt;br /&gt;
echo &amp;quot;Finished reconstructPar at $(date).&amp;quot;&lt;br /&gt;
echo &amp;quot;Manually delete processor directories if reconstruction succeeded. &amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Support =&lt;br /&gt;
&lt;br /&gt;
Please send any questions regarding using OpenFOAM on ARC to support@hpc.ucalgary.ca.&lt;/div&gt;</summary>
		<author><name>Phillips</name></author>
	</entry>
	<entry>
		<id>https://rcs.ucalgary.ca/index.php?title=Mathematica&amp;diff=615</id>
		<title>Mathematica</title>
		<link rel="alternate" type="text/html" href="https://rcs.ucalgary.ca/index.php?title=Mathematica&amp;diff=615"/>
		<updated>2020-05-29T14:49:18Z</updated>

		<summary type="html">&lt;p&gt;Phillips: /* Support */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Mathematica]]&lt;br /&gt;
[[Category:Software]]&lt;br /&gt;
[[Category:ARC]]&lt;br /&gt;
&amp;lt;span id=&amp;quot;contents&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
= &amp;lt;span id=&amp;quot;intro&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Introduction =&lt;br /&gt;
&lt;br /&gt;
[https://www.wolfram.com/mathematica/ Mathematica (external link)] is a general-purpose high-level programming package for both symbolic and numerical calculations.&lt;br /&gt;
&lt;br /&gt;
The main purpose of this page is to show how to use Mathematica on the University of Calgary [[ ARC_Cluster_Guide |ARC (Advanced Research Computing) cluster]]. It is presumed that you already have an account an ARC and have read the material on reserving resources and [[Running jobs|running jobs]] with the Slurm job management system.&lt;br /&gt;
&lt;br /&gt;
= &amp;lt;span id=&amp;quot;license&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Licensing =&lt;br /&gt;
At the University of Calgary, Information Technologies has purchased a site license for using Mathematica for teaching and learning and non-commercial research purposes.  The software has been installed on the ARC cluster, where multiple instances can be run at the same time.  When Mathematica starts up, it checks with a central license server.&lt;br /&gt;
&lt;br /&gt;
For information about installing Mathematica on your own computer, see the Information Technologies Knowledge Base [https://ucalgary.service-now.com/it?id=kb_article&amp;amp;sys_id=9773754113f9bac08246f7b2e144b013 article on Mathematica].&lt;br /&gt;
&lt;br /&gt;
= Running Mathematica on the ARC cluster =&lt;br /&gt;
Although it is possible to run Mathematica interactively (with or without a graphical user interface) on a compute node reserved with the Slurm salloc command, the expectation is that most calculations with Mathematica on ARC will be completed by submitting a batch job script to the Slurm job scheduler with the &#039;&#039;&#039;sbatch&#039;&#039;&#039; command.&lt;br /&gt;
&lt;br /&gt;
Suppose that the following Mathematica code to print out the first million prime numbers is in a file, primes_list.m :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
primeslist = Table[Prime[k],{k,1,1000000}];&lt;br /&gt;
Export[&amp;quot;primes_1000000.out&amp;quot;,primeslist,&amp;quot;Table&amp;quot;,&amp;quot;FieldSeparators&amp;quot;-&amp;gt;&amp;quot; &amp;quot;];&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that formatted Mathematica notebooks cannot be used directly. You need to convert your notebook to a text-format &amp;quot;.m&amp;quot; file, as discussed, for example, [https://mathematica.stackexchange.com/questions/137925/how-can-i-get-the-m-file-with-mathematica here (external link)]. The general idea is to mark cells to be executed as initialization cells and then use &amp;quot;File-&amp;gt;Save as&amp;quot; menu item with the &amp;quot;Package&amp;quot; option to produce the .m file.&lt;br /&gt;
&lt;br /&gt;
The following Slurm batch job script, primes_list.slurm, can be used to run the primes_list.m code on a single complete compute node.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH --nodes=1&lt;br /&gt;
#SBATCH --time=00:30:00&lt;br /&gt;
#SBATCH --mem=0&lt;br /&gt;
#SBATCH --partition=pawson-bf,apophis-bf,razi-bf,single,lattice,parallel,cpu2019,cpu2013&lt;br /&gt;
&lt;br /&gt;
# Mathematica batch processing example.&lt;br /&gt;
# 2020-05-28.&lt;br /&gt;
&lt;br /&gt;
# Select Mathematica command to run:&lt;br /&gt;
MATH=/global/software/mathematica/mathematica1101/bin/math&lt;br /&gt;
&lt;br /&gt;
# Specify the name of the input file of Mathematica text commands:&lt;br /&gt;
INPUT=primes_list.m&lt;br /&gt;
OUTPUT=$(basename $INPUT .m)_${SLURM_JOB_ID}.out&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Current working directory is $(pwd)&amp;quot;&lt;br /&gt;
echo &amp;quot;Running on compute node $(hostname)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Starting run at: $(date)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
$MATH -noprompt -run -script $INPUT &amp;gt; $OUTPUT&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Finished with at: $(date)&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Note that the name of the executable for running Mathematica without a graphical interface is &amp;quot;math&amp;quot;.&lt;br /&gt;
Submit the job with &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sbatch primes_list.slurm&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
For the case of million primes, the run took about 30 seconds on a compute node in one of the slowest partitions (single) on ARC.  The time and memory limits should be adjusted to match the requirements of your calculations, but, some testing is usually required to fine tune those settings.&lt;br /&gt;
= Support =&lt;br /&gt;
&lt;br /&gt;
Please send any questions regarding using Mathematica on ARC to support@hpc.ucalgary.ca.&lt;/div&gt;</summary>
		<author><name>Phillips</name></author>
	</entry>
	<entry>
		<id>https://rcs.ucalgary.ca/index.php?title=MATLAB&amp;diff=614</id>
		<title>MATLAB</title>
		<link rel="alternate" type="text/html" href="https://rcs.ucalgary.ca/index.php?title=MATLAB&amp;diff=614"/>
		<updated>2020-05-29T14:48:53Z</updated>

		<summary type="html">&lt;p&gt;Phillips: /* Support */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:MATLAB]]&lt;br /&gt;
[[Category:Software]]&lt;br /&gt;
[[Category:ARC]]&lt;br /&gt;
&amp;lt;span id=&amp;quot;contents&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
= &amp;lt;span id=&amp;quot;intro&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Introduction =&lt;br /&gt;
&lt;br /&gt;
[http://www.mathworks.com/ MATLAB] is a general-purpose high-level programming package for numerical work such as linear algebra, signal processing and other calculations involving matrices or vectors of data. Visualization tools are also included for presentation of results. The basic MATLAB package is extended through add-on components including SIMULINK, and the Image Processing, Optimization, Neural Network, Signal Processing, Statistics and Wavelet Toolboxes, among others.&lt;br /&gt;
&lt;br /&gt;
The main purpose of this page is to show how to use MATLAB on the University of Calgary [[ ARC_Cluster_Guide |ARC (Advanced Research Computing) cluster]]. It is presumed that you already have an account an ARC and have read the material on reserving resources and [[Running jobs|running jobs]] with the Slurm job management system.&lt;br /&gt;
&lt;br /&gt;
= &amp;lt;span id=&amp;quot;license&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Ways to run MATLAB - License considerations =&lt;br /&gt;
At the University of Calgary, Information Technologies has purchased a MATLAB Total Academic Headcount license that allows installation and use of MATLAB on central clusters, such as ARC, as well as on personal workstations throughout the University. Potentially thousands of instances of MATLAB can be run simultaneously, each checking out a license from a central license server. An alternative is to compile MATLAB code into a standalone application. When such an application is run, it does not need to contact the server for a license. This allows researchers to run their calculations on compatible hardware, not necessarily at the University of Calgary, such as on [https://docs.computecanada.ca/wiki/Getting_started Compute Canada clusters (external link)].&lt;br /&gt;
&lt;br /&gt;
For information about installing MATLAB on your own computer, see the Information Technologies Knowledge Base [https://ucalgary.service-now.com/it?id=kb_article&amp;amp;sys_id=787d708213fdbec08246f7b2e144b0d4 article on MATLAB].&lt;br /&gt;
&lt;br /&gt;
= Running MATLAB on the ARC cluster =&lt;br /&gt;
Although it is possible to run MATLAB interactively, the expectation is that most calculations with MATLAB will be completed by submitting a batch job script to the Slurm job scheduler with the sbatch command.&lt;br /&gt;
&lt;br /&gt;
For many researchers, the main reason for using ARC for MATLAB-based calculations is to be able to run many instances at the same time.  It is recommended in such cases that any parallel processing features be removed from the code and each instance of MATLAB be run on a single CPU core.  It is also possible to run MATLAB on multiple cores in an attempt to speed up individual instances, but, this generally results in a less efficient use of the cluster hardware.  In the sections that follow, serial and then parallel processing examples are shown.&lt;br /&gt;
&lt;br /&gt;
== Serial MATLAB example==&lt;br /&gt;
&lt;br /&gt;
For the purposes of illustration, suppose the following serial MATLAB code, in a file sawtooth.m, is to be run. If your code does not already have them, add a function statement at the beginning and matching end statement at the end as shown in the example. Other features of this example include calling a function with both numerical and string arguments, incorporating a Slurm environment variable into the MATLAB code and producing graphical output in a non-interactive environment.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
function sawtooth(nterms,nppcycle,ncycle,pngfilebase)&lt;br /&gt;
&lt;br /&gt;
% MATLAB file example to approximate a sawtooth&lt;br /&gt;
% with a truncated Fourier expansion.&lt;br /&gt;
&lt;br /&gt;
% nterms = number of terms in expansion.&lt;br /&gt;
% nppcycle = number of points per cycle.&lt;br /&gt;
% ncycle = number of complete cycles to plot.&lt;br /&gt;
% pngfilebase = base of file name for graph of results.&lt;br /&gt;
&lt;br /&gt;
% 2020-05-14&lt;br /&gt;
&lt;br /&gt;
np=nppcycle*ncycle;&lt;br /&gt;
&lt;br /&gt;
fourbypi=4.0/pi;&lt;br /&gt;
y(1:np)=pi/2.0;&lt;br /&gt;
x(1:np)=linspace(-pi*ncycle,pi*ncycle,np);&lt;br /&gt;
&lt;br /&gt;
for k=1:nterms&lt;br /&gt;
  twokm=2*k-1;&lt;br /&gt;
  y=y-fourbypi*cos(twokm*x)/twokm^2;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
% Prepare output&lt;br /&gt;
% Construct the output file name from the base file name and number of terms&lt;br /&gt;
% Also append the Slurm JOBID to keep file names unique from run to run.&lt;br /&gt;
&lt;br /&gt;
job=getenv(&#039;SLURM_JOB_ID&#039;)&lt;br /&gt;
pngfile=strcat(pngfilebase,&#039;_&#039;,num2str(nterms),&#039;_&#039;,job)&lt;br /&gt;
disp([&#039;Writing file: &#039;,pngfile,&#039;.png&#039;])&lt;br /&gt;
&lt;br /&gt;
fig=figure;&lt;br /&gt;
plot(x,y);&lt;br /&gt;
print(fig,pngfile,&#039;-dpng&#039;);&lt;br /&gt;
&lt;br /&gt;
quit&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
In preparation to run the sawtooth.m code, create a batch job script, sawtooth.slurm of the form:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH --time=03:00:00     # Adjust this to match the walltime of your job&lt;br /&gt;
#SBATCH --nodes=1           # For serial code, always specify just one node.&lt;br /&gt;
#SBATCH --ntasks=1          # For serial code, always specify just one task.&lt;br /&gt;
#SBATCH --cpus-per-task=1   # For serial code, always specify just one CPU per task.&lt;br /&gt;
#SBATCH --mem=4000m         # Adjust to match total memory required, in MB.&lt;br /&gt;
#SBATCH --partition=pawson-bf,apophis-bf,razi-bf,single,lattice,parallel,cpu2013,cpu2019&lt;br /&gt;
&lt;br /&gt;
# Sample batch job script for running a MATLAB function with both numerical and string arguments&lt;br /&gt;
# 2020-05-14&lt;br /&gt;
&lt;br /&gt;
# Specify the name of the main MATLAB function to be run.&lt;br /&gt;
# This would normally be the same as the MATLAB source code file name without a .m suffix).&lt;br /&gt;
MAIN=&amp;quot;sawtooth&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Define key parameters for the example calculation.&lt;br /&gt;
NTERMS=100&lt;br /&gt;
NPPCYCLE=20&lt;br /&gt;
NCYCLE=3&lt;br /&gt;
PNGFILEBASE=&amp;quot;sawtooth&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Contruct a complete function call to pass to MATLAB&lt;br /&gt;
# Note, string arguments should appear to MATLAB enclosed in single quotes&lt;br /&gt;
ARGS=&amp;quot;($NTERMS,$NPPCYCLE,$NCYCLE,&#039;$PNGFILEBASE&#039;)&amp;quot;&lt;br /&gt;
MAIN_WITH_ARGS=${MAIN}${ARGS}&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Calling MATLAB function: ${MAIN_WITH_ARGS}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Starting run at $(date)&amp;quot;&lt;br /&gt;
echo &amp;quot;Running on compute node $(hostname)&amp;quot;&lt;br /&gt;
echo &amp;quot;Running from directory $(pwd)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Choose a version of MATLAB by loading a module:&lt;br /&gt;
module load matlab/r2019b&lt;br /&gt;
echo &amp;quot;Using MATLAB version: $(which matlab)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Use -singleCompThread below for serial MATLAB code:&lt;br /&gt;
matlab -singleCompThread -batch &amp;quot;${MAIN_WITH_ARGS}&amp;quot; &amp;gt; ${MAIN}_${SLURM_JOB_ID}.out 2&amp;gt;&amp;amp;1&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Finished run at $(date)&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Note that the above script uses the -batch option on the matlab command line.  The MathWorks web page on [https://www.mathworks.com/help/matlab/ref/matlablinux.html running MATLAB on Linux (external link)] starting with Release 2019a of MATLAB, recommends using the -batch option for non-interactive use instead of the similar -r option that is recommended in interactive sessions.&lt;br /&gt;
&lt;br /&gt;
To submit the job to be executed, run:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sbatch sawtooth.slurm&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The job should produce three output files: Slurm script output, MATLAB command output and a PNG file, all tagged with the Slurm Job ID.&lt;br /&gt;
&lt;br /&gt;
== Parallel MATLAB examples==&lt;br /&gt;
&lt;br /&gt;
MATLAB provides several ways of speeding up calculations through parallel processing.  These include relying on internal parallelization in which multiple threads are used or by using explicit language features, such as parfor, to start up multiple workers on a compute node. Examples of both approaches are shown below. Using multiple compute nodes for a single MATLAB calculation, which depends on the MATLAB Parallel Server product, is not considered here as there has not been sufficient demand to configure that software on ARC.&lt;br /&gt;
&lt;br /&gt;
For many researchers, submitting many independent serial jobs is a better approach to efficient parallelization than using parallel programming in MATLAB itself.  An example of job-based parallelism is also shown below.&lt;br /&gt;
&lt;br /&gt;
=== Thread-based parallel processing ===&lt;br /&gt;
First consider an example using multiple cores with MATLAB&#039;s built-in thread-based parallelization.&lt;br /&gt;
&lt;br /&gt;
Suppose the following code to calculate eigenvalues of a number of random matrices is in a file eig_thread_test.m .  Note the use of the maxNumCompThreads function to control the number of threads (one thread per CPU core). For some years now, MathWorks has marked that function as deprecated, but, it still provides a useful limit to ensure that MATLAB doesn&#039;t use more cores than assigned by Slurm. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
function eig_thread_test(nthreads,matrix_size,nmatrices,results_file)&lt;br /&gt;
&lt;br /&gt;
% Calculate the absolute value of the maximum eigenvalue for each of a number of matrices&lt;br /&gt;
% possibly using multiple threads.&lt;br /&gt;
&lt;br /&gt;
% nthreads = number of computational threads to use.&lt;br /&gt;
% matrix_size = order of two-dimensional random matrix.&lt;br /&gt;
% nmatrices = number of matrices to process.&lt;br /&gt;
% results_file = name of file in which to save the maximum eigenvalues&lt;br /&gt;
&lt;br /&gt;
% 2020-05-25&lt;br /&gt;
&lt;br /&gt;
matlab_ncores=feature(&#039;numcores&#039;)&lt;br /&gt;
&lt;br /&gt;
slurm_ncores_per_task=str2num(getenv(&#039;SLURM_CPUS_PER_TASK&#039;))&lt;br /&gt;
if(isempty(slurm_ncores_per_task))&lt;br /&gt;
  slurm_ncores_per_task=1;&lt;br /&gt;
  disp(&#039;SLURM_CPUS_PER_TASK not set&#039;)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
% Set number of computational threads to the minimum of matlab_ncores and slurm_ncores_per_task&lt;br /&gt;
% Note Mathworks warns that the maxNumCompThreads function will&lt;br /&gt;
% be removed in future versions of MATLAB.&lt;br /&gt;
&lt;br /&gt;
% Use only thread-based parallel processing&lt;br /&gt;
&lt;br /&gt;
intial_matlab_max_ncores = maxNumCompThreads(min([nthreads,slurm_ncores_per_task]));&lt;br /&gt;
&lt;br /&gt;
disp([&#039;Using a maximum of &#039;,num2str(maxNumCompThreads()),&#039; computational threads.&#039;])&lt;br /&gt;
&lt;br /&gt;
tic &lt;br /&gt;
&lt;br /&gt;
for i = 1:nmatrices&lt;br /&gt;
  e=eig(rand(matrix_size));&lt;br /&gt;
  eigenvalues(i) = max(abs(e));&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
toc&lt;br /&gt;
&lt;br /&gt;
save(results_file,&#039;eigenvalues&#039;,&#039;-ascii&#039;)&lt;br /&gt;
&lt;br /&gt;
quit&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here is a job script, eig_thread_test.slurm that can be used to run the eig_thread_test.m code.&lt;br /&gt;
The number of threads used for the calculation is controlled by specifying the --cpus-per-task parameter that Slurm uses to control the number of CPU cores assigned to the job.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
&lt;br /&gt;
#SBATCH --time=01:00:00     # Adjust this to match the walltime of your job&lt;br /&gt;
#SBATCH --nodes=1           # Always specify just one node.&lt;br /&gt;
#SBATCH --ntasks=1          # Specify just one task.&lt;br /&gt;
#SBATCH --cpus-per-task=8   # The number of threads to use&lt;br /&gt;
#SBATCH --mem=4000m         # Adjust to match total memory required, in MB.&lt;br /&gt;
#SBATCH --partition=pawson-bf,apophis-bf,razi-bf,single,lattice,parallel,cpu2013,cpu2019&lt;br /&gt;
&lt;br /&gt;
# Sample batch job script for running a MATLAB function to test thread-based parallel processing features.&lt;br /&gt;
# 2020-05-25&lt;br /&gt;
&lt;br /&gt;
# Specify the name of the main MATLAB function to be run.&lt;br /&gt;
# This would normally be the same as the MATLAB source code file name without a .m suffix).&lt;br /&gt;
MAIN=&amp;quot;eig_thread_test&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Define key parameters for the example calculation.&lt;br /&gt;
NTHREADS=${SLURM_CPUS_PER_TASK}&lt;br /&gt;
MATRIX_SIZE=10000&lt;br /&gt;
NMATRICES=10&lt;br /&gt;
RESULTS_FILE=&amp;quot;maximum_eigenvalues_${SLURM_JOB_ID}.txt&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Contruct a complete function call to pass to MATLAB&lt;br /&gt;
# Note, string arguments should appear to MATLAB enclosed in single quotes&lt;br /&gt;
ARGS=&amp;quot;($NTHREADS,$MATRIX_SIZE,$NMATRICES,&#039;$RESULTS_FILE&#039;)&amp;quot;&lt;br /&gt;
MAIN_WITH_ARGS=${MAIN}${ARGS}&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Calling MATLAB function: ${MAIN_WITH_ARGS}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Starting run at $(date)&amp;quot;&lt;br /&gt;
echo &amp;quot;Running on compute node $(hostname)&amp;quot;&lt;br /&gt;
echo &amp;quot;Running from directory $(pwd)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Choose a version of MATLAB by loading a module:&lt;br /&gt;
module load matlab/r2020a&lt;br /&gt;
echo &amp;quot;Using MATLAB version: $(which matlab)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
matlab -batch &amp;quot;${MAIN_WITH_ARGS}&amp;quot; &amp;gt; ${MAIN}_${SLURM_JOB_ID}.out 2&amp;gt;&amp;amp;1&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Finished run at $(date)&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The above job can be submitted with&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sbatch eig_thread_test.slurm&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If assigned to one of the modern partitions (as opposed to the older single, lattice or parallel partitions) the job took about 16 minutes, about 4 times faster than a comparable serial job.  Using 8 cores to obtain just a factor of four speed-up is not an efficient use of ARC, but, might be justified in some cases.  In some cases, using multiple workers (as discussed in the next section) may be faster than using the same number of cores with thread-based parallelization.&lt;br /&gt;
&lt;br /&gt;
=== Explicit parallel processing using a pool of workers ===&lt;br /&gt;
&lt;br /&gt;
Now consider the more complicated case of creating a pool of workers and using a parfor loop to explicitly parallelize a section of code. Each worker may use one or more cores through MATLAB&#039;s internal thread-based parallelization, as in the preceding example.  Suppose the following code is in a file eig_parallel_test.m.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
function eig_parallel_test(nworkers,nthreads,matrix_size,nmatrices,results_file)&lt;br /&gt;
&lt;br /&gt;
% Calculate the absolute value of the maximum eigenvalue for each of a number of matrices&lt;br /&gt;
% possibly using multiple threads and multiple MATLAB workers.&lt;br /&gt;
&lt;br /&gt;
% nworkers = number of MATLAB workers to use.&lt;br /&gt;
% nthreads = number of threads per worker.&lt;br /&gt;
% matrix_size = order of two-dimensional random matrix.&lt;br /&gt;
% nmatrices = number of matrices to process.&lt;br /&gt;
% results_file = name of file in which to save the maximum eigenvalues&lt;br /&gt;
&lt;br /&gt;
% 2020-05-25&lt;br /&gt;
&lt;br /&gt;
matlab_ncores=feature(&#039;numcores&#039;)&lt;br /&gt;
&lt;br /&gt;
slurm_ncores_per_task=str2num(getenv(&#039;SLURM_CPUS_PER_TASK&#039;))&lt;br /&gt;
if(isempty(slurm_ncores_per_task))&lt;br /&gt;
  slurm_ncores_per_task=1;&lt;br /&gt;
  disp(&#039;SLURM_CPUS_PER_TASK not set&#039;)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
% Set number of computational threads to the minimum of matlab_ncores and slurm_ncores&lt;br /&gt;
% Note Mathworks warns that the maxNumCompThreads function will&lt;br /&gt;
% be removed in future versions of MATLAB.&lt;br /&gt;
% Testing based on remarks at&lt;br /&gt;
% https://www.mathworks.com/matlabcentral/answers/158192-maxnumcompthreads-hyperthreading-and-parpool&lt;br /&gt;
% shows the maxNumCompThreads has to be called inside the parfor loop.&lt;br /&gt;
&lt;br /&gt;
tic&lt;br /&gt;
&lt;br /&gt;
if ( nworkers &amp;gt; 1 )&lt;br /&gt;
&lt;br /&gt;
% Process with multiple workers&lt;br /&gt;
% Check on properties of the local MATLAB cluster.&lt;br /&gt;
% One can set properties such as c.NumThreads and c.NumWorkers&lt;br /&gt;
&lt;br /&gt;
parallel.defaultClusterProfile(&#039;local&#039;)&lt;br /&gt;
c = parcluster()&lt;br /&gt;
c.NumThreads=nthreads&lt;br /&gt;
c.NumWorkers=nworkers&lt;br /&gt;
&lt;br /&gt;
% Create a pool of workers with the current cluster settings.&lt;br /&gt;
% Note, testing without the nworkers argument showed a limit of 12 workers even if c.NumWorkers is defined.&lt;br /&gt;
parpool(c,nworkers)&lt;br /&gt;
&lt;br /&gt;
ticBytes(gcp);&lt;br /&gt;
&lt;br /&gt;
parfor i = 1:nmatrices&lt;br /&gt;
  e=eig(rand(matrix_size));&lt;br /&gt;
  eigenvalues(i) = max(abs(e));&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
tocBytes(gcp)&lt;br /&gt;
&lt;br /&gt;
% Close down the pool.&lt;br /&gt;
delete(gcp(&#039;nocreate&#039;));&lt;br /&gt;
&lt;br /&gt;
else&lt;br /&gt;
&lt;br /&gt;
% Use only thread-based parallel processing&lt;br /&gt;
&lt;br /&gt;
intial_matlab_max_ncores = maxNumCompThreads(min([nthreads,slurm_ncores_per_task]))&lt;br /&gt;
&lt;br /&gt;
for i = 1:nmatrices&lt;br /&gt;
  e=eig(rand(matrix_size));&lt;br /&gt;
  eigenvalues(i) = max(abs(e));&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
end % nworkers test&lt;br /&gt;
&lt;br /&gt;
toc&lt;br /&gt;
&lt;br /&gt;
save(results_file,&#039;eigenvalues&#039;,&#039;-ascii&#039;)&lt;br /&gt;
&lt;br /&gt;
quit&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Of particular note in the preceding example is the section of lines (copied below) that creates a cluster object, c, and modifies the number of threads associated with this object (c.NumThreads=nthreads). In a similar way, one can modify the number of workers (c.NumWorkers=nworkers).  Testing showed that if one then used the MATLAB gcp or parpool commands without arguments to create a pool of workers, at most 12 workers were created. However, it was found that by using parpool(c,nworkers), the requested number of workers would be started, even if nworkers &amp;gt; 12.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
parallel.defaultClusterProfile(&#039;local&#039;)&lt;br /&gt;
c = parcluster()&lt;br /&gt;
c.NumThreads=nthreads&lt;br /&gt;
c.NumWorkers=nworkers&lt;br /&gt;
parpool(c,nworkers)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
An example Slurm batch job script, eig_parallel_test.slurm, used to test the above code was:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
&lt;br /&gt;
#SBATCH --time=03:00:00     # Adjust this to match the walltime of your job&lt;br /&gt;
#SBATCH --nodes=1           # Always specify just one node.&lt;br /&gt;
#SBATCH --ntasks=1          # Always specify just one task.&lt;br /&gt;
#SBATCH --cpus-per-task=8   # Choose --cpus-per-task to match the number of workers * threads per worker&lt;br /&gt;
#SBATCH --mem=10000m         # Adjust to match total memory required, in MB.&lt;br /&gt;
#SBATCH --partition=pawson-bf,apophis-bf,razi-bf,single,lattice,parallel,cpu2013,cpu2019&lt;br /&gt;
&lt;br /&gt;
# Sample batch job script for running a MATLAB function to test parallel processing features&lt;br /&gt;
# 2020-05-25&lt;br /&gt;
&lt;br /&gt;
# Specify the name of the main MATLAB function to be run.&lt;br /&gt;
# This would normally be the same as the MATLAB source code file name without a .m suffix).&lt;br /&gt;
MAIN=&amp;quot;eig_parallel_test&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Define key parameters for the example calculation.&lt;br /&gt;
NWORKERS=${SLURM_NTASKS}&lt;br /&gt;
NTHREADS=${SLURM_CPUS_PER_TASK}&lt;br /&gt;
MATRIX_SIZE=10000&lt;br /&gt;
NMATRICES=10&lt;br /&gt;
RESULTS_FILE=&amp;quot;maximum_eigenvalues_${SLURM_JOB_ID}.txt&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Contruct a complete function call to pass to MATLAB&lt;br /&gt;
# Note, string arguments should appear to MATLAB enclosed in single quotes&lt;br /&gt;
ARGS=&amp;quot;($NWORKERS,$NTHREADS,$MATRIX_SIZE,$NMATRICES,&#039;$RESULTS_FILE&#039;)&amp;quot;&lt;br /&gt;
MAIN_WITH_ARGS=${MAIN}${ARGS}&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Calling MATLAB function: ${MAIN_WITH_ARGS}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Starting run at $(date)&amp;quot;&lt;br /&gt;
echo &amp;quot;Running on compute node $(hostname)&amp;quot;&lt;br /&gt;
echo &amp;quot;Running from directory $(pwd)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Choose a version of MATLAB by loading a module:&lt;br /&gt;
module load matlab/r2020a&lt;br /&gt;
echo &amp;quot;Using MATLAB version: $(which matlab)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
matlab -batch &amp;quot;${MAIN_WITH_ARGS}&amp;quot; &amp;gt; ${MAIN}_${SLURM_JOB_ID}.out 2&amp;gt;&amp;amp;1&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Finished run at $(date)&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Note that the Slurm SBATCH parameter --cpus-per-task, the total number of cores to use, should be the product of the number of workers and the threads per worker.  (It might be argued that one more core should be requested beyond the product of workers and threads, to use for the main MATLAB process, but, for a fully parallelized code, the workers do the great bulk of the calculation and the main MATLAB process uses relatively little CPU time.)&lt;br /&gt;
 &lt;br /&gt;
Variations on the above code were tested with many combinations of workers and threads per worker.  It was found that if many jobs were started in close succession that some of the jobs failed to start properly. The problem can be avoided by introducing a short delay between job submissions, as illustrated in the section on job arrays below.&lt;br /&gt;
&lt;br /&gt;
Also note that in the above example, the number of cores requested is not well matched to the number of workers.  If there are 8 workers processing 10 matrices and each worker gets assigned one matrix, there are two left over. The total time for 10 matrices (or for any number of matrices from 9 to 16) would be about double that for 8 matrices.  For example, in testing the above code, the time for processing 10 matrices with 8 workers with just one computational thread was 1050 seconds, whereas processing just 8 matrices with 8 workers took only 560 seconds.&lt;br /&gt;
&lt;br /&gt;
=== Job-based parallel processing ===&lt;br /&gt;
&lt;br /&gt;
Slurm provides a feature called job arrays that can sometimes be conveniently used to submit a large number of similar jobs.  This can be used effectively when doing a parameter sweep, in which one key value (or several) in the code are changed from run to run. For example, in the eigenvalue calculation code considered in the previous section, one may want to study the effect of changing the matrix size. Alternatively, there may be cases in which the only change from one job to another is the name of an input file that contains the data to be processed.&lt;br /&gt;
&lt;br /&gt;
The key to using the job array feature is to set up the code to depend on a single integer value, the job array index, $SLURM_ARRAY_TASK_ID . When a job is run, the array index variable is replaced by Slurm with a specific value, taken from a corresponding --array argument on the sbatch command line.  For example, if the job script shown below is called eig_parallel_array_test.slurm and you run the script as&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sbatch --array=1000,2000,3000 eig_parallel_array_test.slurm&lt;br /&gt;
&amp;lt;/pre&amp;gt; &lt;br /&gt;
then three jobs will be run, with $SLURM_ARRAY_TASK_ID taking on the values 1000, 2000 and 3000 for the three cases, respectively.&lt;br /&gt;
&lt;br /&gt;
If you had a case in which input files to be processed were data_1.in, data_2.in, ... data_100.in, you could submit 100 jobs to each process one data file with &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sbatch --array=1-100 script_to_process_one_file.slurm&lt;br /&gt;
&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
where the job script refers to the files as data_${SLURM_ARRAY_TASK_ID}.in . (Putting the curly brackets around the variable name helps the bash shell from being confused with other text in the file name.)&lt;br /&gt;
&lt;br /&gt;
Testing shows that starting large numbers of jobs in a short period of time, such as can occur when job arrays are used and there are many free compute nodes, can lead to failures.  This kind of error appears to be related to delayed file system access when MATLAB tries to write job information to a hidden subdirectory under your home directory.   One way to avoid this problem is to introduce a delay between job submissions.  This can be done by using a loop containing a sleep command:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
for job in $(seq 1 100)&lt;br /&gt;
do&lt;br /&gt;
sbatch --array=$job script_to_process_one_file.slurm&lt;br /&gt;
sleep 5&lt;br /&gt;
done&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The &amp;quot;sleep 5&amp;quot; causes a 5-second delay between each job submission.&lt;br /&gt;
&lt;br /&gt;
One other caveat regarding the use of job arrays is that the resources requested with the SBATCH directives are for a single instance of the calculation to be completed. So, if the resource requirements are expected to differ significantly from one job to another, you may have to write separate job scripts for each case or group of cases, rather than using a single job array script.&lt;br /&gt;
&lt;br /&gt;
Here is an example of a job script to calculate the maximum eigenvalue of a number of random matrices of a given size.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
&lt;br /&gt;
#SBATCH --time=01:00:00     # Adjust this to match the walltime of your job&lt;br /&gt;
#SBATCH --nodes=1           # Always specify just one node.&lt;br /&gt;
#SBATCH --ntasks=1          # Always specify just one task.&lt;br /&gt;
#SBATCH --cpus-per-task=1   # For serial code, always specify just one CPU per task.&lt;br /&gt;
#SBATCH --mem=4000m         # Adjust to match total memory required, in MB.&lt;br /&gt;
#SBATCH --partition=pawson-bf,apophis-bf,razi-bf,single,lattice,parallel,cpu2013,cpu2019&lt;br /&gt;
&lt;br /&gt;
# Sample batch job script for running a MATLAB function to illustrate job-based parallel processing with job arrays&lt;br /&gt;
# 2020-05-27&lt;br /&gt;
&lt;br /&gt;
# The order of the matrix is specified using the job array index.&lt;br /&gt;
&lt;br /&gt;
# Specify the name of the main MATLAB function to be run.&lt;br /&gt;
# This would normally be the same as the MATLAB source code file name without a .m suffix).&lt;br /&gt;
MAIN=&amp;quot;eig_parallel_test&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Define key parameters for the example calculation.&lt;br /&gt;
NWORKERS=1&lt;br /&gt;
NTHREADS=1&lt;br /&gt;
MATRIX_SIZE=$SLURM_ARRAY_TASK_ID&lt;br /&gt;
NMATRICES=10&lt;br /&gt;
RESULTS_FILE=&amp;quot;maximum_eigenvalues_${MATRIX_SIZE}_${SLURM_JOB_ID}.txt&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Contruct a complete function call to pass to MATLAB&lt;br /&gt;
# Note, string arguments should appear to MATLAB enclosed in single quotes&lt;br /&gt;
ARGS=&amp;quot;($NWORKERS,$NTHREADS,$MATRIX_SIZE,$NMATRICES,&#039;$RESULTS_FILE&#039;)&amp;quot;&lt;br /&gt;
MAIN_WITH_ARGS=${MAIN}${ARGS}&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Calling MATLAB function: ${MAIN_WITH_ARGS}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Starting run at $(date)&amp;quot;&lt;br /&gt;
echo &amp;quot;Running on compute node $(hostname)&amp;quot;&lt;br /&gt;
echo &amp;quot;Running from directory $(pwd)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Choose a version of MATLAB by loading a module:&lt;br /&gt;
module load matlab/r2020a&lt;br /&gt;
echo &amp;quot;Using MATLAB version: $(which matlab)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
matlab -batch &amp;quot;${MAIN_WITH_ARGS}&amp;quot; &amp;gt; ${MAIN}_${SLURM_JOB_ID}.out 2&amp;gt;&amp;amp;1&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Finished run at $(date)&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Standalone Applications =&lt;br /&gt;
&lt;br /&gt;
When running MATLAB code as described in the preceding sections, a connection to the campus MATLAB license server, checking out licenses for MATLAB and any specialized toolboxes needed, is made for each job that is submitted. Currently, with the University of Calgary&#039;s Total Academic Headcount license, there are sufficient license tokens to support thousands of simultaneous MATLAB sessions (although ARC usage policy and cluster load will limit individual users to smaller numbers of jobs). However, there may be times at which the license server is slow to respond when large numbers of requests are being handled, or the server may be unavailable temporarily due to network problems. MathWorks offers an alternative way of running MATLAB code that can avoid license server issues by compiling it into a standalone application.  A license is required only during the compilation process and not when the code is run.  This allows calculations to be run on ARC without concerns regarding the license server.  The compiled code can also be run on compatible (64-bit Linux) hardware, not necessarily at the University of Calgary, such as on [https://docs.computecanada.ca/wiki/Getting_started Compute Canada (external link)] clusters.&lt;br /&gt;
&lt;br /&gt;
== Creating a standalone application ==&lt;br /&gt;
&lt;br /&gt;
The MATLAB &#039;&#039;&#039;mcc&#039;&#039;&#039; command is used to compile source code (.m files) into a standalone executable. There are a couple of important considerations to keep in mind when creating an executable that can be run in a batch-oriented cluster environment. One is that there is no graphical display attached to your session and another is that the number of threads used by the standalone application has to be controlled.  There is also an important difference in the way arguments of the main function are handled.&lt;br /&gt;
&lt;br /&gt;
Let&#039;s illustrate the process of creating a standalone application for the sawtooth.m code used previously. Unfortunately, if that code is compiled as it is, the resulting compiled application will fail to run properly.  The reason is that the compiled code sees all the input arguments as strings instead of interpreting them as numbers. To work around this problem, use a MATLAB function, &#039;&#039;&#039;isdeployed&#039;&#039;&#039;, to determine whether or not the code is being run as a standalone application. Here is a modified version of code, called sawtooth_standalone.m that can be successfully compiled and run as a standalone application.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
function sawtooth_standalone(nterms,nppcycle,ncycle,pngfilebase)&lt;br /&gt;
&lt;br /&gt;
% MATLAB file example to approximate a sawtooth&lt;br /&gt;
% with a truncated Fourier expansion.&lt;br /&gt;
&lt;br /&gt;
% nterms = number of terms in expansion.&lt;br /&gt;
% nppcycle = number of points per cycle.&lt;br /&gt;
% ncycle = number of complete cycles to plot.&lt;br /&gt;
% pngfilebase = base of file name for graph of results.&lt;br /&gt;
&lt;br /&gt;
% 2020-05-21&lt;br /&gt;
&lt;br /&gt;
% Test to see if the code is running as a standalone application&lt;br /&gt;
% If it is, convert the arguments intended to be numeric from &lt;br /&gt;
% the input strings to numbers&lt;br /&gt;
&lt;br /&gt;
if isdeployed&lt;br /&gt;
  nterms=str2num(nterms)&lt;br /&gt;
  nppcycle=str2num(nppcycle)&lt;br /&gt;
  ncycle=str2num(ncycle)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
np=nppcycle*ncycle;&lt;br /&gt;
&lt;br /&gt;
fourbypi=4.0/pi;&lt;br /&gt;
y(1:np)=pi/2.0;&lt;br /&gt;
x(1:np)=linspace(-pi*ncycle,pi*ncycle,np);&lt;br /&gt;
&lt;br /&gt;
for k=1:nterms&lt;br /&gt;
  twokm=2*k-1;&lt;br /&gt;
  y=y-fourbypi*cos(twokm*x)/twokm^2;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
% Prepare output&lt;br /&gt;
% Construct the output file name from the base file name and number of terms&lt;br /&gt;
% Also append the Slurm JOBID to keep file names unique from run to run.&lt;br /&gt;
&lt;br /&gt;
job=getenv(&#039;SLURM_JOB_ID&#039;)&lt;br /&gt;
pngfile=strcat(pngfilebase,&#039;_&#039;,num2str(nterms),&#039;_&#039;,job)&lt;br /&gt;
disp([&#039;Writing file: &#039;,pngfile,&#039;.png&#039;])&lt;br /&gt;
&lt;br /&gt;
fig=figure;&lt;br /&gt;
plot(x,y);&lt;br /&gt;
print(fig,pngfile,&#039;-dpng&#039;);&lt;br /&gt;
&lt;br /&gt;
quit&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Suppose that the sawtooth_standalone.m file is in a subdirectory src below your current working directory and that the compiled files are going to be written to a subdirectory called deploy. The following commands (at the Linux shell prompt) could be used to compile the code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mkdir deploy&lt;br /&gt;
cd src&lt;br /&gt;
module load matlab/r2019b&lt;br /&gt;
mcc -R -nodisplay \&lt;br /&gt;
 -R -singleCompThread \&lt;br /&gt;
 -m -v -w enable \&lt;br /&gt;
 -d ../deploy \&lt;br /&gt;
 sawtooth_standalone.m&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note the option -singleCompThread has been included in order to limit the executable to just one computational thread.&lt;br /&gt;
&lt;br /&gt;
In the deploy directory, an executable, sawtooth_standalone, will be created along with a script, run_sawtooth_standalone.sh. These two files should be copied to the target machine where the code is to be run.&lt;br /&gt;
&lt;br /&gt;
== Running a standalone application ==&lt;br /&gt;
&lt;br /&gt;
After the standalone executable sawtooth_standalone and corresponding script run_sawtooth_standalone.sh have been transferred to a directory on the target system on which they will be run (whether to a different directory on ARC or to a completely different cluster), a batch job script needs to be created in that same directory. Here is an example batch job script, sawtooth_standalone.slurm, appropriate for the ARC cluster.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH --time=03:00:00     # Adjust this to match the walltime of your job&lt;br /&gt;
#SBATCH --nodes=1           # For serial code, always specify just one node.&lt;br /&gt;
#SBATCH --ntasks=1          # For serial code, always specify just one task.&lt;br /&gt;
#SBATCH --cpus-per-task=1   # For serial code, always specify just one CPU per task.&lt;br /&gt;
#SBATCH --mem=4000m         # Adjust to match total memory required, in MB.&lt;br /&gt;
#SBATCH --partition=pawson-bf,apophis-bf,razi-bf,single,lattice,parallel,cpu2013,cpu2019&lt;br /&gt;
&lt;br /&gt;
# Sample batch job script for running a compiled MATLAB function&lt;br /&gt;
# 2020-05-21&lt;br /&gt;
&lt;br /&gt;
# Specify the name of the compiled MATLAB standalone executable&lt;br /&gt;
MAIN=&amp;quot;sawtooth_standalone&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Define key parameters for the example calculation.&lt;br /&gt;
NTERMS=100&lt;br /&gt;
NPPCYCLE=20&lt;br /&gt;
NCYCLE=3&lt;br /&gt;
PNGFILEBASE=$MAIN&lt;br /&gt;
&lt;br /&gt;
ARGS=&amp;quot;$NTERMS $NPPCYCLE $NCYCLE $PNGFILEBASE&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Choose the MCR directory according to the compiler version used&lt;br /&gt;
MCR=/global/software/matlab/mcr/v97&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Starting run at $(date)&amp;quot;&lt;br /&gt;
echo &amp;quot;Running on compute node $(hostname)&amp;quot;&lt;br /&gt;
echo &amp;quot;Running from directory $(pwd)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
./run_${MAIN}.sh $MCR $ARGS &amp;gt; ${MAIN}_${SLURM_JOB_ID}.out 2&amp;gt;&amp;amp;1&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Finished run at $(date)&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The job is then submitted with sbatch:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sbatch sawtooth_standalone.slurm&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
An important part of the above script is the definition of the variable &#039;&#039;&#039;MCR&#039;&#039;&#039;, which defines the location of the MATLAB Compiler Runtime (MCR) directory. This directory contains files necessary for the standalone application to run. The version of the MCR files specified (v97 in the example, which corresponds to MATLAB R2019b) must match the version of MATLAB used to compile the code.&lt;br /&gt;
&lt;br /&gt;
A list of MATLAB distributions and the corresponding MCR versions is given on the [https://www.mathworks.com/products/compiler/matlab-runtime.html Mathworks web site (external link)]. Some versions installed on ARC are listed below, along with the corresponding installation directory to which the MCR variable should be set if running on ARC. (As of this writing on May 21, 2020, installation of release R2020a has not quite been finished, but, should be ready before the end of the month). If the MCR version you need does not appear in /global/software/matlab/mcr, write to support@hpc.ucalgary.ca to request that it be installed, or use a different version of MATLAB for your compilation.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;WG_Indent3&amp;quot; style=&amp;quot;height: 150px; width: 576px&amp;quot; border=&amp;quot;2&amp;quot;&lt;br /&gt;
| style=&amp;quot;text-align: center&amp;quot; | &#039;&#039;&#039;MATLAB Release&#039;&#039;&#039;&lt;br /&gt;
| style=&amp;quot;text-align: center&amp;quot; | &#039;&#039;&#039;MCR Version&#039;&#039;&#039;&lt;br /&gt;
| style=&amp;quot;text-align: center&amp;quot; | &#039;&#039;&#039;MCR directory&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: center&amp;quot; | R2017a&lt;br /&gt;
| style=&amp;quot;text-align: center&amp;quot; | 9.2&lt;br /&gt;
| class=&amp;quot;WG_Inline_Code&amp;quot; style=&amp;quot;text-align: center&amp;quot; | /global/software/matlab/mcr/v92&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: center&amp;quot; | R2017b&lt;br /&gt;
| style=&amp;quot;text-align: center&amp;quot; | 9.3&lt;br /&gt;
| class=&amp;quot;WG_Inline_Code&amp;quot; style=&amp;quot;text-align: center&amp;quot; | /global/software/matlab/mcr/v93&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: center&amp;quot; | R2018a&lt;br /&gt;
| style=&amp;quot;text-align: center&amp;quot; | 9.4&lt;br /&gt;
| class=&amp;quot;WG_Inline_Code&amp;quot; style=&amp;quot;text-align: center&amp;quot; | /global/software/matlab/mcr/v94&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: center&amp;quot; | R2019b&lt;br /&gt;
| style=&amp;quot;text-align: center&amp;quot; | 9.7&lt;br /&gt;
| class=&amp;quot;WG_Inline_Code&amp;quot; style=&amp;quot;text-align: center&amp;quot; | /global/software/matlab/mcr/v97&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: center&amp;quot; | R2020a&lt;br /&gt;
| style=&amp;quot;text-align: center&amp;quot; | 9.8&lt;br /&gt;
| class=&amp;quot;WG_Inline_Code&amp;quot; style=&amp;quot;text-align: center&amp;quot; | /global/software/matlab/mcr/v98&lt;br /&gt;
|}&lt;br /&gt;
= Support =&lt;br /&gt;
&lt;br /&gt;
Please send any questions regarding using MATLAB on ARC to support@hpc.ucalgary.ca.&lt;/div&gt;</summary>
		<author><name>Phillips</name></author>
	</entry>
	<entry>
		<id>https://rcs.ucalgary.ca/index.php?title=GROMACS&amp;diff=613</id>
		<title>GROMACS</title>
		<link rel="alternate" type="text/html" href="https://rcs.ucalgary.ca/index.php?title=GROMACS&amp;diff=613"/>
		<updated>2020-05-29T14:48:29Z</updated>

		<summary type="html">&lt;p&gt;Phillips: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:GROMACS]]&lt;br /&gt;
[[Category:Software]]&lt;br /&gt;
[[Category:ARC]]&lt;br /&gt;
= General =&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;GROMACS&#039;&#039;&#039; home site: http://www.gromacs.org/&lt;br /&gt;
&lt;br /&gt;
* Manuals: http://manual.gromacs.org/documentation/&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;GROMACS&#039;&#039;&#039; is a versatile package to perform molecular dynamics, &lt;br /&gt;
i.e. simulate the Newtonian equations of motion for systems with hundreds to millions of particles.&lt;br /&gt;
&lt;br /&gt;
It is primarily designed for biochemical molecules like proteins, &lt;br /&gt;
lipids and nucleic acids that have a lot of complicated bonded interactions, &lt;br /&gt;
but since &#039;&#039;&#039;GROMACS&#039;&#039;&#039; is extremely fast at calculating the nonbonded interactions (that usually dominate simulations) &lt;br /&gt;
many groups are also using it for research on non-biological systems, e.g. polymers.&lt;br /&gt;
&lt;br /&gt;
= Using GROMACS on ARC =&lt;br /&gt;
&lt;br /&gt;
Researchers using &#039;&#039;&#039;GROMACS&#039;&#039;&#039; on ARC are expected to be generally familiar with its capabilities, &lt;br /&gt;
input file types and their formats and the use of checkpoint files to restart simulations.&lt;br /&gt;
&lt;br /&gt;
Like other calculations on ARC systems, &#039;&#039;&#039;GROMACS&#039;&#039;&#039; is run by submitting an appropriate script for batch scheduling using the &#039;&#039;&#039;sbatch&#039;&#039;&#039; command. &lt;br /&gt;
For more information about submitting jobs, see [[Running jobs]] article.&lt;br /&gt;
&lt;br /&gt;
=== GROMACS modules ===&lt;br /&gt;
&lt;br /&gt;
Currently there are several software modules on ARC that provide different versions of &#039;&#039;&#039;GROMACS&#039;&#039;&#039;. &lt;br /&gt;
The versions differ in the release date as well as the CPU architecture the software is compiled for.&lt;br /&gt;
&lt;br /&gt;
You can see them using the &amp;lt;code&amp;gt;module&amp;lt;/code&amp;gt; command:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ module avail gromacs&lt;br /&gt;
&lt;br /&gt;
----------- /global/software/Modules/3.2.10/modulefiles ---------&lt;br /&gt;
gromacs/2016.3-gnu&lt;br /&gt;
gromacs/2018.0-gnu&lt;br /&gt;
gromacs/2019.6-legacy &lt;br /&gt;
gromacs/2019.6-skylake &lt;br /&gt;
gromacs/5.0.7-gnu&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The names of the modules give hints on the specific version of &#039;&#039;&#039;GROMACS&#039;&#039;&#039; they provide access to.&lt;br /&gt;
* The &#039;&#039;&#039;gnu&#039;&#039;&#039; suffix indicates that those versions have been compiled with GNU GCC compiler. &lt;br /&gt;
: In these specific cases, GCC 4.8.5.&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;GROMACS&#039;&#039;&#039; &#039;&#039;&#039;2019.6&#039;&#039;&#039; was compiled using GCC 7.3.0 for two different CPU kinds, the old kind, &#039;&#039;&#039;legacy&#039;&#039;&#039;, and the new kind, &#039;&#039;&#039;skylake&#039;&#039;&#039;.&lt;br /&gt;
The &#039;&#039;&#039;legacy&#039;&#039;&#039; module should be used on compute nodes before 2019, and the &#039;&#039;&#039;skylake&#039;&#039;&#039; module is for node from 2019 and up.&lt;br /&gt;
&lt;br /&gt;
* All &#039;&#039;&#039;GROMACS&#039;&#039;&#039; versions provided by all the modules have support for &#039;&#039;&#039;GPU computations&#039;&#039;&#039;, even though it may not be practical to run it on GPU nodes due to limited resources.&lt;br /&gt;
&lt;br /&gt;
A module has to be loaded before &#039;&#039;&#039;GROMACS&#039;&#039;&#039; can be used on ARC. Like this:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ gmx --version&lt;br /&gt;
bash: gmx: command not found...&lt;br /&gt;
&lt;br /&gt;
$ module load gromacs/2019.6-legacy  &lt;br /&gt;
&lt;br /&gt;
$ gmx --version&lt;br /&gt;
                         :-) GROMACS - gmx, 2019.6 (-:&lt;br /&gt;
&lt;br /&gt;
                            GROMACS is written by:&lt;br /&gt;
     Emile Apol      Rossen Apostolov      Paul Bauer     Herman J.C. Berendsen&lt;br /&gt;
.....&lt;br /&gt;
.....&lt;br /&gt;
GROMACS version:    2019.6&lt;br /&gt;
Precision:          single&lt;br /&gt;
Memory model:       64 bit&lt;br /&gt;
MPI library:        none&lt;br /&gt;
OpenMP support:     enabled (GMX_OPENMP_MAX_THREADS = 64)&lt;br /&gt;
GPU support:        CUDA&lt;br /&gt;
SIMD instructions:  SSE4.1&lt;br /&gt;
FFT library:        fftw-3.3.7-sse2-avx&lt;br /&gt;
RDTSCP usage:       enabled&lt;br /&gt;
TNG support:        enabled&lt;br /&gt;
Hwloc support:      hwloc-1.11.8&lt;br /&gt;
Tracing support:    disabled&lt;br /&gt;
C compiler:         /global/software/gcc/gcc-7.3.0/bin/gcc GNU 7.3.0&lt;br /&gt;
C compiler flags:    -msse4.1     -O3 -DNDEBUG -funroll-all-loops -fexcess-precision=fast  &lt;br /&gt;
C++ compiler:       /global/software/gcc/gcc-7.3.0/bin/g++ GNU 7.3.0&lt;br /&gt;
C++ compiler flags:  -msse4.1    -std=c++11   -O3 -DNDEBUG -funroll-all-loops -fexcess-precision=fast  &lt;br /&gt;
CUDA compiler:      /global/software/cuda/cuda-10.0.130/bin/nvcc nvcc: NVIDIA (R) Cuda compiler driver;Copyright (c) 2005-2018 NVIDIA Corporation;Built on Sat_Aug_25_21:08:01_CDT_2018;Cuda compilation tools, release 10.0, V10.0.130&lt;br /&gt;
CUDA compiler flags:-gencode;arch=compute_30,code=sm_30;-gencode;arch=compute_35,code=sm_35;-gencode;arch=compute_37,code=sm_37;-gencode;arch=compute_50,code=sm_50;-gencode;arch=compute_52,code=sm_52;-gencode;arch=compute_60,code=sm_60;-gencode;arch=compute_61,code=sm_61;-gencode;arch=compute_70,code=sm_70;-gencode;arch=compute_75,code=compute_75;-use_fast_math;;; ;-msse4.1;-std=c++11;-O3;-DNDEBUG;-funroll-all-loops;-fexcess-precision=fast;&lt;br /&gt;
CUDA driver:        9.10&lt;br /&gt;
CUDA runtime:       N/A&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Running a GROMACS Job ===&lt;br /&gt;
&lt;br /&gt;
To run your simulation on ARC cluster you have to have: &lt;br /&gt;
(1) a set of &#039;&#039;&#039;GROMACS&#039;&#039;&#039; input files and &lt;br /&gt;
(2) a SLURM job script &#039;&#039;&#039;.slurm&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Place your input files for a simulation into a separate directory and &lt;br /&gt;
prepare an appropriate &#039;&#039;&#039;job script&#039;&#039;&#039; for it.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ ls -l&lt;br /&gt;
&lt;br /&gt;
-rw-r--r-- 1 drozmano drozmano 7224622 Jan 29  2014 bilayer.gro&lt;br /&gt;
-rw-r--r-- 1 drozmano drozmano    2567 May 21 12:14 bilayer.mdp&lt;br /&gt;
-rw-r--r-- 1 drozmano drozmano      87 Apr 29  2016 bilayer.top&lt;br /&gt;
drwxr-xr-x 1 drozmano drozmano     200 May 20 16:27 ff&lt;br /&gt;
-rw-r--r-- 1 drozmano drozmano     504 May 20 16:30 ff.top&lt;br /&gt;
-rwxr-xr-x 1 drozmano drozmano    1171 May 21 13:45 job.slurm&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here:&lt;br /&gt;
* &amp;lt;code&amp;gt;bilayer.top&amp;lt;/code&amp;gt; -- contains the topology of the system. &lt;br /&gt;
* &amp;lt;code&amp;gt;bilayer.gro&amp;lt;/code&amp;gt; -- contains initial configuration (positions of atoms) of the system.&lt;br /&gt;
* &amp;lt;code&amp;gt;bilayer.mdp&amp;lt;/code&amp;gt; -- contains parameters of the simulation run (&#039;&#039;&#039;GROMACS&#039;&#039;&#039; settings).&lt;br /&gt;
* &amp;lt;code&amp;gt;ff&amp;lt;/code&amp;gt; -- a directory containing external custom force field (models). Not required if only standard models are used.&lt;br /&gt;
* &amp;lt;code&amp;gt;ff.top&amp;lt;/code&amp;gt; -- a topology file that includes required models from available force fields.&lt;br /&gt;
: This file is included by the &amp;lt;code&amp;gt;bilayer.top&amp;lt;/code&amp;gt; file. &lt;br /&gt;
* &amp;lt;code&amp;gt;job.slurm&amp;lt;/code&amp;gt; -- a &#039;&#039;&#039;SLURM jobs script&#039;&#039;&#039; that is used to submit this calculation to the cluster.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;On ARC&#039;&#039;&#039;, you can get &#039;&#039;&#039;an example&#039;&#039;&#039; with the files shown above with the commands:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ tar xvf /global/software/gromacs/tests-2019/bilayer.tar.bz2&lt;br /&gt;
&lt;br /&gt;
$ cd bilayer&lt;br /&gt;
$ ls -l&lt;br /&gt;
....&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
At this point you can &#039;&#039;&#039;submit your job&#039;&#039;&#039; to ARC&#039;s scheduler (&#039;&#039;&#039;SLURM&#039;&#039;&#039;).&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ sbatch job.slurm &lt;br /&gt;
&lt;br /&gt;
Submitted batch job 5570681&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
You can check the status of the job using the &#039;&#039;&#039;job ID&#039;&#039;&#039; from the confirmation message above.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ squeue -j 5570681&lt;br /&gt;
&lt;br /&gt;
JOBID     USER     STATE   TIME_LIMIT  TIME  NODES TASKS CPUS  MIN_MEMORY  NODELIST            &lt;br /&gt;
5570681   drozmano RUNNING    5:00:00  0:15      1     1   40          8G       fc1                 &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The &amp;lt;code&amp;gt;squeue&amp;lt;/code&amp;gt; command output may look different in your case depending on your settings.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
After the job is over and it does not show in the &amp;lt;code&amp;gt;squeue&amp;lt;/code&amp;gt; output &lt;br /&gt;
we can check the results.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ ls -l&lt;br /&gt;
&lt;br /&gt;
-rw-r--r-- 1 drozmano drozmano 7224622 Jan 29  2014 bilayer.gro&lt;br /&gt;
-rw-r--r-- 1 drozmano drozmano    2567 May 21 12:14 bilayer.mdp&lt;br /&gt;
-rw-r--r-- 1 drozmano drozmano      87 Apr 29  2016 bilayer.top&lt;br /&gt;
-rw-r--r-- 1 drozmano drozmano 2594772 May 21 14:37 bilayer.tpr&lt;br /&gt;
-rw-r--r-- 1 drozmano drozmano 7224622 May 21 14:37 confout.gro&lt;br /&gt;
-rw-r--r-- 1 drozmano drozmano    1772 May 21 14:37 ener.edr&lt;br /&gt;
drwxr-xr-x 1 drozmano drozmano     200 May 20 16:27 ff&lt;br /&gt;
-rw-r--r-- 1 drozmano drozmano     504 May 20 16:30 ff.top&lt;br /&gt;
-rwxr-xr-x 1 drozmano drozmano    1172 May 21 14:36 job.slurm&lt;br /&gt;
-rw-r--r-- 1 drozmano drozmano   82051 May 21 14:37 md.log&lt;br /&gt;
-rw-r--r-- 1 drozmano drozmano   10949 May 21 14:37 mdout.mdp&lt;br /&gt;
-rw-r--r-- 1 drozmano drozmano   13162 May 21 14:37 slurm-5570681.out&lt;br /&gt;
-rw-r--r-- 1 drozmano drozmano 2514832 May 21 14:37 state.cpt&lt;br /&gt;
-rw-r--r-- 1 drozmano drozmano 4309444 May 21 14:37 traj_comp.xtc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The &#039;&#039;&#039;new files&#039;&#039;&#039; here are:&lt;br /&gt;
* &amp;lt;code&amp;gt;bilayer.tpr&amp;lt;/code&amp;gt; -- Binary input file that is generated by the &amp;lt;code&amp;gt;gmx grompp&amp;lt;/code&amp;gt; before the actual simulation.&lt;br /&gt;
: This file can be generated before submitting the job, if needed. Here it is created in the job script.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;confout.gro&amp;lt;/code&amp;gt; -- a configuration file containing the final atomic positions at the end of the simulation.&lt;br /&gt;
* &amp;lt;code&amp;gt;ener.edr&amp;lt;/code&amp;gt; -- a file with energy data. Can be used for later analysis.&lt;br /&gt;
* &amp;lt;code&amp;gt;md.log&amp;lt;/code&amp;gt; -- the main log file for the simulation.&lt;br /&gt;
* &amp;lt;code&amp;gt;mdout.mdp&amp;lt;/code&amp;gt; -- a file containing all simulation parameters as used by GROMACS. Based on &amp;lt;code&amp;gt;bilayer.mdp&amp;lt;/code&amp;gt;.&lt;br /&gt;
* &amp;lt;code&amp;gt;state.cpt&amp;lt;/code&amp;gt; -- a binary checkpoint file containing the system state at the end of the simulation. &lt;br /&gt;
: This file can be used to continue simulations further.&lt;br /&gt;
* &amp;lt;code&amp;gt;traj_com.xtc&amp;lt;/code&amp;gt; -- a trajectory file containing atomic positions at some time points during the simulation.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;slurm-5570681.out&amp;lt;/code&amp;gt; -- The intercept of the output printed on screen during the simulation. &lt;br /&gt;
: Done by &#039;&#039;&#039;SLURM&#039;&#039;&#039; for you. The number in the name is the &#039;&#039;&#039;job ID&#039;&#039;&#039; of the job.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If &#039;&#039;&#039;something is not working&#039;&#039;&#039; the way you expected, then the &amp;lt;code&amp;gt;slurm-5570681.out&amp;lt;/code&amp;gt; file is the &#039;&#039;&#039;first&#039;&#039;&#039; place you should examine. &lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;md.log&amp;lt;/code&amp;gt; is the &#039;&#039;&#039;next&#039;&#039;&#039; thing to look into.&lt;br /&gt;
&lt;br /&gt;
If everything is as expected, then your &#039;&#039;&#039;computation is done&#039;&#039;&#039; and you can use the results. &lt;br /&gt;
&#039;&#039;&#039;Success!&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
You may want to check the output file and the main log anyways:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Press &amp;quot;q&amp;quot; to exit the text viewer.&lt;br /&gt;
$ less slurm-5570681.out&lt;br /&gt;
....&lt;br /&gt;
&lt;br /&gt;
$ less md.log&lt;br /&gt;
....&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== The job script ===&lt;br /&gt;
&lt;br /&gt;
If you have input files as in the example above, and you use your own computer, &lt;br /&gt;
then to run the simulation,&lt;br /&gt;
you have to generate a binary input file for the &amp;lt;code&amp;gt;mdrun&amp;lt;/code&amp;gt; &#039;&#039;&#039;GROMACS&#039;&#039;&#039; command first.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ gmx grompp -v -f bilayer.mdp -c bilayer.gro -p bilayer.top -o bilayer.tpr&lt;br /&gt;
&lt;br /&gt;
                      :-) GROMACS - gmx grompp, 2019.6 (-:&lt;br /&gt;
&lt;br /&gt;
                            GROMACS is written by:&lt;br /&gt;
     Emile Apol      Rossen Apostolov      Paul Bauer     Herman J.C. Berendsen&lt;br /&gt;
.....&lt;br /&gt;
.....&lt;br /&gt;
Checking consistency between energy and charge groups...&lt;br /&gt;
Calculating fourier grid dimensions for X Y Z&lt;br /&gt;
Using a fourier grid of 112x112x52, spacing 0.116 0.116 0.112&lt;br /&gt;
Estimate for the relative computational load of the PME mesh part: 0.13&lt;br /&gt;
This run will generate roughly 14 Mb of data&lt;br /&gt;
writing run input file...&lt;br /&gt;
&lt;br /&gt;
There were 2 notes&lt;br /&gt;
&lt;br /&gt;
$ ls -l&lt;br /&gt;
-rw-r--r-- 1 drozmano drozmano 7224622 Jan 29  2014 bilayer.gro&lt;br /&gt;
-rw-r--r-- 1 drozmano drozmano    2567 May 21 12:14 bilayer.mdp&lt;br /&gt;
-rw-r--r-- 1 drozmano drozmano      87 Apr 29  2016 bilayer.top&lt;br /&gt;
-rw-r--r-- 1 drozmano drozmano 2594772 May 21 15:06 bilayer.tpr&lt;br /&gt;
drwxr-xr-x 1 drozmano drozmano     200 May 20 16:27 ff&lt;br /&gt;
-rw-r--r-- 1 drozmano drozmano     504 May 20 16:30 ff.top&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
At this point you can run the simulation like this:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ gmx mdrun -v -s bilayer.tpr&lt;br /&gt;
&lt;br /&gt;
                      :-) GROMACS - gmx grompp, 2019.6 (-:&lt;br /&gt;
&lt;br /&gt;
                            GROMACS is written by:&lt;br /&gt;
     Emile Apol      Rossen Apostolov      Paul Bauer     Herman J.C. Berendsen&lt;br /&gt;
......&lt;br /&gt;
... lots-of-output ...&lt;br /&gt;
......&lt;br /&gt;
Writing final coordinates.&lt;br /&gt;
^Mstep 10000, remaining wall clock time:     0 s          &lt;br /&gt;
               Core t (s)   Wall t (s)        (%)&lt;br /&gt;
       Time:     1557.342       38.939     3999.4&lt;br /&gt;
                 (ns/day)    (hour/ns)&lt;br /&gt;
Performance:       22.191        1.082&lt;br /&gt;
&lt;br /&gt;
GROMACS reminds you: &amp;quot;In ...&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
To run this calculation on a cluster via the &#039;&#039;&#039;SLURM&#039;&#039;&#039; scheduling system you have to provide a job script&lt;br /&gt;
that does &#039;&#039;&#039;two things&#039;&#039;&#039;:&lt;br /&gt;
# Provides &#039;&#039;&#039;steps that run&#039;&#039;&#039; the simulation, and&lt;br /&gt;
# Requests all &#039;&#039;&#039;necessary computational resources&#039;&#039;&#039; that are needed for this simulation.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;steps to run&#039;&#039;&#039; the simulation you already know:&lt;br /&gt;
# Load a desired &#039;&#039;&#039;GROMACS&#039;&#039;&#039; module to activate the software.&lt;br /&gt;
# Generate the binary input, the &#039;&#039;&#039;.tpr&#039;&#039;&#039; file.&lt;br /&gt;
# Run the &#039;&#039;&#039;mdrun&#039;&#039;&#039; command on it.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;computational resources&#039;&#039;&#039; for the run include:&lt;br /&gt;
* the &#039;&#039;&#039;Number of CPUs&#039;&#039;&#039;, &lt;br /&gt;
* the &#039;&#039;&#039;Amount of memory&#039;&#039;&#039; (RAM), and &lt;br /&gt;
* the &#039;&#039;&#039;Time&#039;&#039;&#039; sufficient to complete the computation.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Below, &#039;&#039;&#039;several examples of job scripts&#039;&#039;&#039; are given.&lt;br /&gt;
&lt;br /&gt;
These scripts are suitable for use on ARC depending on &lt;br /&gt;
* what &#039;&#039;&#039;part of the cluster&#039;&#039;&#039; the job should run on and &lt;br /&gt;
* the &#039;&#039;&#039;number of CPUs&#039;&#039;&#039; the job is going to use.&lt;br /&gt;
&lt;br /&gt;
==== Single node (modern) job script ====&lt;br /&gt;
This script is for jobs that use up to &#039;&#039;&#039;one&#039;&#039;&#039; full modern node (2019 and later). &lt;br /&gt;
These nodes are in the list of default partitions and have 40 CPUs each.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This specific example requests &#039;&#039;&#039;40 CPUs on 1 node&#039;&#039;&#039; for &#039;&#039;&#039;5 hours&#039;&#039;&#039;. &lt;br /&gt;
It also requests &#039;&#039;&#039;16GB of RAM&#039;&#039;&#039; on the node. &lt;br /&gt;
The simulation runs as &#039;&#039;&#039;1 process of 40 threads&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;job-single.slurm&#039;&#039;&#039;:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# ================================================================&lt;br /&gt;
#SBATCH --job-name=gro_test&lt;br /&gt;
&lt;br /&gt;
#SBATCH --nodes=1&lt;br /&gt;
#SBATCH --ntasks-per-node=1&lt;br /&gt;
#SBATCH --cpus-per-task=40&lt;br /&gt;
#SBATCH --mem=16GB&lt;br /&gt;
#SBATCH --time=0-05:00:00&lt;br /&gt;
# ================================================================&lt;br /&gt;
module purge&lt;br /&gt;
module load gromacs/2019.6-skylake&lt;br /&gt;
# ================================================================&lt;br /&gt;
echo &amp;quot;Starting at `date`.&amp;quot;&lt;br /&gt;
echo &amp;quot;=========================&amp;quot;&lt;br /&gt;
# Input files.&lt;br /&gt;
MDP=bilayer.mdp&lt;br /&gt;
TOP=bilayer.top&lt;br /&gt;
GRO=bilayer.gro&lt;br /&gt;
&lt;br /&gt;
# Binary input file to generate.&lt;br /&gt;
TPR=bilayer.tpr&lt;br /&gt;
&lt;br /&gt;
# Preprocess the input files.&lt;br /&gt;
gmx grompp -v -f $MDP -c $GRO -p $TOP -o $TPR&lt;br /&gt;
&lt;br /&gt;
# Check if preprocessing have gone well.&lt;br /&gt;
if ! test -e $TPR; then&lt;br /&gt;
	echo &amp;quot;ERROR: Could not create a TPR file for the run. Aborting.&amp;quot;&lt;br /&gt;
	exit&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# Run the simulation.&lt;br /&gt;
OMP_NUM_THREADS=$SLURM_CPUS_PER_TASK&lt;br /&gt;
&lt;br /&gt;
gmx mdrun -v -s $TPR&lt;br /&gt;
echo &amp;quot;=========================&amp;quot;&lt;br /&gt;
echo &amp;quot;Done at `date`.&amp;quot;&lt;br /&gt;
# ================================================================&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Multi node (modern) job script ====&lt;br /&gt;
This script is for jobs that use several modern nodes (2019 and later). &lt;br /&gt;
These nodes are in the list of default partitions and have 40 CPUs each. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This specific example requests &#039;&#039;&#039;80 CPUs on 2 nodes&#039;&#039;&#039; (40 CPUs each) for &#039;&#039;&#039;5 hours&#039;&#039;&#039;. &lt;br /&gt;
It also requests &#039;&#039;&#039;16GB of RAM&#039;&#039;&#039; on each node. The simulation runs as &#039;&#039;&#039;80 one-threaded processes&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;job-multi.slurm&#039;&#039;&#039;:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# ================================================================&lt;br /&gt;
#SBATCH --job-name=gro_test&lt;br /&gt;
&lt;br /&gt;
#SBATCH --nodes=2&lt;br /&gt;
#SBATCH --ntasks-per-node=40&lt;br /&gt;
#SBATCH --cpus-per-task=1&lt;br /&gt;
#SBATCH --mem=16GB&lt;br /&gt;
#SBATCH --time=0-05:00:00&lt;br /&gt;
# ================================================================&lt;br /&gt;
module purge&lt;br /&gt;
module load gromacs/2019.6-skylake&lt;br /&gt;
# ================================================================&lt;br /&gt;
echo &amp;quot;Starting at `date`.&amp;quot;&lt;br /&gt;
echo &amp;quot;=========================&amp;quot;&lt;br /&gt;
# Input files.&lt;br /&gt;
MDP=bilayer.mdp&lt;br /&gt;
TOP=bilayer.top&lt;br /&gt;
GRO=bilayer.gro&lt;br /&gt;
&lt;br /&gt;
# Binary input file to generate.&lt;br /&gt;
TPR=bilayer.tpr&lt;br /&gt;
&lt;br /&gt;
# Preprocess the input files.&lt;br /&gt;
gmx grompp -v -f $MDP -c $GRO -p $TOP -o $TPR&lt;br /&gt;
&lt;br /&gt;
# Check if preprocessing have gone well.&lt;br /&gt;
if ! test -e $TPR; then&lt;br /&gt;
	echo &amp;quot;ERROR: Could not create a TPR file for the run. Aborting.&amp;quot;&lt;br /&gt;
	exit&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# Run the simulation.&lt;br /&gt;
OMP_NUM_THREADS=1&lt;br /&gt;
mpiexec gmx_mpi mdrun -v -s $TPR&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;=========================&amp;quot;&lt;br /&gt;
echo &amp;quot;Done at `date`.&amp;quot;&lt;br /&gt;
# ================================================================&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Single node (legacy) job script ====&lt;br /&gt;
&lt;br /&gt;
This script is for jobs that use up to &#039;&#039;&#039;one&#039;&#039;&#039; full legacy node &lt;br /&gt;
(&#039;&#039;&#039;parallel&#039;&#039;&#039;, &#039;&#039;&#039;cpu2013&#039;&#039;&#039;, &#039;&#039;&#039;lattice&#039;&#039;&#039; partitions). &lt;br /&gt;
The partition has to be specified in the resource request.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This specific example requests &#039;&#039;&#039;12 CPUs on 1 node&#039;&#039;&#039; in the &#039;&#039;&#039;parallel&#039;&#039;&#039; legacy partition for &#039;&#039;&#039;5 hours&#039;&#039;&#039;. &lt;br /&gt;
It also requests &#039;&#039;&#039;23GB of RAM&#039;&#039;&#039; on the node (all available memory on this kind). &lt;br /&gt;
The simulation runs as &#039;&#039;&#039;1 process of 12 threads&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;job-single-legacy.slurm&#039;&#039;&#039;:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# ================================================================&lt;br /&gt;
#SBATCH --job-name=gro_test&lt;br /&gt;
&lt;br /&gt;
#SBATCH --nodes=1&lt;br /&gt;
#SBATCH --ntasks-per-node=1&lt;br /&gt;
#SBATCH --cpus-per-task=12&lt;br /&gt;
#SBATCH --mem=23GB&lt;br /&gt;
#SBATCH --time=0-12:00:00&lt;br /&gt;
&lt;br /&gt;
#SBATCH --partition=parallel&lt;br /&gt;
# ================================================================&lt;br /&gt;
module purge&lt;br /&gt;
module load gromacs/2019.6-legacy&lt;br /&gt;
# ================================================================&lt;br /&gt;
echo &amp;quot;Starting at `date`.&amp;quot;&lt;br /&gt;
echo &amp;quot;=========================&amp;quot;&lt;br /&gt;
# Input files.&lt;br /&gt;
MDP=bilayer.mdp&lt;br /&gt;
TOP=bilayer.top&lt;br /&gt;
GRO=bilayer.gro&lt;br /&gt;
&lt;br /&gt;
# Binary input file to generate.&lt;br /&gt;
TPR=bilayer.tpr&lt;br /&gt;
&lt;br /&gt;
# Preprocess the input files.&lt;br /&gt;
gmx grompp -v -f $MDP -c $GRO -p $TOP -o $TPR&lt;br /&gt;
&lt;br /&gt;
# Check if preprocessing have gone well.&lt;br /&gt;
if ! test -e $TPR; then&lt;br /&gt;
	echo &amp;quot;ERROR: Could not create a TPR file for the run. Aborting.&amp;quot;&lt;br /&gt;
	exit&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# Run the simulation.&lt;br /&gt;
OMP_NUM_THREADS=$SLURM_CPUS_PER_TASK&lt;br /&gt;
&lt;br /&gt;
gmx mdrun -v -s $TPR&lt;br /&gt;
echo &amp;quot;=========================&amp;quot;&lt;br /&gt;
echo &amp;quot;Done at `date`.&amp;quot;&lt;br /&gt;
# ================================================================&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Multi node (legacy) job script ====&lt;br /&gt;
&lt;br /&gt;
This script is for jobs that use several legacy node &lt;br /&gt;
(&#039;&#039;&#039;parallel&#039;&#039;&#039;, &#039;&#039;&#039;cpu2013&#039;&#039;&#039;, &#039;&#039;&#039;lattice&#039;&#039;&#039; partitions). &lt;br /&gt;
The partition has to be specified in the resource request.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This specific example requests &#039;&#039;&#039;48 CPUs on 4 nodes&#039;&#039;&#039; in the &#039;&#039;&#039;parallel&#039;&#039;&#039; legacy partition (12 CPUs each) for &#039;&#039;&#039;5 hours&#039;&#039;&#039;. &lt;br /&gt;
It also requests &#039;&#039;&#039;23GB of RAM&#039;&#039;&#039; on each node. The simulation runs as &#039;&#039;&#039;48 one-threaded processes&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;job-multi.slurm&#039;&#039;&#039;:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# ================================================================&lt;br /&gt;
#SBATCH --job-name=gro_test&lt;br /&gt;
&lt;br /&gt;
#SBATCH --nodes=4&lt;br /&gt;
#SBATCH --ntasks-per-node=12&lt;br /&gt;
#SBATCH --cpus-per-task=1&lt;br /&gt;
#SBATCH --mem=23GB&lt;br /&gt;
#SBATCH --time=0-05:00:00&lt;br /&gt;
&lt;br /&gt;
#SBATCH --partition=parallel&lt;br /&gt;
# ================================================================&lt;br /&gt;
module purge&lt;br /&gt;
module load gromacs/2019.6-legacy&lt;br /&gt;
# ================================================================&lt;br /&gt;
echo &amp;quot;Starting at `date`.&amp;quot;&lt;br /&gt;
echo &amp;quot;=========================&amp;quot;&lt;br /&gt;
# Input files.&lt;br /&gt;
MDP=bilayer.mdp&lt;br /&gt;
TOP=bilayer.top&lt;br /&gt;
GRO=bilayer.gro&lt;br /&gt;
&lt;br /&gt;
# Binary input file to generate.&lt;br /&gt;
TPR=bilayer.tpr&lt;br /&gt;
&lt;br /&gt;
# Preprocess the input files.&lt;br /&gt;
gmx grompp -v -f $MDP -c $GRO -p $TOP -o $TPR&lt;br /&gt;
&lt;br /&gt;
# Check if preprocessing have gone well.&lt;br /&gt;
if ! test -e $TPR; then&lt;br /&gt;
	echo &amp;quot;ERROR: Could not create a TPR file for the run. Aborting.&amp;quot;&lt;br /&gt;
	exit&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# Run the simulation.&lt;br /&gt;
OMP_NUM_THREADS=1&lt;br /&gt;
mpiexec gmx_mpi mdrun -v -s $TPR&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;=========================&amp;quot;&lt;br /&gt;
echo &amp;quot;Done at `date`.&amp;quot;&lt;br /&gt;
# ================================================================&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Tip ====&lt;br /&gt;
&lt;br /&gt;
Sometimes it is useful to run the preprocessor to generate the binary input before submitting a job. &lt;br /&gt;
In the example above there had been two notes about the setup and you have to make sure that &lt;br /&gt;
you are ready to continue with the simulation despite them. &lt;br /&gt;
&lt;br /&gt;
Also, if there are problems with your input you will be able to see them right away without going through job submission.&lt;br /&gt;
&lt;br /&gt;
= Misc =&lt;br /&gt;
&lt;br /&gt;
== Performance ==&lt;br /&gt;
&lt;br /&gt;
Performance measurements for &#039;&#039;&#039;GROMACS 2019.6&#039;&#039;&#039; on the 2019 compute nodes using &lt;br /&gt;
different parallelization options and number of CPUs.&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;bilayer&#039;&#039;&#039; system of ~105000 atoms was simulated for 100000 steps.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
-------------------------------------------------------------------------------&lt;br /&gt;
#CPUs   #Nodes  Processes    Threads    Wall Time    Performance  Efficiency&lt;br /&gt;
                 per node   per proc          (s)       (ns/day)         (%)&lt;br /&gt;
-------------------------------------------------------------------------------&lt;br /&gt;
    1       1           1          1       1031.6           0.84       100.0&lt;br /&gt;
&lt;br /&gt;
   10       1           1         10        119.0           7.26        86.4&lt;br /&gt;
   20       1           1         20         65.9          13.11        78.0&lt;br /&gt;
   40       1           1         40         37.6          22.97        68.4&lt;br /&gt;
&lt;br /&gt;
   10       1          10          1        126.4           6.83        81.3  &lt;br /&gt;
   20       1          20          1         78.0          11.08        66.0&lt;br /&gt;
   40       1          40          1         45.3          19.07        56.8&lt;br /&gt;
&lt;br /&gt;
   40       1          20          2         48.3          17.90        53.3        &lt;br /&gt;
   40       1          10          4         43.9          19.68        58.6&lt;br /&gt;
   36       1           6          6         49.4          17.50        57.9&lt;br /&gt;
&lt;br /&gt;
   80       2          10          4         30.5          28.34        42.2  &lt;br /&gt;
   80       2          20          2         32.6          26.53        39.4&lt;br /&gt;
   80       2          40          1         30.3          28.49        42.4&lt;br /&gt;
&lt;br /&gt;
  120       3          40          1         20.8          41.51        41.2&lt;br /&gt;
  160       4          40          1         19.2          44.95        33.4&lt;br /&gt;
-------------------------------------------------------------------------------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Observations&#039;&#039;&#039;:&lt;br /&gt;
* If you want to run the job on a &#039;&#039;&#039;single node&#039;&#039;&#039;, then use &#039;&#039;&#039;1 process&#039;&#039;&#039; with as many threads as the number of CPUs you request.&lt;br /&gt;
&lt;br /&gt;
* If you need &#039;&#039;&#039;more than 1 node&#039;&#039;&#039;, then run &#039;&#039;&#039;1-threaded MPI processes&#039;&#039;&#039; for each CPU you request.&lt;br /&gt;
&lt;br /&gt;
* Going &#039;&#039;&#039;beyond 3 nodes&#039;&#039;&#039; may not be computationally efficient on ARC.&lt;br /&gt;
&lt;br /&gt;
== Selected GROMACS commands ==&lt;br /&gt;
=== gmx ===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
SYNOPSIS&lt;br /&gt;
&lt;br /&gt;
gmx [-[no]h] [-[no]quiet] [-[no]version] [-[no]copyright] [-nice &amp;lt;int&amp;gt;]&lt;br /&gt;
    [-[no]backup]&lt;br /&gt;
&lt;br /&gt;
OPTIONS&lt;br /&gt;
&lt;br /&gt;
Other options:&lt;br /&gt;
&lt;br /&gt;
 -[no]h                     (no)&lt;br /&gt;
           Print help and quit&lt;br /&gt;
 -[no]quiet                 (no)&lt;br /&gt;
           Do not print common startup info or quotes&lt;br /&gt;
 -[no]version               (no)&lt;br /&gt;
           Print extended version information and quit&lt;br /&gt;
 -[no]copyright             (yes)&lt;br /&gt;
           Print copyright information on startup&lt;br /&gt;
 -nice   &amp;lt;int&amp;gt;              (19)&lt;br /&gt;
           Set the nicelevel (default depends on command)&lt;br /&gt;
 -[no]backup                (yes)&lt;br /&gt;
           Write backups if output files exist&lt;br /&gt;
&lt;br /&gt;
Additional help is available on the following topics:&lt;br /&gt;
    commands    List of available commands&lt;br /&gt;
    selections  Selection syntax and usage&lt;br /&gt;
To access the help, use &#039;gmx help &amp;lt;topic&amp;gt;&#039;.&lt;br /&gt;
For help on a command, use &#039;gmx help &amp;lt;command&amp;gt;&#039;.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== gmx grompp ===&lt;br /&gt;
Preprocess input files.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ gmx help grompp&lt;br /&gt;
&lt;br /&gt;
SYNOPSIS&lt;br /&gt;
&lt;br /&gt;
gmx grompp [-f [&amp;lt;.mdp&amp;gt;]] [-c [&amp;lt;.gro/.g96/...&amp;gt;]] [-r [&amp;lt;.gro/.g96/...&amp;gt;]]&lt;br /&gt;
           [-rb [&amp;lt;.gro/.g96/...&amp;gt;]] [-n [&amp;lt;.ndx&amp;gt;]] [-p [&amp;lt;.top&amp;gt;]]&lt;br /&gt;
           [-t [&amp;lt;.trr/.cpt/...&amp;gt;]] [-e [&amp;lt;.edr&amp;gt;]] [-ref [&amp;lt;.trr/.cpt/...&amp;gt;]]&lt;br /&gt;
           [-po [&amp;lt;.mdp&amp;gt;]] [-pp [&amp;lt;.top&amp;gt;]] [-o [&amp;lt;.tpr&amp;gt;]] [-imd [&amp;lt;.gro&amp;gt;]]&lt;br /&gt;
           [-[no]v] [-time &amp;lt;real&amp;gt;] [-[no]rmvsbds] [-maxwarn &amp;lt;int&amp;gt;]&lt;br /&gt;
           [-[no]zero] [-[no]renum]&lt;br /&gt;
&lt;br /&gt;
OPTIONS&lt;br /&gt;
&lt;br /&gt;
Options to specify input files:&lt;br /&gt;
&lt;br /&gt;
 -f      [&amp;lt;.mdp&amp;gt;]           (grompp.mdp)&lt;br /&gt;
           grompp input file with MD parameters&lt;br /&gt;
 -c      [&amp;lt;.gro/.g96/...&amp;gt;]  (conf.gro)&lt;br /&gt;
           Structure file: gro g96 pdb brk ent esp tpr&lt;br /&gt;
 -r      [&amp;lt;.gro/.g96/...&amp;gt;]  (restraint.gro)  (Opt.)&lt;br /&gt;
           Structure file: gro g96 pdb brk ent esp tpr&lt;br /&gt;
 -rb     [&amp;lt;.gro/.g96/...&amp;gt;]  (restraint.gro)  (Opt.)&lt;br /&gt;
           Structure file: gro g96 pdb brk ent esp tpr&lt;br /&gt;
 -n      [&amp;lt;.ndx&amp;gt;]           (index.ndx)      (Opt.)&lt;br /&gt;
           Index file&lt;br /&gt;
 -p      [&amp;lt;.top&amp;gt;]           (topol.top)&lt;br /&gt;
           Topology file&lt;br /&gt;
 -t      [&amp;lt;.trr/.cpt/...&amp;gt;]  (traj.trr)       (Opt.)&lt;br /&gt;
           Full precision trajectory: trr cpt tng&lt;br /&gt;
 -e      [&amp;lt;.edr&amp;gt;]           (ener.edr)       (Opt.)&lt;br /&gt;
           Energy file&lt;br /&gt;
&lt;br /&gt;
Options to specify input/output files:&lt;br /&gt;
&lt;br /&gt;
 -ref    [&amp;lt;.trr/.cpt/...&amp;gt;]  (rotref.trr)     (Opt.)&lt;br /&gt;
           Full precision trajectory: trr cpt tng&lt;br /&gt;
&lt;br /&gt;
Options to specify output files:&lt;br /&gt;
&lt;br /&gt;
 -po     [&amp;lt;.mdp&amp;gt;]           (mdout.mdp)&lt;br /&gt;
           grompp input file with MD parameters&lt;br /&gt;
 -pp     [&amp;lt;.top&amp;gt;]           (processed.top)  (Opt.)&lt;br /&gt;
           Topology file&lt;br /&gt;
 -o      [&amp;lt;.tpr&amp;gt;]           (topol.tpr)&lt;br /&gt;
           Portable xdr run input file&lt;br /&gt;
 -imd    [&amp;lt;.gro&amp;gt;]           (imdgroup.gro)   (Opt.)&lt;br /&gt;
           Coordinate file in Gromos-87 format&lt;br /&gt;
&lt;br /&gt;
Other options:&lt;br /&gt;
&lt;br /&gt;
 -[no]v                     (no)&lt;br /&gt;
           Be loud and noisy&lt;br /&gt;
 -time   &amp;lt;real&amp;gt;             (-1)&lt;br /&gt;
           Take frame at or first after this time.&lt;br /&gt;
 -[no]rmvsbds               (yes)&lt;br /&gt;
           Remove constant bonded interactions with virtual sites&lt;br /&gt;
 -maxwarn &amp;lt;int&amp;gt;             (0)&lt;br /&gt;
           Number of allowed warnings during input processing. Not for normal&lt;br /&gt;
           use and may generate unstable systems&lt;br /&gt;
 -[no]zero                  (no)&lt;br /&gt;
           Set parameters for bonded interactions without defaults to zero&lt;br /&gt;
           instead of generating an error&lt;br /&gt;
 -[no]renum                 (yes)&lt;br /&gt;
           Renumber atomtypes and minimize number of atomtypes&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== gmx mdrun ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;gmx mdrun&#039;&#039;&#039; is the main computational chemistry engine within &#039;&#039;&#039;GROMACS&#039;&#039;&#039;.&lt;br /&gt;
It performs Molecular Dynamics simulations, but it can also perform&lt;br /&gt;
Stochastic Dynamics, Energy Minimization, test particle insertion or&lt;br /&gt;
(re)calculation of energies. Normal mode analysis is another option.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
SYNOPSIS&lt;br /&gt;
&lt;br /&gt;
gmx mdrun [-s [&amp;lt;.tpr&amp;gt;]] [-cpi [&amp;lt;.cpt&amp;gt;]] [-table [&amp;lt;.xvg&amp;gt;]] [-tablep [&amp;lt;.xvg&amp;gt;]]&lt;br /&gt;
          [-tableb [&amp;lt;.xvg&amp;gt; [...]]] [-rerun [&amp;lt;.xtc/.trr/...&amp;gt;]] [-ei [&amp;lt;.edi&amp;gt;]]&lt;br /&gt;
          [-multidir [&amp;lt;dir&amp;gt; [...]]] [-awh [&amp;lt;.xvg&amp;gt;]] [-membed [&amp;lt;.dat&amp;gt;]]&lt;br /&gt;
          [-mp [&amp;lt;.top&amp;gt;]] [-mn [&amp;lt;.ndx&amp;gt;]] [-o [&amp;lt;.trr/.cpt/...&amp;gt;]]&lt;br /&gt;
          [-x [&amp;lt;.xtc/.tng&amp;gt;]] [-cpo [&amp;lt;.cpt&amp;gt;]] [-c [&amp;lt;.gro/.g96/...&amp;gt;]]&lt;br /&gt;
          [-e [&amp;lt;.edr&amp;gt;]] [-g [&amp;lt;.log&amp;gt;]] [-dhdl [&amp;lt;.xvg&amp;gt;]] [-field [&amp;lt;.xvg&amp;gt;]]&lt;br /&gt;
          [-tpi [&amp;lt;.xvg&amp;gt;]] [-tpid [&amp;lt;.xvg&amp;gt;]] [-eo [&amp;lt;.xvg&amp;gt;]] [-devout [&amp;lt;.xvg&amp;gt;]]&lt;br /&gt;
          [-runav [&amp;lt;.xvg&amp;gt;]] [-px [&amp;lt;.xvg&amp;gt;]] [-pf [&amp;lt;.xvg&amp;gt;]] [-ro [&amp;lt;.xvg&amp;gt;]]&lt;br /&gt;
          [-ra [&amp;lt;.log&amp;gt;]] [-rs [&amp;lt;.log&amp;gt;]] [-rt [&amp;lt;.log&amp;gt;]] [-mtx [&amp;lt;.mtx&amp;gt;]]&lt;br /&gt;
          [-if [&amp;lt;.xvg&amp;gt;]] [-swap [&amp;lt;.xvg&amp;gt;]] [-deffnm &amp;lt;string&amp;gt;] [-xvg &amp;lt;enum&amp;gt;]&lt;br /&gt;
          [-dd &amp;lt;vector&amp;gt;] [-ddorder &amp;lt;enum&amp;gt;] [-npme &amp;lt;int&amp;gt;] [-nt &amp;lt;int&amp;gt;]&lt;br /&gt;
          [-ntmpi &amp;lt;int&amp;gt;] [-ntomp &amp;lt;int&amp;gt;] [-ntomp_pme &amp;lt;int&amp;gt;] [-pin &amp;lt;enum&amp;gt;]&lt;br /&gt;
          [-pinoffset &amp;lt;int&amp;gt;] [-pinstride &amp;lt;int&amp;gt;] [-gpu_id &amp;lt;string&amp;gt;]&lt;br /&gt;
          [-gputasks &amp;lt;string&amp;gt;] [-[no]ddcheck] [-rdd &amp;lt;real&amp;gt;] [-rcon &amp;lt;real&amp;gt;]&lt;br /&gt;
          [-dlb &amp;lt;enum&amp;gt;] [-dds &amp;lt;real&amp;gt;] [-gcom &amp;lt;int&amp;gt;] [-nb &amp;lt;enum&amp;gt;]&lt;br /&gt;
          [-nstlist &amp;lt;int&amp;gt;] [-[no]tunepme] [-pme &amp;lt;enum&amp;gt;] [-pmefft &amp;lt;enum&amp;gt;]&lt;br /&gt;
          [-bonded &amp;lt;enum&amp;gt;] [-[no]v] [-pforce &amp;lt;real&amp;gt;] [-[no]reprod]&lt;br /&gt;
          [-cpt &amp;lt;real&amp;gt;] [-[no]cpnum] [-[no]append] [-nsteps &amp;lt;int&amp;gt;]&lt;br /&gt;
          [-maxh &amp;lt;real&amp;gt;] [-replex &amp;lt;int&amp;gt;] [-nex &amp;lt;int&amp;gt;] [-reseed &amp;lt;int&amp;gt;]&lt;br /&gt;
&lt;br /&gt;
OPTIONS&lt;br /&gt;
&lt;br /&gt;
Options to specify input files:&lt;br /&gt;
&lt;br /&gt;
 -s      [&amp;lt;.tpr&amp;gt;]           (topol.tpr)&lt;br /&gt;
           Portable xdr run input file&lt;br /&gt;
 -cpi    [&amp;lt;.cpt&amp;gt;]           (state.cpt)      (Opt.)&lt;br /&gt;
           Checkpoint file&lt;br /&gt;
 -table  [&amp;lt;.xvg&amp;gt;]           (table.xvg)      (Opt.)&lt;br /&gt;
           xvgr/xmgr file&lt;br /&gt;
 -tablep [&amp;lt;.xvg&amp;gt;]           (tablep.xvg)     (Opt.)&lt;br /&gt;
           xvgr/xmgr file&lt;br /&gt;
 -tableb [&amp;lt;.xvg&amp;gt; [...]]     (table.xvg)      (Opt.)&lt;br /&gt;
           xvgr/xmgr file&lt;br /&gt;
 -rerun  [&amp;lt;.xtc/.trr/...&amp;gt;]  (rerun.xtc)      (Opt.)&lt;br /&gt;
           Trajectory: xtc trr cpt gro g96 pdb tng&lt;br /&gt;
 -ei     [&amp;lt;.edi&amp;gt;]           (sam.edi)        (Opt.)&lt;br /&gt;
           ED sampling input&lt;br /&gt;
 -multidir [&amp;lt;dir&amp;gt; [...]]    (rundir)         (Opt.)&lt;br /&gt;
           Run directory&lt;br /&gt;
 -awh    [&amp;lt;.xvg&amp;gt;]           (awhinit.xvg)    (Opt.)&lt;br /&gt;
           xvgr/xmgr file&lt;br /&gt;
 -membed [&amp;lt;.dat&amp;gt;]           (membed.dat)     (Opt.)&lt;br /&gt;
           Generic data file&lt;br /&gt;
 -mp     [&amp;lt;.top&amp;gt;]           (membed.top)     (Opt.)&lt;br /&gt;
           Topology file&lt;br /&gt;
 -mn     [&amp;lt;.ndx&amp;gt;]           (membed.ndx)     (Opt.)&lt;br /&gt;
           Index file&lt;br /&gt;
&lt;br /&gt;
Options to specify output files:&lt;br /&gt;
&lt;br /&gt;
 -o      [&amp;lt;.trr/.cpt/...&amp;gt;]  (traj.trr)&lt;br /&gt;
           Full precision trajectory: trr cpt tng&lt;br /&gt;
 -x      [&amp;lt;.xtc/.tng&amp;gt;]      (traj_comp.xtc)  (Opt.)&lt;br /&gt;
           Compressed trajectory (tng format or portable xdr format)&lt;br /&gt;
 -cpo    [&amp;lt;.cpt&amp;gt;]           (state.cpt)      (Opt.)&lt;br /&gt;
           Checkpoint file&lt;br /&gt;
 -c      [&amp;lt;.gro/.g96/...&amp;gt;]  (confout.gro)&lt;br /&gt;
           Structure file: gro g96 pdb brk ent esp&lt;br /&gt;
 -e      [&amp;lt;.edr&amp;gt;]           (ener.edr)&lt;br /&gt;
           Energy file&lt;br /&gt;
 -g      [&amp;lt;.log&amp;gt;]           (md.log)&lt;br /&gt;
           Log file&lt;br /&gt;
 -dhdl   [&amp;lt;.xvg&amp;gt;]           (dhdl.xvg)       (Opt.)&lt;br /&gt;
           xvgr/xmgr file&lt;br /&gt;
 -field  [&amp;lt;.xvg&amp;gt;]           (field.xvg)      (Opt.)&lt;br /&gt;
           xvgr/xmgr file&lt;br /&gt;
 -tpi    [&amp;lt;.xvg&amp;gt;]           (tpi.xvg)        (Opt.)&lt;br /&gt;
           xvgr/xmgr file&lt;br /&gt;
 -tpid   [&amp;lt;.xvg&amp;gt;]           (tpidist.xvg)    (Opt.)&lt;br /&gt;
           xvgr/xmgr file&lt;br /&gt;
 -eo     [&amp;lt;.xvg&amp;gt;]           (edsam.xvg)      (Opt.)&lt;br /&gt;
           xvgr/xmgr file&lt;br /&gt;
 -devout [&amp;lt;.xvg&amp;gt;]           (deviatie.xvg)   (Opt.)&lt;br /&gt;
           xvgr/xmgr file&lt;br /&gt;
 -runav  [&amp;lt;.xvg&amp;gt;]           (runaver.xvg)    (Opt.)&lt;br /&gt;
           xvgr/xmgr file&lt;br /&gt;
 -px     [&amp;lt;.xvg&amp;gt;]           (pullx.xvg)      (Opt.)&lt;br /&gt;
           xvgr/xmgr file&lt;br /&gt;
 -pf     [&amp;lt;.xvg&amp;gt;]           (pullf.xvg)      (Opt.)&lt;br /&gt;
           xvgr/xmgr file&lt;br /&gt;
 -ro     [&amp;lt;.xvg&amp;gt;]           (rotation.xvg)   (Opt.)&lt;br /&gt;
           xvgr/xmgr file&lt;br /&gt;
 -ra     [&amp;lt;.log&amp;gt;]           (rotangles.log)  (Opt.)&lt;br /&gt;
           Log file&lt;br /&gt;
 -rs     [&amp;lt;.log&amp;gt;]           (rotslabs.log)   (Opt.)&lt;br /&gt;
           Log file&lt;br /&gt;
 -rt     [&amp;lt;.log&amp;gt;]           (rottorque.log)  (Opt.)&lt;br /&gt;
           Log file&lt;br /&gt;
 -mtx    [&amp;lt;.mtx&amp;gt;]           (nm.mtx)         (Opt.)&lt;br /&gt;
           Hessian matrix&lt;br /&gt;
 -if     [&amp;lt;.xvg&amp;gt;]           (imdforces.xvg)  (Opt.)&lt;br /&gt;
           xvgr/xmgr file&lt;br /&gt;
 -swap   [&amp;lt;.xvg&amp;gt;]           (swapions.xvg)   (Opt.)&lt;br /&gt;
           xvgr/xmgr file&lt;br /&gt;
&lt;br /&gt;
Other options:&lt;br /&gt;
&lt;br /&gt;
 -deffnm &amp;lt;string&amp;gt;&lt;br /&gt;
           Set the default filename for all file options&lt;br /&gt;
 -xvg    &amp;lt;enum&amp;gt;             (xmgrace)&lt;br /&gt;
           xvg plot formatting: xmgrace, xmgr, none&lt;br /&gt;
 -dd     &amp;lt;vector&amp;gt;           (0 0 0)&lt;br /&gt;
           Domain decomposition grid, 0 is optimize&lt;br /&gt;
 -ddorder &amp;lt;enum&amp;gt;            (interleave)&lt;br /&gt;
           DD rank order: interleave, pp_pme, cartesian&lt;br /&gt;
 -npme   &amp;lt;int&amp;gt;              (-1)&lt;br /&gt;
           Number of separate ranks to be used for PME, -1 is guess&lt;br /&gt;
 -nt     &amp;lt;int&amp;gt;              (0)&lt;br /&gt;
           Total number of threads to start (0 is guess)&lt;br /&gt;
 -ntmpi  &amp;lt;int&amp;gt;              (0)&lt;br /&gt;
           Number of thread-MPI ranks to start (0 is guess)&lt;br /&gt;
 -ntomp  &amp;lt;int&amp;gt;              (0)&lt;br /&gt;
           Number of OpenMP threads per MPI rank to start (0 is guess)&lt;br /&gt;
 -ntomp_pme &amp;lt;int&amp;gt;           (0)&lt;br /&gt;
           Number of OpenMP threads per MPI rank to start (0 is -ntomp)&lt;br /&gt;
 -pin    &amp;lt;enum&amp;gt;             (auto)&lt;br /&gt;
           Whether mdrun should try to set thread affinities: auto, on, off&lt;br /&gt;
 -pinoffset &amp;lt;int&amp;gt;           (0)&lt;br /&gt;
           The lowest logical core number to which mdrun should pin the first&lt;br /&gt;
           thread&lt;br /&gt;
 -pinstride &amp;lt;int&amp;gt;           (0)&lt;br /&gt;
           Pinning distance in logical cores for threads, use 0 to minimize&lt;br /&gt;
           the number of threads per physical core&lt;br /&gt;
 -gpu_id &amp;lt;string&amp;gt;&lt;br /&gt;
           List of unique GPU device IDs available to use&lt;br /&gt;
 -gputasks &amp;lt;string&amp;gt;&lt;br /&gt;
           List of GPU device IDs, mapping each PP task on each node to a&lt;br /&gt;
           device&lt;br /&gt;
 -[no]ddcheck               (yes)&lt;br /&gt;
           Check for all bonded interactions with DD&lt;br /&gt;
 -rdd    &amp;lt;real&amp;gt;             (0)&lt;br /&gt;
           The maximum distance for bonded interactions with DD (nm), 0 is&lt;br /&gt;
           determine from initial coordinates&lt;br /&gt;
 -rcon   &amp;lt;real&amp;gt;             (0)&lt;br /&gt;
           Maximum distance for P-LINCS (nm), 0 is estimate&lt;br /&gt;
 -dlb    &amp;lt;enum&amp;gt;             (auto)&lt;br /&gt;
           Dynamic load balancing (with DD): auto, no, yes&lt;br /&gt;
 -dds    &amp;lt;real&amp;gt;             (0.8)&lt;br /&gt;
           Fraction in (0,1) by whose reciprocal the initial DD cell size will&lt;br /&gt;
           be increased in order to provide a margin in which dynamic load&lt;br /&gt;
           balancing can act while preserving the minimum cell size.&lt;br /&gt;
 -gcom   &amp;lt;int&amp;gt;              (-1)&lt;br /&gt;
           Global communication frequency&lt;br /&gt;
 -nb     &amp;lt;enum&amp;gt;             (auto)&lt;br /&gt;
           Calculate non-bonded interactions on: auto, cpu, gpu&lt;br /&gt;
 -nstlist &amp;lt;int&amp;gt;             (0)&lt;br /&gt;
           Set nstlist when using a Verlet buffer tolerance (0 is guess)&lt;br /&gt;
 -[no]tunepme               (yes)&lt;br /&gt;
           Optimize PME load between PP/PME ranks or GPU/CPU (only with the&lt;br /&gt;
           Verlet cut-off scheme)&lt;br /&gt;
 -pme    &amp;lt;enum&amp;gt;             (auto)&lt;br /&gt;
           Perform PME calculations on: auto, cpu, gpu&lt;br /&gt;
 -pmefft &amp;lt;enum&amp;gt;             (auto)&lt;br /&gt;
           Perform PME FFT calculations on: auto, cpu, gpu&lt;br /&gt;
 -bonded &amp;lt;enum&amp;gt;             (auto)&lt;br /&gt;
           Perform bonded calculations on: auto, cpu, gpu&lt;br /&gt;
 -[no]v                     (no)&lt;br /&gt;
           Be loud and noisy&lt;br /&gt;
 -pforce &amp;lt;real&amp;gt;             (-1)&lt;br /&gt;
           Print all forces larger than this (kJ/mol nm)&lt;br /&gt;
 -[no]reprod                (no)&lt;br /&gt;
           Try to avoid optimizations that affect binary reproducibility&lt;br /&gt;
 -cpt    &amp;lt;real&amp;gt;             (15)&lt;br /&gt;
           Checkpoint interval (minutes)&lt;br /&gt;
 -[no]cpnum                 (no)&lt;br /&gt;
           Keep and number checkpoint files&lt;br /&gt;
 -[no]append                (yes)&lt;br /&gt;
           Append to previous output files when continuing from checkpoint&lt;br /&gt;
           instead of adding the simulation part number to all file names&lt;br /&gt;
 -nsteps &amp;lt;int&amp;gt;              (-2)&lt;br /&gt;
           Run this number of steps (-1 means infinite, -2 means use mdp&lt;br /&gt;
           option, smaller is invalid)&lt;br /&gt;
 -maxh   &amp;lt;real&amp;gt;             (-1)&lt;br /&gt;
           Terminate after 0.99 times this time (hours)&lt;br /&gt;
 -replex &amp;lt;int&amp;gt;              (0)&lt;br /&gt;
           Attempt replica exchange periodically with this period (steps)&lt;br /&gt;
 -nex    &amp;lt;int&amp;gt;              (0)&lt;br /&gt;
           Number of random exchanges to carry out each exchange interval (N^3&lt;br /&gt;
           is one suggestion).  -nex zero or not specified gives neighbor&lt;br /&gt;
           replica exchange.&lt;br /&gt;
 -reseed &amp;lt;int&amp;gt;              (-1)&lt;br /&gt;
           Seed for replica exchange, -1 is generate a seed&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
= Support =&lt;br /&gt;
&lt;br /&gt;
Please send any questions regarding using GROMACS on ARC to support@hpc.ucalgary.ca.&lt;/div&gt;</summary>
		<author><name>Phillips</name></author>
	</entry>
	<entry>
		<id>https://rcs.ucalgary.ca/index.php?title=Mathematica&amp;diff=612</id>
		<title>Mathematica</title>
		<link rel="alternate" type="text/html" href="https://rcs.ucalgary.ca/index.php?title=Mathematica&amp;diff=612"/>
		<updated>2020-05-29T14:47:31Z</updated>

		<summary type="html">&lt;p&gt;Phillips: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Mathematica]]&lt;br /&gt;
[[Category:Software]]&lt;br /&gt;
[[Category:ARC]]&lt;br /&gt;
&amp;lt;span id=&amp;quot;contents&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
= &amp;lt;span id=&amp;quot;intro&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Introduction =&lt;br /&gt;
&lt;br /&gt;
[https://www.wolfram.com/mathematica/ Mathematica (external link)] is a general-purpose high-level programming package for both symbolic and numerical calculations.&lt;br /&gt;
&lt;br /&gt;
The main purpose of this page is to show how to use Mathematica on the University of Calgary [[ ARC_Cluster_Guide |ARC (Advanced Research Computing) cluster]]. It is presumed that you already have an account an ARC and have read the material on reserving resources and [[Running jobs|running jobs]] with the Slurm job management system.&lt;br /&gt;
&lt;br /&gt;
= &amp;lt;span id=&amp;quot;license&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Licensing =&lt;br /&gt;
At the University of Calgary, Information Technologies has purchased a site license for using Mathematica for teaching and learning and non-commercial research purposes.  The software has been installed on the ARC cluster, where multiple instances can be run at the same time.  When Mathematica starts up, it checks with a central license server.&lt;br /&gt;
&lt;br /&gt;
For information about installing Mathematica on your own computer, see the Information Technologies Knowledge Base [https://ucalgary.service-now.com/it?id=kb_article&amp;amp;sys_id=9773754113f9bac08246f7b2e144b013 article on Mathematica].&lt;br /&gt;
&lt;br /&gt;
= Running Mathematica on the ARC cluster =&lt;br /&gt;
Although it is possible to run Mathematica interactively (with or without a graphical user interface) on a compute node reserved with the Slurm salloc command, the expectation is that most calculations with Mathematica on ARC will be completed by submitting a batch job script to the Slurm job scheduler with the &#039;&#039;&#039;sbatch&#039;&#039;&#039; command.&lt;br /&gt;
&lt;br /&gt;
Suppose that the following Mathematica code to print out the first million prime numbers is in a file, primes_list.m :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
primeslist = Table[Prime[k],{k,1,1000000}];&lt;br /&gt;
Export[&amp;quot;primes_1000000.out&amp;quot;,primeslist,&amp;quot;Table&amp;quot;,&amp;quot;FieldSeparators&amp;quot;-&amp;gt;&amp;quot; &amp;quot;];&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that formatted Mathematica notebooks cannot be used directly. You need to convert your notebook to a text-format &amp;quot;.m&amp;quot; file, as discussed, for example, [https://mathematica.stackexchange.com/questions/137925/how-can-i-get-the-m-file-with-mathematica here (external link)]. The general idea is to mark cells to be executed as initialization cells and then use &amp;quot;File-&amp;gt;Save as&amp;quot; menu item with the &amp;quot;Package&amp;quot; option to produce the .m file.&lt;br /&gt;
&lt;br /&gt;
The following Slurm batch job script, primes_list.slurm, can be used to run the primes_list.m code on a single complete compute node.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH --nodes=1&lt;br /&gt;
#SBATCH --time=00:30:00&lt;br /&gt;
#SBATCH --mem=0&lt;br /&gt;
#SBATCH --partition=pawson-bf,apophis-bf,razi-bf,single,lattice,parallel,cpu2019,cpu2013&lt;br /&gt;
&lt;br /&gt;
# Mathematica batch processing example.&lt;br /&gt;
# 2020-05-28.&lt;br /&gt;
&lt;br /&gt;
# Select Mathematica command to run:&lt;br /&gt;
MATH=/global/software/mathematica/mathematica1101/bin/math&lt;br /&gt;
&lt;br /&gt;
# Specify the name of the input file of Mathematica text commands:&lt;br /&gt;
INPUT=primes_list.m&lt;br /&gt;
OUTPUT=$(basename $INPUT .m)_${SLURM_JOB_ID}.out&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Current working directory is $(pwd)&amp;quot;&lt;br /&gt;
echo &amp;quot;Running on compute node $(hostname)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Starting run at: $(date)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
$MATH -noprompt -run -script $INPUT &amp;gt; $OUTPUT&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Finished with at: $(date)&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Note that the name of the executable for running Mathematica without a graphical interface is &amp;quot;math&amp;quot;.&lt;br /&gt;
Submit the job with &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sbatch primes_list.slurm&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
For the case of million primes, the run took about 30 seconds on a compute node in one of the slowest partitions (single) on ARC.  The time and memory limits should be adjusted to match the requirements of your calculations, but, some testing is usually required to fine tune those settings.&lt;br /&gt;
= Support =&lt;br /&gt;
&lt;br /&gt;
Please send any questions regarding using ANSYS on ARC to support@hpc.ucalgary.ca.&lt;/div&gt;</summary>
		<author><name>Phillips</name></author>
	</entry>
	<entry>
		<id>https://rcs.ucalgary.ca/index.php?title=MATLAB&amp;diff=611</id>
		<title>MATLAB</title>
		<link rel="alternate" type="text/html" href="https://rcs.ucalgary.ca/index.php?title=MATLAB&amp;diff=611"/>
		<updated>2020-05-29T14:46:58Z</updated>

		<summary type="html">&lt;p&gt;Phillips: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:MATLAB]]&lt;br /&gt;
[[Category:Software]]&lt;br /&gt;
[[Category:ARC]]&lt;br /&gt;
&amp;lt;span id=&amp;quot;contents&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
= &amp;lt;span id=&amp;quot;intro&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Introduction =&lt;br /&gt;
&lt;br /&gt;
[http://www.mathworks.com/ MATLAB] is a general-purpose high-level programming package for numerical work such as linear algebra, signal processing and other calculations involving matrices or vectors of data. Visualization tools are also included for presentation of results. The basic MATLAB package is extended through add-on components including SIMULINK, and the Image Processing, Optimization, Neural Network, Signal Processing, Statistics and Wavelet Toolboxes, among others.&lt;br /&gt;
&lt;br /&gt;
The main purpose of this page is to show how to use MATLAB on the University of Calgary [[ ARC_Cluster_Guide |ARC (Advanced Research Computing) cluster]]. It is presumed that you already have an account an ARC and have read the material on reserving resources and [[Running jobs|running jobs]] with the Slurm job management system.&lt;br /&gt;
&lt;br /&gt;
= &amp;lt;span id=&amp;quot;license&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Ways to run MATLAB - License considerations =&lt;br /&gt;
At the University of Calgary, Information Technologies has purchased a MATLAB Total Academic Headcount license that allows installation and use of MATLAB on central clusters, such as ARC, as well as on personal workstations throughout the University. Potentially thousands of instances of MATLAB can be run simultaneously, each checking out a license from a central license server. An alternative is to compile MATLAB code into a standalone application. When such an application is run, it does not need to contact the server for a license. This allows researchers to run their calculations on compatible hardware, not necessarily at the University of Calgary, such as on [https://docs.computecanada.ca/wiki/Getting_started Compute Canada clusters (external link)].&lt;br /&gt;
&lt;br /&gt;
For information about installing MATLAB on your own computer, see the Information Technologies Knowledge Base [https://ucalgary.service-now.com/it?id=kb_article&amp;amp;sys_id=787d708213fdbec08246f7b2e144b0d4 article on MATLAB].&lt;br /&gt;
&lt;br /&gt;
= Running MATLAB on the ARC cluster =&lt;br /&gt;
Although it is possible to run MATLAB interactively, the expectation is that most calculations with MATLAB will be completed by submitting a batch job script to the Slurm job scheduler with the sbatch command.&lt;br /&gt;
&lt;br /&gt;
For many researchers, the main reason for using ARC for MATLAB-based calculations is to be able to run many instances at the same time.  It is recommended in such cases that any parallel processing features be removed from the code and each instance of MATLAB be run on a single CPU core.  It is also possible to run MATLAB on multiple cores in an attempt to speed up individual instances, but, this generally results in a less efficient use of the cluster hardware.  In the sections that follow, serial and then parallel processing examples are shown.&lt;br /&gt;
&lt;br /&gt;
== Serial MATLAB example==&lt;br /&gt;
&lt;br /&gt;
For the purposes of illustration, suppose the following serial MATLAB code, in a file sawtooth.m, is to be run. If your code does not already have them, add a function statement at the beginning and matching end statement at the end as shown in the example. Other features of this example include calling a function with both numerical and string arguments, incorporating a Slurm environment variable into the MATLAB code and producing graphical output in a non-interactive environment.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
function sawtooth(nterms,nppcycle,ncycle,pngfilebase)&lt;br /&gt;
&lt;br /&gt;
% MATLAB file example to approximate a sawtooth&lt;br /&gt;
% with a truncated Fourier expansion.&lt;br /&gt;
&lt;br /&gt;
% nterms = number of terms in expansion.&lt;br /&gt;
% nppcycle = number of points per cycle.&lt;br /&gt;
% ncycle = number of complete cycles to plot.&lt;br /&gt;
% pngfilebase = base of file name for graph of results.&lt;br /&gt;
&lt;br /&gt;
% 2020-05-14&lt;br /&gt;
&lt;br /&gt;
np=nppcycle*ncycle;&lt;br /&gt;
&lt;br /&gt;
fourbypi=4.0/pi;&lt;br /&gt;
y(1:np)=pi/2.0;&lt;br /&gt;
x(1:np)=linspace(-pi*ncycle,pi*ncycle,np);&lt;br /&gt;
&lt;br /&gt;
for k=1:nterms&lt;br /&gt;
  twokm=2*k-1;&lt;br /&gt;
  y=y-fourbypi*cos(twokm*x)/twokm^2;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
% Prepare output&lt;br /&gt;
% Construct the output file name from the base file name and number of terms&lt;br /&gt;
% Also append the Slurm JOBID to keep file names unique from run to run.&lt;br /&gt;
&lt;br /&gt;
job=getenv(&#039;SLURM_JOB_ID&#039;)&lt;br /&gt;
pngfile=strcat(pngfilebase,&#039;_&#039;,num2str(nterms),&#039;_&#039;,job)&lt;br /&gt;
disp([&#039;Writing file: &#039;,pngfile,&#039;.png&#039;])&lt;br /&gt;
&lt;br /&gt;
fig=figure;&lt;br /&gt;
plot(x,y);&lt;br /&gt;
print(fig,pngfile,&#039;-dpng&#039;);&lt;br /&gt;
&lt;br /&gt;
quit&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
In preparation to run the sawtooth.m code, create a batch job script, sawtooth.slurm of the form:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH --time=03:00:00     # Adjust this to match the walltime of your job&lt;br /&gt;
#SBATCH --nodes=1           # For serial code, always specify just one node.&lt;br /&gt;
#SBATCH --ntasks=1          # For serial code, always specify just one task.&lt;br /&gt;
#SBATCH --cpus-per-task=1   # For serial code, always specify just one CPU per task.&lt;br /&gt;
#SBATCH --mem=4000m         # Adjust to match total memory required, in MB.&lt;br /&gt;
#SBATCH --partition=pawson-bf,apophis-bf,razi-bf,single,lattice,parallel,cpu2013,cpu2019&lt;br /&gt;
&lt;br /&gt;
# Sample batch job script for running a MATLAB function with both numerical and string arguments&lt;br /&gt;
# 2020-05-14&lt;br /&gt;
&lt;br /&gt;
# Specify the name of the main MATLAB function to be run.&lt;br /&gt;
# This would normally be the same as the MATLAB source code file name without a .m suffix).&lt;br /&gt;
MAIN=&amp;quot;sawtooth&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Define key parameters for the example calculation.&lt;br /&gt;
NTERMS=100&lt;br /&gt;
NPPCYCLE=20&lt;br /&gt;
NCYCLE=3&lt;br /&gt;
PNGFILEBASE=&amp;quot;sawtooth&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Contruct a complete function call to pass to MATLAB&lt;br /&gt;
# Note, string arguments should appear to MATLAB enclosed in single quotes&lt;br /&gt;
ARGS=&amp;quot;($NTERMS,$NPPCYCLE,$NCYCLE,&#039;$PNGFILEBASE&#039;)&amp;quot;&lt;br /&gt;
MAIN_WITH_ARGS=${MAIN}${ARGS}&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Calling MATLAB function: ${MAIN_WITH_ARGS}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Starting run at $(date)&amp;quot;&lt;br /&gt;
echo &amp;quot;Running on compute node $(hostname)&amp;quot;&lt;br /&gt;
echo &amp;quot;Running from directory $(pwd)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Choose a version of MATLAB by loading a module:&lt;br /&gt;
module load matlab/r2019b&lt;br /&gt;
echo &amp;quot;Using MATLAB version: $(which matlab)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Use -singleCompThread below for serial MATLAB code:&lt;br /&gt;
matlab -singleCompThread -batch &amp;quot;${MAIN_WITH_ARGS}&amp;quot; &amp;gt; ${MAIN}_${SLURM_JOB_ID}.out 2&amp;gt;&amp;amp;1&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Finished run at $(date)&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Note that the above script uses the -batch option on the matlab command line.  The MathWorks web page on [https://www.mathworks.com/help/matlab/ref/matlablinux.html running MATLAB on Linux (external link)] starting with Release 2019a of MATLAB, recommends using the -batch option for non-interactive use instead of the similar -r option that is recommended in interactive sessions.&lt;br /&gt;
&lt;br /&gt;
To submit the job to be executed, run:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sbatch sawtooth.slurm&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The job should produce three output files: Slurm script output, MATLAB command output and a PNG file, all tagged with the Slurm Job ID.&lt;br /&gt;
&lt;br /&gt;
== Parallel MATLAB examples==&lt;br /&gt;
&lt;br /&gt;
MATLAB provides several ways of speeding up calculations through parallel processing.  These include relying on internal parallelization in which multiple threads are used or by using explicit language features, such as parfor, to start up multiple workers on a compute node. Examples of both approaches are shown below. Using multiple compute nodes for a single MATLAB calculation, which depends on the MATLAB Parallel Server product, is not considered here as there has not been sufficient demand to configure that software on ARC.&lt;br /&gt;
&lt;br /&gt;
For many researchers, submitting many independent serial jobs is a better approach to efficient parallelization than using parallel programming in MATLAB itself.  An example of job-based parallelism is also shown below.&lt;br /&gt;
&lt;br /&gt;
=== Thread-based parallel processing ===&lt;br /&gt;
First consider an example using multiple cores with MATLAB&#039;s built-in thread-based parallelization.&lt;br /&gt;
&lt;br /&gt;
Suppose the following code to calculate eigenvalues of a number of random matrices is in a file eig_thread_test.m .  Note the use of the maxNumCompThreads function to control the number of threads (one thread per CPU core). For some years now, MathWorks has marked that function as deprecated, but, it still provides a useful limit to ensure that MATLAB doesn&#039;t use more cores than assigned by Slurm. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
function eig_thread_test(nthreads,matrix_size,nmatrices,results_file)&lt;br /&gt;
&lt;br /&gt;
% Calculate the absolute value of the maximum eigenvalue for each of a number of matrices&lt;br /&gt;
% possibly using multiple threads.&lt;br /&gt;
&lt;br /&gt;
% nthreads = number of computational threads to use.&lt;br /&gt;
% matrix_size = order of two-dimensional random matrix.&lt;br /&gt;
% nmatrices = number of matrices to process.&lt;br /&gt;
% results_file = name of file in which to save the maximum eigenvalues&lt;br /&gt;
&lt;br /&gt;
% 2020-05-25&lt;br /&gt;
&lt;br /&gt;
matlab_ncores=feature(&#039;numcores&#039;)&lt;br /&gt;
&lt;br /&gt;
slurm_ncores_per_task=str2num(getenv(&#039;SLURM_CPUS_PER_TASK&#039;))&lt;br /&gt;
if(isempty(slurm_ncores_per_task))&lt;br /&gt;
  slurm_ncores_per_task=1;&lt;br /&gt;
  disp(&#039;SLURM_CPUS_PER_TASK not set&#039;)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
% Set number of computational threads to the minimum of matlab_ncores and slurm_ncores_per_task&lt;br /&gt;
% Note Mathworks warns that the maxNumCompThreads function will&lt;br /&gt;
% be removed in future versions of MATLAB.&lt;br /&gt;
&lt;br /&gt;
% Use only thread-based parallel processing&lt;br /&gt;
&lt;br /&gt;
intial_matlab_max_ncores = maxNumCompThreads(min([nthreads,slurm_ncores_per_task]));&lt;br /&gt;
&lt;br /&gt;
disp([&#039;Using a maximum of &#039;,num2str(maxNumCompThreads()),&#039; computational threads.&#039;])&lt;br /&gt;
&lt;br /&gt;
tic &lt;br /&gt;
&lt;br /&gt;
for i = 1:nmatrices&lt;br /&gt;
  e=eig(rand(matrix_size));&lt;br /&gt;
  eigenvalues(i) = max(abs(e));&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
toc&lt;br /&gt;
&lt;br /&gt;
save(results_file,&#039;eigenvalues&#039;,&#039;-ascii&#039;)&lt;br /&gt;
&lt;br /&gt;
quit&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here is a job script, eig_thread_test.slurm that can be used to run the eig_thread_test.m code.&lt;br /&gt;
The number of threads used for the calculation is controlled by specifying the --cpus-per-task parameter that Slurm uses to control the number of CPU cores assigned to the job.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
&lt;br /&gt;
#SBATCH --time=01:00:00     # Adjust this to match the walltime of your job&lt;br /&gt;
#SBATCH --nodes=1           # Always specify just one node.&lt;br /&gt;
#SBATCH --ntasks=1          # Specify just one task.&lt;br /&gt;
#SBATCH --cpus-per-task=8   # The number of threads to use&lt;br /&gt;
#SBATCH --mem=4000m         # Adjust to match total memory required, in MB.&lt;br /&gt;
#SBATCH --partition=pawson-bf,apophis-bf,razi-bf,single,lattice,parallel,cpu2013,cpu2019&lt;br /&gt;
&lt;br /&gt;
# Sample batch job script for running a MATLAB function to test thread-based parallel processing features.&lt;br /&gt;
# 2020-05-25&lt;br /&gt;
&lt;br /&gt;
# Specify the name of the main MATLAB function to be run.&lt;br /&gt;
# This would normally be the same as the MATLAB source code file name without a .m suffix).&lt;br /&gt;
MAIN=&amp;quot;eig_thread_test&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Define key parameters for the example calculation.&lt;br /&gt;
NTHREADS=${SLURM_CPUS_PER_TASK}&lt;br /&gt;
MATRIX_SIZE=10000&lt;br /&gt;
NMATRICES=10&lt;br /&gt;
RESULTS_FILE=&amp;quot;maximum_eigenvalues_${SLURM_JOB_ID}.txt&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Contruct a complete function call to pass to MATLAB&lt;br /&gt;
# Note, string arguments should appear to MATLAB enclosed in single quotes&lt;br /&gt;
ARGS=&amp;quot;($NTHREADS,$MATRIX_SIZE,$NMATRICES,&#039;$RESULTS_FILE&#039;)&amp;quot;&lt;br /&gt;
MAIN_WITH_ARGS=${MAIN}${ARGS}&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Calling MATLAB function: ${MAIN_WITH_ARGS}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Starting run at $(date)&amp;quot;&lt;br /&gt;
echo &amp;quot;Running on compute node $(hostname)&amp;quot;&lt;br /&gt;
echo &amp;quot;Running from directory $(pwd)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Choose a version of MATLAB by loading a module:&lt;br /&gt;
module load matlab/r2020a&lt;br /&gt;
echo &amp;quot;Using MATLAB version: $(which matlab)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
matlab -batch &amp;quot;${MAIN_WITH_ARGS}&amp;quot; &amp;gt; ${MAIN}_${SLURM_JOB_ID}.out 2&amp;gt;&amp;amp;1&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Finished run at $(date)&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The above job can be submitted with&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sbatch eig_thread_test.slurm&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If assigned to one of the modern partitions (as opposed to the older single, lattice or parallel partitions) the job took about 16 minutes, about 4 times faster than a comparable serial job.  Using 8 cores to obtain just a factor of four speed-up is not an efficient use of ARC, but, might be justified in some cases.  In some cases, using multiple workers (as discussed in the next section) may be faster than using the same number of cores with thread-based parallelization.&lt;br /&gt;
&lt;br /&gt;
=== Explicit parallel processing using a pool of workers ===&lt;br /&gt;
&lt;br /&gt;
Now consider the more complicated case of creating a pool of workers and using a parfor loop to explicitly parallelize a section of code. Each worker may use one or more cores through MATLAB&#039;s internal thread-based parallelization, as in the preceding example.  Suppose the following code is in a file eig_parallel_test.m.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
function eig_parallel_test(nworkers,nthreads,matrix_size,nmatrices,results_file)&lt;br /&gt;
&lt;br /&gt;
% Calculate the absolute value of the maximum eigenvalue for each of a number of matrices&lt;br /&gt;
% possibly using multiple threads and multiple MATLAB workers.&lt;br /&gt;
&lt;br /&gt;
% nworkers = number of MATLAB workers to use.&lt;br /&gt;
% nthreads = number of threads per worker.&lt;br /&gt;
% matrix_size = order of two-dimensional random matrix.&lt;br /&gt;
% nmatrices = number of matrices to process.&lt;br /&gt;
% results_file = name of file in which to save the maximum eigenvalues&lt;br /&gt;
&lt;br /&gt;
% 2020-05-25&lt;br /&gt;
&lt;br /&gt;
matlab_ncores=feature(&#039;numcores&#039;)&lt;br /&gt;
&lt;br /&gt;
slurm_ncores_per_task=str2num(getenv(&#039;SLURM_CPUS_PER_TASK&#039;))&lt;br /&gt;
if(isempty(slurm_ncores_per_task))&lt;br /&gt;
  slurm_ncores_per_task=1;&lt;br /&gt;
  disp(&#039;SLURM_CPUS_PER_TASK not set&#039;)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
% Set number of computational threads to the minimum of matlab_ncores and slurm_ncores&lt;br /&gt;
% Note Mathworks warns that the maxNumCompThreads function will&lt;br /&gt;
% be removed in future versions of MATLAB.&lt;br /&gt;
% Testing based on remarks at&lt;br /&gt;
% https://www.mathworks.com/matlabcentral/answers/158192-maxnumcompthreads-hyperthreading-and-parpool&lt;br /&gt;
% shows the maxNumCompThreads has to be called inside the parfor loop.&lt;br /&gt;
&lt;br /&gt;
tic&lt;br /&gt;
&lt;br /&gt;
if ( nworkers &amp;gt; 1 )&lt;br /&gt;
&lt;br /&gt;
% Process with multiple workers&lt;br /&gt;
% Check on properties of the local MATLAB cluster.&lt;br /&gt;
% One can set properties such as c.NumThreads and c.NumWorkers&lt;br /&gt;
&lt;br /&gt;
parallel.defaultClusterProfile(&#039;local&#039;)&lt;br /&gt;
c = parcluster()&lt;br /&gt;
c.NumThreads=nthreads&lt;br /&gt;
c.NumWorkers=nworkers&lt;br /&gt;
&lt;br /&gt;
% Create a pool of workers with the current cluster settings.&lt;br /&gt;
% Note, testing without the nworkers argument showed a limit of 12 workers even if c.NumWorkers is defined.&lt;br /&gt;
parpool(c,nworkers)&lt;br /&gt;
&lt;br /&gt;
ticBytes(gcp);&lt;br /&gt;
&lt;br /&gt;
parfor i = 1:nmatrices&lt;br /&gt;
  e=eig(rand(matrix_size));&lt;br /&gt;
  eigenvalues(i) = max(abs(e));&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
tocBytes(gcp)&lt;br /&gt;
&lt;br /&gt;
% Close down the pool.&lt;br /&gt;
delete(gcp(&#039;nocreate&#039;));&lt;br /&gt;
&lt;br /&gt;
else&lt;br /&gt;
&lt;br /&gt;
% Use only thread-based parallel processing&lt;br /&gt;
&lt;br /&gt;
intial_matlab_max_ncores = maxNumCompThreads(min([nthreads,slurm_ncores_per_task]))&lt;br /&gt;
&lt;br /&gt;
for i = 1:nmatrices&lt;br /&gt;
  e=eig(rand(matrix_size));&lt;br /&gt;
  eigenvalues(i) = max(abs(e));&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
end % nworkers test&lt;br /&gt;
&lt;br /&gt;
toc&lt;br /&gt;
&lt;br /&gt;
save(results_file,&#039;eigenvalues&#039;,&#039;-ascii&#039;)&lt;br /&gt;
&lt;br /&gt;
quit&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Of particular note in the preceding example is the section of lines (copied below) that creates a cluster object, c, and modifies the number of threads associated with this object (c.NumThreads=nthreads). In a similar way, one can modify the number of workers (c.NumWorkers=nworkers).  Testing showed that if one then used the MATLAB gcp or parpool commands without arguments to create a pool of workers, at most 12 workers were created. However, it was found that by using parpool(c,nworkers), the requested number of workers would be started, even if nworkers &amp;gt; 12.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
parallel.defaultClusterProfile(&#039;local&#039;)&lt;br /&gt;
c = parcluster()&lt;br /&gt;
c.NumThreads=nthreads&lt;br /&gt;
c.NumWorkers=nworkers&lt;br /&gt;
parpool(c,nworkers)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
An example Slurm batch job script, eig_parallel_test.slurm, used to test the above code was:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
&lt;br /&gt;
#SBATCH --time=03:00:00     # Adjust this to match the walltime of your job&lt;br /&gt;
#SBATCH --nodes=1           # Always specify just one node.&lt;br /&gt;
#SBATCH --ntasks=1          # Always specify just one task.&lt;br /&gt;
#SBATCH --cpus-per-task=8   # Choose --cpus-per-task to match the number of workers * threads per worker&lt;br /&gt;
#SBATCH --mem=10000m         # Adjust to match total memory required, in MB.&lt;br /&gt;
#SBATCH --partition=pawson-bf,apophis-bf,razi-bf,single,lattice,parallel,cpu2013,cpu2019&lt;br /&gt;
&lt;br /&gt;
# Sample batch job script for running a MATLAB function to test parallel processing features&lt;br /&gt;
# 2020-05-25&lt;br /&gt;
&lt;br /&gt;
# Specify the name of the main MATLAB function to be run.&lt;br /&gt;
# This would normally be the same as the MATLAB source code file name without a .m suffix).&lt;br /&gt;
MAIN=&amp;quot;eig_parallel_test&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Define key parameters for the example calculation.&lt;br /&gt;
NWORKERS=${SLURM_NTASKS}&lt;br /&gt;
NTHREADS=${SLURM_CPUS_PER_TASK}&lt;br /&gt;
MATRIX_SIZE=10000&lt;br /&gt;
NMATRICES=10&lt;br /&gt;
RESULTS_FILE=&amp;quot;maximum_eigenvalues_${SLURM_JOB_ID}.txt&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Contruct a complete function call to pass to MATLAB&lt;br /&gt;
# Note, string arguments should appear to MATLAB enclosed in single quotes&lt;br /&gt;
ARGS=&amp;quot;($NWORKERS,$NTHREADS,$MATRIX_SIZE,$NMATRICES,&#039;$RESULTS_FILE&#039;)&amp;quot;&lt;br /&gt;
MAIN_WITH_ARGS=${MAIN}${ARGS}&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Calling MATLAB function: ${MAIN_WITH_ARGS}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Starting run at $(date)&amp;quot;&lt;br /&gt;
echo &amp;quot;Running on compute node $(hostname)&amp;quot;&lt;br /&gt;
echo &amp;quot;Running from directory $(pwd)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Choose a version of MATLAB by loading a module:&lt;br /&gt;
module load matlab/r2020a&lt;br /&gt;
echo &amp;quot;Using MATLAB version: $(which matlab)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
matlab -batch &amp;quot;${MAIN_WITH_ARGS}&amp;quot; &amp;gt; ${MAIN}_${SLURM_JOB_ID}.out 2&amp;gt;&amp;amp;1&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Finished run at $(date)&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Note that the Slurm SBATCH parameter --cpus-per-task, the total number of cores to use, should be the product of the number of workers and the threads per worker.  (It might be argued that one more core should be requested beyond the product of workers and threads, to use for the main MATLAB process, but, for a fully parallelized code, the workers do the great bulk of the calculation and the main MATLAB process uses relatively little CPU time.)&lt;br /&gt;
 &lt;br /&gt;
Variations on the above code were tested with many combinations of workers and threads per worker.  It was found that if many jobs were started in close succession that some of the jobs failed to start properly. The problem can be avoided by introducing a short delay between job submissions, as illustrated in the section on job arrays below.&lt;br /&gt;
&lt;br /&gt;
Also note that in the above example, the number of cores requested is not well matched to the number of workers.  If there are 8 workers processing 10 matrices and each worker gets assigned one matrix, there are two left over. The total time for 10 matrices (or for any number of matrices from 9 to 16) would be about double that for 8 matrices.  For example, in testing the above code, the time for processing 10 matrices with 8 workers with just one computational thread was 1050 seconds, whereas processing just 8 matrices with 8 workers took only 560 seconds.&lt;br /&gt;
&lt;br /&gt;
=== Job-based parallel processing ===&lt;br /&gt;
&lt;br /&gt;
Slurm provides a feature called job arrays that can sometimes be conveniently used to submit a large number of similar jobs.  This can be used effectively when doing a parameter sweep, in which one key value (or several) in the code are changed from run to run. For example, in the eigenvalue calculation code considered in the previous section, one may want to study the effect of changing the matrix size. Alternatively, there may be cases in which the only change from one job to another is the name of an input file that contains the data to be processed.&lt;br /&gt;
&lt;br /&gt;
The key to using the job array feature is to set up the code to depend on a single integer value, the job array index, $SLURM_ARRAY_TASK_ID . When a job is run, the array index variable is replaced by Slurm with a specific value, taken from a corresponding --array argument on the sbatch command line.  For example, if the job script shown below is called eig_parallel_array_test.slurm and you run the script as&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sbatch --array=1000,2000,3000 eig_parallel_array_test.slurm&lt;br /&gt;
&amp;lt;/pre&amp;gt; &lt;br /&gt;
then three jobs will be run, with $SLURM_ARRAY_TASK_ID taking on the values 1000, 2000 and 3000 for the three cases, respectively.&lt;br /&gt;
&lt;br /&gt;
If you had a case in which input files to be processed were data_1.in, data_2.in, ... data_100.in, you could submit 100 jobs to each process one data file with &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sbatch --array=1-100 script_to_process_one_file.slurm&lt;br /&gt;
&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
where the job script refers to the files as data_${SLURM_ARRAY_TASK_ID}.in . (Putting the curly brackets around the variable name helps the bash shell from being confused with other text in the file name.)&lt;br /&gt;
&lt;br /&gt;
Testing shows that starting large numbers of jobs in a short period of time, such as can occur when job arrays are used and there are many free compute nodes, can lead to failures.  This kind of error appears to be related to delayed file system access when MATLAB tries to write job information to a hidden subdirectory under your home directory.   One way to avoid this problem is to introduce a delay between job submissions.  This can be done by using a loop containing a sleep command:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
for job in $(seq 1 100)&lt;br /&gt;
do&lt;br /&gt;
sbatch --array=$job script_to_process_one_file.slurm&lt;br /&gt;
sleep 5&lt;br /&gt;
done&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The &amp;quot;sleep 5&amp;quot; causes a 5-second delay between each job submission.&lt;br /&gt;
&lt;br /&gt;
One other caveat regarding the use of job arrays is that the resources requested with the SBATCH directives are for a single instance of the calculation to be completed. So, if the resource requirements are expected to differ significantly from one job to another, you may have to write separate job scripts for each case or group of cases, rather than using a single job array script.&lt;br /&gt;
&lt;br /&gt;
Here is an example of a job script to calculate the maximum eigenvalue of a number of random matrices of a given size.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
&lt;br /&gt;
#SBATCH --time=01:00:00     # Adjust this to match the walltime of your job&lt;br /&gt;
#SBATCH --nodes=1           # Always specify just one node.&lt;br /&gt;
#SBATCH --ntasks=1          # Always specify just one task.&lt;br /&gt;
#SBATCH --cpus-per-task=1   # For serial code, always specify just one CPU per task.&lt;br /&gt;
#SBATCH --mem=4000m         # Adjust to match total memory required, in MB.&lt;br /&gt;
#SBATCH --partition=pawson-bf,apophis-bf,razi-bf,single,lattice,parallel,cpu2013,cpu2019&lt;br /&gt;
&lt;br /&gt;
# Sample batch job script for running a MATLAB function to illustrate job-based parallel processing with job arrays&lt;br /&gt;
# 2020-05-27&lt;br /&gt;
&lt;br /&gt;
# The order of the matrix is specified using the job array index.&lt;br /&gt;
&lt;br /&gt;
# Specify the name of the main MATLAB function to be run.&lt;br /&gt;
# This would normally be the same as the MATLAB source code file name without a .m suffix).&lt;br /&gt;
MAIN=&amp;quot;eig_parallel_test&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Define key parameters for the example calculation.&lt;br /&gt;
NWORKERS=1&lt;br /&gt;
NTHREADS=1&lt;br /&gt;
MATRIX_SIZE=$SLURM_ARRAY_TASK_ID&lt;br /&gt;
NMATRICES=10&lt;br /&gt;
RESULTS_FILE=&amp;quot;maximum_eigenvalues_${MATRIX_SIZE}_${SLURM_JOB_ID}.txt&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Contruct a complete function call to pass to MATLAB&lt;br /&gt;
# Note, string arguments should appear to MATLAB enclosed in single quotes&lt;br /&gt;
ARGS=&amp;quot;($NWORKERS,$NTHREADS,$MATRIX_SIZE,$NMATRICES,&#039;$RESULTS_FILE&#039;)&amp;quot;&lt;br /&gt;
MAIN_WITH_ARGS=${MAIN}${ARGS}&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Calling MATLAB function: ${MAIN_WITH_ARGS}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Starting run at $(date)&amp;quot;&lt;br /&gt;
echo &amp;quot;Running on compute node $(hostname)&amp;quot;&lt;br /&gt;
echo &amp;quot;Running from directory $(pwd)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Choose a version of MATLAB by loading a module:&lt;br /&gt;
module load matlab/r2020a&lt;br /&gt;
echo &amp;quot;Using MATLAB version: $(which matlab)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
matlab -batch &amp;quot;${MAIN_WITH_ARGS}&amp;quot; &amp;gt; ${MAIN}_${SLURM_JOB_ID}.out 2&amp;gt;&amp;amp;1&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Finished run at $(date)&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Standalone Applications =&lt;br /&gt;
&lt;br /&gt;
When running MATLAB code as described in the preceding sections, a connection to the campus MATLAB license server, checking out licenses for MATLAB and any specialized toolboxes needed, is made for each job that is submitted. Currently, with the University of Calgary&#039;s Total Academic Headcount license, there are sufficient license tokens to support thousands of simultaneous MATLAB sessions (although ARC usage policy and cluster load will limit individual users to smaller numbers of jobs). However, there may be times at which the license server is slow to respond when large numbers of requests are being handled, or the server may be unavailable temporarily due to network problems. MathWorks offers an alternative way of running MATLAB code that can avoid license server issues by compiling it into a standalone application.  A license is required only during the compilation process and not when the code is run.  This allows calculations to be run on ARC without concerns regarding the license server.  The compiled code can also be run on compatible (64-bit Linux) hardware, not necessarily at the University of Calgary, such as on [https://docs.computecanada.ca/wiki/Getting_started Compute Canada (external link)] clusters.&lt;br /&gt;
&lt;br /&gt;
== Creating a standalone application ==&lt;br /&gt;
&lt;br /&gt;
The MATLAB &#039;&#039;&#039;mcc&#039;&#039;&#039; command is used to compile source code (.m files) into a standalone executable. There are a couple of important considerations to keep in mind when creating an executable that can be run in a batch-oriented cluster environment. One is that there is no graphical display attached to your session and another is that the number of threads used by the standalone application has to be controlled.  There is also an important difference in the way arguments of the main function are handled.&lt;br /&gt;
&lt;br /&gt;
Let&#039;s illustrate the process of creating a standalone application for the sawtooth.m code used previously. Unfortunately, if that code is compiled as it is, the resulting compiled application will fail to run properly.  The reason is that the compiled code sees all the input arguments as strings instead of interpreting them as numbers. To work around this problem, use a MATLAB function, &#039;&#039;&#039;isdeployed&#039;&#039;&#039;, to determine whether or not the code is being run as a standalone application. Here is a modified version of code, called sawtooth_standalone.m that can be successfully compiled and run as a standalone application.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
function sawtooth_standalone(nterms,nppcycle,ncycle,pngfilebase)&lt;br /&gt;
&lt;br /&gt;
% MATLAB file example to approximate a sawtooth&lt;br /&gt;
% with a truncated Fourier expansion.&lt;br /&gt;
&lt;br /&gt;
% nterms = number of terms in expansion.&lt;br /&gt;
% nppcycle = number of points per cycle.&lt;br /&gt;
% ncycle = number of complete cycles to plot.&lt;br /&gt;
% pngfilebase = base of file name for graph of results.&lt;br /&gt;
&lt;br /&gt;
% 2020-05-21&lt;br /&gt;
&lt;br /&gt;
% Test to see if the code is running as a standalone application&lt;br /&gt;
% If it is, convert the arguments intended to be numeric from &lt;br /&gt;
% the input strings to numbers&lt;br /&gt;
&lt;br /&gt;
if isdeployed&lt;br /&gt;
  nterms=str2num(nterms)&lt;br /&gt;
  nppcycle=str2num(nppcycle)&lt;br /&gt;
  ncycle=str2num(ncycle)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
np=nppcycle*ncycle;&lt;br /&gt;
&lt;br /&gt;
fourbypi=4.0/pi;&lt;br /&gt;
y(1:np)=pi/2.0;&lt;br /&gt;
x(1:np)=linspace(-pi*ncycle,pi*ncycle,np);&lt;br /&gt;
&lt;br /&gt;
for k=1:nterms&lt;br /&gt;
  twokm=2*k-1;&lt;br /&gt;
  y=y-fourbypi*cos(twokm*x)/twokm^2;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
% Prepare output&lt;br /&gt;
% Construct the output file name from the base file name and number of terms&lt;br /&gt;
% Also append the Slurm JOBID to keep file names unique from run to run.&lt;br /&gt;
&lt;br /&gt;
job=getenv(&#039;SLURM_JOB_ID&#039;)&lt;br /&gt;
pngfile=strcat(pngfilebase,&#039;_&#039;,num2str(nterms),&#039;_&#039;,job)&lt;br /&gt;
disp([&#039;Writing file: &#039;,pngfile,&#039;.png&#039;])&lt;br /&gt;
&lt;br /&gt;
fig=figure;&lt;br /&gt;
plot(x,y);&lt;br /&gt;
print(fig,pngfile,&#039;-dpng&#039;);&lt;br /&gt;
&lt;br /&gt;
quit&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Suppose that the sawtooth_standalone.m file is in a subdirectory src below your current working directory and that the compiled files are going to be written to a subdirectory called deploy. The following commands (at the Linux shell prompt) could be used to compile the code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mkdir deploy&lt;br /&gt;
cd src&lt;br /&gt;
module load matlab/r2019b&lt;br /&gt;
mcc -R -nodisplay \&lt;br /&gt;
 -R -singleCompThread \&lt;br /&gt;
 -m -v -w enable \&lt;br /&gt;
 -d ../deploy \&lt;br /&gt;
 sawtooth_standalone.m&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note the option -singleCompThread has been included in order to limit the executable to just one computational thread.&lt;br /&gt;
&lt;br /&gt;
In the deploy directory, an executable, sawtooth_standalone, will be created along with a script, run_sawtooth_standalone.sh. These two files should be copied to the target machine where the code is to be run.&lt;br /&gt;
&lt;br /&gt;
== Running a standalone application ==&lt;br /&gt;
&lt;br /&gt;
After the standalone executable sawtooth_standalone and corresponding script run_sawtooth_standalone.sh have been transferred to a directory on the target system on which they will be run (whether to a different directory on ARC or to a completely different cluster), a batch job script needs to be created in that same directory. Here is an example batch job script, sawtooth_standalone.slurm, appropriate for the ARC cluster.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH --time=03:00:00     # Adjust this to match the walltime of your job&lt;br /&gt;
#SBATCH --nodes=1           # For serial code, always specify just one node.&lt;br /&gt;
#SBATCH --ntasks=1          # For serial code, always specify just one task.&lt;br /&gt;
#SBATCH --cpus-per-task=1   # For serial code, always specify just one CPU per task.&lt;br /&gt;
#SBATCH --mem=4000m         # Adjust to match total memory required, in MB.&lt;br /&gt;
#SBATCH --partition=pawson-bf,apophis-bf,razi-bf,single,lattice,parallel,cpu2013,cpu2019&lt;br /&gt;
&lt;br /&gt;
# Sample batch job script for running a compiled MATLAB function&lt;br /&gt;
# 2020-05-21&lt;br /&gt;
&lt;br /&gt;
# Specify the name of the compiled MATLAB standalone executable&lt;br /&gt;
MAIN=&amp;quot;sawtooth_standalone&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Define key parameters for the example calculation.&lt;br /&gt;
NTERMS=100&lt;br /&gt;
NPPCYCLE=20&lt;br /&gt;
NCYCLE=3&lt;br /&gt;
PNGFILEBASE=$MAIN&lt;br /&gt;
&lt;br /&gt;
ARGS=&amp;quot;$NTERMS $NPPCYCLE $NCYCLE $PNGFILEBASE&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Choose the MCR directory according to the compiler version used&lt;br /&gt;
MCR=/global/software/matlab/mcr/v97&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Starting run at $(date)&amp;quot;&lt;br /&gt;
echo &amp;quot;Running on compute node $(hostname)&amp;quot;&lt;br /&gt;
echo &amp;quot;Running from directory $(pwd)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
./run_${MAIN}.sh $MCR $ARGS &amp;gt; ${MAIN}_${SLURM_JOB_ID}.out 2&amp;gt;&amp;amp;1&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Finished run at $(date)&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The job is then submitted with sbatch:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sbatch sawtooth_standalone.slurm&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
An important part of the above script is the definition of the variable &#039;&#039;&#039;MCR&#039;&#039;&#039;, which defines the location of the MATLAB Compiler Runtime (MCR) directory. This directory contains files necessary for the standalone application to run. The version of the MCR files specified (v97 in the example, which corresponds to MATLAB R2019b) must match the version of MATLAB used to compile the code.&lt;br /&gt;
&lt;br /&gt;
A list of MATLAB distributions and the corresponding MCR versions is given on the [https://www.mathworks.com/products/compiler/matlab-runtime.html Mathworks web site (external link)]. Some versions installed on ARC are listed below, along with the corresponding installation directory to which the MCR variable should be set if running on ARC. (As of this writing on May 21, 2020, installation of release R2020a has not quite been finished, but, should be ready before the end of the month). If the MCR version you need does not appear in /global/software/matlab/mcr, write to support@hpc.ucalgary.ca to request that it be installed, or use a different version of MATLAB for your compilation.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;WG_Indent3&amp;quot; style=&amp;quot;height: 150px; width: 576px&amp;quot; border=&amp;quot;2&amp;quot;&lt;br /&gt;
| style=&amp;quot;text-align: center&amp;quot; | &#039;&#039;&#039;MATLAB Release&#039;&#039;&#039;&lt;br /&gt;
| style=&amp;quot;text-align: center&amp;quot; | &#039;&#039;&#039;MCR Version&#039;&#039;&#039;&lt;br /&gt;
| style=&amp;quot;text-align: center&amp;quot; | &#039;&#039;&#039;MCR directory&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: center&amp;quot; | R2017a&lt;br /&gt;
| style=&amp;quot;text-align: center&amp;quot; | 9.2&lt;br /&gt;
| class=&amp;quot;WG_Inline_Code&amp;quot; style=&amp;quot;text-align: center&amp;quot; | /global/software/matlab/mcr/v92&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: center&amp;quot; | R2017b&lt;br /&gt;
| style=&amp;quot;text-align: center&amp;quot; | 9.3&lt;br /&gt;
| class=&amp;quot;WG_Inline_Code&amp;quot; style=&amp;quot;text-align: center&amp;quot; | /global/software/matlab/mcr/v93&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: center&amp;quot; | R2018a&lt;br /&gt;
| style=&amp;quot;text-align: center&amp;quot; | 9.4&lt;br /&gt;
| class=&amp;quot;WG_Inline_Code&amp;quot; style=&amp;quot;text-align: center&amp;quot; | /global/software/matlab/mcr/v94&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: center&amp;quot; | R2019b&lt;br /&gt;
| style=&amp;quot;text-align: center&amp;quot; | 9.7&lt;br /&gt;
| class=&amp;quot;WG_Inline_Code&amp;quot; style=&amp;quot;text-align: center&amp;quot; | /global/software/matlab/mcr/v97&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: center&amp;quot; | R2020a&lt;br /&gt;
| style=&amp;quot;text-align: center&amp;quot; | 9.8&lt;br /&gt;
| class=&amp;quot;WG_Inline_Code&amp;quot; style=&amp;quot;text-align: center&amp;quot; | /global/software/matlab/mcr/v98&lt;br /&gt;
|}&lt;br /&gt;
= Support =&lt;br /&gt;
&lt;br /&gt;
Please send any questions regarding using ANSYS on ARC to support@hpc.ucalgary.ca.&lt;/div&gt;</summary>
		<author><name>Phillips</name></author>
	</entry>
	<entry>
		<id>https://rcs.ucalgary.ca/index.php?title=ANSYS&amp;diff=610</id>
		<title>ANSYS</title>
		<link rel="alternate" type="text/html" href="https://rcs.ucalgary.ca/index.php?title=ANSYS&amp;diff=610"/>
		<updated>2020-05-29T14:46:14Z</updated>

		<summary type="html">&lt;p&gt;Phillips: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:ANSYS]]&lt;br /&gt;
[[Category:ANSYS Fluent]]&lt;br /&gt;
[[Category:ANSYS CFX]]&lt;br /&gt;
[[Category:ANSYS Mechanical]]&lt;br /&gt;
[[Category:Software]]&lt;br /&gt;
[[Category:ARC]]&lt;br /&gt;
&amp;lt;span id=&amp;quot;contents&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
= &amp;lt;span id=&amp;quot;intro&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Introduction =&lt;br /&gt;
[http://www.ansys.com ANSYS (external link)] is a commercial suite of programs for engineering simulation, including fluid dynamics (Fluent and CFX), structural analysis (ANSYS Mechanical) and electromagnetics/electronics software.&lt;br /&gt;
&lt;br /&gt;
Typically, researchers will install ANSYS on their own computers to develop models in a graphical user interface and then run simulations that exceed their local hardware capabilities on ARC.&lt;br /&gt;
&lt;br /&gt;
The software can be downloaded, upon approval, from the [https://iac01.ucalgary.ca/SDSWeb/ IT Software Distribution] web site.&lt;br /&gt;
&lt;br /&gt;
ANSYS is available to all U of C researchers with an ARC account, but, with licensing restrictions as outlined in the next section.= &amp;lt;span id=&amp;quot;licensing&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Licensing considerations =&lt;br /&gt;
&lt;br /&gt;
For many years, Information Technologies has provided a limited number of license tokens for ANSYS software, sometimes supplemented by contributions from researchers. The software contract is typically renewed annually in August.  If you are interested in contributing to the pool of licenses, you can write to the IT Help Desk [mailto:itsupport@ucalgary.ca itsupport@ucalgary.ca] and ask that your email be redirected to the IT software librarian.&lt;br /&gt;
&lt;br /&gt;
The discussion that follows relates only to the research version of the software.  Note that the conditions of use of the teaching licenses prohibits them from being used for research projects.&lt;br /&gt;
&lt;br /&gt;
At the time of this writing in May 2020, there are 50 basic academic licenses and 512 extended &amp;quot;HPC&amp;quot; license tokens available (with 256 of the latter reserved for a specific research group who purchased their own licenses). The number of tokens available at a given time can be seen by running the following commands on ARC:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
module load ansys/2019r2&lt;br /&gt;
lmutil lmstat -c 1055@ansyslic.ucalgary.ca -a&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
For ANSYS Fluent, each job on ARC will use one token of the software feature &amp;quot;aa_r&amp;quot; in the lmstat output. In addition, one license token per core is used of the &amp;quot;aa_r_hpc&amp;quot; type for cores in excess of 16. So, for example, a job using a 40-core node from the cpu2019 partition will use one aa_r token and 24 aa_r_hpc tokens.&lt;br /&gt;
&lt;br /&gt;
Using the fastest hardware available will provide the most value a given number of license tokens, so, using the 40-core compute nodes, selected by specifying the cpu2019 partition in your batch job (see example scripts below), is preferred. However, if there is a shortage of license tokens, you may use just part of a compute node or compute nodes from the older legacy partitions, such as parallel.&lt;br /&gt;
&lt;br /&gt;
= Running ANSYS Fluent batch jobs =&lt;br /&gt;
Researchers using ANSYS on ARC are expected to be generally familiar with ANSYS capabilities, input file format and the use of restart files.&lt;br /&gt;
&lt;br /&gt;
You can use&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
module avail ansys&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
to see the versions of the ANSYS software that have been installed on ARC.&lt;br /&gt;
== Creating a Fluent input file ==&lt;br /&gt;
After preparing your model, at the point where you are ready to run a Fluent solver, you save the case and data files and transfer them to ARC. In addition to those files, to run your model on ARC you need an input file containing Fluent text interface commands to specify such parameters as the solver to use, the number of time steps, the frequency of output and other simulation controls. &lt;br /&gt;
&lt;br /&gt;
Typically the main difficulty in getting started with Fluent on ARC is figuring out what text interface commands correspond to the graphical interface commands with which you may be more familiar from using a desktop version of Fluent. At the Fluent command prompt, if you just hit enter the available commands will be shown, similar to:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
adapt/                  file/                   report/&lt;br /&gt;
define/                 mesh/                   solve/&lt;br /&gt;
display/                parallel/               surface/&lt;br /&gt;
exit                    plot/                   views/&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Entering one of those commands and then another enter will give sub-options:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;gt; file&lt;br /&gt;
&lt;br /&gt;
/file&amp;gt;&lt;br /&gt;
async-optimize?         read-case-data          start-journal&lt;br /&gt;
auto-save/              read-field-functions    start-transcript&lt;br /&gt;
binary-files?           read-journal            stop-journal&lt;br /&gt;
confirm-overwrite?      read-macros             stop-macro&lt;br /&gt;
define-macro            read-profile            stop-transcript&lt;br /&gt;
execute-macro           read-transient-table    transient-export/&lt;br /&gt;
export/                 set-batch-options       write-cleanup-script&lt;br /&gt;
import/                 show-configuration      write-field-functions&lt;br /&gt;
read-case               solution-files/         write-macros&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
So, for example, one can discover by exploring these menus that the commands to set the frequency with which data and case files can be automatically stored periodically during a long run are of the form:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/file/auto-save/data-frequency 1000&lt;br /&gt;
/file/auto-save/case-frequency if-case-is-modified&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Here is an example of a complete text input file in which case and data files are read in, some parameters are set related to the storing of output, the solver is run and data and case files saved at the end of the run.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/file/read-case test.cas&lt;br /&gt;
/file/read-data test.dat&lt;br /&gt;
&lt;br /&gt;
/file/confirm-overwrite no&lt;br /&gt;
/file/auto-save/data-frequency 1000&lt;br /&gt;
/file/auto-save/case-frequency if-case-is-modified&lt;br /&gt;
/file/auto-save/root-name test&lt;br /&gt;
&lt;br /&gt;
/solve/dual-time-iterate&lt;br /&gt;
22200&lt;br /&gt;
150&lt;br /&gt;
&lt;br /&gt;
/file/write-case test.%t.%i.cas&lt;br /&gt;
/file/write-data test.%t.%i.dat&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Note that blank lines are significant for some commands.&lt;br /&gt;
== Slurm batch job script examples ==&lt;br /&gt;
Like other calculations on ARC systems, ANSYS software is run by submitting an appropriate script for batch scheduling using the sbatch command. For more information about submitting jobs, see the [[ARC_Cluster_Guide|ARC Cluster Guide]].&lt;br /&gt;
&lt;br /&gt;
The scripts below can serve as a template for your own batch job scripts.&lt;br /&gt;
=== Full node example - cpu2019 partition ===&lt;br /&gt;
&lt;br /&gt;
When running on a full compute node, specify --mem=0 to request all the associated memory on the node. Note that when using the cpu2019 partition (40-core nodes), an n-node ANSYS job will take 40*n-16 license tokens from the aa_r_hpc pool.&lt;br /&gt;
The following example, in ansys_2019r2_fluent_cpu2019_node.slurm , and the input files, elbow3.in and elbow3.cas are available on ARC in the directory /global/software/ansys/scripts .&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
&lt;br /&gt;
#SBATCH --time=00:10:00&lt;br /&gt;
#SBATCH --nodes=1&lt;br /&gt;
#SBATCH --ntasks-per-node=40&lt;br /&gt;
#SBATCH --mem=0&lt;br /&gt;
#SBATCH --partition=cpu2019&lt;br /&gt;
&lt;br /&gt;
# Fluent job script for elbow example on 40-core ARC cpu2019 partition nodes.&lt;br /&gt;
# You may change the time and nodes requests, but, leave ntasks-per-node=40 and mem=0&lt;br /&gt;
&lt;br /&gt;
# 2019-07-16 DSP - Updated for Fluent 2019R2 on ARC&lt;br /&gt;
&lt;br /&gt;
# Define the run files and solver type:&lt;br /&gt;
BASE=elbow3&lt;br /&gt;
INPUT=${BASE}.in&lt;br /&gt;
OUTPUT=${BASE}_${SLURM_JOB_ID}.out&lt;br /&gt;
SOLVER=&amp;quot;2d&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Choose version of ANSYS Fluent to use:&lt;br /&gt;
module load ansys/2019r2&lt;br /&gt;
&lt;br /&gt;
FLUENT=`which fluent`&lt;br /&gt;
echo &amp;quot;Using Fluent: $FLUENT&amp;quot;&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Current working directory is `pwd`&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Create a node list so that Fluent knows which nodes to use.&lt;br /&gt;
HOSTLIST=hostlist_${SLURM_JOB_ID}&lt;br /&gt;
scontrol show hostnames &amp;gt; $HOSTLIST&lt;br /&gt;
echo &amp;quot;Created host list file $HOSTLIST&amp;quot;&lt;br /&gt;
echo &amp;quot;Running on hosts:&amp;quot;&lt;br /&gt;
cat $HOSTLIST&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Using $SLURM_NTASKS cores.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Starting run at: `date`&amp;quot;&lt;br /&gt;
&lt;br /&gt;
$FLUENT $SOLVER -g -t${SLURM_NTASKS} -ssh -cnf=${HOSTLIST} -i $INPUT &amp;gt; $OUTPUT 2&amp;gt;&amp;amp;1&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Job finished at: `date`&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Legacy node example - parallel partition ===&lt;br /&gt;
&lt;br /&gt;
Use the parallel partition only when the waiting time for cpu2019 nodes is comparable to the run time, as the cpu2019 partition nodes should run Fluent about twice as fast as the parallel partition nodes.&lt;br /&gt;
&lt;br /&gt;
The following example, in ansys_2019r2_fluent_parallel_node.slurm , and the input files, elbow3.in and elbow3.cas are available on ARC in the directory /global/software/ansys/scripts .&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
&lt;br /&gt;
#SBATCH --time=00:10:00&lt;br /&gt;
#SBATCH --nodes=2&lt;br /&gt;
#SBATCH --ntasks-per-node=12&lt;br /&gt;
#SBATCH --mem=0&lt;br /&gt;
#SBATCH --partition=parallel&lt;br /&gt;
&lt;br /&gt;
# Fluent job script for elbow example on 12-core ARC parallel partition nodes.&lt;br /&gt;
# You may change the time and nodes requests, but, leave ntasks-per-node=12 and mem=0&lt;br /&gt;
&lt;br /&gt;
# 2019-07-16 DSP - Updated for Fluent 2019R2 on ARC&lt;br /&gt;
&lt;br /&gt;
# Define the run files and solver type:&lt;br /&gt;
BASE=elbow3&lt;br /&gt;
INPUT=${BASE}.in&lt;br /&gt;
OUTPUT=${BASE}_${SLURM_JOB_ID}.out&lt;br /&gt;
SOLVER=&amp;quot;2d&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Choose version of ANSYS Fluent to use:&lt;br /&gt;
module load ansys/2019r2&lt;br /&gt;
&lt;br /&gt;
FLUENT=`which fluent`&lt;br /&gt;
echo &amp;quot;Using Fluent: $FLUENT&amp;quot;&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Current working directory is `pwd`&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Create a node list so that Fluent knows which nodes to use.&lt;br /&gt;
HOSTLIST=hostlist_${SLURM_JOB_ID}&lt;br /&gt;
scontrol show hostnames &amp;gt; $HOSTLIST&lt;br /&gt;
echo &amp;quot;Created host list file $HOSTLIST&amp;quot;&lt;br /&gt;
echo &amp;quot;Running on hosts:&amp;quot;&lt;br /&gt;
cat $HOSTLIST&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Using $SLURM_NTASKS cores.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Starting run at: `date`&amp;quot;&lt;br /&gt;
&lt;br /&gt;
$FLUENT $SOLVER -g -t${SLURM_NTASKS} -ssh  -pib -cnf=${HOSTLIST} -i $INPUT &amp;gt; $OUTPUT 2&amp;gt;&amp;amp;1&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Job finished at: `date`&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
For the legacy partitions, note the use of the -pib argument on the Fluent command line to indicate that InfiniBand networking is to be used.&lt;br /&gt;
= Support =&lt;br /&gt;
&lt;br /&gt;
Please send any questions regarding using ANSYS on ARC to support@hpc.ucalgary.ca.&lt;/div&gt;</summary>
		<author><name>Phillips</name></author>
	</entry>
	<entry>
		<id>https://rcs.ucalgary.ca/index.php?title=ANSYS&amp;diff=609</id>
		<title>ANSYS</title>
		<link rel="alternate" type="text/html" href="https://rcs.ucalgary.ca/index.php?title=ANSYS&amp;diff=609"/>
		<updated>2020-05-29T14:42:02Z</updated>

		<summary type="html">&lt;p&gt;Phillips: Add sample batch scripts&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:ANSYS]]&lt;br /&gt;
[[Category:ANSYS Fluent]]&lt;br /&gt;
[[Category:ANSYS CFX]]&lt;br /&gt;
[[Category:ANSYS Mechanical]]&lt;br /&gt;
[[Category:Software]]&lt;br /&gt;
[[Category:ARC]]&lt;br /&gt;
&amp;lt;span id=&amp;quot;contents&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
= &amp;lt;span id=&amp;quot;intro&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Introduction =&lt;br /&gt;
[http://www.ansys.com ANSYS (external link)] is a commercial suite of programs for engineering simulation, including fluid dynamics (Fluent and CFX), structural analysis (ANSYS Mechanical) and electromagnetics/electronics software.&lt;br /&gt;
&lt;br /&gt;
Typically, researchers will install ANSYS on their own computers to develop models in a graphical user interface and then run simulations that exceed their local hardware capabilities on ARC.&lt;br /&gt;
&lt;br /&gt;
The software can be downloaded, upon approval, from the [https://iac01.ucalgary.ca/SDSWeb/ IT Software Distribution] web site.&lt;br /&gt;
&lt;br /&gt;
ANSYS is available to all U of C researchers with an ARC account, but, with licensing restrictions as outlined in the next section.= &amp;lt;span id=&amp;quot;licensing&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Licensing considerations =&lt;br /&gt;
&lt;br /&gt;
For many years, Information Technologies has provided a limited number of license tokens for ANSYS software, sometimes supplemented by contributions from researchers. The software contract is typically renewed annually in August.  If you are interested in contributing to the pool of licenses, you can write to the IT Help Desk [mailto:itsupport@ucalgary.ca itsupport@ucalgary.ca] and ask that your email be redirected to the IT software librarian.&lt;br /&gt;
&lt;br /&gt;
The discussion that follows relates only to the research version of the software.  Note that the conditions of use of the teaching licenses prohibits them from being used for research projects.&lt;br /&gt;
&lt;br /&gt;
At the time of this writing in May 2020, there are 50 basic academic licenses and 512 extended &amp;quot;HPC&amp;quot; license tokens available (with 256 of the latter reserved for a specific research group who purchased their own licenses). The number of tokens available at a given time can be seen by running the following commands on ARC:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
module load ansys/2019r2&lt;br /&gt;
lmutil lmstat -c 1055@ansyslic.ucalgary.ca -a&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
For ANSYS Fluent, each job on ARC will use one token of the software feature &amp;quot;aa_r&amp;quot; in the lmstat output. In addition, one license token per core is used of the &amp;quot;aa_r_hpc&amp;quot; type for cores in excess of 16. So, for example, a job using a 40-core node from the cpu2019 partition will use one aa_r token and 24 aa_r_hpc tokens.&lt;br /&gt;
&lt;br /&gt;
Using the fastest hardware available will provide the most value a given number of license tokens, so, using the 40-core compute nodes, selected by specifying the cpu2019 partition in your batch job (see example scripts below), is preferred. However, if there is a shortage of license tokens, you may use just part of a compute node or compute nodes from the older legacy partitions, such as parallel.&lt;br /&gt;
&lt;br /&gt;
= Running ANSYS Fluent batch jobs =&lt;br /&gt;
Researchers using ANSYS on ARC are expected to be generally familiar with ANSYS capabilities, input file format and the use of restart files.&lt;br /&gt;
&lt;br /&gt;
You can use&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
module avail ansys&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
to see the versions of the ANSYS software that have been installed on ARC.&lt;br /&gt;
== Creating a Fluent input file ==&lt;br /&gt;
After preparing your model, at the point where you are ready to run a Fluent solver, you save the case and data files and transfer them to ARC. In addition to those files, to run your model on ARC you need an input file containing Fluent text interface commands to specify such parameters as the solver to use, the number of time steps, the frequency of output and other simulation controls. &lt;br /&gt;
&lt;br /&gt;
Typically the main difficulty in getting started with Fluent on ARC is figuring out what text interface commands correspond to the graphical interface commands with which you may be more familiar from using a desktop version of Fluent. At the Fluent command prompt, if you just hit enter the available commands will be shown, similar to:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
adapt/                  file/                   report/&lt;br /&gt;
define/                 mesh/                   solve/&lt;br /&gt;
display/                parallel/               surface/&lt;br /&gt;
exit                    plot/                   views/&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Entering one of those commands and then another enter will give sub-options:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;gt; file&lt;br /&gt;
&lt;br /&gt;
/file&amp;gt;&lt;br /&gt;
async-optimize?         read-case-data          start-journal&lt;br /&gt;
auto-save/              read-field-functions    start-transcript&lt;br /&gt;
binary-files?           read-journal            stop-journal&lt;br /&gt;
confirm-overwrite?      read-macros             stop-macro&lt;br /&gt;
define-macro            read-profile            stop-transcript&lt;br /&gt;
execute-macro           read-transient-table    transient-export/&lt;br /&gt;
export/                 set-batch-options       write-cleanup-script&lt;br /&gt;
import/                 show-configuration      write-field-functions&lt;br /&gt;
read-case               solution-files/         write-macros&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
So, for example, one can discover by exploring these menus that the commands to set the frequency with which data and case files can be automatically stored periodically during a long run are of the form:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/file/auto-save/data-frequency 1000&lt;br /&gt;
/file/auto-save/case-frequency if-case-is-modified&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Here is an example of a complete text input file in which case and data files are read in, some parameters are set related to the storing of output, the solver is run and data and case files saved at the end of the run.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/file/read-case test.cas&lt;br /&gt;
/file/read-data test.dat&lt;br /&gt;
&lt;br /&gt;
/file/confirm-overwrite no&lt;br /&gt;
/file/auto-save/data-frequency 1000&lt;br /&gt;
/file/auto-save/case-frequency if-case-is-modified&lt;br /&gt;
/file/auto-save/root-name test&lt;br /&gt;
&lt;br /&gt;
/solve/dual-time-iterate&lt;br /&gt;
22200&lt;br /&gt;
150&lt;br /&gt;
&lt;br /&gt;
/file/write-case test.%t.%i.cas&lt;br /&gt;
/file/write-data test.%t.%i.dat&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Note that blank lines are significant for some commands.&lt;br /&gt;
== Slurm batch job script examples ==&lt;br /&gt;
Like other calculations on ARC systems, ANSYS software is run by submitting an appropriate script for batch scheduling using the sbatch command. For more information about submitting jobs, see the [[ARC_Cluster_Guide|ARC Cluster Guide]].&lt;br /&gt;
&lt;br /&gt;
The scripts below can serve as a template for your own batch job scripts.&lt;br /&gt;
=== Full node example - cpu2019 partition ===&lt;br /&gt;
&lt;br /&gt;
When running on a full compute node, specify --mem=0 to request all the associated memory on the node. Note that when using the cpu2019 partition (40-core nodes), an n-node ANSYS job will take 40*n-16 license tokens from the aa_r_hpc pool.&lt;br /&gt;
The following example and the input file, elbow3.in is available on ARC at &lt;br /&gt;
/global/software/ansys/scripts/ansys_2019r2_fluent_cpu2019_node.slurm .&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
&lt;br /&gt;
#SBATCH --time=00:10:00&lt;br /&gt;
#SBATCH --nodes=1&lt;br /&gt;
#SBATCH --ntasks-per-node=40&lt;br /&gt;
#SBATCH --mem=0&lt;br /&gt;
#SBATCH --partition=cpu2019&lt;br /&gt;
&lt;br /&gt;
# Fluent job script for elbow example on 40-core ARC cpu2019 partition nodes.&lt;br /&gt;
# You may change the time and nodes requests, but, leave ntasks-per-node=40 and mem=0&lt;br /&gt;
&lt;br /&gt;
# 2019-07-16 DSP - Updated for Fluent 2019R2 on ARC&lt;br /&gt;
&lt;br /&gt;
# Define the run files and solver type:&lt;br /&gt;
BASE=elbow3&lt;br /&gt;
INPUT=${BASE}.in&lt;br /&gt;
OUTPUT=${BASE}_${SLURM_JOB_ID}.out&lt;br /&gt;
SOLVER=&amp;quot;2d&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Choose version of ANSYS Fluent to use:&lt;br /&gt;
module load ansys/2019r2&lt;br /&gt;
&lt;br /&gt;
FLUENT=`which fluent`&lt;br /&gt;
echo &amp;quot;Using Fluent: $FLUENT&amp;quot;&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Current working directory is `pwd`&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Create a node list so that Fluent knows which nodes to use.&lt;br /&gt;
HOSTLIST=hostlist_${SLURM_JOB_ID}&lt;br /&gt;
scontrol show hostnames &amp;gt; $HOSTLIST&lt;br /&gt;
echo &amp;quot;Created host list file $HOSTLIST&amp;quot;&lt;br /&gt;
echo &amp;quot;Running on hosts:&amp;quot;&lt;br /&gt;
cat $HOSTLIST&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Using $SLURM_NTASKS cores.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Starting run at: `date`&amp;quot;&lt;br /&gt;
&lt;br /&gt;
$FLUENT $SOLVER -g -t${SLURM_NTASKS} -ssh -cnf=${HOSTLIST} -i $INPUT &amp;gt; $OUTPUT 2&amp;gt;&amp;amp;1&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Job finished at: `date`&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Legacy node example - parallel partition ===&lt;br /&gt;
&lt;br /&gt;
Use the parallel partition only when the waiting time for cpu2019 nodes is comparable to the run time, as the cpu2019 partition nodes should run Fluent about twice as fast as the parallel partition nodes.&lt;br /&gt;
&lt;br /&gt;
The following example and the input file, elbow3.in is available on ARC at &lt;br /&gt;
/global/software/ansys/scripts/ansys_2019r2_fluent_parallel_node.slurm .&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
&lt;br /&gt;
#SBATCH --time=00:10:00&lt;br /&gt;
#SBATCH --nodes=2&lt;br /&gt;
#SBATCH --ntasks-per-node=12&lt;br /&gt;
#SBATCH --mem=0&lt;br /&gt;
#SBATCH --partition=parallel&lt;br /&gt;
&lt;br /&gt;
# Fluent job script for elbow example on 12-core ARC parallel partition nodes.&lt;br /&gt;
# You may change the time and nodes requests, but, leave ntasks-per-node=12 and mem=0&lt;br /&gt;
&lt;br /&gt;
# 2019-07-16 DSP - Updated for Fluent 2019R2 on ARC&lt;br /&gt;
&lt;br /&gt;
# Define the run files and solver type:&lt;br /&gt;
BASE=elbow3&lt;br /&gt;
INPUT=${BASE}.in&lt;br /&gt;
OUTPUT=${BASE}_${SLURM_JOB_ID}.out&lt;br /&gt;
SOLVER=&amp;quot;2d&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Choose version of ANSYS Fluent to use:&lt;br /&gt;
module load ansys/2019r2&lt;br /&gt;
&lt;br /&gt;
FLUENT=`which fluent`&lt;br /&gt;
echo &amp;quot;Using Fluent: $FLUENT&amp;quot;&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Current working directory is `pwd`&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Create a node list so that Fluent knows which nodes to use.&lt;br /&gt;
HOSTLIST=hostlist_${SLURM_JOB_ID}&lt;br /&gt;
scontrol show hostnames &amp;gt; $HOSTLIST&lt;br /&gt;
echo &amp;quot;Created host list file $HOSTLIST&amp;quot;&lt;br /&gt;
echo &amp;quot;Running on hosts:&amp;quot;&lt;br /&gt;
cat $HOSTLIST&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Using $SLURM_NTASKS cores.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Starting run at: `date`&amp;quot;&lt;br /&gt;
&lt;br /&gt;
$FLUENT $SOLVER -g -t${SLURM_NTASKS} -ssh  -pib -cnf=${HOSTLIST} -i $INPUT &amp;gt; $OUTPUT 2&amp;gt;&amp;amp;1&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Job finished at: `date`&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
For the legacy partitions, note the use of the -pib argument on the Fluent command line to indicate that InfiniBand networking is to be used.&lt;br /&gt;
= Support =&lt;br /&gt;
&lt;br /&gt;
Please send any questions regarding using ANSYS on ARC to support@hpc.ucalgary.ca.&lt;/div&gt;</summary>
		<author><name>Phillips</name></author>
	</entry>
	<entry>
		<id>https://rcs.ucalgary.ca/index.php?title=ANSYS&amp;diff=608</id>
		<title>ANSYS</title>
		<link rel="alternate" type="text/html" href="https://rcs.ucalgary.ca/index.php?title=ANSYS&amp;diff=608"/>
		<updated>2020-05-29T10:19:26Z</updated>

		<summary type="html">&lt;p&gt;Phillips: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:ANSYS]]&lt;br /&gt;
[[Category:ANSYS Fluent]]&lt;br /&gt;
[[Category:ANSYS CFX]]&lt;br /&gt;
[[Category:ANSYS Mechanical]]&lt;br /&gt;
[[Category:Software]]&lt;br /&gt;
[[Category:ARC]]&lt;br /&gt;
&amp;lt;span id=&amp;quot;contents&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
= &amp;lt;span id=&amp;quot;intro&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Introduction =&lt;br /&gt;
[http://www.ansys.com ANSYS (external link)] is a commercial suite of programs for engineering simulation, including fluid dynamics (Fluent and CFX), structural analysis (ANSYS Mechanical) and electromagnetics/electronics software.&lt;br /&gt;
&lt;br /&gt;
Typically, researchers will install ANSYS on their own computers to develop models in a graphical user interface and then run simulations that exceed their local hardware capabilities on ARC.&lt;br /&gt;
&lt;br /&gt;
The software can be downloaded, upon approval, from the [https://iac01.ucalgary.ca/SDSWeb/ IT Software Distribution] web site.&lt;br /&gt;
&lt;br /&gt;
ANSYS is available to all U of C researchers with an ARC account, but, with licensing restrictions as outlined in the next section.= &amp;lt;span id=&amp;quot;licensing&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Licensing considerations =&lt;br /&gt;
&lt;br /&gt;
For many years, Information Technologies has provided a limited number of license tokens for ANSYS software, sometimes supplemented by contributions from researchers. The software contract is typically renewed annually in August.  If you are interested in contributing to the pool of licenses, you can write to the IT Help Desk [mailto:itsupport@ucalgary.ca itsupport@ucalgary.ca] and ask that your email be redirected to the IT software librarian.&lt;br /&gt;
&lt;br /&gt;
The discussion that follows relates only to the research version of the software.  Note that the conditions of use of the teaching licenses prohibits them from being used for research projects.&lt;br /&gt;
&lt;br /&gt;
At the time of this writing in May 2020, there are 50 basic academic licenses and 512 extended &amp;quot;HPC&amp;quot; license tokens available (with 256 of the latter reserved for a specific research group who purchased their own licenses). The number of tokens available at a given time can be seen by running the following commands on ARC:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
module load ansys/2019r2&lt;br /&gt;
lmutil lmstat -c 1055@ansyslic.ucalgary.ca -a&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
For ANSYS Fluent, each job on ARC will use one token of the software feature &amp;quot;aa_r&amp;quot; in the lmstat output. In addition, one license token per core is used of the &amp;quot;aa_r_hpc&amp;quot; type for cores in excess of 16. So, for example, a job using a 40-core node from the cpu2019 partition will use one aa_r token and 24 aa_r_hpc tokens.&lt;br /&gt;
&lt;br /&gt;
Using the fastest hardware available will provide the most value a given number of license tokens, so, using the 40-core compute nodes, selected by specifying the cpu2019 partition in your batch job (see example scripts below), is preferred. However, if there is a shortage of license tokens, you may use just part of a compute node or compute nodes from the older legacy partitions, such as parallel.&lt;br /&gt;
&lt;br /&gt;
= Running ANSYS Fluent batch jobs =&lt;br /&gt;
Researchers using ANSYS on ARC are expected to be generally familiar with ANSYS capabilities, input file format and the use of restart files.&lt;br /&gt;
== Creating a Fluent input file ==&lt;br /&gt;
After preparing your model, at the point where you are ready to run a Fluent solver, you save the case and data files and transfer them to ARC. In addition to those files, to run your model on ARC you need an input file containing Fluent text interface commands to specify such parameters as the solver to use, the number of time steps, the frequency of output and other simulation controls. &lt;br /&gt;
&lt;br /&gt;
Typically the main difficulty in getting started with Fluent on ARC is figuring out what text interface commands correspond to the graphical interface commands with which you may be more familiar from using a desktop version of Fluent. At the Fluent command prompt, if you just hit enter the available commands will be shown, similar to:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
adapt/                  file/                   report/&lt;br /&gt;
define/                 mesh/                   solve/&lt;br /&gt;
display/                parallel/               surface/&lt;br /&gt;
exit                    plot/                   views/&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Entering one of those commands and then another enter will give sub-options:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;gt; file&lt;br /&gt;
&lt;br /&gt;
/file&amp;gt;&lt;br /&gt;
async-optimize?         read-case-data          start-journal&lt;br /&gt;
auto-save/              read-field-functions    start-transcript&lt;br /&gt;
binary-files?           read-journal            stop-journal&lt;br /&gt;
confirm-overwrite?      read-macros             stop-macro&lt;br /&gt;
define-macro            read-profile            stop-transcript&lt;br /&gt;
execute-macro           read-transient-table    transient-export/&lt;br /&gt;
export/                 set-batch-options       write-cleanup-script&lt;br /&gt;
import/                 show-configuration      write-field-functions&lt;br /&gt;
read-case               solution-files/         write-macros&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
So, for example, one can discover by exploring these menus that the commands to set the frequency with which data and case files can be automatically stored periodically during a long run are of the form:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/file/auto-save/data-frequency 1000&lt;br /&gt;
/file/auto-save/case-frequency if-case-is-modified&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Here is an example of a complete text input file in which case and data files are read in, some parameters are set related to the storing of output, the solver is run and data and case files saved at the end of the run.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/file/read-case test.cas&lt;br /&gt;
/file/read-data test.dat&lt;br /&gt;
&lt;br /&gt;
/file/confirm-overwrite no&lt;br /&gt;
/file/auto-save/data-frequency 1000&lt;br /&gt;
/file/auto-save/case-frequency if-case-is-modified&lt;br /&gt;
/file/auto-save/root-name test&lt;br /&gt;
&lt;br /&gt;
/solve/dual-time-iterate&lt;br /&gt;
22200&lt;br /&gt;
150&lt;br /&gt;
&lt;br /&gt;
/file/write-case test.%t.%i.cas&lt;br /&gt;
/file/write-data test.%t.%i.dat&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Note that blank lines are significant for some commands.&lt;br /&gt;
== Slurm batch job script examples ==&lt;br /&gt;
Like other calculations on ARC systems, ANSYS software is run by submitting an appropriate script for batch scheduling using the sbatch command. For more information about submitting jobs, see the [[ARC_Cluster_Guide|ARC Cluster Guide]].&lt;br /&gt;
&lt;br /&gt;
The scripts below can serve as a template for your own batch job scripts.&lt;br /&gt;
=== Full node example - cpu2019 partition ===&lt;br /&gt;
&lt;br /&gt;
When running on a full compute node, specify --mem=0 to request all the associated memory on the node. Note that when using the cpu2019 partition (40-core nodes), an n-node ANSYS job will take 40*n-16 license tokens from the aa_r_hpc pool.&lt;br /&gt;
&lt;br /&gt;
    See /global/software/ansys/scripts/ansys_2019r2_fluent_cpu2019_node.slurm on ARC&lt;br /&gt;
&lt;br /&gt;
=== Legacy node example - parallel partition ===&lt;br /&gt;
&lt;br /&gt;
Use the parallel partition only when the waiting time for cpu2019 nodes is comparable to the run time, as the cpu2019 partition nodes should run Fluent about twice as fast as the parallel partition nodes.&lt;br /&gt;
&lt;br /&gt;
    See /global/software/ansys/scripts/ansys_2019r2_fluent_parallel_node.slurm on ARC&lt;br /&gt;
= Support =&lt;br /&gt;
&lt;br /&gt;
Please send any questions regarding using ANSYS on ARC to support@hpc.ucalgary.ca.&lt;/div&gt;</summary>
		<author><name>Phillips</name></author>
	</entry>
	<entry>
		<id>https://rcs.ucalgary.ca/index.php?title=ANSYS&amp;diff=607</id>
		<title>ANSYS</title>
		<link rel="alternate" type="text/html" href="https://rcs.ucalgary.ca/index.php?title=ANSYS&amp;diff=607"/>
		<updated>2020-05-29T10:18:59Z</updated>

		<summary type="html">&lt;p&gt;Phillips: Add text interface and batch job script examples&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:ANSYS]]&lt;br /&gt;
[[Category:ANSYS Fluent]]&lt;br /&gt;
[[Category:ANSYS CFX]]&lt;br /&gt;
[[Category:ANSYS Mechanical]]&lt;br /&gt;
[[Category:Software]]&lt;br /&gt;
[[Category:ARC]]&lt;br /&gt;
&amp;lt;span id=&amp;quot;contents&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
= &amp;lt;span id=&amp;quot;intro&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Introduction =&lt;br /&gt;
[http://www.ansys.com ANSYS (external link)] is a commercial suite of programs for engineering simulation, including fluid dynamics (Fluent and CFX), structural analysis (ANSYS Mechanical) and electromagnetics/electronics software.&lt;br /&gt;
&lt;br /&gt;
Typically, researchers will install ANSYS on their own computers to develop models in a graphical user interface and then run simulations that exceed their local hardware capabilities on ARC.&lt;br /&gt;
&lt;br /&gt;
The software can be downloaded, upon approval, from the [https://iac01.ucalgary.ca/SDSWeb/ IT Software Distribution] web site.&lt;br /&gt;
&lt;br /&gt;
ANSYS is available to all U of C researchers with an ARC account, but, with licensing restrictions as outlined in the next section.= &amp;lt;span id=&amp;quot;licensing&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Licensing considerations =&lt;br /&gt;
&lt;br /&gt;
For many years, Information Technologies has provided a limited number of license tokens for ANSYS software, sometimes supplemented by contributions from researchers. The software contract is typically renewed annually in August.  If you are interested in contributing to the pool of licenses, you can write to the IT Help Desk [mailto:itsupport@ucalgary.ca itsupport@ucalgary.ca] and ask that your email be redirected to the IT software librarian.&lt;br /&gt;
&lt;br /&gt;
The discussion that follows relates only to the research version of the software.  Note that the conditions of use of the teaching licenses prohibits them from being used for research projects.&lt;br /&gt;
&lt;br /&gt;
At the time of this writing in May 2020, there are 50 basic academic licenses and 512 extended &amp;quot;HPC&amp;quot; license tokens available (with 256 of the latter reserved for a specific research group who purchased their own licenses). The number of tokens available at a given time can be seen by running the following commands on ARC:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
module load ansys/2019r2&lt;br /&gt;
lmutil lmstat -c 1055@ansyslic.ucalgary.ca -a&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
For ANSYS Fluent, each job on ARC will use one token of the software feature &amp;quot;aa_r&amp;quot; in the lmstat output. In addition, one license token per core is used of the &amp;quot;aa_r_hpc&amp;quot; type for cores in excess of 16. So, for example, a job using a 40-core node from the cpu2019 partition will use one aa_r token and 24 aa_r_hpc tokens.&lt;br /&gt;
&lt;br /&gt;
Using the fastest hardware available will provide the most value a given number of license tokens, so, using the 40-core compute nodes, selected by specifying the cpu2019 partition in your batch job (see example scripts below), is preferred. However, if there is a shortage of license tokens, you may use just part of a compute node or compute nodes from the older legacy partitions, such as parallel.&lt;br /&gt;
&lt;br /&gt;
= Running ANSYS Fluent batch jobs =&lt;br /&gt;
Researchers using ANSYS on ARC are expected to be generally familiar with ANSYS capabilities, input file format and the use of restart files.&lt;br /&gt;
== Creating a Fluent input file ==&lt;br /&gt;
After preparing your model, at the point where you are ready to run a Fluent solver, you save the case and data files and transfer them to ARC. In addition to those files, to run your model on ARC you need an input file containing Fluent text interface commands to specify such parameters as the solver to use, the number of time steps, the frequency of output and other simulation controls. &lt;br /&gt;
&lt;br /&gt;
Typically the main difficulty in getting started with Fluent on ARC is figuring out what text interface commands correspond to the graphical interface commands with which you may be more familiar from using a desktop version of Fluent. At the Fluent command prompt, if you just hit enter the available commands will be shown, similar to:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
adapt/                  file/                   report/&lt;br /&gt;
define/                 mesh/                   solve/&lt;br /&gt;
display/                parallel/               surface/&lt;br /&gt;
exit                    plot/                   views/&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Entering one of those commands and then another enter will give sub-options:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;gt; file&lt;br /&gt;
&lt;br /&gt;
/file&amp;gt;&lt;br /&gt;
async-optimize?         read-case-data          start-journal&lt;br /&gt;
auto-save/              read-field-functions    start-transcript&lt;br /&gt;
binary-files?           read-journal            stop-journal&lt;br /&gt;
confirm-overwrite?      read-macros             stop-macro&lt;br /&gt;
define-macro            read-profile            stop-transcript&lt;br /&gt;
execute-macro           read-transient-table    transient-export/&lt;br /&gt;
export/                 set-batch-options       write-cleanup-script&lt;br /&gt;
import/                 show-configuration      write-field-functions&lt;br /&gt;
read-case               solution-files/         write-macros&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
So, for example, one can discover by exploring these menus that the commands to set the frequency with which data and case files can be automatically stored periodically during a long run are of the form:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/file/auto-save/data-frequency 1000&lt;br /&gt;
/file/auto-save/case-frequency if-case-is-modified&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Here is an example of a complete text input file in which case and data files are read in, some parameters are set related to the storing of output, the solver is run and data and case files saved at the end of the run.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/file/read-case test.cas&lt;br /&gt;
/file/read-data test.dat&lt;br /&gt;
&lt;br /&gt;
/file/confirm-overwrite no&lt;br /&gt;
/file/auto-save/data-frequency 1000&lt;br /&gt;
/file/auto-save/case-frequency if-case-is-modified&lt;br /&gt;
/file/auto-save/root-name test&lt;br /&gt;
&lt;br /&gt;
/solve/dual-time-iterate&lt;br /&gt;
22200&lt;br /&gt;
150&lt;br /&gt;
&lt;br /&gt;
/file/write-case test.%t.%i.cas&lt;br /&gt;
/file/write-data test.%t.%i.dat&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Note that blank lines are significant for some commands.&lt;br /&gt;
== Slurm batch job script examples ==&lt;br /&gt;
Like other calculations on ARC systems, ANSYS software is run by submitting an appropriate script for batch scheduling using the sbatch command. For more information about submitting jobs, see the [[ARC_Cluster_Guide|ARC Cluster Guide]].&lt;br /&gt;
&lt;br /&gt;
The scripts below can serve as a template for your own batch job scripts.&lt;br /&gt;
=== Full node example - cpu2019 partition ===&lt;br /&gt;
&lt;br /&gt;
When running on a full compute node, specify --mem=0 to request all the associated memory on the node. Note that when using the cpu2019 partition (40-core nodes), an n-node ANSYS job will take 40*n-16 license tokens from the aa_r_hpc pool.&lt;br /&gt;
&lt;br /&gt;
    See /global/software/ansys/scripts/ansys_2019r2_fluent_cpu2019_node.slurm on ARC&lt;br /&gt;
&lt;br /&gt;
=== Legacy node example - parallel partition ===&lt;br /&gt;
&lt;br /&gt;
Use the parallel partition only when the waiting time for cpu2019 nodes is comparable to the run time, as the cpu2019 partition nodes should run Fluent about twice as fast as the parallel partition nodes.&lt;br /&gt;
&lt;br /&gt;
    See /global/software/ansys/scripts/ansys_2019r2_fluent_parallel_node.slurm on ARC&lt;br /&gt;
&lt;br /&gt;
== Support ==&lt;br /&gt;
&lt;br /&gt;
Please send any questions regarding using ANSYS on ARC to support@hpc.ucalgary.ca.&lt;/div&gt;</summary>
		<author><name>Phillips</name></author>
	</entry>
	<entry>
		<id>https://rcs.ucalgary.ca/index.php?title=ANSYS&amp;diff=606</id>
		<title>ANSYS</title>
		<link rel="alternate" type="text/html" href="https://rcs.ucalgary.ca/index.php?title=ANSYS&amp;diff=606"/>
		<updated>2020-05-29T09:40:46Z</updated>

		<summary type="html">&lt;p&gt;Phillips: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:ANSYS]]&lt;br /&gt;
[[Category:ANSYS Fluent]]&lt;br /&gt;
[[Category:ANSYS CFX]]&lt;br /&gt;
[[Category:ANSYS Mechanical]]&lt;br /&gt;
[[Category:Software]]&lt;br /&gt;
[[Category:ARC]]&lt;br /&gt;
&amp;lt;span id=&amp;quot;contents&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
= &amp;lt;span id=&amp;quot;intro&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Introduction =&lt;br /&gt;
[http://www.ansys.com ANSYS (external link)] is a commercial suite of programs for engineering simulation, including fluid dynamics (Fluent and CFX), structural analysis (ANSYS Mechanical) and electromagnetics/electronics software.&lt;br /&gt;
&lt;br /&gt;
Typically, researchers will install ANSYS on their own computers to develop models in a graphical user interface and then run simulations that exceed their local hardware capabilities on ARC.&lt;br /&gt;
&lt;br /&gt;
The software can be downloaded, upon approval, from the [https://iac01.ucalgary.ca/SDSWeb/IT Software Distribution] web site.&lt;br /&gt;
&lt;br /&gt;
ANSYS is available to all U of C researchers with an ARC account, but, with licensing restrictions as outlined in the next section.= &amp;lt;span id=&amp;quot;licensing&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Licensing considerations =&lt;br /&gt;
&lt;br /&gt;
For many years, Information Technologies has provided a limited number of license tokens for ANSYS software, sometimes supplemented by contributions from researchers. The software contract is typically renewed annually in August.  If you are interested in contributing to the pool of licenses, you can write to the IT Help Desk [mailto:itsupport@ucalgary.ca itsupport@ucalgary.ca] and ask that your email be redirected to the IT software librarian.&lt;br /&gt;
&lt;br /&gt;
The discussion that follows relates only to the research version of the software.  Note that the conditions of use of the teaching licenses prohibits them from being used for research projects.&lt;br /&gt;
&lt;br /&gt;
At the time of this writing in May 2020, there are 50 basic academic licenses and 512 extended &amp;quot;HPC&amp;quot; license tokens available (with 256 of the latter reserved for a specific research group who purchased their own licenses). The number of tokens available at a given time can be seen by running the following commands on ARC:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
module load ansys/2019r2&lt;br /&gt;
lmutil lmstat -c 1055@ansyslic.ucalgary.ca -a&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Phillips</name></author>
	</entry>
	<entry>
		<id>https://rcs.ucalgary.ca/index.php?title=Mathematica&amp;diff=605</id>
		<title>Mathematica</title>
		<link rel="alternate" type="text/html" href="https://rcs.ucalgary.ca/index.php?title=Mathematica&amp;diff=605"/>
		<updated>2020-05-29T09:32:27Z</updated>

		<summary type="html">&lt;p&gt;Phillips: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Mathematica]]&lt;br /&gt;
[[Category:Software]]&lt;br /&gt;
[[Category:ARC]]&lt;br /&gt;
&amp;lt;span id=&amp;quot;contents&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
= &amp;lt;span id=&amp;quot;intro&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Introduction =&lt;br /&gt;
&lt;br /&gt;
[https://www.wolfram.com/mathematica/ Mathematica (external link)] is a general-purpose high-level programming package for both symbolic and numerical calculations.&lt;br /&gt;
&lt;br /&gt;
The main purpose of this page is to show how to use Mathematica on the University of Calgary [[ ARC_Cluster_Guide |ARC (Advanced Research Computing) cluster]]. It is presumed that you already have an account an ARC and have read the material on reserving resources and [[Running jobs|running jobs]] with the Slurm job management system.&lt;br /&gt;
&lt;br /&gt;
= &amp;lt;span id=&amp;quot;license&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Licensing =&lt;br /&gt;
At the University of Calgary, Information Technologies has purchased a site license for using Mathematica for teaching and learning and non-commercial research purposes.  The software has been installed on the ARC cluster, where multiple instances can be run at the same time.  When Mathematica starts up, it checks with a central license server.&lt;br /&gt;
&lt;br /&gt;
For information about installing Mathematica on your own computer, see the Information Technologies Knowledge Base [https://ucalgary.service-now.com/it?id=kb_article&amp;amp;sys_id=9773754113f9bac08246f7b2e144b013 article on Mathematica].&lt;br /&gt;
&lt;br /&gt;
= Running Mathematica on the ARC cluster =&lt;br /&gt;
Although it is possible to run Mathematica interactively (with or without a graphical user interface) on a compute node reserved with the Slurm salloc command, the expectation is that most calculations with Mathematica on ARC will be completed by submitting a batch job script to the Slurm job scheduler with the &#039;&#039;&#039;sbatch&#039;&#039;&#039; command.&lt;br /&gt;
&lt;br /&gt;
Suppose that the following Mathematica code to print out the first million prime numbers is in a file, primes_list.m :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
primeslist = Table[Prime[k],{k,1,1000000}];&lt;br /&gt;
Export[&amp;quot;primes_1000000.out&amp;quot;,primeslist,&amp;quot;Table&amp;quot;,&amp;quot;FieldSeparators&amp;quot;-&amp;gt;&amp;quot; &amp;quot;];&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that formatted Mathematica notebooks cannot be used directly. You need to convert your notebook to a text-format &amp;quot;.m&amp;quot; file, as discussed, for example, [https://mathematica.stackexchange.com/questions/137925/how-can-i-get-the-m-file-with-mathematica here (external link)]. The general idea is to mark cells to be executed as initialization cells and then use &amp;quot;File-&amp;gt;Save as&amp;quot; menu item with the &amp;quot;Package&amp;quot; option to produce the .m file.&lt;br /&gt;
&lt;br /&gt;
The following Slurm batch job script, primes_list.slurm, can be used to run the primes_list.m code on a single complete compute node.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH --nodes=1&lt;br /&gt;
#SBATCH --time=00:30:00&lt;br /&gt;
#SBATCH --mem=0&lt;br /&gt;
#SBATCH --partition=pawson-bf,apophis-bf,razi-bf,single,lattice,parallel,cpu2019,cpu2013&lt;br /&gt;
&lt;br /&gt;
# Mathematica batch processing example.&lt;br /&gt;
# 2020-05-28.&lt;br /&gt;
&lt;br /&gt;
# Select Mathematica command to run:&lt;br /&gt;
MATH=/global/software/mathematica/mathematica1101/bin/math&lt;br /&gt;
&lt;br /&gt;
# Specify the name of the input file of Mathematica text commands:&lt;br /&gt;
INPUT=primes_list.m&lt;br /&gt;
OUTPUT=$(basename $INPUT .m)_${SLURM_JOB_ID}.out&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Current working directory is $(pwd)&amp;quot;&lt;br /&gt;
echo &amp;quot;Running on compute node $(hostname)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Starting run at: $(date)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
$MATH -noprompt -run -script $INPUT &amp;gt; $OUTPUT&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Finished with at: $(date)&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Note that the name of the executable for running Mathematica without a graphical interface is &amp;quot;math&amp;quot;.&lt;br /&gt;
Submit the job with &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sbatch primes_list.slurm&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
For the case of million primes, the run took about 30 seconds on a compute node in one of the slowest partitions (single) on ARC.  The time and memory limits should be adjusted to match the requirements of your calculations, but, some testing is usually required to fine tune those settings.&lt;/div&gt;</summary>
		<author><name>Phillips</name></author>
	</entry>
	<entry>
		<id>https://rcs.ucalgary.ca/index.php?title=MATLAB&amp;diff=604</id>
		<title>MATLAB</title>
		<link rel="alternate" type="text/html" href="https://rcs.ucalgary.ca/index.php?title=MATLAB&amp;diff=604"/>
		<updated>2020-05-29T09:32:03Z</updated>

		<summary type="html">&lt;p&gt;Phillips: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:MATLAB]]&lt;br /&gt;
[[Category:Software]]&lt;br /&gt;
[[Category:ARC]]&lt;br /&gt;
&amp;lt;span id=&amp;quot;contents&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
= &amp;lt;span id=&amp;quot;intro&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Introduction =&lt;br /&gt;
&lt;br /&gt;
[http://www.mathworks.com/ MATLAB] is a general-purpose high-level programming package for numerical work such as linear algebra, signal processing and other calculations involving matrices or vectors of data. Visualization tools are also included for presentation of results. The basic MATLAB package is extended through add-on components including SIMULINK, and the Image Processing, Optimization, Neural Network, Signal Processing, Statistics and Wavelet Toolboxes, among others.&lt;br /&gt;
&lt;br /&gt;
The main purpose of this page is to show how to use MATLAB on the University of Calgary [[ ARC_Cluster_Guide |ARC (Advanced Research Computing) cluster]]. It is presumed that you already have an account an ARC and have read the material on reserving resources and [[Running jobs|running jobs]] with the Slurm job management system.&lt;br /&gt;
&lt;br /&gt;
= &amp;lt;span id=&amp;quot;license&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Ways to run MATLAB - License considerations =&lt;br /&gt;
At the University of Calgary, Information Technologies has purchased a MATLAB Total Academic Headcount license that allows installation and use of MATLAB on central clusters, such as ARC, as well as on personal workstations throughout the University. Potentially thousands of instances of MATLAB can be run simultaneously, each checking out a license from a central license server. An alternative is to compile MATLAB code into a standalone application. When such an application is run, it does not need to contact the server for a license. This allows researchers to run their calculations on compatible hardware, not necessarily at the University of Calgary, such as on [https://docs.computecanada.ca/wiki/Getting_started Compute Canada clusters (external link)].&lt;br /&gt;
&lt;br /&gt;
For information about installing MATLAB on your own computer, see the Information Technologies Knowledge Base [https://ucalgary.service-now.com/it?id=kb_article&amp;amp;sys_id=787d708213fdbec08246f7b2e144b0d4 article on MATLAB].&lt;br /&gt;
&lt;br /&gt;
= Running MATLAB on the ARC cluster =&lt;br /&gt;
Although it is possible to run MATLAB interactively, the expectation is that most calculations with MATLAB will be completed by submitting a batch job script to the Slurm job scheduler with the sbatch command.&lt;br /&gt;
&lt;br /&gt;
For many researchers, the main reason for using ARC for MATLAB-based calculations is to be able to run many instances at the same time.  It is recommended in such cases that any parallel processing features be removed from the code and each instance of MATLAB be run on a single CPU core.  It is also possible to run MATLAB on multiple cores in an attempt to speed up individual instances, but, this generally results in a less efficient use of the cluster hardware.  In the sections that follow, serial and then parallel processing examples are shown.&lt;br /&gt;
&lt;br /&gt;
== Serial MATLAB example==&lt;br /&gt;
&lt;br /&gt;
For the purposes of illustration, suppose the following serial MATLAB code, in a file sawtooth.m, is to be run. If your code does not already have them, add a function statement at the beginning and matching end statement at the end as shown in the example. Other features of this example include calling a function with both numerical and string arguments, incorporating a Slurm environment variable into the MATLAB code and producing graphical output in a non-interactive environment.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
function sawtooth(nterms,nppcycle,ncycle,pngfilebase)&lt;br /&gt;
&lt;br /&gt;
% MATLAB file example to approximate a sawtooth&lt;br /&gt;
% with a truncated Fourier expansion.&lt;br /&gt;
&lt;br /&gt;
% nterms = number of terms in expansion.&lt;br /&gt;
% nppcycle = number of points per cycle.&lt;br /&gt;
% ncycle = number of complete cycles to plot.&lt;br /&gt;
% pngfilebase = base of file name for graph of results.&lt;br /&gt;
&lt;br /&gt;
% 2020-05-14&lt;br /&gt;
&lt;br /&gt;
np=nppcycle*ncycle;&lt;br /&gt;
&lt;br /&gt;
fourbypi=4.0/pi;&lt;br /&gt;
y(1:np)=pi/2.0;&lt;br /&gt;
x(1:np)=linspace(-pi*ncycle,pi*ncycle,np);&lt;br /&gt;
&lt;br /&gt;
for k=1:nterms&lt;br /&gt;
  twokm=2*k-1;&lt;br /&gt;
  y=y-fourbypi*cos(twokm*x)/twokm^2;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
% Prepare output&lt;br /&gt;
% Construct the output file name from the base file name and number of terms&lt;br /&gt;
% Also append the Slurm JOBID to keep file names unique from run to run.&lt;br /&gt;
&lt;br /&gt;
job=getenv(&#039;SLURM_JOB_ID&#039;)&lt;br /&gt;
pngfile=strcat(pngfilebase,&#039;_&#039;,num2str(nterms),&#039;_&#039;,job)&lt;br /&gt;
disp([&#039;Writing file: &#039;,pngfile,&#039;.png&#039;])&lt;br /&gt;
&lt;br /&gt;
fig=figure;&lt;br /&gt;
plot(x,y);&lt;br /&gt;
print(fig,pngfile,&#039;-dpng&#039;);&lt;br /&gt;
&lt;br /&gt;
quit&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
In preparation to run the sawtooth.m code, create a batch job script, sawtooth.slurm of the form:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH --time=03:00:00     # Adjust this to match the walltime of your job&lt;br /&gt;
#SBATCH --nodes=1           # For serial code, always specify just one node.&lt;br /&gt;
#SBATCH --ntasks=1          # For serial code, always specify just one task.&lt;br /&gt;
#SBATCH --cpus-per-task=1   # For serial code, always specify just one CPU per task.&lt;br /&gt;
#SBATCH --mem=4000m         # Adjust to match total memory required, in MB.&lt;br /&gt;
#SBATCH --partition=pawson-bf,apophis-bf,razi-bf,single,lattice,parallel,cpu2013,cpu2019&lt;br /&gt;
&lt;br /&gt;
# Sample batch job script for running a MATLAB function with both numerical and string arguments&lt;br /&gt;
# 2020-05-14&lt;br /&gt;
&lt;br /&gt;
# Specify the name of the main MATLAB function to be run.&lt;br /&gt;
# This would normally be the same as the MATLAB source code file name without a .m suffix).&lt;br /&gt;
MAIN=&amp;quot;sawtooth&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Define key parameters for the example calculation.&lt;br /&gt;
NTERMS=100&lt;br /&gt;
NPPCYCLE=20&lt;br /&gt;
NCYCLE=3&lt;br /&gt;
PNGFILEBASE=&amp;quot;sawtooth&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Contruct a complete function call to pass to MATLAB&lt;br /&gt;
# Note, string arguments should appear to MATLAB enclosed in single quotes&lt;br /&gt;
ARGS=&amp;quot;($NTERMS,$NPPCYCLE,$NCYCLE,&#039;$PNGFILEBASE&#039;)&amp;quot;&lt;br /&gt;
MAIN_WITH_ARGS=${MAIN}${ARGS}&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Calling MATLAB function: ${MAIN_WITH_ARGS}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Starting run at $(date)&amp;quot;&lt;br /&gt;
echo &amp;quot;Running on compute node $(hostname)&amp;quot;&lt;br /&gt;
echo &amp;quot;Running from directory $(pwd)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Choose a version of MATLAB by loading a module:&lt;br /&gt;
module load matlab/r2019b&lt;br /&gt;
echo &amp;quot;Using MATLAB version: $(which matlab)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Use -singleCompThread below for serial MATLAB code:&lt;br /&gt;
matlab -singleCompThread -batch &amp;quot;${MAIN_WITH_ARGS}&amp;quot; &amp;gt; ${MAIN}_${SLURM_JOB_ID}.out 2&amp;gt;&amp;amp;1&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Finished run at $(date)&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Note that the above script uses the -batch option on the matlab command line.  The MathWorks web page on [https://www.mathworks.com/help/matlab/ref/matlablinux.html running MATLAB on Linux (external link)] starting with Release 2019a of MATLAB, recommends using the -batch option for non-interactive use instead of the similar -r option that is recommended in interactive sessions.&lt;br /&gt;
&lt;br /&gt;
To submit the job to be executed, run:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sbatch sawtooth.slurm&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The job should produce three output files: Slurm script output, MATLAB command output and a PNG file, all tagged with the Slurm Job ID.&lt;br /&gt;
&lt;br /&gt;
== Parallel MATLAB examples==&lt;br /&gt;
&lt;br /&gt;
MATLAB provides several ways of speeding up calculations through parallel processing.  These include relying on internal parallelization in which multiple threads are used or by using explicit language features, such as parfor, to start up multiple workers on a compute node. Examples of both approaches are shown below. Using multiple compute nodes for a single MATLAB calculation, which depends on the MATLAB Parallel Server product, is not considered here as there has not been sufficient demand to configure that software on ARC.&lt;br /&gt;
&lt;br /&gt;
For many researchers, submitting many independent serial jobs is a better approach to efficient parallelization than using parallel programming in MATLAB itself.  An example of job-based parallelism is also shown below.&lt;br /&gt;
&lt;br /&gt;
=== Thread-based parallel processing ===&lt;br /&gt;
First consider an example using multiple cores with MATLAB&#039;s built-in thread-based parallelization.&lt;br /&gt;
&lt;br /&gt;
Suppose the following code to calculate eigenvalues of a number of random matrices is in a file eig_thread_test.m .  Note the use of the maxNumCompThreads function to control the number of threads (one thread per CPU core). For some years now, MathWorks has marked that function as deprecated, but, it still provides a useful limit to ensure that MATLAB doesn&#039;t use more cores than assigned by Slurm. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
function eig_thread_test(nthreads,matrix_size,nmatrices,results_file)&lt;br /&gt;
&lt;br /&gt;
% Calculate the absolute value of the maximum eigenvalue for each of a number of matrices&lt;br /&gt;
% possibly using multiple threads.&lt;br /&gt;
&lt;br /&gt;
% nthreads = number of computational threads to use.&lt;br /&gt;
% matrix_size = order of two-dimensional random matrix.&lt;br /&gt;
% nmatrices = number of matrices to process.&lt;br /&gt;
% results_file = name of file in which to save the maximum eigenvalues&lt;br /&gt;
&lt;br /&gt;
% 2020-05-25&lt;br /&gt;
&lt;br /&gt;
matlab_ncores=feature(&#039;numcores&#039;)&lt;br /&gt;
&lt;br /&gt;
slurm_ncores_per_task=str2num(getenv(&#039;SLURM_CPUS_PER_TASK&#039;))&lt;br /&gt;
if(isempty(slurm_ncores_per_task))&lt;br /&gt;
  slurm_ncores_per_task=1;&lt;br /&gt;
  disp(&#039;SLURM_CPUS_PER_TASK not set&#039;)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
% Set number of computational threads to the minimum of matlab_ncores and slurm_ncores_per_task&lt;br /&gt;
% Note Mathworks warns that the maxNumCompThreads function will&lt;br /&gt;
% be removed in future versions of MATLAB.&lt;br /&gt;
&lt;br /&gt;
% Use only thread-based parallel processing&lt;br /&gt;
&lt;br /&gt;
intial_matlab_max_ncores = maxNumCompThreads(min([nthreads,slurm_ncores_per_task]));&lt;br /&gt;
&lt;br /&gt;
disp([&#039;Using a maximum of &#039;,num2str(maxNumCompThreads()),&#039; computational threads.&#039;])&lt;br /&gt;
&lt;br /&gt;
tic &lt;br /&gt;
&lt;br /&gt;
for i = 1:nmatrices&lt;br /&gt;
  e=eig(rand(matrix_size));&lt;br /&gt;
  eigenvalues(i) = max(abs(e));&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
toc&lt;br /&gt;
&lt;br /&gt;
save(results_file,&#039;eigenvalues&#039;,&#039;-ascii&#039;)&lt;br /&gt;
&lt;br /&gt;
quit&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here is a job script, eig_thread_test.slurm that can be used to run the eig_thread_test.m code.&lt;br /&gt;
The number of threads used for the calculation is controlled by specifying the --cpus-per-task parameter that Slurm uses to control the number of CPU cores assigned to the job.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
&lt;br /&gt;
#SBATCH --time=01:00:00     # Adjust this to match the walltime of your job&lt;br /&gt;
#SBATCH --nodes=1           # Always specify just one node.&lt;br /&gt;
#SBATCH --ntasks=1          # Specify just one task.&lt;br /&gt;
#SBATCH --cpus-per-task=8   # The number of threads to use&lt;br /&gt;
#SBATCH --mem=4000m         # Adjust to match total memory required, in MB.&lt;br /&gt;
#SBATCH --partition=pawson-bf,apophis-bf,razi-bf,single,lattice,parallel,cpu2013,cpu2019&lt;br /&gt;
&lt;br /&gt;
# Sample batch job script for running a MATLAB function to test thread-based parallel processing features.&lt;br /&gt;
# 2020-05-25&lt;br /&gt;
&lt;br /&gt;
# Specify the name of the main MATLAB function to be run.&lt;br /&gt;
# This would normally be the same as the MATLAB source code file name without a .m suffix).&lt;br /&gt;
MAIN=&amp;quot;eig_thread_test&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Define key parameters for the example calculation.&lt;br /&gt;
NTHREADS=${SLURM_CPUS_PER_TASK}&lt;br /&gt;
MATRIX_SIZE=10000&lt;br /&gt;
NMATRICES=10&lt;br /&gt;
RESULTS_FILE=&amp;quot;maximum_eigenvalues_${SLURM_JOB_ID}.txt&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Contruct a complete function call to pass to MATLAB&lt;br /&gt;
# Note, string arguments should appear to MATLAB enclosed in single quotes&lt;br /&gt;
ARGS=&amp;quot;($NTHREADS,$MATRIX_SIZE,$NMATRICES,&#039;$RESULTS_FILE&#039;)&amp;quot;&lt;br /&gt;
MAIN_WITH_ARGS=${MAIN}${ARGS}&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Calling MATLAB function: ${MAIN_WITH_ARGS}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Starting run at $(date)&amp;quot;&lt;br /&gt;
echo &amp;quot;Running on compute node $(hostname)&amp;quot;&lt;br /&gt;
echo &amp;quot;Running from directory $(pwd)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Choose a version of MATLAB by loading a module:&lt;br /&gt;
module load matlab/r2020a&lt;br /&gt;
echo &amp;quot;Using MATLAB version: $(which matlab)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
matlab -batch &amp;quot;${MAIN_WITH_ARGS}&amp;quot; &amp;gt; ${MAIN}_${SLURM_JOB_ID}.out 2&amp;gt;&amp;amp;1&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Finished run at $(date)&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The above job can be submitted with&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sbatch eig_thread_test.slurm&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If assigned to one of the modern partitions (as opposed to the older single, lattice or parallel partitions) the job took about 16 minutes, about 4 times faster than a comparable serial job.  Using 8 cores to obtain just a factor of four speed-up is not an efficient use of ARC, but, might be justified in some cases.  In some cases, using multiple workers (as discussed in the next section) may be faster than using the same number of cores with thread-based parallelization.&lt;br /&gt;
&lt;br /&gt;
=== Explicit parallel processing using a pool of workers ===&lt;br /&gt;
&lt;br /&gt;
Now consider the more complicated case of creating a pool of workers and using a parfor loop to explicitly parallelize a section of code. Each worker may use one or more cores through MATLAB&#039;s internal thread-based parallelization, as in the preceding example.  Suppose the following code is in a file eig_parallel_test.m.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
function eig_parallel_test(nworkers,nthreads,matrix_size,nmatrices,results_file)&lt;br /&gt;
&lt;br /&gt;
% Calculate the absolute value of the maximum eigenvalue for each of a number of matrices&lt;br /&gt;
% possibly using multiple threads and multiple MATLAB workers.&lt;br /&gt;
&lt;br /&gt;
% nworkers = number of MATLAB workers to use.&lt;br /&gt;
% nthreads = number of threads per worker.&lt;br /&gt;
% matrix_size = order of two-dimensional random matrix.&lt;br /&gt;
% nmatrices = number of matrices to process.&lt;br /&gt;
% results_file = name of file in which to save the maximum eigenvalues&lt;br /&gt;
&lt;br /&gt;
% 2020-05-25&lt;br /&gt;
&lt;br /&gt;
matlab_ncores=feature(&#039;numcores&#039;)&lt;br /&gt;
&lt;br /&gt;
slurm_ncores_per_task=str2num(getenv(&#039;SLURM_CPUS_PER_TASK&#039;))&lt;br /&gt;
if(isempty(slurm_ncores_per_task))&lt;br /&gt;
  slurm_ncores_per_task=1;&lt;br /&gt;
  disp(&#039;SLURM_CPUS_PER_TASK not set&#039;)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
% Set number of computational threads to the minimum of matlab_ncores and slurm_ncores&lt;br /&gt;
% Note Mathworks warns that the maxNumCompThreads function will&lt;br /&gt;
% be removed in future versions of MATLAB.&lt;br /&gt;
% Testing based on remarks at&lt;br /&gt;
% https://www.mathworks.com/matlabcentral/answers/158192-maxnumcompthreads-hyperthreading-and-parpool&lt;br /&gt;
% shows the maxNumCompThreads has to be called inside the parfor loop.&lt;br /&gt;
&lt;br /&gt;
tic&lt;br /&gt;
&lt;br /&gt;
if ( nworkers &amp;gt; 1 )&lt;br /&gt;
&lt;br /&gt;
% Process with multiple workers&lt;br /&gt;
% Check on properties of the local MATLAB cluster.&lt;br /&gt;
% One can set properties such as c.NumThreads and c.NumWorkers&lt;br /&gt;
&lt;br /&gt;
parallel.defaultClusterProfile(&#039;local&#039;)&lt;br /&gt;
c = parcluster()&lt;br /&gt;
c.NumThreads=nthreads&lt;br /&gt;
c.NumWorkers=nworkers&lt;br /&gt;
&lt;br /&gt;
% Create a pool of workers with the current cluster settings.&lt;br /&gt;
% Note, testing without the nworkers argument showed a limit of 12 workers even if c.NumWorkers is defined.&lt;br /&gt;
parpool(c,nworkers)&lt;br /&gt;
&lt;br /&gt;
ticBytes(gcp);&lt;br /&gt;
&lt;br /&gt;
parfor i = 1:nmatrices&lt;br /&gt;
  e=eig(rand(matrix_size));&lt;br /&gt;
  eigenvalues(i) = max(abs(e));&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
tocBytes(gcp)&lt;br /&gt;
&lt;br /&gt;
% Close down the pool.&lt;br /&gt;
delete(gcp(&#039;nocreate&#039;));&lt;br /&gt;
&lt;br /&gt;
else&lt;br /&gt;
&lt;br /&gt;
% Use only thread-based parallel processing&lt;br /&gt;
&lt;br /&gt;
intial_matlab_max_ncores = maxNumCompThreads(min([nthreads,slurm_ncores_per_task]))&lt;br /&gt;
&lt;br /&gt;
for i = 1:nmatrices&lt;br /&gt;
  e=eig(rand(matrix_size));&lt;br /&gt;
  eigenvalues(i) = max(abs(e));&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
end % nworkers test&lt;br /&gt;
&lt;br /&gt;
toc&lt;br /&gt;
&lt;br /&gt;
save(results_file,&#039;eigenvalues&#039;,&#039;-ascii&#039;)&lt;br /&gt;
&lt;br /&gt;
quit&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Of particular note in the preceding example is the section of lines (copied below) that creates a cluster object, c, and modifies the number of threads associated with this object (c.NumThreads=nthreads). In a similar way, one can modify the number of workers (c.NumWorkers=nworkers).  Testing showed that if one then used the MATLAB gcp or parpool commands without arguments to create a pool of workers, at most 12 workers were created. However, it was found that by using parpool(c,nworkers), the requested number of workers would be started, even if nworkers &amp;gt; 12.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
parallel.defaultClusterProfile(&#039;local&#039;)&lt;br /&gt;
c = parcluster()&lt;br /&gt;
c.NumThreads=nthreads&lt;br /&gt;
c.NumWorkers=nworkers&lt;br /&gt;
parpool(c,nworkers)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
An example Slurm batch job script, eig_parallel_test.slurm, used to test the above code was:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
&lt;br /&gt;
#SBATCH --time=03:00:00     # Adjust this to match the walltime of your job&lt;br /&gt;
#SBATCH --nodes=1           # Always specify just one node.&lt;br /&gt;
#SBATCH --ntasks=1          # Always specify just one task.&lt;br /&gt;
#SBATCH --cpus-per-task=8   # Choose --cpus-per-task to match the number of workers * threads per worker&lt;br /&gt;
#SBATCH --mem=10000m         # Adjust to match total memory required, in MB.&lt;br /&gt;
#SBATCH --partition=pawson-bf,apophis-bf,razi-bf,single,lattice,parallel,cpu2013,cpu2019&lt;br /&gt;
&lt;br /&gt;
# Sample batch job script for running a MATLAB function to test parallel processing features&lt;br /&gt;
# 2020-05-25&lt;br /&gt;
&lt;br /&gt;
# Specify the name of the main MATLAB function to be run.&lt;br /&gt;
# This would normally be the same as the MATLAB source code file name without a .m suffix).&lt;br /&gt;
MAIN=&amp;quot;eig_parallel_test&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Define key parameters for the example calculation.&lt;br /&gt;
NWORKERS=${SLURM_NTASKS}&lt;br /&gt;
NTHREADS=${SLURM_CPUS_PER_TASK}&lt;br /&gt;
MATRIX_SIZE=10000&lt;br /&gt;
NMATRICES=10&lt;br /&gt;
RESULTS_FILE=&amp;quot;maximum_eigenvalues_${SLURM_JOB_ID}.txt&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Contruct a complete function call to pass to MATLAB&lt;br /&gt;
# Note, string arguments should appear to MATLAB enclosed in single quotes&lt;br /&gt;
ARGS=&amp;quot;($NWORKERS,$NTHREADS,$MATRIX_SIZE,$NMATRICES,&#039;$RESULTS_FILE&#039;)&amp;quot;&lt;br /&gt;
MAIN_WITH_ARGS=${MAIN}${ARGS}&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Calling MATLAB function: ${MAIN_WITH_ARGS}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Starting run at $(date)&amp;quot;&lt;br /&gt;
echo &amp;quot;Running on compute node $(hostname)&amp;quot;&lt;br /&gt;
echo &amp;quot;Running from directory $(pwd)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Choose a version of MATLAB by loading a module:&lt;br /&gt;
module load matlab/r2020a&lt;br /&gt;
echo &amp;quot;Using MATLAB version: $(which matlab)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
matlab -batch &amp;quot;${MAIN_WITH_ARGS}&amp;quot; &amp;gt; ${MAIN}_${SLURM_JOB_ID}.out 2&amp;gt;&amp;amp;1&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Finished run at $(date)&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Note that the Slurm SBATCH parameter --cpus-per-task, the total number of cores to use, should be the product of the number of workers and the threads per worker.  (It might be argued that one more core should be requested beyond the product of workers and threads, to use for the main MATLAB process, but, for a fully parallelized code, the workers do the great bulk of the calculation and the main MATLAB process uses relatively little CPU time.)&lt;br /&gt;
 &lt;br /&gt;
Variations on the above code were tested with many combinations of workers and threads per worker.  It was found that if many jobs were started in close succession that some of the jobs failed to start properly. The problem can be avoided by introducing a short delay between job submissions, as illustrated in the section on job arrays below.&lt;br /&gt;
&lt;br /&gt;
Also note that in the above example, the number of cores requested is not well matched to the number of workers.  If there are 8 workers processing 10 matrices and each worker gets assigned one matrix, there are two left over. The total time for 10 matrices (or for any number of matrices from 9 to 16) would be about double that for 8 matrices.  For example, in testing the above code, the time for processing 10 matrices with 8 workers with just one computational thread was 1050 seconds, whereas processing just 8 matrices with 8 workers took only 560 seconds.&lt;br /&gt;
&lt;br /&gt;
=== Job-based parallel processing ===&lt;br /&gt;
&lt;br /&gt;
Slurm provides a feature called job arrays that can sometimes be conveniently used to submit a large number of similar jobs.  This can be used effectively when doing a parameter sweep, in which one key value (or several) in the code are changed from run to run. For example, in the eigenvalue calculation code considered in the previous section, one may want to study the effect of changing the matrix size. Alternatively, there may be cases in which the only change from one job to another is the name of an input file that contains the data to be processed.&lt;br /&gt;
&lt;br /&gt;
The key to using the job array feature is to set up the code to depend on a single integer value, the job array index, $SLURM_ARRAY_TASK_ID . When a job is run, the array index variable is replaced by Slurm with a specific value, taken from a corresponding --array argument on the sbatch command line.  For example, if the job script shown below is called eig_parallel_array_test.slurm and you run the script as&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sbatch --array=1000,2000,3000 eig_parallel_array_test.slurm&lt;br /&gt;
&amp;lt;/pre&amp;gt; &lt;br /&gt;
then three jobs will be run, with $SLURM_ARRAY_TASK_ID taking on the values 1000, 2000 and 3000 for the three cases, respectively.&lt;br /&gt;
&lt;br /&gt;
If you had a case in which input files to be processed were data_1.in, data_2.in, ... data_100.in, you could submit 100 jobs to each process one data file with &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sbatch --array=1-100 script_to_process_one_file.slurm&lt;br /&gt;
&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
where the job script refers to the files as data_${SLURM_ARRAY_TASK_ID}.in . (Putting the curly brackets around the variable name helps the bash shell from being confused with other text in the file name.)&lt;br /&gt;
&lt;br /&gt;
Testing shows that starting large numbers of jobs in a short period of time, such as can occur when job arrays are used and there are many free compute nodes, can lead to failures.  This kind of error appears to be related to delayed file system access when MATLAB tries to write job information to a hidden subdirectory under your home directory.   One way to avoid this problem is to introduce a delay between job submissions.  This can be done by using a loop containing a sleep command:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
for job in $(seq 1 100)&lt;br /&gt;
do&lt;br /&gt;
sbatch --array=$job script_to_process_one_file.slurm&lt;br /&gt;
sleep 5&lt;br /&gt;
done&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The &amp;quot;sleep 5&amp;quot; causes a 5-second delay between each job submission.&lt;br /&gt;
&lt;br /&gt;
One other caveat regarding the use of job arrays is that the resources requested with the SBATCH directives are for a single instance of the calculation to be completed. So, if the resource requirements are expected to differ significantly from one job to another, you may have to write separate job scripts for each case or group of cases, rather than using a single job array script.&lt;br /&gt;
&lt;br /&gt;
Here is an example of a job script to calculate the maximum eigenvalue of a number of random matrices of a given size.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
&lt;br /&gt;
#SBATCH --time=01:00:00     # Adjust this to match the walltime of your job&lt;br /&gt;
#SBATCH --nodes=1           # Always specify just one node.&lt;br /&gt;
#SBATCH --ntasks=1          # Always specify just one task.&lt;br /&gt;
#SBATCH --cpus-per-task=1   # For serial code, always specify just one CPU per task.&lt;br /&gt;
#SBATCH --mem=4000m         # Adjust to match total memory required, in MB.&lt;br /&gt;
#SBATCH --partition=pawson-bf,apophis-bf,razi-bf,single,lattice,parallel,cpu2013,cpu2019&lt;br /&gt;
&lt;br /&gt;
# Sample batch job script for running a MATLAB function to illustrate job-based parallel processing with job arrays&lt;br /&gt;
# 2020-05-27&lt;br /&gt;
&lt;br /&gt;
# The order of the matrix is specified using the job array index.&lt;br /&gt;
&lt;br /&gt;
# Specify the name of the main MATLAB function to be run.&lt;br /&gt;
# This would normally be the same as the MATLAB source code file name without a .m suffix).&lt;br /&gt;
MAIN=&amp;quot;eig_parallel_test&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Define key parameters for the example calculation.&lt;br /&gt;
NWORKERS=1&lt;br /&gt;
NTHREADS=1&lt;br /&gt;
MATRIX_SIZE=$SLURM_ARRAY_TASK_ID&lt;br /&gt;
NMATRICES=10&lt;br /&gt;
RESULTS_FILE=&amp;quot;maximum_eigenvalues_${MATRIX_SIZE}_${SLURM_JOB_ID}.txt&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Contruct a complete function call to pass to MATLAB&lt;br /&gt;
# Note, string arguments should appear to MATLAB enclosed in single quotes&lt;br /&gt;
ARGS=&amp;quot;($NWORKERS,$NTHREADS,$MATRIX_SIZE,$NMATRICES,&#039;$RESULTS_FILE&#039;)&amp;quot;&lt;br /&gt;
MAIN_WITH_ARGS=${MAIN}${ARGS}&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Calling MATLAB function: ${MAIN_WITH_ARGS}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Starting run at $(date)&amp;quot;&lt;br /&gt;
echo &amp;quot;Running on compute node $(hostname)&amp;quot;&lt;br /&gt;
echo &amp;quot;Running from directory $(pwd)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Choose a version of MATLAB by loading a module:&lt;br /&gt;
module load matlab/r2020a&lt;br /&gt;
echo &amp;quot;Using MATLAB version: $(which matlab)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
matlab -batch &amp;quot;${MAIN_WITH_ARGS}&amp;quot; &amp;gt; ${MAIN}_${SLURM_JOB_ID}.out 2&amp;gt;&amp;amp;1&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Finished run at $(date)&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Standalone Applications =&lt;br /&gt;
&lt;br /&gt;
When running MATLAB code as described in the preceding sections, a connection to the campus MATLAB license server, checking out licenses for MATLAB and any specialized toolboxes needed, is made for each job that is submitted. Currently, with the University of Calgary&#039;s Total Academic Headcount license, there are sufficient license tokens to support thousands of simultaneous MATLAB sessions (although ARC usage policy and cluster load will limit individual users to smaller numbers of jobs). However, there may be times at which the license server is slow to respond when large numbers of requests are being handled, or the server may be unavailable temporarily due to network problems. MathWorks offers an alternative way of running MATLAB code that can avoid license server issues by compiling it into a standalone application.  A license is required only during the compilation process and not when the code is run.  This allows calculations to be run on ARC without concerns regarding the license server.  The compiled code can also be run on compatible (64-bit Linux) hardware, not necessarily at the University of Calgary, such as on [https://docs.computecanada.ca/wiki/Getting_started Compute Canada (external link)] clusters.&lt;br /&gt;
&lt;br /&gt;
== Creating a standalone application ==&lt;br /&gt;
&lt;br /&gt;
The MATLAB &#039;&#039;&#039;mcc&#039;&#039;&#039; command is used to compile source code (.m files) into a standalone executable. There are a couple of important considerations to keep in mind when creating an executable that can be run in a batch-oriented cluster environment. One is that there is no graphical display attached to your session and another is that the number of threads used by the standalone application has to be controlled.  There is also an important difference in the way arguments of the main function are handled.&lt;br /&gt;
&lt;br /&gt;
Let&#039;s illustrate the process of creating a standalone application for the sawtooth.m code used previously. Unfortunately, if that code is compiled as it is, the resulting compiled application will fail to run properly.  The reason is that the compiled code sees all the input arguments as strings instead of interpreting them as numbers. To work around this problem, use a MATLAB function, &#039;&#039;&#039;isdeployed&#039;&#039;&#039;, to determine whether or not the code is being run as a standalone application. Here is a modified version of code, called sawtooth_standalone.m that can be successfully compiled and run as a standalone application.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
function sawtooth_standalone(nterms,nppcycle,ncycle,pngfilebase)&lt;br /&gt;
&lt;br /&gt;
% MATLAB file example to approximate a sawtooth&lt;br /&gt;
% with a truncated Fourier expansion.&lt;br /&gt;
&lt;br /&gt;
% nterms = number of terms in expansion.&lt;br /&gt;
% nppcycle = number of points per cycle.&lt;br /&gt;
% ncycle = number of complete cycles to plot.&lt;br /&gt;
% pngfilebase = base of file name for graph of results.&lt;br /&gt;
&lt;br /&gt;
% 2020-05-21&lt;br /&gt;
&lt;br /&gt;
% Test to see if the code is running as a standalone application&lt;br /&gt;
% If it is, convert the arguments intended to be numeric from &lt;br /&gt;
% the input strings to numbers&lt;br /&gt;
&lt;br /&gt;
if isdeployed&lt;br /&gt;
  nterms=str2num(nterms)&lt;br /&gt;
  nppcycle=str2num(nppcycle)&lt;br /&gt;
  ncycle=str2num(ncycle)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
np=nppcycle*ncycle;&lt;br /&gt;
&lt;br /&gt;
fourbypi=4.0/pi;&lt;br /&gt;
y(1:np)=pi/2.0;&lt;br /&gt;
x(1:np)=linspace(-pi*ncycle,pi*ncycle,np);&lt;br /&gt;
&lt;br /&gt;
for k=1:nterms&lt;br /&gt;
  twokm=2*k-1;&lt;br /&gt;
  y=y-fourbypi*cos(twokm*x)/twokm^2;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
% Prepare output&lt;br /&gt;
% Construct the output file name from the base file name and number of terms&lt;br /&gt;
% Also append the Slurm JOBID to keep file names unique from run to run.&lt;br /&gt;
&lt;br /&gt;
job=getenv(&#039;SLURM_JOB_ID&#039;)&lt;br /&gt;
pngfile=strcat(pngfilebase,&#039;_&#039;,num2str(nterms),&#039;_&#039;,job)&lt;br /&gt;
disp([&#039;Writing file: &#039;,pngfile,&#039;.png&#039;])&lt;br /&gt;
&lt;br /&gt;
fig=figure;&lt;br /&gt;
plot(x,y);&lt;br /&gt;
print(fig,pngfile,&#039;-dpng&#039;);&lt;br /&gt;
&lt;br /&gt;
quit&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Suppose that the sawtooth_standalone.m file is in a subdirectory src below your current working directory and that the compiled files are going to be written to a subdirectory called deploy. The following commands (at the Linux shell prompt) could be used to compile the code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mkdir deploy&lt;br /&gt;
cd src&lt;br /&gt;
module load matlab/r2019b&lt;br /&gt;
mcc -R -nodisplay \&lt;br /&gt;
 -R -singleCompThread \&lt;br /&gt;
 -m -v -w enable \&lt;br /&gt;
 -d ../deploy \&lt;br /&gt;
 sawtooth_standalone.m&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note the option -singleCompThread has been included in order to limit the executable to just one computational thread.&lt;br /&gt;
&lt;br /&gt;
In the deploy directory, an executable, sawtooth_standalone, will be created along with a script, run_sawtooth_standalone.sh. These two files should be copied to the target machine where the code is to be run.&lt;br /&gt;
&lt;br /&gt;
== Running a standalone application ==&lt;br /&gt;
&lt;br /&gt;
After the standalone executable sawtooth_standalone and corresponding script run_sawtooth_standalone.sh have been transferred to a directory on the target system on which they will be run (whether to a different directory on ARC or to a completely different cluster), a batch job script needs to be created in that same directory. Here is an example batch job script, sawtooth_standalone.slurm, appropriate for the ARC cluster.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH --time=03:00:00     # Adjust this to match the walltime of your job&lt;br /&gt;
#SBATCH --nodes=1           # For serial code, always specify just one node.&lt;br /&gt;
#SBATCH --ntasks=1          # For serial code, always specify just one task.&lt;br /&gt;
#SBATCH --cpus-per-task=1   # For serial code, always specify just one CPU per task.&lt;br /&gt;
#SBATCH --mem=4000m         # Adjust to match total memory required, in MB.&lt;br /&gt;
#SBATCH --partition=pawson-bf,apophis-bf,razi-bf,single,lattice,parallel,cpu2013,cpu2019&lt;br /&gt;
&lt;br /&gt;
# Sample batch job script for running a compiled MATLAB function&lt;br /&gt;
# 2020-05-21&lt;br /&gt;
&lt;br /&gt;
# Specify the name of the compiled MATLAB standalone executable&lt;br /&gt;
MAIN=&amp;quot;sawtooth_standalone&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Define key parameters for the example calculation.&lt;br /&gt;
NTERMS=100&lt;br /&gt;
NPPCYCLE=20&lt;br /&gt;
NCYCLE=3&lt;br /&gt;
PNGFILEBASE=$MAIN&lt;br /&gt;
&lt;br /&gt;
ARGS=&amp;quot;$NTERMS $NPPCYCLE $NCYCLE $PNGFILEBASE&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Choose the MCR directory according to the compiler version used&lt;br /&gt;
MCR=/global/software/matlab/mcr/v97&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Starting run at $(date)&amp;quot;&lt;br /&gt;
echo &amp;quot;Running on compute node $(hostname)&amp;quot;&lt;br /&gt;
echo &amp;quot;Running from directory $(pwd)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
./run_${MAIN}.sh $MCR $ARGS &amp;gt; ${MAIN}_${SLURM_JOB_ID}.out 2&amp;gt;&amp;amp;1&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Finished run at $(date)&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The job is then submitted with sbatch:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sbatch sawtooth_standalone.slurm&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
An important part of the above script is the definition of the variable &#039;&#039;&#039;MCR&#039;&#039;&#039;, which defines the location of the MATLAB Compiler Runtime (MCR) directory. This directory contains files necessary for the standalone application to run. The version of the MCR files specified (v97 in the example, which corresponds to MATLAB R2019b) must match the version of MATLAB used to compile the code.&lt;br /&gt;
&lt;br /&gt;
A list of MATLAB distributions and the corresponding MCR versions is given on the [https://www.mathworks.com/products/compiler/matlab-runtime.html Mathworks web site (external link)]. Some versions installed on ARC are listed below, along with the corresponding installation directory to which the MCR variable should be set if running on ARC. (As of this writing on May 21, 2020, installation of release R2020a has not quite been finished, but, should be ready before the end of the month). If the MCR version you need does not appear in /global/software/matlab/mcr, write to support@hpc.ucalgary.ca to request that it be installed, or use a different version of MATLAB for your compilation.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;WG_Indent3&amp;quot; style=&amp;quot;height: 150px; width: 576px&amp;quot; border=&amp;quot;2&amp;quot;&lt;br /&gt;
| style=&amp;quot;text-align: center&amp;quot; | &#039;&#039;&#039;MATLAB Release&#039;&#039;&#039;&lt;br /&gt;
| style=&amp;quot;text-align: center&amp;quot; | &#039;&#039;&#039;MCR Version&#039;&#039;&#039;&lt;br /&gt;
| style=&amp;quot;text-align: center&amp;quot; | &#039;&#039;&#039;MCR directory&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: center&amp;quot; | R2017a&lt;br /&gt;
| style=&amp;quot;text-align: center&amp;quot; | 9.2&lt;br /&gt;
| class=&amp;quot;WG_Inline_Code&amp;quot; style=&amp;quot;text-align: center&amp;quot; | /global/software/matlab/mcr/v92&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: center&amp;quot; | R2017b&lt;br /&gt;
| style=&amp;quot;text-align: center&amp;quot; | 9.3&lt;br /&gt;
| class=&amp;quot;WG_Inline_Code&amp;quot; style=&amp;quot;text-align: center&amp;quot; | /global/software/matlab/mcr/v93&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: center&amp;quot; | R2018a&lt;br /&gt;
| style=&amp;quot;text-align: center&amp;quot; | 9.4&lt;br /&gt;
| class=&amp;quot;WG_Inline_Code&amp;quot; style=&amp;quot;text-align: center&amp;quot; | /global/software/matlab/mcr/v94&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: center&amp;quot; | R2019b&lt;br /&gt;
| style=&amp;quot;text-align: center&amp;quot; | 9.7&lt;br /&gt;
| class=&amp;quot;WG_Inline_Code&amp;quot; style=&amp;quot;text-align: center&amp;quot; | /global/software/matlab/mcr/v97&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: center&amp;quot; | R2020a&lt;br /&gt;
| style=&amp;quot;text-align: center&amp;quot; | 9.8&lt;br /&gt;
| class=&amp;quot;WG_Inline_Code&amp;quot; style=&amp;quot;text-align: center&amp;quot; | /global/software/matlab/mcr/v98&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Phillips</name></author>
	</entry>
	<entry>
		<id>https://rcs.ucalgary.ca/index.php?title=ANSYS&amp;diff=603</id>
		<title>ANSYS</title>
		<link rel="alternate" type="text/html" href="https://rcs.ucalgary.ca/index.php?title=ANSYS&amp;diff=603"/>
		<updated>2020-05-29T09:31:44Z</updated>

		<summary type="html">&lt;p&gt;Phillips: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:ANSYS]]&lt;br /&gt;
[[Category:ANSYS Fluent]]&lt;br /&gt;
[[Category:ANSYS CFX]]&lt;br /&gt;
[[Category:ANSYS Mechanical]]&lt;br /&gt;
[[Category:Software]]&lt;br /&gt;
[[Category:ARC]]&lt;br /&gt;
&amp;lt;span id=&amp;quot;contents&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
= &amp;lt;span id=&amp;quot;intro&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Introduction =&lt;/div&gt;</summary>
		<author><name>Phillips</name></author>
	</entry>
	<entry>
		<id>https://rcs.ucalgary.ca/index.php?title=Category:ANSYS&amp;diff=600</id>
		<title>Category:ANSYS</title>
		<link rel="alternate" type="text/html" href="https://rcs.ucalgary.ca/index.php?title=Category:ANSYS&amp;diff=600"/>
		<updated>2020-05-29T09:30:28Z</updated>

		<summary type="html">&lt;p&gt;Phillips: Created blank page&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Phillips</name></author>
	</entry>
	<entry>
		<id>https://rcs.ucalgary.ca/index.php?title=ANSYS&amp;diff=598</id>
		<title>ANSYS</title>
		<link rel="alternate" type="text/html" href="https://rcs.ucalgary.ca/index.php?title=ANSYS&amp;diff=598"/>
		<updated>2020-05-29T09:29:58Z</updated>

		<summary type="html">&lt;p&gt;Phillips: ANSYS page created&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:ANSYS]]&lt;br /&gt;
[[Category:ANSYS Fluent]]&lt;br /&gt;
[[Category:ANSYS CFX]]&lt;br /&gt;
[[Category:ANSYS Mechanical]]&lt;br /&gt;
[[Category:Software]]&lt;br /&gt;
[[Category:ARC]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;contents&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= &amp;lt;span id=&amp;quot;intro&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Introduction =&lt;/div&gt;</summary>
		<author><name>Phillips</name></author>
	</entry>
	<entry>
		<id>https://rcs.ucalgary.ca/index.php?title=Category:Software&amp;diff=593</id>
		<title>Category:Software</title>
		<link rel="alternate" type="text/html" href="https://rcs.ucalgary.ca/index.php?title=Category:Software&amp;diff=593"/>
		<updated>2020-05-28T08:05:42Z</updated>

		<summary type="html">&lt;p&gt;Phillips: Created blank page&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Phillips</name></author>
	</entry>
	<entry>
		<id>https://rcs.ucalgary.ca/index.php?title=Category:ARC&amp;diff=592</id>
		<title>Category:ARC</title>
		<link rel="alternate" type="text/html" href="https://rcs.ucalgary.ca/index.php?title=Category:ARC&amp;diff=592"/>
		<updated>2020-05-28T08:04:37Z</updated>

		<summary type="html">&lt;p&gt;Phillips: Created blank page&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Phillips</name></author>
	</entry>
	<entry>
		<id>https://rcs.ucalgary.ca/index.php?title=GROMACS&amp;diff=591</id>
		<title>GROMACS</title>
		<link rel="alternate" type="text/html" href="https://rcs.ucalgary.ca/index.php?title=GROMACS&amp;diff=591"/>
		<updated>2020-05-28T08:03:36Z</updated>

		<summary type="html">&lt;p&gt;Phillips: Added categories&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:GROMACS]]&lt;br /&gt;
[[Category:Software]]&lt;br /&gt;
[[Category:ARC]]&lt;br /&gt;
= General =&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;GROMACS&#039;&#039;&#039; home site: http://www.gromacs.org/&lt;br /&gt;
&lt;br /&gt;
* Manuals: http://manual.gromacs.org/documentation/&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;GROMACS&#039;&#039;&#039; is a versatile package to perform molecular dynamics, &lt;br /&gt;
i.e. simulate the Newtonian equations of motion for systems with hundreds to millions of particles.&lt;br /&gt;
&lt;br /&gt;
It is primarily designed for biochemical molecules like proteins, &lt;br /&gt;
lipids and nucleic acids that have a lot of complicated bonded interactions, &lt;br /&gt;
but since &#039;&#039;&#039;GROMACS&#039;&#039;&#039; is extremely fast at calculating the nonbonded interactions (that usually dominate simulations) &lt;br /&gt;
many groups are also using it for research on non-biological systems, e.g. polymers.&lt;br /&gt;
&lt;br /&gt;
= Using GROMACS on ARC =&lt;br /&gt;
&lt;br /&gt;
Researchers using &#039;&#039;&#039;GROMACS&#039;&#039;&#039; on ARC are expected to be generally familiar with its capabilities, &lt;br /&gt;
input file types and their formats and the use of checkpoint files to restart simulations.&lt;br /&gt;
&lt;br /&gt;
Like other calculations on ARC systems, &#039;&#039;&#039;GROMACS&#039;&#039;&#039; is run by submitting an appropriate script for batch scheduling using the &#039;&#039;&#039;sbatch&#039;&#039;&#039; command. &lt;br /&gt;
For more information about submitting jobs, see [[Running jobs]] article.&lt;br /&gt;
&lt;br /&gt;
=== GROMACS modules ===&lt;br /&gt;
&lt;br /&gt;
Currently there are several software modules on ARC that provide different versions of &#039;&#039;&#039;GROMACS&#039;&#039;&#039;. &lt;br /&gt;
The versions differ in the release date as well as the CPU architecture the software is compiled for.&lt;br /&gt;
&lt;br /&gt;
You can see them using the &amp;lt;code&amp;gt;module&amp;lt;/code&amp;gt; command:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ module avail gromacs&lt;br /&gt;
&lt;br /&gt;
----------- /global/software/Modules/3.2.10/modulefiles ---------&lt;br /&gt;
gromacs/2016.3-gnu&lt;br /&gt;
gromacs/2018.0-gnu&lt;br /&gt;
gromacs/2019.6-legacy &lt;br /&gt;
gromacs/2019.6-skylake &lt;br /&gt;
gromacs/5.0.7-gnu&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The names of the modules give hints on the specific version of &#039;&#039;&#039;GROMACS&#039;&#039;&#039; they provide access to.&lt;br /&gt;
* The &#039;&#039;&#039;gnu&#039;&#039;&#039; suffix indicates that those versions have been compiled with GNU GCC compiler. &lt;br /&gt;
: In these specific cases, GCC 4.8.5.&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;GROMACS&#039;&#039;&#039; &#039;&#039;&#039;2019.6&#039;&#039;&#039; was compiled using GCC 7.3.0 for two different CPU kinds, the old kind, &#039;&#039;&#039;legacy&#039;&#039;&#039;, and the new kind, &#039;&#039;&#039;skylake&#039;&#039;&#039;.&lt;br /&gt;
The &#039;&#039;&#039;legacy&#039;&#039;&#039; module should be used on compute nodes before 2019, and the &#039;&#039;&#039;skylake&#039;&#039;&#039; module is for node from 2019 and up.&lt;br /&gt;
&lt;br /&gt;
* All &#039;&#039;&#039;GROMACS&#039;&#039;&#039; versions provided by all the modules have support for &#039;&#039;&#039;GPU computations&#039;&#039;&#039;, even though it may not be practical to run it on GPU nodes due to limited resources.&lt;br /&gt;
&lt;br /&gt;
A module has to be loaded before &#039;&#039;&#039;GROMACS&#039;&#039;&#039; can be used on ARC. Like this:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ gmx --version&lt;br /&gt;
bash: gmx: command not found...&lt;br /&gt;
&lt;br /&gt;
$ module load gromacs/2019.6-legacy  &lt;br /&gt;
&lt;br /&gt;
$ gmx --version&lt;br /&gt;
                         :-) GROMACS - gmx, 2019.6 (-:&lt;br /&gt;
&lt;br /&gt;
                            GROMACS is written by:&lt;br /&gt;
     Emile Apol      Rossen Apostolov      Paul Bauer     Herman J.C. Berendsen&lt;br /&gt;
.....&lt;br /&gt;
.....&lt;br /&gt;
GROMACS version:    2019.6&lt;br /&gt;
Precision:          single&lt;br /&gt;
Memory model:       64 bit&lt;br /&gt;
MPI library:        none&lt;br /&gt;
OpenMP support:     enabled (GMX_OPENMP_MAX_THREADS = 64)&lt;br /&gt;
GPU support:        CUDA&lt;br /&gt;
SIMD instructions:  SSE4.1&lt;br /&gt;
FFT library:        fftw-3.3.7-sse2-avx&lt;br /&gt;
RDTSCP usage:       enabled&lt;br /&gt;
TNG support:        enabled&lt;br /&gt;
Hwloc support:      hwloc-1.11.8&lt;br /&gt;
Tracing support:    disabled&lt;br /&gt;
C compiler:         /global/software/gcc/gcc-7.3.0/bin/gcc GNU 7.3.0&lt;br /&gt;
C compiler flags:    -msse4.1     -O3 -DNDEBUG -funroll-all-loops -fexcess-precision=fast  &lt;br /&gt;
C++ compiler:       /global/software/gcc/gcc-7.3.0/bin/g++ GNU 7.3.0&lt;br /&gt;
C++ compiler flags:  -msse4.1    -std=c++11   -O3 -DNDEBUG -funroll-all-loops -fexcess-precision=fast  &lt;br /&gt;
CUDA compiler:      /global/software/cuda/cuda-10.0.130/bin/nvcc nvcc: NVIDIA (R) Cuda compiler driver;Copyright (c) 2005-2018 NVIDIA Corporation;Built on Sat_Aug_25_21:08:01_CDT_2018;Cuda compilation tools, release 10.0, V10.0.130&lt;br /&gt;
CUDA compiler flags:-gencode;arch=compute_30,code=sm_30;-gencode;arch=compute_35,code=sm_35;-gencode;arch=compute_37,code=sm_37;-gencode;arch=compute_50,code=sm_50;-gencode;arch=compute_52,code=sm_52;-gencode;arch=compute_60,code=sm_60;-gencode;arch=compute_61,code=sm_61;-gencode;arch=compute_70,code=sm_70;-gencode;arch=compute_75,code=compute_75;-use_fast_math;;; ;-msse4.1;-std=c++11;-O3;-DNDEBUG;-funroll-all-loops;-fexcess-precision=fast;&lt;br /&gt;
CUDA driver:        9.10&lt;br /&gt;
CUDA runtime:       N/A&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Running a GROMACS Job ===&lt;br /&gt;
&lt;br /&gt;
To run your simulation on ARC cluster you have to have: &lt;br /&gt;
(1) a set of &#039;&#039;&#039;GROMACS&#039;&#039;&#039; input files and &lt;br /&gt;
(2) a SLURM job script &#039;&#039;&#039;.slurm&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Place your input files for a simulation into a separate directory and &lt;br /&gt;
prepare an appropriate &#039;&#039;&#039;job script&#039;&#039;&#039; for it.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ ls -l&lt;br /&gt;
&lt;br /&gt;
-rw-r--r-- 1 drozmano drozmano 7224622 Jan 29  2014 bilayer.gro&lt;br /&gt;
-rw-r--r-- 1 drozmano drozmano    2567 May 21 12:14 bilayer.mdp&lt;br /&gt;
-rw-r--r-- 1 drozmano drozmano      87 Apr 29  2016 bilayer.top&lt;br /&gt;
drwxr-xr-x 1 drozmano drozmano     200 May 20 16:27 ff&lt;br /&gt;
-rw-r--r-- 1 drozmano drozmano     504 May 20 16:30 ff.top&lt;br /&gt;
-rwxr-xr-x 1 drozmano drozmano    1171 May 21 13:45 job.slurm&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here:&lt;br /&gt;
* &amp;lt;code&amp;gt;bilayer.top&amp;lt;/code&amp;gt; -- contains the topology of the system. &lt;br /&gt;
* &amp;lt;code&amp;gt;bilayer.gro&amp;lt;/code&amp;gt; -- contains initial configuration (positions of atoms) of the system.&lt;br /&gt;
* &amp;lt;code&amp;gt;bilayer.mdp&amp;lt;/code&amp;gt; -- contains parameters of the simulation run (&#039;&#039;&#039;GROMACS&#039;&#039;&#039; settings).&lt;br /&gt;
* &amp;lt;code&amp;gt;ff&amp;lt;/code&amp;gt; -- a directory containing external custom force field (models). Not required if only standard models are used.&lt;br /&gt;
* &amp;lt;code&amp;gt;ff.top&amp;lt;/code&amp;gt; -- a topology file that includes required models from available force fields.&lt;br /&gt;
: This file is included by the &amp;lt;code&amp;gt;bilayer.top&amp;lt;/code&amp;gt; file. &lt;br /&gt;
* &amp;lt;code&amp;gt;job.slurm&amp;lt;/code&amp;gt; -- a &#039;&#039;&#039;SLURM jobs script&#039;&#039;&#039; that is used to submit this calculation to the cluster.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;On ARC&#039;&#039;&#039;, you can get &#039;&#039;&#039;an example&#039;&#039;&#039; with the files shown above with the commands:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ tar xvf /global/software/gromacs/tests-2019/bilayer.tar.bz2&lt;br /&gt;
&lt;br /&gt;
$ cd bilayer&lt;br /&gt;
$ ls -l&lt;br /&gt;
....&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
At this point you can &#039;&#039;&#039;submit your job&#039;&#039;&#039; to ARC&#039;s scheduler (&#039;&#039;&#039;SLURM&#039;&#039;&#039;).&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ sbatch job.slurm &lt;br /&gt;
&lt;br /&gt;
Submitted batch job 5570681&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
You can check the status of the job using the &#039;&#039;&#039;job ID&#039;&#039;&#039; from the confirmation message above.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ squeue -j 5570681&lt;br /&gt;
&lt;br /&gt;
JOBID     USER     STATE   TIME_LIMIT  TIME  NODES TASKS CPUS  MIN_MEMORY  NODELIST            &lt;br /&gt;
5570681   drozmano RUNNING    5:00:00  0:15      1     1   40          8G       fc1                 &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The &amp;lt;code&amp;gt;squeue&amp;lt;/code&amp;gt; command output may look different in your case depending on your settings.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
After the job is over and it does not show in the &amp;lt;code&amp;gt;squeue&amp;lt;/code&amp;gt; output &lt;br /&gt;
we can check the results.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ ls -l&lt;br /&gt;
&lt;br /&gt;
-rw-r--r-- 1 drozmano drozmano 7224622 Jan 29  2014 bilayer.gro&lt;br /&gt;
-rw-r--r-- 1 drozmano drozmano    2567 May 21 12:14 bilayer.mdp&lt;br /&gt;
-rw-r--r-- 1 drozmano drozmano      87 Apr 29  2016 bilayer.top&lt;br /&gt;
-rw-r--r-- 1 drozmano drozmano 2594772 May 21 14:37 bilayer.tpr&lt;br /&gt;
-rw-r--r-- 1 drozmano drozmano 7224622 May 21 14:37 confout.gro&lt;br /&gt;
-rw-r--r-- 1 drozmano drozmano    1772 May 21 14:37 ener.edr&lt;br /&gt;
drwxr-xr-x 1 drozmano drozmano     200 May 20 16:27 ff&lt;br /&gt;
-rw-r--r-- 1 drozmano drozmano     504 May 20 16:30 ff.top&lt;br /&gt;
-rwxr-xr-x 1 drozmano drozmano    1172 May 21 14:36 job.slurm&lt;br /&gt;
-rw-r--r-- 1 drozmano drozmano   82051 May 21 14:37 md.log&lt;br /&gt;
-rw-r--r-- 1 drozmano drozmano   10949 May 21 14:37 mdout.mdp&lt;br /&gt;
-rw-r--r-- 1 drozmano drozmano   13162 May 21 14:37 slurm-5570681.out&lt;br /&gt;
-rw-r--r-- 1 drozmano drozmano 2514832 May 21 14:37 state.cpt&lt;br /&gt;
-rw-r--r-- 1 drozmano drozmano 4309444 May 21 14:37 traj_comp.xtc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The &#039;&#039;&#039;new files&#039;&#039;&#039; here are:&lt;br /&gt;
* &amp;lt;code&amp;gt;bilayer.tpr&amp;lt;/code&amp;gt; -- Binary input file that is generated by the &amp;lt;code&amp;gt;gmx grompp&amp;lt;/code&amp;gt; before the actual simulation.&lt;br /&gt;
: This file can be generated before submitting the job, if needed. Here it is created in the job script.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;confout.gro&amp;lt;/code&amp;gt; -- a configuration file containing the final atomic positions at the end of the simulation.&lt;br /&gt;
* &amp;lt;code&amp;gt;ener.edr&amp;lt;/code&amp;gt; -- a file with energy data. Can be used for later analysis.&lt;br /&gt;
* &amp;lt;code&amp;gt;md.log&amp;lt;/code&amp;gt; -- the main log file for the simulation.&lt;br /&gt;
* &amp;lt;code&amp;gt;mdout.mdp&amp;lt;/code&amp;gt; -- a file containing all simulation parameters as used by GROMACS. Based on &amp;lt;code&amp;gt;bilayer.mdp&amp;lt;/code&amp;gt;.&lt;br /&gt;
* &amp;lt;code&amp;gt;state.cpt&amp;lt;/code&amp;gt; -- a binary checkpoint file containing the system state at the end of the simulation. &lt;br /&gt;
: This file can be used to continue simulations further.&lt;br /&gt;
* &amp;lt;code&amp;gt;traj_com.xtc&amp;lt;/code&amp;gt; -- a trajectory file containing atomic positions at some time points during the simulation.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;slurm-5570681.out&amp;lt;/code&amp;gt; -- The intercept of the output printed on screen during the simulation. &lt;br /&gt;
: Done by &#039;&#039;&#039;SLURM&#039;&#039;&#039; for you. The number in the name is the &#039;&#039;&#039;job ID&#039;&#039;&#039; of the job.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If &#039;&#039;&#039;something is not working&#039;&#039;&#039; the way you expected, then the &amp;lt;code&amp;gt;slurm-5570681.out&amp;lt;/code&amp;gt; file is the &#039;&#039;&#039;first&#039;&#039;&#039; place you should examine. &lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;md.log&amp;lt;/code&amp;gt; is the &#039;&#039;&#039;next&#039;&#039;&#039; thing to look into.&lt;br /&gt;
&lt;br /&gt;
If everything is as expected, then your &#039;&#039;&#039;computation is done&#039;&#039;&#039; and you can use the results. &lt;br /&gt;
&#039;&#039;&#039;Success!&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
You may want to check the output file and the main log anyways:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Press &amp;quot;q&amp;quot; to exit the text viewer.&lt;br /&gt;
$ less slurm-5570681.out&lt;br /&gt;
....&lt;br /&gt;
&lt;br /&gt;
$ less md.log&lt;br /&gt;
....&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== The job script ===&lt;br /&gt;
&lt;br /&gt;
If you have input files as in the example above, and you use your own computer, &lt;br /&gt;
then to run the simulation,&lt;br /&gt;
you have to generate a binary input file for the &amp;lt;code&amp;gt;mdrun&amp;lt;/code&amp;gt; &#039;&#039;&#039;GROMACS&#039;&#039;&#039; command first.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ gmx grompp -v -f bilayer.mdp -c bilayer.gro -p bilayer.top -o bilayer.tpr&lt;br /&gt;
&lt;br /&gt;
                      :-) GROMACS - gmx grompp, 2019.6 (-:&lt;br /&gt;
&lt;br /&gt;
                            GROMACS is written by:&lt;br /&gt;
     Emile Apol      Rossen Apostolov      Paul Bauer     Herman J.C. Berendsen&lt;br /&gt;
.....&lt;br /&gt;
.....&lt;br /&gt;
Checking consistency between energy and charge groups...&lt;br /&gt;
Calculating fourier grid dimensions for X Y Z&lt;br /&gt;
Using a fourier grid of 112x112x52, spacing 0.116 0.116 0.112&lt;br /&gt;
Estimate for the relative computational load of the PME mesh part: 0.13&lt;br /&gt;
This run will generate roughly 14 Mb of data&lt;br /&gt;
writing run input file...&lt;br /&gt;
&lt;br /&gt;
There were 2 notes&lt;br /&gt;
&lt;br /&gt;
$ ls -l&lt;br /&gt;
-rw-r--r-- 1 drozmano drozmano 7224622 Jan 29  2014 bilayer.gro&lt;br /&gt;
-rw-r--r-- 1 drozmano drozmano    2567 May 21 12:14 bilayer.mdp&lt;br /&gt;
-rw-r--r-- 1 drozmano drozmano      87 Apr 29  2016 bilayer.top&lt;br /&gt;
-rw-r--r-- 1 drozmano drozmano 2594772 May 21 15:06 bilayer.tpr&lt;br /&gt;
drwxr-xr-x 1 drozmano drozmano     200 May 20 16:27 ff&lt;br /&gt;
-rw-r--r-- 1 drozmano drozmano     504 May 20 16:30 ff.top&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
At this point you can run the simulation like this:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ gmx mdrun -v -s bilayer.tpr&lt;br /&gt;
&lt;br /&gt;
                      :-) GROMACS - gmx grompp, 2019.6 (-:&lt;br /&gt;
&lt;br /&gt;
                            GROMACS is written by:&lt;br /&gt;
     Emile Apol      Rossen Apostolov      Paul Bauer     Herman J.C. Berendsen&lt;br /&gt;
......&lt;br /&gt;
... lots-of-output ...&lt;br /&gt;
......&lt;br /&gt;
Writing final coordinates.&lt;br /&gt;
^Mstep 10000, remaining wall clock time:     0 s          &lt;br /&gt;
               Core t (s)   Wall t (s)        (%)&lt;br /&gt;
       Time:     1557.342       38.939     3999.4&lt;br /&gt;
                 (ns/day)    (hour/ns)&lt;br /&gt;
Performance:       22.191        1.082&lt;br /&gt;
&lt;br /&gt;
GROMACS reminds you: &amp;quot;In ...&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
To run this calculation on a cluster via the &#039;&#039;&#039;SLURM&#039;&#039;&#039; scheduling system you have to provide a job script&lt;br /&gt;
that does &#039;&#039;&#039;two things&#039;&#039;&#039;:&lt;br /&gt;
# Provides &#039;&#039;&#039;steps that run&#039;&#039;&#039; the simulation, and&lt;br /&gt;
# Requests all &#039;&#039;&#039;necessary computational resources&#039;&#039;&#039; that are needed for this simulation.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;steps to run&#039;&#039;&#039; the simulation you already know:&lt;br /&gt;
# Load a desired &#039;&#039;&#039;GROMACS&#039;&#039;&#039; module to activate the software.&lt;br /&gt;
# Generate the binary input, the &#039;&#039;&#039;.tpr&#039;&#039;&#039; file.&lt;br /&gt;
# Run the &#039;&#039;&#039;mdrun&#039;&#039;&#039; command on it.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;computational resources&#039;&#039;&#039; for the run include:&lt;br /&gt;
* the &#039;&#039;&#039;Number of CPUs&#039;&#039;&#039;, &lt;br /&gt;
* the &#039;&#039;&#039;Amount of memory&#039;&#039;&#039; (RAM), and &lt;br /&gt;
* the &#039;&#039;&#039;Time&#039;&#039;&#039; sufficient to complete the computation.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Below, &#039;&#039;&#039;several examples of job scripts&#039;&#039;&#039; are given.&lt;br /&gt;
&lt;br /&gt;
These scripts are suitable for use on ARC depending on &lt;br /&gt;
* what &#039;&#039;&#039;part of the cluster&#039;&#039;&#039; the job should run on and &lt;br /&gt;
* the &#039;&#039;&#039;number of CPUs&#039;&#039;&#039; the job is going to use.&lt;br /&gt;
&lt;br /&gt;
==== Single node (modern) job script ====&lt;br /&gt;
This script is for jobs that use up to &#039;&#039;&#039;one&#039;&#039;&#039; full modern node (2019 and later). &lt;br /&gt;
These nodes are in the list of default partitions and have 40 CPUs each.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This specific example requests &#039;&#039;&#039;40 CPUs on 1 node&#039;&#039;&#039; for &#039;&#039;&#039;5 hours&#039;&#039;&#039;. &lt;br /&gt;
It also requests &#039;&#039;&#039;16GB of RAM&#039;&#039;&#039; on the node. &lt;br /&gt;
The simulation runs as &#039;&#039;&#039;1 process of 40 threads&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;job-single.slurm&#039;&#039;&#039;:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# ================================================================&lt;br /&gt;
#SBATCH --job-name=gro_test&lt;br /&gt;
&lt;br /&gt;
#SBATCH --nodes=1&lt;br /&gt;
#SBATCH --ntasks-per-node=1&lt;br /&gt;
#SBATCH --cpus-per-task=40&lt;br /&gt;
#SBATCH --mem=16GB&lt;br /&gt;
#SBATCH --time=0-05:00:00&lt;br /&gt;
# ================================================================&lt;br /&gt;
module purge&lt;br /&gt;
module load gromacs/2019.6-skylake&lt;br /&gt;
# ================================================================&lt;br /&gt;
echo &amp;quot;Starting at `date`.&amp;quot;&lt;br /&gt;
echo &amp;quot;=========================&amp;quot;&lt;br /&gt;
# Input files.&lt;br /&gt;
MDP=bilayer.mdp&lt;br /&gt;
TOP=bilayer.top&lt;br /&gt;
GRO=bilayer.gro&lt;br /&gt;
&lt;br /&gt;
# Binary input file to generate.&lt;br /&gt;
TPR=bilayer.tpr&lt;br /&gt;
&lt;br /&gt;
# Preprocess the input files.&lt;br /&gt;
gmx grompp -v -f $MDP -c $GRO -p $TOP -o $TPR&lt;br /&gt;
&lt;br /&gt;
# Check if preprocessing have gone well.&lt;br /&gt;
if ! test -e $TPR; then&lt;br /&gt;
	echo &amp;quot;ERROR: Could not create a TPR file for the run. Aborting.&amp;quot;&lt;br /&gt;
	exit&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# Run the simulation.&lt;br /&gt;
OMP_NUM_THREADS=$SLURM_CPUS_PER_TASK&lt;br /&gt;
&lt;br /&gt;
gmx mdrun -v -s $TPR&lt;br /&gt;
echo &amp;quot;=========================&amp;quot;&lt;br /&gt;
echo &amp;quot;Done at `date`.&amp;quot;&lt;br /&gt;
# ================================================================&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Multi node (modern) job script ====&lt;br /&gt;
This script is for jobs that use several modern nodes (2019 and later). &lt;br /&gt;
These nodes are in the list of default partitions and have 40 CPUs each. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This specific example requests &#039;&#039;&#039;80 CPUs on 2 nodes&#039;&#039;&#039; (40 CPUs each) for &#039;&#039;&#039;5 hours&#039;&#039;&#039;. &lt;br /&gt;
It also requests &#039;&#039;&#039;16GB of RAM&#039;&#039;&#039; on each node. The simulation runs as &#039;&#039;&#039;80 one-threaded processes&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;job-multi.slurm&#039;&#039;&#039;:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# ================================================================&lt;br /&gt;
#SBATCH --job-name=gro_test&lt;br /&gt;
&lt;br /&gt;
#SBATCH --nodes=2&lt;br /&gt;
#SBATCH --ntasks-per-node=40&lt;br /&gt;
#SBATCH --cpus-per-task=1&lt;br /&gt;
#SBATCH --mem=16GB&lt;br /&gt;
#SBATCH --time=0-05:00:00&lt;br /&gt;
# ================================================================&lt;br /&gt;
module purge&lt;br /&gt;
module load gromacs/2019.6-skylake&lt;br /&gt;
# ================================================================&lt;br /&gt;
echo &amp;quot;Starting at `date`.&amp;quot;&lt;br /&gt;
echo &amp;quot;=========================&amp;quot;&lt;br /&gt;
# Input files.&lt;br /&gt;
MDP=bilayer.mdp&lt;br /&gt;
TOP=bilayer.top&lt;br /&gt;
GRO=bilayer.gro&lt;br /&gt;
&lt;br /&gt;
# Binary input file to generate.&lt;br /&gt;
TPR=bilayer.tpr&lt;br /&gt;
&lt;br /&gt;
# Preprocess the input files.&lt;br /&gt;
gmx grompp -v -f $MDP -c $GRO -p $TOP -o $TPR&lt;br /&gt;
&lt;br /&gt;
# Check if preprocessing have gone well.&lt;br /&gt;
if ! test -e $TPR; then&lt;br /&gt;
	echo &amp;quot;ERROR: Could not create a TPR file for the run. Aborting.&amp;quot;&lt;br /&gt;
	exit&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# Run the simulation.&lt;br /&gt;
OMP_NUM_THREADS=1&lt;br /&gt;
mpiexec gmx_mpi mdrun -v -s $TPR&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;=========================&amp;quot;&lt;br /&gt;
echo &amp;quot;Done at `date`.&amp;quot;&lt;br /&gt;
# ================================================================&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Single node (legacy) job script ====&lt;br /&gt;
&lt;br /&gt;
This script is for jobs that use up to &#039;&#039;&#039;one&#039;&#039;&#039; full legacy node &lt;br /&gt;
(&#039;&#039;&#039;parallel&#039;&#039;&#039;, &#039;&#039;&#039;cpu2013&#039;&#039;&#039;, &#039;&#039;&#039;lattice&#039;&#039;&#039; partitions). &lt;br /&gt;
The partition has to be specified in the resource request.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This specific example requests &#039;&#039;&#039;12 CPUs on 1 node&#039;&#039;&#039; in the &#039;&#039;&#039;parallel&#039;&#039;&#039; legacy partition for &#039;&#039;&#039;5 hours&#039;&#039;&#039;. &lt;br /&gt;
It also requests &#039;&#039;&#039;23GB of RAM&#039;&#039;&#039; on the node (all available memory on this kind). &lt;br /&gt;
The simulation runs as &#039;&#039;&#039;1 process of 12 threads&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;job-single-legacy.slurm&#039;&#039;&#039;:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# ================================================================&lt;br /&gt;
#SBATCH --job-name=gro_test&lt;br /&gt;
&lt;br /&gt;
#SBATCH --nodes=1&lt;br /&gt;
#SBATCH --ntasks-per-node=1&lt;br /&gt;
#SBATCH --cpus-per-task=12&lt;br /&gt;
#SBATCH --mem=23GB&lt;br /&gt;
#SBATCH --time=0-12:00:00&lt;br /&gt;
&lt;br /&gt;
#SBATCH --partition=parallel&lt;br /&gt;
# ================================================================&lt;br /&gt;
module purge&lt;br /&gt;
module load gromacs/2019.6-legacy&lt;br /&gt;
# ================================================================&lt;br /&gt;
echo &amp;quot;Starting at `date`.&amp;quot;&lt;br /&gt;
echo &amp;quot;=========================&amp;quot;&lt;br /&gt;
# Input files.&lt;br /&gt;
MDP=bilayer.mdp&lt;br /&gt;
TOP=bilayer.top&lt;br /&gt;
GRO=bilayer.gro&lt;br /&gt;
&lt;br /&gt;
# Binary input file to generate.&lt;br /&gt;
TPR=bilayer.tpr&lt;br /&gt;
&lt;br /&gt;
# Preprocess the input files.&lt;br /&gt;
gmx grompp -v -f $MDP -c $GRO -p $TOP -o $TPR&lt;br /&gt;
&lt;br /&gt;
# Check if preprocessing have gone well.&lt;br /&gt;
if ! test -e $TPR; then&lt;br /&gt;
	echo &amp;quot;ERROR: Could not create a TPR file for the run. Aborting.&amp;quot;&lt;br /&gt;
	exit&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# Run the simulation.&lt;br /&gt;
OMP_NUM_THREADS=$SLURM_CPUS_PER_TASK&lt;br /&gt;
&lt;br /&gt;
gmx mdrun -v -s $TPR&lt;br /&gt;
echo &amp;quot;=========================&amp;quot;&lt;br /&gt;
echo &amp;quot;Done at `date`.&amp;quot;&lt;br /&gt;
# ================================================================&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Multi node (legacy) job script ====&lt;br /&gt;
&lt;br /&gt;
This script is for jobs that use several legacy node &lt;br /&gt;
(&#039;&#039;&#039;parallel&#039;&#039;&#039;, &#039;&#039;&#039;cpu2013&#039;&#039;&#039;, &#039;&#039;&#039;lattice&#039;&#039;&#039; partitions). &lt;br /&gt;
The partition has to be specified in the resource request.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This specific example requests &#039;&#039;&#039;48 CPUs on 4 nodes&#039;&#039;&#039; in the &#039;&#039;&#039;parallel&#039;&#039;&#039; legacy partition (12 CPUs each) for &#039;&#039;&#039;5 hours&#039;&#039;&#039;. &lt;br /&gt;
It also requests &#039;&#039;&#039;23GB of RAM&#039;&#039;&#039; on each node. The simulation runs as &#039;&#039;&#039;48 one-threaded processes&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;job-multi.slurm&#039;&#039;&#039;:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# ================================================================&lt;br /&gt;
#SBATCH --job-name=gro_test&lt;br /&gt;
&lt;br /&gt;
#SBATCH --nodes=4&lt;br /&gt;
#SBATCH --ntasks-per-node=12&lt;br /&gt;
#SBATCH --cpus-per-task=1&lt;br /&gt;
#SBATCH --mem=23GB&lt;br /&gt;
#SBATCH --time=0-05:00:00&lt;br /&gt;
&lt;br /&gt;
#SBATCH --partition=parallel&lt;br /&gt;
# ================================================================&lt;br /&gt;
module purge&lt;br /&gt;
module load gromacs/2019.6-legacy&lt;br /&gt;
# ================================================================&lt;br /&gt;
echo &amp;quot;Starting at `date`.&amp;quot;&lt;br /&gt;
echo &amp;quot;=========================&amp;quot;&lt;br /&gt;
# Input files.&lt;br /&gt;
MDP=bilayer.mdp&lt;br /&gt;
TOP=bilayer.top&lt;br /&gt;
GRO=bilayer.gro&lt;br /&gt;
&lt;br /&gt;
# Binary input file to generate.&lt;br /&gt;
TPR=bilayer.tpr&lt;br /&gt;
&lt;br /&gt;
# Preprocess the input files.&lt;br /&gt;
gmx grompp -v -f $MDP -c $GRO -p $TOP -o $TPR&lt;br /&gt;
&lt;br /&gt;
# Check if preprocessing have gone well.&lt;br /&gt;
if ! test -e $TPR; then&lt;br /&gt;
	echo &amp;quot;ERROR: Could not create a TPR file for the run. Aborting.&amp;quot;&lt;br /&gt;
	exit&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# Run the simulation.&lt;br /&gt;
OMP_NUM_THREADS=1&lt;br /&gt;
mpiexec gmx_mpi mdrun -v -s $TPR&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;=========================&amp;quot;&lt;br /&gt;
echo &amp;quot;Done at `date`.&amp;quot;&lt;br /&gt;
# ================================================================&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Tip ====&lt;br /&gt;
&lt;br /&gt;
Sometimes it is useful to run the preprocessor to generate the binary input before submitting a job. &lt;br /&gt;
In the example above there had been two notes about the setup and you have to make sure that &lt;br /&gt;
you are ready to continue with the simulation despite them. &lt;br /&gt;
&lt;br /&gt;
Also, if there are problems with your input you will be able to see them right away without going through job submission.&lt;br /&gt;
&lt;br /&gt;
= Misc =&lt;br /&gt;
&lt;br /&gt;
== Performance ==&lt;br /&gt;
&lt;br /&gt;
Performance measurements for &#039;&#039;&#039;GROMACS 2019.6&#039;&#039;&#039; on the 2019 compute nodes using &lt;br /&gt;
different parallelization options and number of CPUs.&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;bilayer&#039;&#039;&#039; system of ~105000 atoms was simulated for 100000 steps.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
-------------------------------------------------------------------------------&lt;br /&gt;
#CPUs   #Nodes  Processes    Threads    Wall Time    Performance  Efficiency&lt;br /&gt;
                 per node   per proc          (s)       (ns/day)         (%)&lt;br /&gt;
-------------------------------------------------------------------------------&lt;br /&gt;
    1       1           1          1       1031.6           0.84       100.0&lt;br /&gt;
&lt;br /&gt;
   10       1           1         10        119.0           7.26        86.4&lt;br /&gt;
   20       1           1         20         65.9          13.11        78.0&lt;br /&gt;
   40       1           1         40         37.6          22.97        68.4&lt;br /&gt;
&lt;br /&gt;
   10       1          10          1        126.4           6.83        81.3  &lt;br /&gt;
   20       1          20          1         78.0          11.08        66.0&lt;br /&gt;
   40       1          40          1         45.3          19.07        56.8&lt;br /&gt;
&lt;br /&gt;
   40       1          20          2         48.3          17.90        53.3        &lt;br /&gt;
   40       1          10          4         43.9          19.68        58.6&lt;br /&gt;
   36       1           6          6         49.4          17.50        57.9&lt;br /&gt;
&lt;br /&gt;
   80       2          10          4         30.5          28.34        42.2  &lt;br /&gt;
   80       2          20          2         32.6          26.53        39.4&lt;br /&gt;
   80       2          40          1         30.3          28.49        42.4&lt;br /&gt;
&lt;br /&gt;
  120       3          40          1         20.8          41.51        41.2&lt;br /&gt;
  160       4          40          1         19.2          44.95        33.4&lt;br /&gt;
-------------------------------------------------------------------------------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Observations&#039;&#039;&#039;:&lt;br /&gt;
* If you want to run the job on a &#039;&#039;&#039;single node&#039;&#039;&#039;, then use &#039;&#039;&#039;1 process&#039;&#039;&#039; with as many threads as the number of CPUs you request.&lt;br /&gt;
&lt;br /&gt;
* If you need &#039;&#039;&#039;more than 1 node&#039;&#039;&#039;, then run &#039;&#039;&#039;1-threaded MPI processes&#039;&#039;&#039; for each CPU you request.&lt;br /&gt;
&lt;br /&gt;
* Going &#039;&#039;&#039;beyond 3 nodes&#039;&#039;&#039; may not be computationally efficient on ARC.&lt;br /&gt;
&lt;br /&gt;
== Selected GROMACS commands ==&lt;br /&gt;
=== gmx ===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
SYNOPSIS&lt;br /&gt;
&lt;br /&gt;
gmx [-[no]h] [-[no]quiet] [-[no]version] [-[no]copyright] [-nice &amp;lt;int&amp;gt;]&lt;br /&gt;
    [-[no]backup]&lt;br /&gt;
&lt;br /&gt;
OPTIONS&lt;br /&gt;
&lt;br /&gt;
Other options:&lt;br /&gt;
&lt;br /&gt;
 -[no]h                     (no)&lt;br /&gt;
           Print help and quit&lt;br /&gt;
 -[no]quiet                 (no)&lt;br /&gt;
           Do not print common startup info or quotes&lt;br /&gt;
 -[no]version               (no)&lt;br /&gt;
           Print extended version information and quit&lt;br /&gt;
 -[no]copyright             (yes)&lt;br /&gt;
           Print copyright information on startup&lt;br /&gt;
 -nice   &amp;lt;int&amp;gt;              (19)&lt;br /&gt;
           Set the nicelevel (default depends on command)&lt;br /&gt;
 -[no]backup                (yes)&lt;br /&gt;
           Write backups if output files exist&lt;br /&gt;
&lt;br /&gt;
Additional help is available on the following topics:&lt;br /&gt;
    commands    List of available commands&lt;br /&gt;
    selections  Selection syntax and usage&lt;br /&gt;
To access the help, use &#039;gmx help &amp;lt;topic&amp;gt;&#039;.&lt;br /&gt;
For help on a command, use &#039;gmx help &amp;lt;command&amp;gt;&#039;.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== gmx grompp ===&lt;br /&gt;
Preprocess input files.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ gmx help grompp&lt;br /&gt;
&lt;br /&gt;
SYNOPSIS&lt;br /&gt;
&lt;br /&gt;
gmx grompp [-f [&amp;lt;.mdp&amp;gt;]] [-c [&amp;lt;.gro/.g96/...&amp;gt;]] [-r [&amp;lt;.gro/.g96/...&amp;gt;]]&lt;br /&gt;
           [-rb [&amp;lt;.gro/.g96/...&amp;gt;]] [-n [&amp;lt;.ndx&amp;gt;]] [-p [&amp;lt;.top&amp;gt;]]&lt;br /&gt;
           [-t [&amp;lt;.trr/.cpt/...&amp;gt;]] [-e [&amp;lt;.edr&amp;gt;]] [-ref [&amp;lt;.trr/.cpt/...&amp;gt;]]&lt;br /&gt;
           [-po [&amp;lt;.mdp&amp;gt;]] [-pp [&amp;lt;.top&amp;gt;]] [-o [&amp;lt;.tpr&amp;gt;]] [-imd [&amp;lt;.gro&amp;gt;]]&lt;br /&gt;
           [-[no]v] [-time &amp;lt;real&amp;gt;] [-[no]rmvsbds] [-maxwarn &amp;lt;int&amp;gt;]&lt;br /&gt;
           [-[no]zero] [-[no]renum]&lt;br /&gt;
&lt;br /&gt;
OPTIONS&lt;br /&gt;
&lt;br /&gt;
Options to specify input files:&lt;br /&gt;
&lt;br /&gt;
 -f      [&amp;lt;.mdp&amp;gt;]           (grompp.mdp)&lt;br /&gt;
           grompp input file with MD parameters&lt;br /&gt;
 -c      [&amp;lt;.gro/.g96/...&amp;gt;]  (conf.gro)&lt;br /&gt;
           Structure file: gro g96 pdb brk ent esp tpr&lt;br /&gt;
 -r      [&amp;lt;.gro/.g96/...&amp;gt;]  (restraint.gro)  (Opt.)&lt;br /&gt;
           Structure file: gro g96 pdb brk ent esp tpr&lt;br /&gt;
 -rb     [&amp;lt;.gro/.g96/...&amp;gt;]  (restraint.gro)  (Opt.)&lt;br /&gt;
           Structure file: gro g96 pdb brk ent esp tpr&lt;br /&gt;
 -n      [&amp;lt;.ndx&amp;gt;]           (index.ndx)      (Opt.)&lt;br /&gt;
           Index file&lt;br /&gt;
 -p      [&amp;lt;.top&amp;gt;]           (topol.top)&lt;br /&gt;
           Topology file&lt;br /&gt;
 -t      [&amp;lt;.trr/.cpt/...&amp;gt;]  (traj.trr)       (Opt.)&lt;br /&gt;
           Full precision trajectory: trr cpt tng&lt;br /&gt;
 -e      [&amp;lt;.edr&amp;gt;]           (ener.edr)       (Opt.)&lt;br /&gt;
           Energy file&lt;br /&gt;
&lt;br /&gt;
Options to specify input/output files:&lt;br /&gt;
&lt;br /&gt;
 -ref    [&amp;lt;.trr/.cpt/...&amp;gt;]  (rotref.trr)     (Opt.)&lt;br /&gt;
           Full precision trajectory: trr cpt tng&lt;br /&gt;
&lt;br /&gt;
Options to specify output files:&lt;br /&gt;
&lt;br /&gt;
 -po     [&amp;lt;.mdp&amp;gt;]           (mdout.mdp)&lt;br /&gt;
           grompp input file with MD parameters&lt;br /&gt;
 -pp     [&amp;lt;.top&amp;gt;]           (processed.top)  (Opt.)&lt;br /&gt;
           Topology file&lt;br /&gt;
 -o      [&amp;lt;.tpr&amp;gt;]           (topol.tpr)&lt;br /&gt;
           Portable xdr run input file&lt;br /&gt;
 -imd    [&amp;lt;.gro&amp;gt;]           (imdgroup.gro)   (Opt.)&lt;br /&gt;
           Coordinate file in Gromos-87 format&lt;br /&gt;
&lt;br /&gt;
Other options:&lt;br /&gt;
&lt;br /&gt;
 -[no]v                     (no)&lt;br /&gt;
           Be loud and noisy&lt;br /&gt;
 -time   &amp;lt;real&amp;gt;             (-1)&lt;br /&gt;
           Take frame at or first after this time.&lt;br /&gt;
 -[no]rmvsbds               (yes)&lt;br /&gt;
           Remove constant bonded interactions with virtual sites&lt;br /&gt;
 -maxwarn &amp;lt;int&amp;gt;             (0)&lt;br /&gt;
           Number of allowed warnings during input processing. Not for normal&lt;br /&gt;
           use and may generate unstable systems&lt;br /&gt;
 -[no]zero                  (no)&lt;br /&gt;
           Set parameters for bonded interactions without defaults to zero&lt;br /&gt;
           instead of generating an error&lt;br /&gt;
 -[no]renum                 (yes)&lt;br /&gt;
           Renumber atomtypes and minimize number of atomtypes&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== gmx mdrun ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;gmx mdrun&#039;&#039;&#039; is the main computational chemistry engine within &#039;&#039;&#039;GROMACS&#039;&#039;&#039;.&lt;br /&gt;
It performs Molecular Dynamics simulations, but it can also perform&lt;br /&gt;
Stochastic Dynamics, Energy Minimization, test particle insertion or&lt;br /&gt;
(re)calculation of energies. Normal mode analysis is another option.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
SYNOPSIS&lt;br /&gt;
&lt;br /&gt;
gmx mdrun [-s [&amp;lt;.tpr&amp;gt;]] [-cpi [&amp;lt;.cpt&amp;gt;]] [-table [&amp;lt;.xvg&amp;gt;]] [-tablep [&amp;lt;.xvg&amp;gt;]]&lt;br /&gt;
          [-tableb [&amp;lt;.xvg&amp;gt; [...]]] [-rerun [&amp;lt;.xtc/.trr/...&amp;gt;]] [-ei [&amp;lt;.edi&amp;gt;]]&lt;br /&gt;
          [-multidir [&amp;lt;dir&amp;gt; [...]]] [-awh [&amp;lt;.xvg&amp;gt;]] [-membed [&amp;lt;.dat&amp;gt;]]&lt;br /&gt;
          [-mp [&amp;lt;.top&amp;gt;]] [-mn [&amp;lt;.ndx&amp;gt;]] [-o [&amp;lt;.trr/.cpt/...&amp;gt;]]&lt;br /&gt;
          [-x [&amp;lt;.xtc/.tng&amp;gt;]] [-cpo [&amp;lt;.cpt&amp;gt;]] [-c [&amp;lt;.gro/.g96/...&amp;gt;]]&lt;br /&gt;
          [-e [&amp;lt;.edr&amp;gt;]] [-g [&amp;lt;.log&amp;gt;]] [-dhdl [&amp;lt;.xvg&amp;gt;]] [-field [&amp;lt;.xvg&amp;gt;]]&lt;br /&gt;
          [-tpi [&amp;lt;.xvg&amp;gt;]] [-tpid [&amp;lt;.xvg&amp;gt;]] [-eo [&amp;lt;.xvg&amp;gt;]] [-devout [&amp;lt;.xvg&amp;gt;]]&lt;br /&gt;
          [-runav [&amp;lt;.xvg&amp;gt;]] [-px [&amp;lt;.xvg&amp;gt;]] [-pf [&amp;lt;.xvg&amp;gt;]] [-ro [&amp;lt;.xvg&amp;gt;]]&lt;br /&gt;
          [-ra [&amp;lt;.log&amp;gt;]] [-rs [&amp;lt;.log&amp;gt;]] [-rt [&amp;lt;.log&amp;gt;]] [-mtx [&amp;lt;.mtx&amp;gt;]]&lt;br /&gt;
          [-if [&amp;lt;.xvg&amp;gt;]] [-swap [&amp;lt;.xvg&amp;gt;]] [-deffnm &amp;lt;string&amp;gt;] [-xvg &amp;lt;enum&amp;gt;]&lt;br /&gt;
          [-dd &amp;lt;vector&amp;gt;] [-ddorder &amp;lt;enum&amp;gt;] [-npme &amp;lt;int&amp;gt;] [-nt &amp;lt;int&amp;gt;]&lt;br /&gt;
          [-ntmpi &amp;lt;int&amp;gt;] [-ntomp &amp;lt;int&amp;gt;] [-ntomp_pme &amp;lt;int&amp;gt;] [-pin &amp;lt;enum&amp;gt;]&lt;br /&gt;
          [-pinoffset &amp;lt;int&amp;gt;] [-pinstride &amp;lt;int&amp;gt;] [-gpu_id &amp;lt;string&amp;gt;]&lt;br /&gt;
          [-gputasks &amp;lt;string&amp;gt;] [-[no]ddcheck] [-rdd &amp;lt;real&amp;gt;] [-rcon &amp;lt;real&amp;gt;]&lt;br /&gt;
          [-dlb &amp;lt;enum&amp;gt;] [-dds &amp;lt;real&amp;gt;] [-gcom &amp;lt;int&amp;gt;] [-nb &amp;lt;enum&amp;gt;]&lt;br /&gt;
          [-nstlist &amp;lt;int&amp;gt;] [-[no]tunepme] [-pme &amp;lt;enum&amp;gt;] [-pmefft &amp;lt;enum&amp;gt;]&lt;br /&gt;
          [-bonded &amp;lt;enum&amp;gt;] [-[no]v] [-pforce &amp;lt;real&amp;gt;] [-[no]reprod]&lt;br /&gt;
          [-cpt &amp;lt;real&amp;gt;] [-[no]cpnum] [-[no]append] [-nsteps &amp;lt;int&amp;gt;]&lt;br /&gt;
          [-maxh &amp;lt;real&amp;gt;] [-replex &amp;lt;int&amp;gt;] [-nex &amp;lt;int&amp;gt;] [-reseed &amp;lt;int&amp;gt;]&lt;br /&gt;
&lt;br /&gt;
OPTIONS&lt;br /&gt;
&lt;br /&gt;
Options to specify input files:&lt;br /&gt;
&lt;br /&gt;
 -s      [&amp;lt;.tpr&amp;gt;]           (topol.tpr)&lt;br /&gt;
           Portable xdr run input file&lt;br /&gt;
 -cpi    [&amp;lt;.cpt&amp;gt;]           (state.cpt)      (Opt.)&lt;br /&gt;
           Checkpoint file&lt;br /&gt;
 -table  [&amp;lt;.xvg&amp;gt;]           (table.xvg)      (Opt.)&lt;br /&gt;
           xvgr/xmgr file&lt;br /&gt;
 -tablep [&amp;lt;.xvg&amp;gt;]           (tablep.xvg)     (Opt.)&lt;br /&gt;
           xvgr/xmgr file&lt;br /&gt;
 -tableb [&amp;lt;.xvg&amp;gt; [...]]     (table.xvg)      (Opt.)&lt;br /&gt;
           xvgr/xmgr file&lt;br /&gt;
 -rerun  [&amp;lt;.xtc/.trr/...&amp;gt;]  (rerun.xtc)      (Opt.)&lt;br /&gt;
           Trajectory: xtc trr cpt gro g96 pdb tng&lt;br /&gt;
 -ei     [&amp;lt;.edi&amp;gt;]           (sam.edi)        (Opt.)&lt;br /&gt;
           ED sampling input&lt;br /&gt;
 -multidir [&amp;lt;dir&amp;gt; [...]]    (rundir)         (Opt.)&lt;br /&gt;
           Run directory&lt;br /&gt;
 -awh    [&amp;lt;.xvg&amp;gt;]           (awhinit.xvg)    (Opt.)&lt;br /&gt;
           xvgr/xmgr file&lt;br /&gt;
 -membed [&amp;lt;.dat&amp;gt;]           (membed.dat)     (Opt.)&lt;br /&gt;
           Generic data file&lt;br /&gt;
 -mp     [&amp;lt;.top&amp;gt;]           (membed.top)     (Opt.)&lt;br /&gt;
           Topology file&lt;br /&gt;
 -mn     [&amp;lt;.ndx&amp;gt;]           (membed.ndx)     (Opt.)&lt;br /&gt;
           Index file&lt;br /&gt;
&lt;br /&gt;
Options to specify output files:&lt;br /&gt;
&lt;br /&gt;
 -o      [&amp;lt;.trr/.cpt/...&amp;gt;]  (traj.trr)&lt;br /&gt;
           Full precision trajectory: trr cpt tng&lt;br /&gt;
 -x      [&amp;lt;.xtc/.tng&amp;gt;]      (traj_comp.xtc)  (Opt.)&lt;br /&gt;
           Compressed trajectory (tng format or portable xdr format)&lt;br /&gt;
 -cpo    [&amp;lt;.cpt&amp;gt;]           (state.cpt)      (Opt.)&lt;br /&gt;
           Checkpoint file&lt;br /&gt;
 -c      [&amp;lt;.gro/.g96/...&amp;gt;]  (confout.gro)&lt;br /&gt;
           Structure file: gro g96 pdb brk ent esp&lt;br /&gt;
 -e      [&amp;lt;.edr&amp;gt;]           (ener.edr)&lt;br /&gt;
           Energy file&lt;br /&gt;
 -g      [&amp;lt;.log&amp;gt;]           (md.log)&lt;br /&gt;
           Log file&lt;br /&gt;
 -dhdl   [&amp;lt;.xvg&amp;gt;]           (dhdl.xvg)       (Opt.)&lt;br /&gt;
           xvgr/xmgr file&lt;br /&gt;
 -field  [&amp;lt;.xvg&amp;gt;]           (field.xvg)      (Opt.)&lt;br /&gt;
           xvgr/xmgr file&lt;br /&gt;
 -tpi    [&amp;lt;.xvg&amp;gt;]           (tpi.xvg)        (Opt.)&lt;br /&gt;
           xvgr/xmgr file&lt;br /&gt;
 -tpid   [&amp;lt;.xvg&amp;gt;]           (tpidist.xvg)    (Opt.)&lt;br /&gt;
           xvgr/xmgr file&lt;br /&gt;
 -eo     [&amp;lt;.xvg&amp;gt;]           (edsam.xvg)      (Opt.)&lt;br /&gt;
           xvgr/xmgr file&lt;br /&gt;
 -devout [&amp;lt;.xvg&amp;gt;]           (deviatie.xvg)   (Opt.)&lt;br /&gt;
           xvgr/xmgr file&lt;br /&gt;
 -runav  [&amp;lt;.xvg&amp;gt;]           (runaver.xvg)    (Opt.)&lt;br /&gt;
           xvgr/xmgr file&lt;br /&gt;
 -px     [&amp;lt;.xvg&amp;gt;]           (pullx.xvg)      (Opt.)&lt;br /&gt;
           xvgr/xmgr file&lt;br /&gt;
 -pf     [&amp;lt;.xvg&amp;gt;]           (pullf.xvg)      (Opt.)&lt;br /&gt;
           xvgr/xmgr file&lt;br /&gt;
 -ro     [&amp;lt;.xvg&amp;gt;]           (rotation.xvg)   (Opt.)&lt;br /&gt;
           xvgr/xmgr file&lt;br /&gt;
 -ra     [&amp;lt;.log&amp;gt;]           (rotangles.log)  (Opt.)&lt;br /&gt;
           Log file&lt;br /&gt;
 -rs     [&amp;lt;.log&amp;gt;]           (rotslabs.log)   (Opt.)&lt;br /&gt;
           Log file&lt;br /&gt;
 -rt     [&amp;lt;.log&amp;gt;]           (rottorque.log)  (Opt.)&lt;br /&gt;
           Log file&lt;br /&gt;
 -mtx    [&amp;lt;.mtx&amp;gt;]           (nm.mtx)         (Opt.)&lt;br /&gt;
           Hessian matrix&lt;br /&gt;
 -if     [&amp;lt;.xvg&amp;gt;]           (imdforces.xvg)  (Opt.)&lt;br /&gt;
           xvgr/xmgr file&lt;br /&gt;
 -swap   [&amp;lt;.xvg&amp;gt;]           (swapions.xvg)   (Opt.)&lt;br /&gt;
           xvgr/xmgr file&lt;br /&gt;
&lt;br /&gt;
Other options:&lt;br /&gt;
&lt;br /&gt;
 -deffnm &amp;lt;string&amp;gt;&lt;br /&gt;
           Set the default filename for all file options&lt;br /&gt;
 -xvg    &amp;lt;enum&amp;gt;             (xmgrace)&lt;br /&gt;
           xvg plot formatting: xmgrace, xmgr, none&lt;br /&gt;
 -dd     &amp;lt;vector&amp;gt;           (0 0 0)&lt;br /&gt;
           Domain decomposition grid, 0 is optimize&lt;br /&gt;
 -ddorder &amp;lt;enum&amp;gt;            (interleave)&lt;br /&gt;
           DD rank order: interleave, pp_pme, cartesian&lt;br /&gt;
 -npme   &amp;lt;int&amp;gt;              (-1)&lt;br /&gt;
           Number of separate ranks to be used for PME, -1 is guess&lt;br /&gt;
 -nt     &amp;lt;int&amp;gt;              (0)&lt;br /&gt;
           Total number of threads to start (0 is guess)&lt;br /&gt;
 -ntmpi  &amp;lt;int&amp;gt;              (0)&lt;br /&gt;
           Number of thread-MPI ranks to start (0 is guess)&lt;br /&gt;
 -ntomp  &amp;lt;int&amp;gt;              (0)&lt;br /&gt;
           Number of OpenMP threads per MPI rank to start (0 is guess)&lt;br /&gt;
 -ntomp_pme &amp;lt;int&amp;gt;           (0)&lt;br /&gt;
           Number of OpenMP threads per MPI rank to start (0 is -ntomp)&lt;br /&gt;
 -pin    &amp;lt;enum&amp;gt;             (auto)&lt;br /&gt;
           Whether mdrun should try to set thread affinities: auto, on, off&lt;br /&gt;
 -pinoffset &amp;lt;int&amp;gt;           (0)&lt;br /&gt;
           The lowest logical core number to which mdrun should pin the first&lt;br /&gt;
           thread&lt;br /&gt;
 -pinstride &amp;lt;int&amp;gt;           (0)&lt;br /&gt;
           Pinning distance in logical cores for threads, use 0 to minimize&lt;br /&gt;
           the number of threads per physical core&lt;br /&gt;
 -gpu_id &amp;lt;string&amp;gt;&lt;br /&gt;
           List of unique GPU device IDs available to use&lt;br /&gt;
 -gputasks &amp;lt;string&amp;gt;&lt;br /&gt;
           List of GPU device IDs, mapping each PP task on each node to a&lt;br /&gt;
           device&lt;br /&gt;
 -[no]ddcheck               (yes)&lt;br /&gt;
           Check for all bonded interactions with DD&lt;br /&gt;
 -rdd    &amp;lt;real&amp;gt;             (0)&lt;br /&gt;
           The maximum distance for bonded interactions with DD (nm), 0 is&lt;br /&gt;
           determine from initial coordinates&lt;br /&gt;
 -rcon   &amp;lt;real&amp;gt;             (0)&lt;br /&gt;
           Maximum distance for P-LINCS (nm), 0 is estimate&lt;br /&gt;
 -dlb    &amp;lt;enum&amp;gt;             (auto)&lt;br /&gt;
           Dynamic load balancing (with DD): auto, no, yes&lt;br /&gt;
 -dds    &amp;lt;real&amp;gt;             (0.8)&lt;br /&gt;
           Fraction in (0,1) by whose reciprocal the initial DD cell size will&lt;br /&gt;
           be increased in order to provide a margin in which dynamic load&lt;br /&gt;
           balancing can act while preserving the minimum cell size.&lt;br /&gt;
 -gcom   &amp;lt;int&amp;gt;              (-1)&lt;br /&gt;
           Global communication frequency&lt;br /&gt;
 -nb     &amp;lt;enum&amp;gt;             (auto)&lt;br /&gt;
           Calculate non-bonded interactions on: auto, cpu, gpu&lt;br /&gt;
 -nstlist &amp;lt;int&amp;gt;             (0)&lt;br /&gt;
           Set nstlist when using a Verlet buffer tolerance (0 is guess)&lt;br /&gt;
 -[no]tunepme               (yes)&lt;br /&gt;
           Optimize PME load between PP/PME ranks or GPU/CPU (only with the&lt;br /&gt;
           Verlet cut-off scheme)&lt;br /&gt;
 -pme    &amp;lt;enum&amp;gt;             (auto)&lt;br /&gt;
           Perform PME calculations on: auto, cpu, gpu&lt;br /&gt;
 -pmefft &amp;lt;enum&amp;gt;             (auto)&lt;br /&gt;
           Perform PME FFT calculations on: auto, cpu, gpu&lt;br /&gt;
 -bonded &amp;lt;enum&amp;gt;             (auto)&lt;br /&gt;
           Perform bonded calculations on: auto, cpu, gpu&lt;br /&gt;
 -[no]v                     (no)&lt;br /&gt;
           Be loud and noisy&lt;br /&gt;
 -pforce &amp;lt;real&amp;gt;             (-1)&lt;br /&gt;
           Print all forces larger than this (kJ/mol nm)&lt;br /&gt;
 -[no]reprod                (no)&lt;br /&gt;
           Try to avoid optimizations that affect binary reproducibility&lt;br /&gt;
 -cpt    &amp;lt;real&amp;gt;             (15)&lt;br /&gt;
           Checkpoint interval (minutes)&lt;br /&gt;
 -[no]cpnum                 (no)&lt;br /&gt;
           Keep and number checkpoint files&lt;br /&gt;
 -[no]append                (yes)&lt;br /&gt;
           Append to previous output files when continuing from checkpoint&lt;br /&gt;
           instead of adding the simulation part number to all file names&lt;br /&gt;
 -nsteps &amp;lt;int&amp;gt;              (-2)&lt;br /&gt;
           Run this number of steps (-1 means infinite, -2 means use mdp&lt;br /&gt;
           option, smaller is invalid)&lt;br /&gt;
 -maxh   &amp;lt;real&amp;gt;             (-1)&lt;br /&gt;
           Terminate after 0.99 times this time (hours)&lt;br /&gt;
 -replex &amp;lt;int&amp;gt;              (0)&lt;br /&gt;
           Attempt replica exchange periodically with this period (steps)&lt;br /&gt;
 -nex    &amp;lt;int&amp;gt;              (0)&lt;br /&gt;
           Number of random exchanges to carry out each exchange interval (N^3&lt;br /&gt;
           is one suggestion).  -nex zero or not specified gives neighbor&lt;br /&gt;
           replica exchange.&lt;br /&gt;
 -reseed &amp;lt;int&amp;gt;              (-1)&lt;br /&gt;
           Seed for replica exchange, -1 is generate a seed&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Phillips</name></author>
	</entry>
	<entry>
		<id>https://rcs.ucalgary.ca/index.php?title=Mathematica&amp;diff=590</id>
		<title>Mathematica</title>
		<link rel="alternate" type="text/html" href="https://rcs.ucalgary.ca/index.php?title=Mathematica&amp;diff=590"/>
		<updated>2020-05-28T07:27:32Z</updated>

		<summary type="html">&lt;p&gt;Phillips: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Mathematica]]&lt;br /&gt;
[[Category:Software]]&lt;br /&gt;
[[Category:ARC]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;contents&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
= &amp;lt;span id=&amp;quot;intro&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Introduction =&lt;br /&gt;
&lt;br /&gt;
[https://www.wolfram.com/mathematica/ Mathematica (external link)] is a general-purpose high-level programming package for both symbolic and numerical calculations.&lt;br /&gt;
&lt;br /&gt;
The main purpose of this page is to show how to use Mathematica on the University of Calgary [[ ARC_Cluster_Guide |ARC (Advanced Research Computing) cluster]]. It is presumed that you already have an account an ARC and have read the material on reserving resources and [[Running jobs|running jobs]] with the Slurm job management system.&lt;br /&gt;
&lt;br /&gt;
= &amp;lt;span id=&amp;quot;license&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Licensing =&lt;br /&gt;
At the University of Calgary, Information Technologies has purchased a site license for using Mathematica for teaching and learning and non-commercial research purposes.  The software has been installed on the ARC cluster, where multiple instances can be run at the same time.  When Mathematica starts up, it checks with a central license server.&lt;br /&gt;
&lt;br /&gt;
For information about installing Mathematica on your own computer, see the Information Technologies Knowledge Base [https://ucalgary.service-now.com/it?id=kb_article&amp;amp;sys_id=9773754113f9bac08246f7b2e144b013 article on Mathematica].&lt;br /&gt;
&lt;br /&gt;
= Running Mathematica on the ARC cluster =&lt;br /&gt;
Although it is possible to run Mathematica interactively (with or without a graphical user interface) on a compute node reserved with the Slurm salloc command, the expectation is that most calculations with Mathematica on ARC will be completed by submitting a batch job script to the Slurm job scheduler with the &#039;&#039;&#039;sbatch&#039;&#039;&#039; command.&lt;br /&gt;
&lt;br /&gt;
Suppose that the following Mathematica code to print out the first million prime numbers is in a file, primes_list.m :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
primeslist = Table[Prime[k],{k,1,1000000}];&lt;br /&gt;
Export[&amp;quot;primes_1000000.out&amp;quot;,primeslist,&amp;quot;Table&amp;quot;,&amp;quot;FieldSeparators&amp;quot;-&amp;gt;&amp;quot; &amp;quot;];&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that formatted Mathematica notebooks cannot be used directly. You need to convert your notebook to a text-format &amp;quot;.m&amp;quot; file, as discussed, for example, [https://mathematica.stackexchange.com/questions/137925/how-can-i-get-the-m-file-with-mathematica here (external link)]. The general idea is to mark cells to be executed as initialization cells and then use &amp;quot;File-&amp;gt;Save as&amp;quot; menu item with the &amp;quot;Package&amp;quot; option to produce the .m file.&lt;br /&gt;
&lt;br /&gt;
The following Slurm batch job script, primes_list.slurm, can be used to run the primes_list.m code on a single complete compute node.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH --nodes=1&lt;br /&gt;
#SBATCH --time=00:30:00&lt;br /&gt;
#SBATCH --mem=0&lt;br /&gt;
#SBATCH --partition=pawson-bf,apophis-bf,razi-bf,single,lattice,parallel,cpu2019,cpu2013&lt;br /&gt;
&lt;br /&gt;
# Mathematica batch processing example.&lt;br /&gt;
# 2020-05-28.&lt;br /&gt;
&lt;br /&gt;
# Select Mathematica command to run:&lt;br /&gt;
MATH=/global/software/mathematica/mathematica1101/bin/math&lt;br /&gt;
&lt;br /&gt;
# Specify the name of the input file of Mathematica text commands:&lt;br /&gt;
INPUT=primes_list.m&lt;br /&gt;
OUTPUT=$(basename $INPUT .m)_${SLURM_JOB_ID}.out&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Current working directory is $(pwd)&amp;quot;&lt;br /&gt;
echo &amp;quot;Running on compute node $(hostname)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Starting run at: $(date)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
$MATH -noprompt -run -script $INPUT &amp;gt; $OUTPUT&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Finished with at: $(date)&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Note that the name of the executable for running Mathematica without a graphical interface is &amp;quot;math&amp;quot;.&lt;br /&gt;
Submit the job with &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sbatch primes_list.slurm&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
For the case of million primes, the run took about 30 seconds on a compute node in one of the slowest partitions (single) on ARC.  The time and memory limits should be adjusted to match the requirements of your calculations, but, some testing is usually required to fine tune those settings.&lt;/div&gt;</summary>
		<author><name>Phillips</name></author>
	</entry>
	<entry>
		<id>https://rcs.ucalgary.ca/index.php?title=Mathematica&amp;diff=589</id>
		<title>Mathematica</title>
		<link rel="alternate" type="text/html" href="https://rcs.ucalgary.ca/index.php?title=Mathematica&amp;diff=589"/>
		<updated>2020-05-28T07:18:42Z</updated>

		<summary type="html">&lt;p&gt;Phillips: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Mathematica]]&lt;br /&gt;
[[Category:Software]]&lt;br /&gt;
[[Category:ARC]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;contents&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= &amp;lt;span id=&amp;quot;intro&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Introduction =&lt;br /&gt;
&lt;br /&gt;
[https://www.wolfram.com/mathematica/ Mathematica (external link)] is a general-purpose high-level programming package for both symbolic and numerical calculations.&lt;br /&gt;
&lt;br /&gt;
The main purpose of this page is to show how to use Mathematica on the University of Calgary [[ ARC_Cluster_Guide |ARC (Advanced Research Computing) cluster]]. It is presumed that you already have an account an ARC and have read the material on reserving resources and [[Running jobs|running jobs]] with the Slurm job management system.&lt;br /&gt;
&lt;br /&gt;
= &amp;lt;span id=&amp;quot;license&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Licensing =&lt;br /&gt;
At the University of Calgary, Information Technologies has purchased a site license for using Mathematica for teaching and learning and non-commercial research purposes.  The software has been installed on the ARC cluster, where multiple instances can be run at the same time.  When Mathematica starts up, it checks with a central license server.&lt;br /&gt;
&lt;br /&gt;
For information about installing Mathematica on your own computer, see the Information Technologies Knowledge Base [https://ucalgary.service-now.com/it?id=kb_article&amp;amp;sys_id=9773754113f9bac08246f7b2e144b013 article on Mathematica].&lt;br /&gt;
&lt;br /&gt;
= Running Mathematica on the ARC cluster =&lt;br /&gt;
Although it is possible to run Mathematica interactively (with or without a graphical user interface) on a compute node reserved with the Slurm salloc command, the expectation is that most calculations with Mathematica on ARC will be completed by submitting a batch job script to the Slurm job scheduler with the &#039;&#039;&#039;sbatch&#039;&#039;&#039; command.&lt;br /&gt;
&lt;br /&gt;
Suppose that the following Mathematica code to print out the first million prime numbers is in a file, primes_list.m :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
primeslist = Table[Prime[k],{k,1,1000000}];&lt;br /&gt;
Export[&amp;quot;primes_1000000.out&amp;quot;,primeslist,&amp;quot;Table&amp;quot;,&amp;quot;FieldSeparators&amp;quot;-&amp;gt;&amp;quot; &amp;quot;];&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that formatted Mathematica notebooks cannot be used directly. You need to convert your notebook to a text-format &amp;quot;.m&amp;quot; file, as discussed, for example, [https://mathematica.stackexchange.com/questions/137925/how-can-i-get-the-m-file-with-mathematica here (external link)]. The general idea is to mark cells to be executed as initialization cells and then use &amp;quot;File-&amp;gt;Save as&amp;quot; menu item with the &amp;quot;Package&amp;quot; option to produce the .m file.&lt;br /&gt;
&lt;br /&gt;
The following Slurm batch job script, primes_list.slurm, can be used to run the primes_list.m code on a single complete compute node.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH --nodes=1&lt;br /&gt;
#SBATCH --time=00:30:00&lt;br /&gt;
#SBATCH --mem=0&lt;br /&gt;
#SBATCH --partition=pawson-bf,apophis-bf,razi-bf,single,lattice,parallel,cpu2019,cpu2013&lt;br /&gt;
&lt;br /&gt;
# Mathematica batch processing example.&lt;br /&gt;
# 2020-05-28.&lt;br /&gt;
&lt;br /&gt;
# Select Mathematica command to run:&lt;br /&gt;
MATH=/global/software/mathematica/mathematica1101/bin/math&lt;br /&gt;
&lt;br /&gt;
# Specify the name of the input file of Mathematica text commands:&lt;br /&gt;
INPUT=primes_list.m&lt;br /&gt;
OUTPUT=$(basename $INPUT .m)_${SLURM_JOB_ID}.out&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Current working directory is $(pwd)&amp;quot;&lt;br /&gt;
echo &amp;quot;Running on compute node $(hostname)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Starting run at: $(date)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
$MATH -noprompt -run -script $INPUT &amp;gt; $OUTPUT&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Finished with at: $(date)&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Note that the name of the executable for running Mathematica without a graphical interface is &amp;quot;math&amp;quot;.&lt;br /&gt;
Submit the job with &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sbatch primes_list.slurm&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
For the case of million primes, the run took about 30 seconds on a compute node in one of the slowest partitions (single) on ARC.  The time and memory limits should be adjusted to match the requirements of your calculations, but, some testing is usually required to fine tune those settings.&lt;/div&gt;</summary>
		<author><name>Phillips</name></author>
	</entry>
	<entry>
		<id>https://rcs.ucalgary.ca/index.php?title=Mathematica&amp;diff=588</id>
		<title>Mathematica</title>
		<link rel="alternate" type="text/html" href="https://rcs.ucalgary.ca/index.php?title=Mathematica&amp;diff=588"/>
		<updated>2020-05-28T07:16:36Z</updated>

		<summary type="html">&lt;p&gt;Phillips: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Mathematica]]&lt;br /&gt;
[[Category:Software]]&lt;br /&gt;
[[Category:ARC]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;contents&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= &amp;lt;span id=&amp;quot;intro&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Introduction =&lt;br /&gt;
&lt;br /&gt;
[https://www.wolfram.com/mathematica/ Mathematica (external link)] is a general-purpose high-level programming package for both symbolic and numerical calculations.&lt;br /&gt;
&lt;br /&gt;
The main purpose of this page is to show how to use Mathematica on the University of Calgary [[ ARC_Cluster_Guide |ARC (Advanced Research Computing) cluster]]. It is presumed that you already have an account an ARC and have read the material on reserving resources and [[Running jobs|running jobs]] with the Slurm job management system.&lt;br /&gt;
&lt;br /&gt;
= &amp;lt;span id=&amp;quot;license&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Licensing =&lt;br /&gt;
At the University of Calgary, Information Technologies has purchased a site license for using Mathematica for teaching and learning and non-commercial research purposes.  The software has been installed on the ARC cluster, where multiple instances can be run at the same time.  When Mathematica starts up, it checks with a central license server.&lt;br /&gt;
&lt;br /&gt;
For information about installing Mathematica on your own computer, see the Information Technologies Knowledge Base [https://ucalgary.service-now.com/it?id=kb_article&amp;amp;sys_id=9773754113f9bac08246f7b2e144b013 article on Mathematica].&lt;br /&gt;
&lt;br /&gt;
= Running Mathematica on the ARC cluster =&lt;br /&gt;
Although it is possible to run Mathematica interactively, the expectation is that most calculations with Mathematica on ARC will be completed by submitting a batch job script to the Slurm job scheduler with the sbatch command.&lt;br /&gt;
&lt;br /&gt;
Suppose that the following Mathematica code to print out the first million prime numbers is in a file, primes_list.m :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
primeslist = Table[Prime[k],{k,1,1000000}];&lt;br /&gt;
Export[&amp;quot;primes_1000000.out&amp;quot;,primeslist,&amp;quot;Table&amp;quot;,&amp;quot;FieldSeparators&amp;quot;-&amp;gt;&amp;quot; &amp;quot;];&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that formatted Mathematica notebooks cannot be used directly. You need to convert your notebook to a text-format &amp;quot;.m&amp;quot; file, as discussed, for example, [https://mathematica.stackexchange.com/questions/137925/how-can-i-get-the-m-file-with-mathematica here (external link)]. The general idea is to mark cells to be executed as initialization cells and then use &amp;quot;File-&amp;gt;Save as&amp;quot; menu item with the &amp;quot;Package&amp;quot; option to produce the .m file.&lt;br /&gt;
&lt;br /&gt;
The following Slurm batch job script, primes_list.slurm, can be used to run the primes_list.m code on a single complete compute node.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH --nodes=1&lt;br /&gt;
#SBATCH --time=00:30:00&lt;br /&gt;
#SBATCH --mem=0&lt;br /&gt;
#SBATCH --partition=pawson-bf,apophis-bf,razi-bf,single,lattice,parallel,cpu2019,cpu2013&lt;br /&gt;
&lt;br /&gt;
# Mathematica batch processing example.&lt;br /&gt;
# 2020-05-28.&lt;br /&gt;
&lt;br /&gt;
# Select Mathematica command to run:&lt;br /&gt;
MATH=/global/software/mathematica/mathematica1101/bin/math&lt;br /&gt;
&lt;br /&gt;
# Specify the name of the input file of Mathematica text commands:&lt;br /&gt;
INPUT=primes_list.m&lt;br /&gt;
OUTPUT=$(basename $INPUT .m)_${SLURM_JOB_ID}.out&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Current working directory is $(pwd)&amp;quot;&lt;br /&gt;
echo &amp;quot;Running on compute node $(hostname)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Starting run at: $(date)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
$MATH -noprompt -run -script $INPUT &amp;gt; $OUTPUT&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Finished with at: $(date)&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Note that the name of the executable for running Mathematica without a graphical interface is &amp;quot;math&amp;quot;.&lt;br /&gt;
Submit the job with &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sbatch primes_list.slurm&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
For the case of million primes, the run took about 30 seconds on a compute node in one of the slowest partitions (single) on ARC.  The time and memory limits should be adjusted to match the requirements of your calculations, but, some testing is usually required to fine tune those settings.&lt;/div&gt;</summary>
		<author><name>Phillips</name></author>
	</entry>
	<entry>
		<id>https://rcs.ucalgary.ca/index.php?title=Mathematica&amp;diff=587</id>
		<title>Mathematica</title>
		<link rel="alternate" type="text/html" href="https://rcs.ucalgary.ca/index.php?title=Mathematica&amp;diff=587"/>
		<updated>2020-05-28T07:06:35Z</updated>

		<summary type="html">&lt;p&gt;Phillips: Add example&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Mathematica]]&lt;br /&gt;
[[Category:Software]]&lt;br /&gt;
[[Category:ARC]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;contents&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= &amp;lt;span id=&amp;quot;intro&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Introduction =&lt;br /&gt;
&lt;br /&gt;
[https://www.wolfram.com/mathematica/ Mathematica (external link)] is a general-purpose high-level programming package for both symbolic and numerical calculations.&lt;br /&gt;
&lt;br /&gt;
The main purpose of this page is to show how to use Mathematica on the University of Calgary [[ ARC_Cluster_Guide |ARC (Advanced Research Computing) cluster]]. It is presumed that you already have an account an ARC and have read the material on reserving resources and [[Running jobs|running jobs]] with the Slurm job management system.&lt;br /&gt;
&lt;br /&gt;
= &amp;lt;span id=&amp;quot;license&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Licensing =&lt;br /&gt;
At the University of Calgary, Information Technologies has purchased a site license for using Mathematica for teaching and learning and non-commercial research purposes.  The software has been installed on the ARC cluster, where multiple instances can be run at the same time.  When Mathematica starts up, it checks with a central license server.&lt;br /&gt;
&lt;br /&gt;
For information about installing Mathematica on your own computer, see the Information Technologies Knowledge Base [https://ucalgary.service-now.com/it?id=kb_article&amp;amp;sys_id=9773754113f9bac08246f7b2e144b013 article on Mathematica].&lt;br /&gt;
&lt;br /&gt;
= Running Mathematica on the ARC cluster =&lt;br /&gt;
Although it is possible to run Mathematica interactively, the expectation is that most calculations with Mathematica on ARC will be completed by submitting a batch job script to the Slurm job scheduler with the sbatch command.&lt;br /&gt;
&lt;br /&gt;
Suppose that the following Mathematica code to print out the first million prime numbers is in a file, prime_list.m :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
primelist = Table[Prime[k],{k,1,1000000}];&lt;br /&gt;
Export[&amp;quot;primes_1000000.out&amp;quot;,primelist,&amp;quot;Table&amp;quot;,&amp;quot;FieldSeparators&amp;quot;-&amp;gt;&amp;quot; &amp;quot;];&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The following Slurm batch job script, prime_list.slurm, can be used to run the prime_list.m code on a single complete compute node.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH --nodes=1&lt;br /&gt;
#SBATCH --time=00:30:00&lt;br /&gt;
#SBATCH --mem=0&lt;br /&gt;
#SBATCH --partition=pawson-bf,apophis-bf,razi-bf,single,lattice,parallel,cpu2019,cpu2013&lt;br /&gt;
&lt;br /&gt;
# Mathematica batch processing example.&lt;br /&gt;
# 2020-05-28.&lt;br /&gt;
&lt;br /&gt;
# Select Mathematica command to run:&lt;br /&gt;
MATH=/global/software/mathematica/mathematica1101/bin/math&lt;br /&gt;
&lt;br /&gt;
# Specify the name of the input file of Mathematica text commands:&lt;br /&gt;
INPUT=primes_list.m&lt;br /&gt;
OUTPUT=$(basename $INPUT .m)_${SLURM_JOB_ID}.out&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Current working directory is $(pwd)&amp;quot;&lt;br /&gt;
echo &amp;quot;Running on compute node $(hostname)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Starting run at: $(date)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
$MATH -noprompt -run -script $INPUT &amp;gt; $OUTPUT&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Finished with at: $(date)&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Submit the job with &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sbatch primes_list.slurm&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
For the case of million primes, the run took about 30 seconds on a compute node in one of the slowest partitions (single) on ARC.  The time and memory limits should be adjusted to match the requirements of your calculations, but, some testing is usually required to fine tune those settings.&lt;/div&gt;</summary>
		<author><name>Phillips</name></author>
	</entry>
	<entry>
		<id>https://rcs.ucalgary.ca/index.php?title=Mathematica&amp;diff=586</id>
		<title>Mathematica</title>
		<link rel="alternate" type="text/html" href="https://rcs.ucalgary.ca/index.php?title=Mathematica&amp;diff=586"/>
		<updated>2020-05-28T06:48:11Z</updated>

		<summary type="html">&lt;p&gt;Phillips: Mathematica page created&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Mathematica]]&lt;br /&gt;
[[Category:Software]]&lt;br /&gt;
[[Category:ARC]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;contents&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= &amp;lt;span id=&amp;quot;intro&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Introduction =&lt;br /&gt;
&lt;br /&gt;
[https://www.wolfram.com/mathematica/ Mathematica (external link)] is a general-purpose high-level programming package for both symbolic and numerical calculations.&lt;br /&gt;
&lt;br /&gt;
The main purpose of this page is to show how to use Mathematica on the University of Calgary [[ ARC_Cluster_Guide |ARC (Advanced Research Computing) cluster]]. It is presumed that you already have an account an ARC and have read the material on reserving resources and [[Running jobs|running jobs]] with the Slurm job management system.&lt;br /&gt;
&lt;br /&gt;
= &amp;lt;span id=&amp;quot;license&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Licensing =&lt;br /&gt;
At the University of Calgary, Information Technologies has purchased a site license for using Mathematica for teaching and learning and non-commercial research purposes.  The software has been installed on the ARC cluster, where multiple instances can be run at the same time.  When Mathematica starts up, it checks with a central license server.&lt;br /&gt;
&lt;br /&gt;
For information about installing Mathematica on your own computer, see the Information Technologies Knowledge Base [https://ucalgary.service-now.com/it?id=kb_article&amp;amp;sys_id=9773754113f9bac08246f7b2e144b013 article on Mathematica].&lt;br /&gt;
&lt;br /&gt;
= Running Mathematica on the ARC cluster =&lt;br /&gt;
Although it is possible to run Mathematica interactively, the expectation is that most calculations with Mathematica on ARC will be completed by submitting a batch job script to the Slurm job scheduler with the sbatch command.&lt;/div&gt;</summary>
		<author><name>Phillips</name></author>
	</entry>
	<entry>
		<id>https://rcs.ucalgary.ca/index.php?title=ARC_Software&amp;diff=585</id>
		<title>ARC Software</title>
		<link rel="alternate" type="text/html" href="https://rcs.ucalgary.ca/index.php?title=ARC_Software&amp;diff=585"/>
		<updated>2020-05-28T06:27:21Z</updated>

		<summary type="html">&lt;p&gt;Phillips: Add Mathematica&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Chemistry =&lt;br /&gt;
&lt;br /&gt;
* [[Gaussian on ARC | Gaussian 16]]&lt;br /&gt;
* [[GROMACS]] -- classical molecular dynamics simulator.&lt;br /&gt;
&lt;br /&gt;
= Geospatial Analysis =&lt;br /&gt;
&lt;br /&gt;
* [[GDAL on ARC | GDAL]]&lt;br /&gt;
&lt;br /&gt;
* [[Geopandas on ARC | Geopandas]]&lt;br /&gt;
&lt;br /&gt;
= Machine Learning =&lt;br /&gt;
&lt;br /&gt;
* [[Tensorflow on ARC | Tensorflow]]&lt;br /&gt;
&lt;br /&gt;
* [[Torch on ARC | PyTorch]]&lt;br /&gt;
&lt;br /&gt;
= Mathematical Libaries and Applications =&lt;br /&gt;
&lt;br /&gt;
* [[MATLAB | Using MATLAB on ARC]]&lt;br /&gt;
* [[Mathematica | Using Mathematica on ARC]]&lt;br /&gt;
&lt;br /&gt;
= Neuroimaging =&lt;br /&gt;
&lt;br /&gt;
* [[FSL on ARC | Freesurfer]]&lt;br /&gt;
&lt;br /&gt;
* [[Statistical Parametric Mapping on ARC | SPM 12]]&lt;br /&gt;
&lt;br /&gt;
= Package Management =&lt;br /&gt;
&lt;br /&gt;
* [[Conda on ARC | Conda]]&lt;br /&gt;
&lt;br /&gt;
= Statistics =&lt;br /&gt;
&lt;br /&gt;
* [[R on ARC | R]]&lt;br /&gt;
&lt;br /&gt;
* [[Stan on ARC | rstan]]&lt;br /&gt;
&lt;br /&gt;
= Reservoir Simulations =&lt;br /&gt;
&lt;br /&gt;
= Bioinformatics =&lt;/div&gt;</summary>
		<author><name>Phillips</name></author>
	</entry>
	<entry>
		<id>https://rcs.ucalgary.ca/index.php?title=ARC_Software&amp;diff=584</id>
		<title>ARC Software</title>
		<link rel="alternate" type="text/html" href="https://rcs.ucalgary.ca/index.php?title=ARC_Software&amp;diff=584"/>
		<updated>2020-05-28T06:26:19Z</updated>

		<summary type="html">&lt;p&gt;Phillips: Add MATLAB&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Chemistry =&lt;br /&gt;
&lt;br /&gt;
* [[Gaussian on ARC | Gaussian 16]]&lt;br /&gt;
* [[GROMACS]] -- classical molecular dynamics simulator.&lt;br /&gt;
&lt;br /&gt;
= Geospatial Analysis =&lt;br /&gt;
&lt;br /&gt;
* [[GDAL on ARC | GDAL]]&lt;br /&gt;
&lt;br /&gt;
* [[Geopandas on ARC | Geopandas]]&lt;br /&gt;
&lt;br /&gt;
= Machine Learning =&lt;br /&gt;
&lt;br /&gt;
* [[Tensorflow on ARC | Tensorflow]]&lt;br /&gt;
&lt;br /&gt;
* [[Torch on ARC | PyTorch]]&lt;br /&gt;
&lt;br /&gt;
= Mathematical Libaries and Applications =&lt;br /&gt;
&lt;br /&gt;
* [[MATLAB | Using MATLAB on ARC]]&lt;br /&gt;
&lt;br /&gt;
= Neuroimaging =&lt;br /&gt;
&lt;br /&gt;
* [[FSL on ARC | Freesurfer]]&lt;br /&gt;
&lt;br /&gt;
* [[Statistical Parametric Mapping on ARC | SPM 12]]&lt;br /&gt;
&lt;br /&gt;
= Package Management =&lt;br /&gt;
&lt;br /&gt;
* [[Conda on ARC | Conda]]&lt;br /&gt;
&lt;br /&gt;
= Statistics =&lt;br /&gt;
&lt;br /&gt;
* [[R on ARC | R]]&lt;br /&gt;
&lt;br /&gt;
* [[Stan on ARC | rstan]]&lt;br /&gt;
&lt;br /&gt;
= Reservoir Simulations =&lt;br /&gt;
&lt;br /&gt;
= Bioinformatics =&lt;/div&gt;</summary>
		<author><name>Phillips</name></author>
	</entry>
	<entry>
		<id>https://rcs.ucalgary.ca/index.php?title=ARC_Cluster_Guide&amp;diff=583</id>
		<title>ARC Cluster Guide</title>
		<link rel="alternate" type="text/html" href="https://rcs.ucalgary.ca/index.php?title=ARC_Cluster_Guide&amp;diff=583"/>
		<updated>2020-05-28T00:14:15Z</updated>

		<summary type="html">&lt;p&gt;Phillips: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:ARC Cluster]]&lt;br /&gt;
This guide gives an overview of the ARC (Advanced Research Computing) cluster at the University of Calgary.&lt;br /&gt;
&lt;br /&gt;
It is intended to be read by new account holders getting started on ARC, covering such topics as the hardware and performance characteristics, available software, usage policies and how to log in and run jobs. &lt;br /&gt;
&lt;br /&gt;
For ARC-related questions not answered here, please write to support@hpc.ucalgary.ca .&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Cybersecurity awareness at the U of C&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Please note that there are typically about 950 phishing attempts targeting University of Calgary accounts each month. This is just a reminder to be careful about computer security issues, both at home and at the University. See [https://it.ucalgary.ca/it-security] for more information, such as tips for secure computing and how to report suspected security problems.&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
ARC is a cluster primarily comprised of Linux-based computers repurposed from several separate older clusters (Breezy, Lattice, Parallel) that were formerly offered to researchers from across Canada.  In addition, a large-memory compute node (Bigbyte) was salvaged from the now-retired local Storm cluster. In January 2019, a major addition to ARC was purchased, with modern hardware.&lt;br /&gt;
&lt;br /&gt;
In this new configuration, as ARC, the computational resources of these clusters are now being restricted to research projects based at the University of Calgary.  ARC is meant to supplement the resources available to researchers through Compute Canada. You can read about those machines at the Compute Canada web site.&lt;br /&gt;
&lt;br /&gt;
The ARC cluster can be used for running large numbers (hundreds) of concurrent serial (one-core) jobs, OpenMP or other thread-based, shared-memory parallel codes using up to 40 threads per job (or even 80 on one large node), or distributed-memory (MPI-based) parallel codes using up to hundreds of cores.  Software that make use of Graphics Processing Units (GPUs) can also be used.&lt;br /&gt;
&lt;br /&gt;
== Accounts ==&lt;br /&gt;
If you have a project you think would be appropriate for ARC, please write to support@hpc.ucalgary.ca .  To assist you getting started, it would be helpful if you mention what software you plan to use.&lt;br /&gt;
&lt;br /&gt;
Note that University of Calgary Information Technologies computing account credentials are used for ARC (the same as used for University of Calgary email accounts). If you don&#039;t have a University of Calgary email address, please register for one at https://itregport.ucalgary.ca/ and include your email address in your request for a ARC account. &lt;br /&gt;
&lt;br /&gt;
If you don&#039;t have University of Calgary credentials because you are external to the University you may still apply for an account if you are collaborating on a project with a University of Calgary faculty member.  In your email, please explain your situation and mention the project leader involved.&lt;br /&gt;
&lt;br /&gt;
== Hardware ==&lt;br /&gt;
=== Processors ===&lt;br /&gt;
Besides login and administrative servers, the ARC hardware consists of compute nodes of several types. When submitting jobs to run on the cluster, you can specify a partition parameter to select the particular type of hardware that is most appropriate for your work. See the [[ARC Hardware|ARC Hardware page]] for further technical details about the hardware if you are interested, but, most users will only need to be aware of the processor count and memory characteristics given in the section on [[#Selecting a partition|selecting a partition]] below. &lt;br /&gt;
&lt;br /&gt;
=== Network (interconnect) ===&lt;br /&gt;
Most of the partitions have a high-speed interconnect between the compute nodes, making them suitable for multi-node parallel processing.  It is sometimes important to make a distinction in the type of network technology used, as some software may be built to work with libraries supporting one type of network and not another. &lt;br /&gt;
&lt;br /&gt;
The compute nodes in some of the partitions (cpu2019, apophis, apophis-bf, pawson, pawson-bf, razi and razi-bf) communicate via a 100 Gbit/s Omni-Path network, whereas the older compute nodes within the lattice and parallel cluster partitions use 40 Gbit/s InfiniBand.  A bit more detail is given on the [ARC Hardware page].&lt;br /&gt;
&lt;br /&gt;
=== Storage ===&lt;br /&gt;
About a petabyte of raw disk storage is available to the ARC cluster, but for error checking and performance reasons, the amount of usable storage for researchers&#039; projects is considerably less than that.  From a user&#039;s perspective, the total amount of storage is less important than the individual storage limits.  As described below, there are three storage areas: home, scratch and work, with different limits and usage policies.&lt;br /&gt;
&lt;br /&gt;
==== Home file system: /home ====&lt;br /&gt;
There is a per-user quota of 500 GB under /home. This limit is fixed and cannot be increased.  Each user has a directory under /home, which is the default working directory when logging in to ARC. It is expected that most researchers will be able to do their work from within their home directories, but, there are two options (/work and /scratch) for accessing more space.&lt;br /&gt;
&lt;br /&gt;
Note on file sharing: Due to security concerns, permissions set on your home directory with the chmod command, to allow others to share your files, will be automatically removed by a system monitoring process unless an explicit exception is made. If you need to share files with other researchers on the ARC cluster, please write to support@hpc.ucalgary.ca to ask for such an exception.&lt;br /&gt;
&lt;br /&gt;
==== Scratch file system for large job-oriented storage: /scratch ====&lt;br /&gt;
Associated with each job, under the /scratch directory, a subdirectory is created that can be referenced in job scripts as /scratch/${SLURM_JOB_ID}. You can use that directory for temporary files needed during the course of a job. Up to 30 TB of storage may be used, per user (total for all your jobs) in the /scratch file system.  Deletion policy: data in /scratch associated with a given job will be deleted automatically, without exception, five days after the job finishes.&lt;br /&gt;
&lt;br /&gt;
==== Work file system for larger projects: /work ====&lt;br /&gt;
If you need more space than provided in /home and the /scratch job-oriented space is not appropriate for you case, please write to support@hpc.ucalgary.ca with an explanation, including an indication of how much storage you expect to need and for how long.  If approved, you will then be assigned a directory under /work with an appropriately large quota.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Backup policy:&#039;&#039;&#039; you are responsible for your own backups.  Many researchers will have accounts with Compute Canada and may choose to back up their data there (the Project file system accessible through the Cedar cluster would often be used).  We can explain more about this option if you write to support@hpc.ucalgary.ca .&lt;br /&gt;
&lt;br /&gt;
== Software ==&lt;br /&gt;
Look for installed software under /global/software and through the module avail command (described below). Links to documentation for some of the installed software is highlighted on a [[ARC_Software_pages|separate Wiki page]].&lt;br /&gt;
&lt;br /&gt;
The setup of the environment for using some of the installed software is through the module command. An overview of [https://www.westgrid.ca//support/modules modules on WestGrid (external link)] is largely applicable to ARC.&lt;br /&gt;
&lt;br /&gt;
To list available modules, type:&lt;br /&gt;
&lt;br /&gt;
 module avail&lt;br /&gt;
&lt;br /&gt;
So, for example, to load a module for Python use:&lt;br /&gt;
&lt;br /&gt;
 module load python/anaconda-3.6-5.1.0&lt;br /&gt;
&lt;br /&gt;
and to remove it use:&lt;br /&gt;
&lt;br /&gt;
 module remove python/anaconda-3.6-5.1.0&lt;br /&gt;
&lt;br /&gt;
To see currently loaded modules, type:&lt;br /&gt;
&lt;br /&gt;
 module list&lt;br /&gt;
&lt;br /&gt;
Unlike some clusters, there are no modules loaded by default.  So, for example, to use Intel compilers, or to use Open MPI parallel programming, you must load an appropriate module.&lt;br /&gt;
&lt;br /&gt;
Write to support@hpc.ucalgary.ca if you need additional software installed.&lt;br /&gt;
&lt;br /&gt;
== Using ARC ==&lt;br /&gt;
=== Logging in ===&lt;br /&gt;
To log in to ARC, connect to arc.ucalgary.ca using an ssh (secure shell) client. For more information about connecting and setting up your environment, the WestGrid [http://www.westgrid.ca/support/quickstart/new_users QuickStart Guide for New Users] may be helpful.  Note that connections are accepted only from on-campus IP addresses. You can connect from off-campus by using Virtual Private Network (VPN) software available from [https://ucalgary.service-now.com/it?id=kb_article&amp;amp;sys_id=880e71071381ae006f3afbb2e144b05c Information Techologies].&lt;br /&gt;
&lt;br /&gt;
=== Storage ===&lt;br /&gt;
Please review the [[#Storage|Storage]] section above for important policies and advice regarding file storage and file sharing.&lt;br /&gt;
&lt;br /&gt;
=== Working interactively ===&lt;br /&gt;
ARC uses the Linux operating system. The program that responds to your typed commands and allows you to run other programs is called the Linux shell. There are several different shells available, but, by default you will use one called bash. It is useful to have some knowledge of the shell and a variety of other command-line programs that you can use to manipulate files. If you are new to Linux systems, we recommend that you work through one of the many online tutorials that are available, such as the [http://www.ee.surrey.ac.uk/Teaching/Unix/index.html UNIX Tutorial for Beginners (external link)] provided by the University of Surrey. The tutorial covers such fundamental topics, among others, as creating, renaming and deleting files and directories, how to produce a listing of your files and how to tell how much disk space you are using.  For a more comprehensive introduction to Linux, see [http://linuxcommand.sourceforge.net/tlcl.php The Linux Command Line (external link)].&lt;br /&gt;
&lt;br /&gt;
The ARC login node may be used for such tasks as editing files, compiling programs and running short tests while developing programs (under 15 minutes, say). Processors may also be reserved for interactive sessions using the salloc command specifying the resources needed through arguments on the salloc command line.&lt;br /&gt;
&lt;br /&gt;
=== Running non-interactive jobs (batch processing) ===&lt;br /&gt;
Production runs and longer test runs should be submitted as (non-interactive) batch jobs, in which commands to be executed are listed in a script (text file). Batch jobs scripts are submitted using the sbatch command, part of the Slurm job management and scheduling software. #SBATCH directive lines at the beginning of the script are used to specify the resources needed for the job (cores, memory, run time limit and any specialized hardware needed).&lt;br /&gt;
&lt;br /&gt;
Most of the information on the [https://docs.computecanada.ca/wiki/Running_jobs Running Jobs (external link)] page on the Compute Canada web site is also relevant for submitting and managing batch jobs and reserving processors for interactive work on ARC.  One major difference between running jobs on the ARC and Compute Canada clusters is in selecting the type of hardware that should be used for a job. On ARC, you choose the hardware to use primarily by specifying a partition, as described below.&lt;br /&gt;
&lt;br /&gt;
=== Selecting a partition ===&lt;br /&gt;
The type of computer on which a job can or should be run is determined by characteristics of your software, such as whether it supports parallel processing and by simulation or data-dependent factors such as the amount of memory required.  If the program you are running uses MPI (Message Passing Interface) for parallel processing, which allows the memory usage to be distributed across multiple compute nodes, then, the memory required per MPI process is an important factor.  If you are running a serial code (that is, it is not able to use multiple CPU cores) or one that is parallelized with OpenMP or other thread-based techniques that restrict it to running on just a single compute node, then, the total memory required is the main factor to consider.  If your program can make use of graphics processing units, then, that will be the determining factor.  If you have questions about which ARC hardware to use, please write to [[mailto:support@hpc.ucalgary.ca]] and we would be happy to discuss this with you.&lt;br /&gt;
&lt;br /&gt;
One you have decided what type of hardware best suits your calculations, you can select it on a job-by-job basis by including the &#039;&#039;&#039;partition&#039;&#039;&#039; keyword for an &#039;&#039;&#039;SBATCH&#039;&#039;&#039; directive in your batch job. The tables below summarize the characteristics of the various partitions&lt;br /&gt;
&lt;br /&gt;
If you omit the partition specification, the system will try to assign your job to appropriate hardware based on other aspects of your request, but, for more control you can specify one or more partitions yourself.  You are allowed to specify a comma-separate list of partitions. &lt;br /&gt;
&lt;br /&gt;
In some cases, you really should specify the partition explicitly.  For example, if you are running single-node jobs with thread-based parallel processing requesting 8 cores you could use:&lt;br /&gt;
&lt;br /&gt;
 #SBATCH --mem=0 &lt;br /&gt;
 #SBATCH --nodes=1 &lt;br /&gt;
 #SBATCH --ntasks=1 &lt;br /&gt;
 #SBATCH --cpus-per-task=8 &lt;br /&gt;
 #SBATCH --partition=single,lattice&lt;br /&gt;
&lt;br /&gt;
Since the single and lattice partitions both have the same type of hardware, it is appropriate to list them both.  Specifying --mem=0 allows you to use all the available memory (12000 MB) on the compute node assigned to the job.  Since the compute nodes in those partitions have 8 cores each and you will be using them all, you need not be concerned about other users&#039; jobs sharing the memory with your job.  However, if you didn&#039;t explicitly specify the partition in such a case, the system would try to assign your job to the cpu2019 or similar partition.  Those nodes have 40 cores and much more memory than the single and lattice partitions.  If you specified --mem=0 in such a case, you would be wasting 32 cores of processing.  So, if you don&#039;t specify a partition yourself, you have to give greater thought to the memory specification to make sure that the scheduler will not assign your job more resources than are needed.&lt;br /&gt;
&lt;br /&gt;
As time limits may be changed by administrators to adjust to maintenance schedules or system load, the values given in the tables are not definitive.  See the Time limits section below for commands you can use on ARC itself to determine current limits.&lt;br /&gt;
&lt;br /&gt;
Parameters such as &#039;&#039;&#039;--ntasks-per-cpu&#039;&#039;&#039;, &#039;&#039;&#039;--cpus-per-task&#039;&#039;&#039;, &#039;&#039;&#039;--mem&#039;&#039;&#039; and &#039;&#039;&#039;--mem-per-cpu&amp;gt;&#039;&#039;&#039; have to be adjusted according to the capabilities of the hardware also. The product of --ntasks-per-cpu and --cpus-per-task should be less than or equal to the number given in the &amp;quot;Cores/node&amp;quot; column.  The &#039;&#039;&#039;--mem&amp;gt;&#039;&#039;&#039; parameter (or the product of &#039;&#039;&#039;--mem-per-cpu&#039;&#039;&#039; and &#039;&#039;&#039;--cpus-per-task&#039;&#039;&#039;) should be less than the &amp;quot;Memory limit&amp;quot; shown. If using whole nodes, you can specify &#039;&#039;&#039;--mem=0&#039;&#039;&#039; to request the maximum amount of memory per node.&lt;br /&gt;
&lt;br /&gt;
==== Partitions for modern hardware: ====&lt;br /&gt;
&lt;br /&gt;
Note, MPI codes using this hardware should be compiled with Omni-Path networking support. This is provided by loading the openmpi/2.1.3-opa or openmpi/3.1.2-opa modules prior to compiling.&lt;br /&gt;
{| class=&amp;quot;wikitable&lt;br /&gt;
!Partition&lt;br /&gt;
!Cores/node&lt;br /&gt;
!Memory limit (MB)&lt;br /&gt;
!Time limit (h)&lt;br /&gt;
!GPUs/node&lt;br /&gt;
|-&lt;br /&gt;
|cpu2019&lt;br /&gt;
|40&lt;br /&gt;
|185000&lt;br /&gt;
|168	&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|apophis&amp;amp;dagger;&lt;br /&gt;
|40&lt;br /&gt;
|185000&lt;br /&gt;
|168&lt;br /&gt;
|	&lt;br /&gt;
|-&lt;br /&gt;
|apophis-bf&amp;amp;dagger;&lt;br /&gt;
|40&lt;br /&gt;
|185000&lt;br /&gt;
|5&lt;br /&gt;
|	&lt;br /&gt;
|-&lt;br /&gt;
|razi&amp;amp;dagger;&lt;br /&gt;
|40&lt;br /&gt;
|185000&lt;br /&gt;
|168&lt;br /&gt;
|	&lt;br /&gt;
|-&lt;br /&gt;
|razi-bf&amp;amp;dagger;&lt;br /&gt;
|40&lt;br /&gt;
|185000&lt;br /&gt;
|5&lt;br /&gt;
|	&lt;br /&gt;
|-&lt;br /&gt;
|bigmem&lt;br /&gt;
|80&lt;br /&gt;
|3000000&lt;br /&gt;
|24&lt;br /&gt;
|	&lt;br /&gt;
|-&lt;br /&gt;
|gpu-v100&lt;br /&gt;
|40&lt;br /&gt;
|753000&lt;br /&gt;
|24&lt;br /&gt;
|2&lt;br /&gt;
|}&lt;br /&gt;
&amp;amp;dagger; The apophis and razi partitions contain hardware contributed to ARC by particular researchers. They should be used only by members of those researchers&#039; groups.  However, they have generously allowed their compute nodes to be shared with others outside their research groups for relatively short jobs by specifying the apophis-bf and razi-bf partitions.  (In some cases in which a partition is not explicitly specified, these &amp;quot;back-fill&amp;quot; partitions may be automatically selected by the system).&lt;br /&gt;
&lt;br /&gt;
==== Partitions for legacy hardware: ====&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Partition&lt;br /&gt;
!Cores/node&lt;br /&gt;
!Memory limit (MB)&lt;br /&gt;
!Time limit (h)&lt;br /&gt;
!GPUs/node&lt;br /&gt;
|-&lt;br /&gt;
|cpu2013&lt;br /&gt;
|16&lt;br /&gt;
|120000&lt;br /&gt;
|168&lt;br /&gt;
|&lt;br /&gt;
|-	&lt;br /&gt;
|lattice&lt;br /&gt;
|8&lt;br /&gt;
|12000&lt;br /&gt;
|168&lt;br /&gt;
|&lt;br /&gt;
|-	&lt;br /&gt;
|parallel&lt;br /&gt;
|12&lt;br /&gt;
|23000&lt;br /&gt;
|168&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|breezy&amp;amp;Dagger;&lt;br /&gt;
|24&lt;br /&gt;
|255000&lt;br /&gt;
|72&lt;br /&gt;
|&lt;br /&gt;
|-	&lt;br /&gt;
|bigbyte&amp;amp;Dagger;&lt;br /&gt;
|32&lt;br /&gt;
|1000000&lt;br /&gt;
|24&lt;br /&gt;
|&lt;br /&gt;
|-	&lt;br /&gt;
|single&lt;br /&gt;
|8&lt;br /&gt;
|12000&lt;br /&gt;
|168&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|gpu&lt;br /&gt;
|12&lt;br /&gt;
|23000&lt;br /&gt;
|72&lt;br /&gt;
|3&lt;br /&gt;
|}&lt;br /&gt;
&amp;amp;Dagger; Update 2019-11-27 - the breezy and bigbyte partition nodes are being repurposed as a cluster to support teaching and learning activities and are no longer available as part of ARC.&lt;br /&gt;
&lt;br /&gt;
Here are some examples of specifying the various partitions.&lt;br /&gt;
&lt;br /&gt;
As mentioned in the [[#Hardware|Hardware]] section above, the ARC cluster was expanded in January 2019.  To select the 40-core general purpose nodes specify:&lt;br /&gt;
&lt;br /&gt;
 #SBATCH --partition=cpu2019&lt;br /&gt;
&lt;br /&gt;
To run on the Tesla V100 GPU-enabled nodes, use the &#039;&#039;&#039;gpu-v100&#039;&#039;&#039; partition.  You will also need to include an SBATCH directive in the form &#039;&#039;&#039;--gres=gpu:n&#039;&#039;&#039; to specify the number of GPUs, n, that you need.  For example, if the software you are running can make use of both GPUs on a gpu-v100 partition compute node, use:&lt;br /&gt;
&lt;br /&gt;
 #SBATCH --partition=gpu-v100 --gres=gpu:2&lt;br /&gt;
&lt;br /&gt;
For very large memory jobs (more than 185000 MB), specify the bigmem partition:&lt;br /&gt;
&lt;br /&gt;
 #SBATCH --partition=bigmem&lt;br /&gt;
&lt;br /&gt;
If the more modern computers are too busy or you have a job well-suited to run on the compute nodes described in the legacy hardware section above, choose the cpu2013,  Lattice or Parallel compute nodes (without graphics processing units) by specifying the corresponding partition keyword:&lt;br /&gt;
&lt;br /&gt;
 #SBATCH --partition=cpu2013&lt;br /&gt;
&lt;br /&gt;
 #SBATCH --partition=lattice&lt;br /&gt;
&lt;br /&gt;
or&lt;br /&gt;
&lt;br /&gt;
 #SBATCH --partition=parallel&lt;br /&gt;
&lt;br /&gt;
There is an additional partition called &#039;&#039;&#039;single&#039;&#039;&#039; that provides nodes similar to the lattice partition, but, is intended for single-node jobs. Select the single partition with&lt;br /&gt;
&lt;br /&gt;
 #SBATCH --partition=single&lt;br /&gt;
&lt;br /&gt;
For single-node jobs requiring more memory or processors than available through the breezy or single partitions, use the bigbyte partition:&lt;br /&gt;
&lt;br /&gt;
 #SBATCH --partition=bigbyte&lt;br /&gt;
&lt;br /&gt;
To select the nodes that have GPUs, specify the &#039;&#039;&#039;gpu&#039;&#039;&#039; partition. Use an SBATCH directive in the form &#039;&#039;&#039;--gres=gpu:n&#039;&#039;&#039; to specify the number of GPUs, n, that you need.  For example, if the software you are running can make use of all three GPUs on a compute node, use:&lt;br /&gt;
&lt;br /&gt;
 #SBATCH --partition=gpu --gres=gpu:3&lt;br /&gt;
&lt;br /&gt;
=== Time limits ===&lt;br /&gt;
Use a directive of the form&lt;br /&gt;
&lt;br /&gt;
 #SBATCH --time=hh:mm:ss&lt;br /&gt;
&lt;br /&gt;
to tell the job scheduler the maximum time that your job might run. You can use the command&lt;br /&gt;
&lt;br /&gt;
 scontrol show partitions&lt;br /&gt;
&lt;br /&gt;
to see the current configuration of the partitions including the maximum time limit you can specify for each partition, as given by the MaxTime field.  Alternatively, see the TIMELIMIT column in the output from&lt;br /&gt;
&lt;br /&gt;
 sinfo&lt;br /&gt;
&lt;br /&gt;
=== Hardware resource and job policy limits ===&lt;br /&gt;
There are limits on the number of cores, nodes and/or GPUs that one can use on ARC at any given time.  There is also a limit on the number of jobs that a user can have pending or running at a given time (the MaxSubmitJobs parameter in the command below). The limits are generally applied on a partition-by-partition basis, so, using resources in one partition should not affect the amount you can use in a different partition. To see the current limits you can run the command:&lt;br /&gt;
&lt;br /&gt;
 sacctmgr show qos format=Name,MaxWall,MaxTRESPU%20,MaxSubmitJobs&lt;br /&gt;
&lt;br /&gt;
== Support ==&lt;br /&gt;
Please send ARC-related questions to support@hpc.ucalgary.ca.&lt;/div&gt;</summary>
		<author><name>Phillips</name></author>
	</entry>
	<entry>
		<id>https://rcs.ucalgary.ca/index.php?title=ARC_Cluster_Guide&amp;diff=582</id>
		<title>ARC Cluster Guide</title>
		<link rel="alternate" type="text/html" href="https://rcs.ucalgary.ca/index.php?title=ARC_Cluster_Guide&amp;diff=582"/>
		<updated>2020-05-28T00:10:26Z</updated>

		<summary type="html">&lt;p&gt;Phillips: /* Software */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:ARC Cluster]]&lt;br /&gt;
This guide gives an overview of the ARC (Advanced Research Computing) cluster at the University of Calgary.&lt;br /&gt;
&lt;br /&gt;
It is intended to be read by new account holders getting started on ARC, covering such topics as the hardware and performance characteristics, available software, usage policies and how to log in and run jobs. &lt;br /&gt;
&lt;br /&gt;
For ARC-related questions not answered here, please write to support@hpc.ucalgary.ca .&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Cybersecurity awareness at the U of C&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Please note that there are typically about 950 phishing attempts targeting University of Calgary accounts each month. This is just a reminder to be careful about computer security issues, both at home and at the University. See [https://it.ucalgary.ca/it-security] for more information, such as tips for secure computing and how to report suspected security problems.&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
ARC is a cluster primarily comprised of Linux-based computers repurposed from several separate older clusters (Breezy, Lattice, Parallel) that were formerly offered to researchers from across Canada.  In addition, a large-memory compute node (Bigbyte) was salvaged from the now-retired local Storm cluster. In January 2019, a major addition to ARC was purchased, with modern hardware.&lt;br /&gt;
&lt;br /&gt;
In this new configuration, as ARC, the computational resources of these clusters are now being restricted to research projects based at the University of Calgary.  ARC is meant to supplement the resources available to researchers through Compute Canada. You can read about those machines at the Compute Canada web site.&lt;br /&gt;
&lt;br /&gt;
The ARC cluster can be used for running large numbers (hundreds) of concurrent serial (one-core) jobs, OpenMP or other thread-based, shared-memory parallel codes using up to 40 threads per job (or even 80 on one large node), or distributed-memory (MPI-based) parallel codes using up to hundreds of cores.  Software that make use of Graphics Processing Units (GPUs) can also be used.&lt;br /&gt;
&lt;br /&gt;
== Accounts ==&lt;br /&gt;
If you have a project you think would be appropriate for ARC, please write to support@hpc.ucalgary.ca .  To assist you getting started, it would be helpful if you mention what software you plan to use.&lt;br /&gt;
&lt;br /&gt;
Note that University of Calgary Information Technologies computing account credentials are used for ARC (the same as used for University of Calgary email accounts). If you don&#039;t have a University of Calgary email address, please register for one at https://itregport.ucalgary.ca/ and include your email address in your request for a ARC account. &lt;br /&gt;
&lt;br /&gt;
If you don&#039;t have University of Calgary credentials because you are external to the University you may still apply for an account if you are collaborating on a project with a University of Calgary faculty member.  In your email, please explain your situation and mention the project leader involved.&lt;br /&gt;
&lt;br /&gt;
== Hardware ==&lt;br /&gt;
=== Processors ===&lt;br /&gt;
Besides login and administrative servers, the ARC hardware consists of compute nodes of several types. When submitting jobs to run on the cluster, you can specify a partition parameter to select the particular type of hardware that is most appropriate for your work. See the [[ARC Hardware|ARC Hardware page]] for further technical details about the hardware if you are interested, but, most users will only need to be aware of the processor count and memory characteristics given in the section on [[#Selecting a partition|selecting a partition]] below. &lt;br /&gt;
&lt;br /&gt;
=== Network (interconnect) ===&lt;br /&gt;
Most of the partitions have a high-speed interconnect between the compute nodes, making them suitable for multi-node parallel processing.  It is sometimes important to make a distinction in the type of network technology used, as some software may be built to work with libraries supporting one type of network and not another. &lt;br /&gt;
&lt;br /&gt;
The compute nodes in some of the partitions (cpu2019, apophis, apophis-bf, pawson, pawson-bf, razi and razi-bf) communicate via a 100 Gbit/s Omni-Path network, whereas the older compute nodes within the lattice and parallel cluster partitions use 40 Gbit/s InfiniBand.  A bit more detail is given on the [ARC Hardware page].&lt;br /&gt;
&lt;br /&gt;
=== Storage ===&lt;br /&gt;
About a petabyte of raw disk storage is available to the ARC cluster, but for error checking and performance reasons, the amount of usable storage for researchers&#039; projects is considerably less than that.  From a user&#039;s perspective, the total amount of storage is less important than the individual storage limits.  As described below, there are three storage areas: home, scratch and work, with different limits and usage policies.&lt;br /&gt;
&lt;br /&gt;
==== Home file system: /home ====&lt;br /&gt;
There is a per-user quota of 500 GB under /home. This limit is fixed and cannot be increased.  Each user has a directory under /home, which is the default working directory when logging in to ARC. It is expected that most researchers will be able to do their work from within their home directories, but, there are two options (/work and /scratch) for accessing more space.&lt;br /&gt;
&lt;br /&gt;
Note on file sharing: Due to security concerns, permissions set on your home directory with the chmod command, to allow others to share your files, will be automatically removed by a system monitoring process unless an explicit exception is made. If you need to share files with other researchers on the ARC cluster, please write to support@hpc.ucalgary.ca to ask for such an exception.&lt;br /&gt;
&lt;br /&gt;
==== Scratch file system for large job-oriented storage: /scratch ====&lt;br /&gt;
Associated with each job, under the /scratch directory, a subdirectory is created that can be referenced in job scripts as /scratch/${SLURM_JOB_ID}. You can use that directory for temporary files needed during the course of a job. Up to 30 TB of storage may be used, per user (total for all your jobs) in the /scratch file system.  Deletion policy: data in /scratch associated with a given job will be deleted automatically, without exception, five days after the job finishes.&lt;br /&gt;
&lt;br /&gt;
==== Work file system for larger projects: /work ====&lt;br /&gt;
If you need more space than provided in /home and the /scratch job-oriented space is not appropriate for you case, please write to support@hpc.ucalgary.ca with an explanation, including an indication of how much storage you expect to need and for how long.  If approved, you will then be assigned a directory under /work with an appropriately large quota.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Backup policy:&#039;&#039;&#039; you are responsible for your own backups.  Many researchers will have accounts with Compute Canada and may choose to back up their data there (the Project file system accessible through the Cedar cluster would often be used).  We can explain more about this option if you write to support@hpc.ucalgary.ca .&lt;br /&gt;
&lt;br /&gt;
== Software ==&lt;br /&gt;
Look for installed software under /global/software and through the module avail command (described below). Links to documentation for some of the installed software is highlighted on a [[ARC_Software_pages separate Wiki page]].&lt;br /&gt;
&lt;br /&gt;
The setup of the environment for using some of the installed software is through the module command. An overview of [https://www.westgrid.ca//support/modules modules on WestGrid (external link)] is largely applicable to ARC.&lt;br /&gt;
&lt;br /&gt;
To list available modules, type:&lt;br /&gt;
&lt;br /&gt;
 module avail&lt;br /&gt;
&lt;br /&gt;
So, for example, to load a module for Python use:&lt;br /&gt;
&lt;br /&gt;
 module load python/anaconda-3.6-5.1.0&lt;br /&gt;
&lt;br /&gt;
and to remove it use:&lt;br /&gt;
&lt;br /&gt;
 module remove python/anaconda-3.6-5.1.0&lt;br /&gt;
&lt;br /&gt;
To see currently loaded modules, type:&lt;br /&gt;
&lt;br /&gt;
 module list&lt;br /&gt;
&lt;br /&gt;
Unlike some clusters, there are no modules loaded by default.  So, for example, to use Intel compilers, or to use Open MPI parallel programming, you must load an appropriate module.&lt;br /&gt;
&lt;br /&gt;
Write to support@hpc.ucalgary.ca if you need additional software installed.&lt;br /&gt;
&lt;br /&gt;
== Using ARC ==&lt;br /&gt;
=== Logging in ===&lt;br /&gt;
To log in to ARC, connect to arc.ucalgary.ca using an ssh (secure shell) client. For more information about connecting and setting up your environment, the WestGrid [http://www.westgrid.ca/support/quickstart/new_users QuickStart Guide for New Users] may be helpful.  Note that connections are accepted only from on-campus IP addresses. You can connect from off-campus by using Virtual Private Network (VPN) software available from [https://ucalgary.service-now.com/it?id=kb_article&amp;amp;sys_id=880e71071381ae006f3afbb2e144b05c Information Techologies].&lt;br /&gt;
&lt;br /&gt;
=== Storage ===&lt;br /&gt;
Please review the [[#Storage|Storage]] section above for important policies and advice regarding file storage and file sharing.&lt;br /&gt;
&lt;br /&gt;
=== Working interactively ===&lt;br /&gt;
ARC uses the Linux operating system. The program that responds to your typed commands and allows you to run other programs is called the Linux shell. There are several different shells available, but, by default you will use one called bash. It is useful to have some knowledge of the shell and a variety of other command-line programs that you can use to manipulate files. If you are new to Linux systems, we recommend that you work through one of the many online tutorials that are available, such as the [http://www.ee.surrey.ac.uk/Teaching/Unix/index.html UNIX Tutorial for Beginners (external link)] provided by the University of Surrey. The tutorial covers such fundamental topics, among others, as creating, renaming and deleting files and directories, how to produce a listing of your files and how to tell how much disk space you are using.  For a more comprehensive introduction to Linux, see [http://linuxcommand.sourceforge.net/tlcl.php The Linux Command Line (external link)].&lt;br /&gt;
&lt;br /&gt;
The ARC login node may be used for such tasks as editing files, compiling programs and running short tests while developing programs (under 15 minutes, say). Processors may also be reserved for interactive sessions using the salloc command specifying the resources needed through arguments on the salloc command line.&lt;br /&gt;
&lt;br /&gt;
=== Running non-interactive jobs (batch processing) ===&lt;br /&gt;
Production runs and longer test runs should be submitted as (non-interactive) batch jobs, in which commands to be executed are listed in a script (text file). Batch jobs scripts are submitted using the sbatch command, part of the Slurm job management and scheduling software. #SBATCH directive lines at the beginning of the script are used to specify the resources needed for the job (cores, memory, run time limit and any specialized hardware needed).&lt;br /&gt;
&lt;br /&gt;
Most of the information on the [https://docs.computecanada.ca/wiki/Running_jobs Running Jobs (external link)] page on the Compute Canada web site is also relevant for submitting and managing batch jobs and reserving processors for interactive work on ARC.  One major difference between running jobs on the ARC and Compute Canada clusters is in selecting the type of hardware that should be used for a job. On ARC, you choose the hardware to use primarily by specifying a partition, as described below.&lt;br /&gt;
&lt;br /&gt;
=== Selecting a partition ===&lt;br /&gt;
The type of computer on which a job can or should be run is determined by characteristics of your software, such as whether it supports parallel processing and by simulation or data-dependent factors such as the amount of memory required.  If the program you are running uses MPI (Message Passing Interface) for parallel processing, which allows the memory usage to be distributed across multiple compute nodes, then, the memory required per MPI process is an important factor.  If you are running a serial code (that is, it is not able to use multiple CPU cores) or one that is parallelized with OpenMP or other thread-based techniques that restrict it to running on just a single compute node, then, the total memory required is the main factor to consider.  If your program can make use of graphics processing units, then, that will be the determining factor.  If you have questions about which ARC hardware to use, please write to [[mailto:support@hpc.ucalgary.ca]] and we would be happy to discuss this with you.&lt;br /&gt;
&lt;br /&gt;
One you have decided what type of hardware best suits your calculations, you can select it on a job-by-job basis by including the &#039;&#039;&#039;partition&#039;&#039;&#039; keyword for an &#039;&#039;&#039;SBATCH&#039;&#039;&#039; directive in your batch job. The tables below summarize the characteristics of the various partitions&lt;br /&gt;
&lt;br /&gt;
If you omit the partition specification, the system will try to assign your job to appropriate hardware based on other aspects of your request, but, for more control you can specify one or more partitions yourself.  You are allowed to specify a comma-separate list of partitions. &lt;br /&gt;
&lt;br /&gt;
In some cases, you really should specify the partition explicitly.  For example, if you are running single-node jobs with thread-based parallel processing requesting 8 cores you could use:&lt;br /&gt;
&lt;br /&gt;
 #SBATCH --mem=0 &lt;br /&gt;
 #SBATCH --nodes=1 &lt;br /&gt;
 #SBATCH --ntasks=1 &lt;br /&gt;
 #SBATCH --cpus-per-task=8 &lt;br /&gt;
 #SBATCH --partition=single,lattice&lt;br /&gt;
&lt;br /&gt;
Since the single and lattice partitions both have the same type of hardware, it is appropriate to list them both.  Specifying --mem=0 allows you to use all the available memory (12000 MB) on the compute node assigned to the job.  Since the compute nodes in those partitions have 8 cores each and you will be using them all, you need not be concerned about other users&#039; jobs sharing the memory with your job.  However, if you didn&#039;t explicitly specify the partition in such a case, the system would try to assign your job to the cpu2019 or similar partition.  Those nodes have 40 cores and much more memory than the single and lattice partitions.  If you specified --mem=0 in such a case, you would be wasting 32 cores of processing.  So, if you don&#039;t specify a partition yourself, you have to give greater thought to the memory specification to make sure that the scheduler will not assign your job more resources than are needed.&lt;br /&gt;
&lt;br /&gt;
As time limits may be changed by administrators to adjust to maintenance schedules or system load, the values given in the tables are not definitive.  See the Time limits section below for commands you can use on ARC itself to determine current limits.&lt;br /&gt;
&lt;br /&gt;
Parameters such as &#039;&#039;&#039;--ntasks-per-cpu&#039;&#039;&#039;, &#039;&#039;&#039;--cpus-per-task&#039;&#039;&#039;, &#039;&#039;&#039;--mem&#039;&#039;&#039; and &#039;&#039;&#039;--mem-per-cpu&amp;gt;&#039;&#039;&#039; have to be adjusted according to the capabilities of the hardware also. The product of --ntasks-per-cpu and --cpus-per-task should be less than or equal to the number given in the &amp;quot;Cores/node&amp;quot; column.  The &#039;&#039;&#039;--mem&amp;gt;&#039;&#039;&#039; parameter (or the product of &#039;&#039;&#039;--mem-per-cpu&#039;&#039;&#039; and &#039;&#039;&#039;--cpus-per-task&#039;&#039;&#039;) should be less than the &amp;quot;Memory limit&amp;quot; shown. If using whole nodes, you can specify &#039;&#039;&#039;--mem=0&#039;&#039;&#039; to request the maximum amount of memory per node.&lt;br /&gt;
&lt;br /&gt;
==== Partitions for modern hardware: ====&lt;br /&gt;
&lt;br /&gt;
Note, MPI codes using this hardware should be compiled with Omni-Path networking support. This is provided by loading the openmpi/2.1.3-opa or openmpi/3.1.2-opa modules prior to compiling.&lt;br /&gt;
{| class=&amp;quot;wikitable&lt;br /&gt;
!Partition&lt;br /&gt;
!Cores/node&lt;br /&gt;
!Memory limit (MB)&lt;br /&gt;
!Time limit (h)&lt;br /&gt;
!GPUs/node&lt;br /&gt;
|-&lt;br /&gt;
|cpu2019&lt;br /&gt;
|40&lt;br /&gt;
|185000&lt;br /&gt;
|168	&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|apophis&amp;amp;dagger;&lt;br /&gt;
|40&lt;br /&gt;
|185000&lt;br /&gt;
|168&lt;br /&gt;
|	&lt;br /&gt;
|-&lt;br /&gt;
|apophis-bf&amp;amp;dagger;&lt;br /&gt;
|40&lt;br /&gt;
|185000&lt;br /&gt;
|5&lt;br /&gt;
|	&lt;br /&gt;
|-&lt;br /&gt;
|razi&amp;amp;dagger;&lt;br /&gt;
|40&lt;br /&gt;
|185000&lt;br /&gt;
|168&lt;br /&gt;
|	&lt;br /&gt;
|-&lt;br /&gt;
|razi-bf&amp;amp;dagger;&lt;br /&gt;
|40&lt;br /&gt;
|185000&lt;br /&gt;
|5&lt;br /&gt;
|	&lt;br /&gt;
|-&lt;br /&gt;
|bigmem&lt;br /&gt;
|80&lt;br /&gt;
|3000000&lt;br /&gt;
|24&lt;br /&gt;
|	&lt;br /&gt;
|-&lt;br /&gt;
|gpu-v100&lt;br /&gt;
|40&lt;br /&gt;
|753000&lt;br /&gt;
|24&lt;br /&gt;
|2&lt;br /&gt;
|}&lt;br /&gt;
&amp;amp;dagger; The apophis and razi partitions contain hardware contributed to ARC by particular researchers. They should be used only by members of those researchers&#039; groups.  However, they have generously allowed their compute nodes to be shared with others outside their research groups for relatively short jobs by specifying the apophis-bf and razi-bf partitions.  (In some cases in which a partition is not explicitly specified, these &amp;quot;back-fill&amp;quot; partitions may be automatically selected by the system).&lt;br /&gt;
&lt;br /&gt;
==== Partitions for legacy hardware: ====&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Partition&lt;br /&gt;
!Cores/node&lt;br /&gt;
!Memory limit (MB)&lt;br /&gt;
!Time limit (h)&lt;br /&gt;
!GPUs/node&lt;br /&gt;
|-&lt;br /&gt;
|cpu2013&lt;br /&gt;
|16&lt;br /&gt;
|120000&lt;br /&gt;
|168&lt;br /&gt;
|&lt;br /&gt;
|-	&lt;br /&gt;
|lattice&lt;br /&gt;
|8&lt;br /&gt;
|12000&lt;br /&gt;
|168&lt;br /&gt;
|&lt;br /&gt;
|-	&lt;br /&gt;
|parallel&lt;br /&gt;
|12&lt;br /&gt;
|23000&lt;br /&gt;
|168&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|breezy&amp;amp;Dagger;&lt;br /&gt;
|24&lt;br /&gt;
|255000&lt;br /&gt;
|72&lt;br /&gt;
|&lt;br /&gt;
|-	&lt;br /&gt;
|bigbyte&amp;amp;Dagger;&lt;br /&gt;
|32&lt;br /&gt;
|1000000&lt;br /&gt;
|24&lt;br /&gt;
|&lt;br /&gt;
|-	&lt;br /&gt;
|single&lt;br /&gt;
|8&lt;br /&gt;
|12000&lt;br /&gt;
|168&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|gpu&lt;br /&gt;
|12&lt;br /&gt;
|23000&lt;br /&gt;
|72&lt;br /&gt;
|3&lt;br /&gt;
|}&lt;br /&gt;
&amp;amp;Dagger; Update 2019-11-27 - the breezy and bigbyte partition nodes are being repurposed as a cluster to support teaching and learning activities and are no longer available as part of ARC.&lt;br /&gt;
&lt;br /&gt;
Here are some examples of specifying the various partitions.&lt;br /&gt;
&lt;br /&gt;
As mentioned in the [[#Hardware|Hardware]] section above, the ARC cluster was expanded in January 2019.  To select the 40-core general purpose nodes specify:&lt;br /&gt;
&lt;br /&gt;
 #SBATCH --partition=cpu2019&lt;br /&gt;
&lt;br /&gt;
To run on the Tesla V100 GPU-enabled nodes, use the &#039;&#039;&#039;gpu-v100&#039;&#039;&#039; partition.  You will also need to include an SBATCH directive in the form &#039;&#039;&#039;--gres=gpu:n&#039;&#039;&#039; to specify the number of GPUs, n, that you need.  For example, if the software you are running can make use of both GPUs on a gpu-v100 partition compute node, use:&lt;br /&gt;
&lt;br /&gt;
 #SBATCH --partition=gpu-v100 --gres=gpu:2&lt;br /&gt;
&lt;br /&gt;
For very large memory jobs (more than 185000 MB), specify the bigmem partition:&lt;br /&gt;
&lt;br /&gt;
 #SBATCH --partition=bigmem&lt;br /&gt;
&lt;br /&gt;
If the more modern computers are too busy or you have a job well-suited to run on the compute nodes described in the legacy hardware section above, choose the cpu2013,  Lattice or Parallel compute nodes (without graphics processing units) by specifying the corresponding partition keyword:&lt;br /&gt;
&lt;br /&gt;
 #SBATCH --partition=cpu2013&lt;br /&gt;
&lt;br /&gt;
 #SBATCH --partition=lattice&lt;br /&gt;
&lt;br /&gt;
or&lt;br /&gt;
&lt;br /&gt;
 #SBATCH --partition=parallel&lt;br /&gt;
&lt;br /&gt;
There is an additional partition called &#039;&#039;&#039;single&#039;&#039;&#039; that provides nodes similar to the lattice partition, but, is intended for single-node jobs. Select the single partition with&lt;br /&gt;
&lt;br /&gt;
 #SBATCH --partition=single&lt;br /&gt;
&lt;br /&gt;
For single-node jobs requiring more memory or processors than available through the breezy or single partitions, use the bigbyte partition:&lt;br /&gt;
&lt;br /&gt;
 #SBATCH --partition=bigbyte&lt;br /&gt;
&lt;br /&gt;
To select the nodes that have GPUs, specify the &#039;&#039;&#039;gpu&#039;&#039;&#039; partition. Use an SBATCH directive in the form &#039;&#039;&#039;--gres=gpu:n&#039;&#039;&#039; to specify the number of GPUs, n, that you need.  For example, if the software you are running can make use of all three GPUs on a compute node, use:&lt;br /&gt;
&lt;br /&gt;
 #SBATCH --partition=gpu --gres=gpu:3&lt;br /&gt;
&lt;br /&gt;
=== Time limits ===&lt;br /&gt;
Use a directive of the form&lt;br /&gt;
&lt;br /&gt;
 #SBATCH --time=hh:mm:ss&lt;br /&gt;
&lt;br /&gt;
to tell the job scheduler the maximum time that your job might run. You can use the command&lt;br /&gt;
&lt;br /&gt;
 scontrol show partitions&lt;br /&gt;
&lt;br /&gt;
to see the current configuration of the partitions including the maximum time limit you can specify for each partition, as given by the MaxTime field.  Alternatively, see the TIMELIMIT column in the output from&lt;br /&gt;
&lt;br /&gt;
 sinfo&lt;br /&gt;
&lt;br /&gt;
=== Hardware resource and job policy limits ===&lt;br /&gt;
There are limits on the number of cores, nodes and/or GPUs that one can use on ARC at any given time.  There is also a limit on the number of jobs that a user can have pending or running at a given time (the MaxSubmitJobs parameter in the command below). The limits are generally applied on a partition-by-partition basis, so, using resources in one partition should not affect the amount you can use in a different partition. To see the current limits you can run the command:&lt;br /&gt;
&lt;br /&gt;
 sacctmgr show qos format=Name,MaxWall,MaxTRESPU%20,MaxSubmitJobs&lt;br /&gt;
&lt;br /&gt;
== Support ==&lt;br /&gt;
Please send ARC-related questions to support@hpc.ucalgary.ca.&lt;/div&gt;</summary>
		<author><name>Phillips</name></author>
	</entry>
	<entry>
		<id>https://rcs.ucalgary.ca/index.php?title=ARC_Cluster_Guide&amp;diff=581</id>
		<title>ARC Cluster Guide</title>
		<link rel="alternate" type="text/html" href="https://rcs.ucalgary.ca/index.php?title=ARC_Cluster_Guide&amp;diff=581"/>
		<updated>2020-05-28T00:06:21Z</updated>

		<summary type="html">&lt;p&gt;Phillips: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:ARC Cluster]]&lt;br /&gt;
This guide gives an overview of the ARC (Advanced Research Computing) cluster at the University of Calgary.&lt;br /&gt;
&lt;br /&gt;
It is intended to be read by new account holders getting started on ARC, covering such topics as the hardware and performance characteristics, available software, usage policies and how to log in and run jobs. &lt;br /&gt;
&lt;br /&gt;
For ARC-related questions not answered here, please write to support@hpc.ucalgary.ca .&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Cybersecurity awareness at the U of C&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Please note that there are typically about 950 phishing attempts targeting University of Calgary accounts each month. This is just a reminder to be careful about computer security issues, both at home and at the University. See [https://it.ucalgary.ca/it-security] for more information, such as tips for secure computing and how to report suspected security problems.&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
ARC is a cluster primarily comprised of Linux-based computers repurposed from several separate older clusters (Breezy, Lattice, Parallel) that were formerly offered to researchers from across Canada.  In addition, a large-memory compute node (Bigbyte) was salvaged from the now-retired local Storm cluster. In January 2019, a major addition to ARC was purchased, with modern hardware.&lt;br /&gt;
&lt;br /&gt;
In this new configuration, as ARC, the computational resources of these clusters are now being restricted to research projects based at the University of Calgary.  ARC is meant to supplement the resources available to researchers through Compute Canada. You can read about those machines at the Compute Canada web site.&lt;br /&gt;
&lt;br /&gt;
The ARC cluster can be used for running large numbers (hundreds) of concurrent serial (one-core) jobs, OpenMP or other thread-based, shared-memory parallel codes using up to 40 threads per job (or even 80 on one large node), or distributed-memory (MPI-based) parallel codes using up to hundreds of cores.  Software that make use of Graphics Processing Units (GPUs) can also be used.&lt;br /&gt;
&lt;br /&gt;
== Accounts ==&lt;br /&gt;
If you have a project you think would be appropriate for ARC, please write to support@hpc.ucalgary.ca .  To assist you getting started, it would be helpful if you mention what software you plan to use.&lt;br /&gt;
&lt;br /&gt;
Note that University of Calgary Information Technologies computing account credentials are used for ARC (the same as used for University of Calgary email accounts). If you don&#039;t have a University of Calgary email address, please register for one at https://itregport.ucalgary.ca/ and include your email address in your request for a ARC account. &lt;br /&gt;
&lt;br /&gt;
If you don&#039;t have University of Calgary credentials because you are external to the University you may still apply for an account if you are collaborating on a project with a University of Calgary faculty member.  In your email, please explain your situation and mention the project leader involved.&lt;br /&gt;
&lt;br /&gt;
== Hardware ==&lt;br /&gt;
=== Processors ===&lt;br /&gt;
Besides login and administrative servers, the ARC hardware consists of compute nodes of several types. When submitting jobs to run on the cluster, you can specify a partition parameter to select the particular type of hardware that is most appropriate for your work. See the [[ARC Hardware|ARC Hardware page]] for further technical details about the hardware if you are interested, but, most users will only need to be aware of the processor count and memory characteristics given in the section on [[#Selecting a partition|selecting a partition]] below. &lt;br /&gt;
&lt;br /&gt;
=== Network (interconnect) ===&lt;br /&gt;
Most of the partitions have a high-speed interconnect between the compute nodes, making them suitable for multi-node parallel processing.  It is sometimes important to make a distinction in the type of network technology used, as some software may be built to work with libraries supporting one type of network and not another. &lt;br /&gt;
&lt;br /&gt;
The compute nodes in some of the partitions (cpu2019, apophis, apophis-bf, pawson, pawson-bf, razi and razi-bf) communicate via a 100 Gbit/s Omni-Path network, whereas the older compute nodes within the lattice and parallel cluster partitions use 40 Gbit/s InfiniBand.  A bit more detail is given on the [ARC Hardware page].&lt;br /&gt;
&lt;br /&gt;
=== Storage ===&lt;br /&gt;
About a petabyte of raw disk storage is available to the ARC cluster, but for error checking and performance reasons, the amount of usable storage for researchers&#039; projects is considerably less than that.  From a user&#039;s perspective, the total amount of storage is less important than the individual storage limits.  As described below, there are three storage areas: home, scratch and work, with different limits and usage policies.&lt;br /&gt;
&lt;br /&gt;
==== Home file system: /home ====&lt;br /&gt;
There is a per-user quota of 500 GB under /home. This limit is fixed and cannot be increased.  Each user has a directory under /home, which is the default working directory when logging in to ARC. It is expected that most researchers will be able to do their work from within their home directories, but, there are two options (/work and /scratch) for accessing more space.&lt;br /&gt;
&lt;br /&gt;
Note on file sharing: Due to security concerns, permissions set on your home directory with the chmod command, to allow others to share your files, will be automatically removed by a system monitoring process unless an explicit exception is made. If you need to share files with other researchers on the ARC cluster, please write to support@hpc.ucalgary.ca to ask for such an exception.&lt;br /&gt;
&lt;br /&gt;
==== Scratch file system for large job-oriented storage: /scratch ====&lt;br /&gt;
Associated with each job, under the /scratch directory, a subdirectory is created that can be referenced in job scripts as /scratch/${SLURM_JOB_ID}. You can use that directory for temporary files needed during the course of a job. Up to 30 TB of storage may be used, per user (total for all your jobs) in the /scratch file system.  Deletion policy: data in /scratch associated with a given job will be deleted automatically, without exception, five days after the job finishes.&lt;br /&gt;
&lt;br /&gt;
==== Work file system for larger projects: /work ====&lt;br /&gt;
If you need more space than provided in /home and the /scratch job-oriented space is not appropriate for you case, please write to support@hpc.ucalgary.ca with an explanation, including an indication of how much storage you expect to need and for how long.  If approved, you will then be assigned a directory under /work with an appropriately large quota.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Backup policy:&#039;&#039;&#039; you are responsible for your own backups.  Many researchers will have accounts with Compute Canada and may choose to back up their data there (the Project file system accessible through the Cedar cluster would often be used).  We can explain more about this option if you write to support@hpc.ucalgary.ca .&lt;br /&gt;
&lt;br /&gt;
== Software ==&lt;br /&gt;
Look for installed software under /global/software and through the module avail command. The setup of the environment for using some of the installed software is through the module command. An overview of [https://www.westgrid.ca//support/modules modules on WestGrid (external link)] is largely applicable to ARC.&lt;br /&gt;
&lt;br /&gt;
To list available modules, type:&lt;br /&gt;
&lt;br /&gt;
 module avail&lt;br /&gt;
&lt;br /&gt;
So, for example, to load a module for Python use:&lt;br /&gt;
&lt;br /&gt;
 module load python/anaconda-3.6-5.1.0&lt;br /&gt;
&lt;br /&gt;
and to remove it use:&lt;br /&gt;
&lt;br /&gt;
 module remove python/anaconda-3.6-5.1.0&lt;br /&gt;
&lt;br /&gt;
To see currently loaded modules, type:&lt;br /&gt;
&lt;br /&gt;
 module list&lt;br /&gt;
&lt;br /&gt;
Unlike some clusters, there are no modules loaded by default.  So, for example, to use Intel compilers, or to use Open MPI parallel programming, you must load an appropriate module.&lt;br /&gt;
&lt;br /&gt;
Write to support@hpc.ucalgary.ca if you need additional software installed.&lt;br /&gt;
&lt;br /&gt;
== Using ARC ==&lt;br /&gt;
=== Logging in ===&lt;br /&gt;
To log in to ARC, connect to arc.ucalgary.ca using an ssh (secure shell) client. For more information about connecting and setting up your environment, the WestGrid [http://www.westgrid.ca/support/quickstart/new_users QuickStart Guide for New Users] may be helpful.  Note that connections are accepted only from on-campus IP addresses. You can connect from off-campus by using Virtual Private Network (VPN) software available from [https://ucalgary.service-now.com/it?id=kb_article&amp;amp;sys_id=880e71071381ae006f3afbb2e144b05c Information Techologies].&lt;br /&gt;
&lt;br /&gt;
=== Storage ===&lt;br /&gt;
Please review the [[#Storage|Storage]] section above for important policies and advice regarding file storage and file sharing.&lt;br /&gt;
&lt;br /&gt;
=== Working interactively ===&lt;br /&gt;
ARC uses the Linux operating system. The program that responds to your typed commands and allows you to run other programs is called the Linux shell. There are several different shells available, but, by default you will use one called bash. It is useful to have some knowledge of the shell and a variety of other command-line programs that you can use to manipulate files. If you are new to Linux systems, we recommend that you work through one of the many online tutorials that are available, such as the [http://www.ee.surrey.ac.uk/Teaching/Unix/index.html UNIX Tutorial for Beginners (external link)] provided by the University of Surrey. The tutorial covers such fundamental topics, among others, as creating, renaming and deleting files and directories, how to produce a listing of your files and how to tell how much disk space you are using.  For a more comprehensive introduction to Linux, see [http://linuxcommand.sourceforge.net/tlcl.php The Linux Command Line (external link)].&lt;br /&gt;
&lt;br /&gt;
The ARC login node may be used for such tasks as editing files, compiling programs and running short tests while developing programs (under 15 minutes, say). Processors may also be reserved for interactive sessions using the salloc command specifying the resources needed through arguments on the salloc command line.&lt;br /&gt;
&lt;br /&gt;
=== Running non-interactive jobs (batch processing) ===&lt;br /&gt;
Production runs and longer test runs should be submitted as (non-interactive) batch jobs, in which commands to be executed are listed in a script (text file). Batch jobs scripts are submitted using the sbatch command, part of the Slurm job management and scheduling software. #SBATCH directive lines at the beginning of the script are used to specify the resources needed for the job (cores, memory, run time limit and any specialized hardware needed).&lt;br /&gt;
&lt;br /&gt;
Most of the information on the [https://docs.computecanada.ca/wiki/Running_jobs Running Jobs (external link)] page on the Compute Canada web site is also relevant for submitting and managing batch jobs and reserving processors for interactive work on ARC.  One major difference between running jobs on the ARC and Compute Canada clusters is in selecting the type of hardware that should be used for a job. On ARC, you choose the hardware to use primarily by specifying a partition, as described below.&lt;br /&gt;
&lt;br /&gt;
=== Selecting a partition ===&lt;br /&gt;
The type of computer on which a job can or should be run is determined by characteristics of your software, such as whether it supports parallel processing and by simulation or data-dependent factors such as the amount of memory required.  If the program you are running uses MPI (Message Passing Interface) for parallel processing, which allows the memory usage to be distributed across multiple compute nodes, then, the memory required per MPI process is an important factor.  If you are running a serial code (that is, it is not able to use multiple CPU cores) or one that is parallelized with OpenMP or other thread-based techniques that restrict it to running on just a single compute node, then, the total memory required is the main factor to consider.  If your program can make use of graphics processing units, then, that will be the determining factor.  If you have questions about which ARC hardware to use, please write to [[mailto:support@hpc.ucalgary.ca]] and we would be happy to discuss this with you.&lt;br /&gt;
&lt;br /&gt;
One you have decided what type of hardware best suits your calculations, you can select it on a job-by-job basis by including the &#039;&#039;&#039;partition&#039;&#039;&#039; keyword for an &#039;&#039;&#039;SBATCH&#039;&#039;&#039; directive in your batch job. The tables below summarize the characteristics of the various partitions&lt;br /&gt;
&lt;br /&gt;
If you omit the partition specification, the system will try to assign your job to appropriate hardware based on other aspects of your request, but, for more control you can specify one or more partitions yourself.  You are allowed to specify a comma-separate list of partitions. &lt;br /&gt;
&lt;br /&gt;
In some cases, you really should specify the partition explicitly.  For example, if you are running single-node jobs with thread-based parallel processing requesting 8 cores you could use:&lt;br /&gt;
&lt;br /&gt;
 #SBATCH --mem=0 &lt;br /&gt;
 #SBATCH --nodes=1 &lt;br /&gt;
 #SBATCH --ntasks=1 &lt;br /&gt;
 #SBATCH --cpus-per-task=8 &lt;br /&gt;
 #SBATCH --partition=single,lattice&lt;br /&gt;
&lt;br /&gt;
Since the single and lattice partitions both have the same type of hardware, it is appropriate to list them both.  Specifying --mem=0 allows you to use all the available memory (12000 MB) on the compute node assigned to the job.  Since the compute nodes in those partitions have 8 cores each and you will be using them all, you need not be concerned about other users&#039; jobs sharing the memory with your job.  However, if you didn&#039;t explicitly specify the partition in such a case, the system would try to assign your job to the cpu2019 or similar partition.  Those nodes have 40 cores and much more memory than the single and lattice partitions.  If you specified --mem=0 in such a case, you would be wasting 32 cores of processing.  So, if you don&#039;t specify a partition yourself, you have to give greater thought to the memory specification to make sure that the scheduler will not assign your job more resources than are needed.&lt;br /&gt;
&lt;br /&gt;
As time limits may be changed by administrators to adjust to maintenance schedules or system load, the values given in the tables are not definitive.  See the Time limits section below for commands you can use on ARC itself to determine current limits.&lt;br /&gt;
&lt;br /&gt;
Parameters such as &#039;&#039;&#039;--ntasks-per-cpu&#039;&#039;&#039;, &#039;&#039;&#039;--cpus-per-task&#039;&#039;&#039;, &#039;&#039;&#039;--mem&#039;&#039;&#039; and &#039;&#039;&#039;--mem-per-cpu&amp;gt;&#039;&#039;&#039; have to be adjusted according to the capabilities of the hardware also. The product of --ntasks-per-cpu and --cpus-per-task should be less than or equal to the number given in the &amp;quot;Cores/node&amp;quot; column.  The &#039;&#039;&#039;--mem&amp;gt;&#039;&#039;&#039; parameter (or the product of &#039;&#039;&#039;--mem-per-cpu&#039;&#039;&#039; and &#039;&#039;&#039;--cpus-per-task&#039;&#039;&#039;) should be less than the &amp;quot;Memory limit&amp;quot; shown. If using whole nodes, you can specify &#039;&#039;&#039;--mem=0&#039;&#039;&#039; to request the maximum amount of memory per node.&lt;br /&gt;
&lt;br /&gt;
==== Partitions for modern hardware: ====&lt;br /&gt;
&lt;br /&gt;
Note, MPI codes using this hardware should be compiled with Omni-Path networking support. This is provided by loading the openmpi/2.1.3-opa or openmpi/3.1.2-opa modules prior to compiling.&lt;br /&gt;
{| class=&amp;quot;wikitable&lt;br /&gt;
!Partition&lt;br /&gt;
!Cores/node&lt;br /&gt;
!Memory limit (MB)&lt;br /&gt;
!Time limit (h)&lt;br /&gt;
!GPUs/node&lt;br /&gt;
|-&lt;br /&gt;
|cpu2019&lt;br /&gt;
|40&lt;br /&gt;
|185000&lt;br /&gt;
|168	&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|apophis&amp;amp;dagger;&lt;br /&gt;
|40&lt;br /&gt;
|185000&lt;br /&gt;
|168&lt;br /&gt;
|	&lt;br /&gt;
|-&lt;br /&gt;
|apophis-bf&amp;amp;dagger;&lt;br /&gt;
|40&lt;br /&gt;
|185000&lt;br /&gt;
|5&lt;br /&gt;
|	&lt;br /&gt;
|-&lt;br /&gt;
|razi&amp;amp;dagger;&lt;br /&gt;
|40&lt;br /&gt;
|185000&lt;br /&gt;
|168&lt;br /&gt;
|	&lt;br /&gt;
|-&lt;br /&gt;
|razi-bf&amp;amp;dagger;&lt;br /&gt;
|40&lt;br /&gt;
|185000&lt;br /&gt;
|5&lt;br /&gt;
|	&lt;br /&gt;
|-&lt;br /&gt;
|bigmem&lt;br /&gt;
|80&lt;br /&gt;
|3000000&lt;br /&gt;
|24&lt;br /&gt;
|	&lt;br /&gt;
|-&lt;br /&gt;
|gpu-v100&lt;br /&gt;
|40&lt;br /&gt;
|753000&lt;br /&gt;
|24&lt;br /&gt;
|2&lt;br /&gt;
|}&lt;br /&gt;
&amp;amp;dagger; The apophis and razi partitions contain hardware contributed to ARC by particular researchers. They should be used only by members of those researchers&#039; groups.  However, they have generously allowed their compute nodes to be shared with others outside their research groups for relatively short jobs by specifying the apophis-bf and razi-bf partitions.  (In some cases in which a partition is not explicitly specified, these &amp;quot;back-fill&amp;quot; partitions may be automatically selected by the system).&lt;br /&gt;
&lt;br /&gt;
==== Partitions for legacy hardware: ====&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Partition&lt;br /&gt;
!Cores/node&lt;br /&gt;
!Memory limit (MB)&lt;br /&gt;
!Time limit (h)&lt;br /&gt;
!GPUs/node&lt;br /&gt;
|-&lt;br /&gt;
|cpu2013&lt;br /&gt;
|16&lt;br /&gt;
|120000&lt;br /&gt;
|168&lt;br /&gt;
|&lt;br /&gt;
|-	&lt;br /&gt;
|lattice&lt;br /&gt;
|8&lt;br /&gt;
|12000&lt;br /&gt;
|168&lt;br /&gt;
|&lt;br /&gt;
|-	&lt;br /&gt;
|parallel&lt;br /&gt;
|12&lt;br /&gt;
|23000&lt;br /&gt;
|168&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|breezy&amp;amp;Dagger;&lt;br /&gt;
|24&lt;br /&gt;
|255000&lt;br /&gt;
|72&lt;br /&gt;
|&lt;br /&gt;
|-	&lt;br /&gt;
|bigbyte&amp;amp;Dagger;&lt;br /&gt;
|32&lt;br /&gt;
|1000000&lt;br /&gt;
|24&lt;br /&gt;
|&lt;br /&gt;
|-	&lt;br /&gt;
|single&lt;br /&gt;
|8&lt;br /&gt;
|12000&lt;br /&gt;
|168&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|gpu&lt;br /&gt;
|12&lt;br /&gt;
|23000&lt;br /&gt;
|72&lt;br /&gt;
|3&lt;br /&gt;
|}&lt;br /&gt;
&amp;amp;Dagger; Update 2019-11-27 - the breezy and bigbyte partition nodes are being repurposed as a cluster to support teaching and learning activities and are no longer available as part of ARC.&lt;br /&gt;
&lt;br /&gt;
Here are some examples of specifying the various partitions.&lt;br /&gt;
&lt;br /&gt;
As mentioned in the [[#Hardware|Hardware]] section above, the ARC cluster was expanded in January 2019.  To select the 40-core general purpose nodes specify:&lt;br /&gt;
&lt;br /&gt;
 #SBATCH --partition=cpu2019&lt;br /&gt;
&lt;br /&gt;
To run on the Tesla V100 GPU-enabled nodes, use the &#039;&#039;&#039;gpu-v100&#039;&#039;&#039; partition.  You will also need to include an SBATCH directive in the form &#039;&#039;&#039;--gres=gpu:n&#039;&#039;&#039; to specify the number of GPUs, n, that you need.  For example, if the software you are running can make use of both GPUs on a gpu-v100 partition compute node, use:&lt;br /&gt;
&lt;br /&gt;
 #SBATCH --partition=gpu-v100 --gres=gpu:2&lt;br /&gt;
&lt;br /&gt;
For very large memory jobs (more than 185000 MB), specify the bigmem partition:&lt;br /&gt;
&lt;br /&gt;
 #SBATCH --partition=bigmem&lt;br /&gt;
&lt;br /&gt;
If the more modern computers are too busy or you have a job well-suited to run on the compute nodes described in the legacy hardware section above, choose the cpu2013,  Lattice or Parallel compute nodes (without graphics processing units) by specifying the corresponding partition keyword:&lt;br /&gt;
&lt;br /&gt;
 #SBATCH --partition=cpu2013&lt;br /&gt;
&lt;br /&gt;
 #SBATCH --partition=lattice&lt;br /&gt;
&lt;br /&gt;
or&lt;br /&gt;
&lt;br /&gt;
 #SBATCH --partition=parallel&lt;br /&gt;
&lt;br /&gt;
There is an additional partition called &#039;&#039;&#039;single&#039;&#039;&#039; that provides nodes similar to the lattice partition, but, is intended for single-node jobs. Select the single partition with&lt;br /&gt;
&lt;br /&gt;
 #SBATCH --partition=single&lt;br /&gt;
&lt;br /&gt;
For single-node jobs requiring more memory or processors than available through the breezy or single partitions, use the bigbyte partition:&lt;br /&gt;
&lt;br /&gt;
 #SBATCH --partition=bigbyte&lt;br /&gt;
&lt;br /&gt;
To select the nodes that have GPUs, specify the &#039;&#039;&#039;gpu&#039;&#039;&#039; partition. Use an SBATCH directive in the form &#039;&#039;&#039;--gres=gpu:n&#039;&#039;&#039; to specify the number of GPUs, n, that you need.  For example, if the software you are running can make use of all three GPUs on a compute node, use:&lt;br /&gt;
&lt;br /&gt;
 #SBATCH --partition=gpu --gres=gpu:3&lt;br /&gt;
&lt;br /&gt;
=== Time limits ===&lt;br /&gt;
Use a directive of the form&lt;br /&gt;
&lt;br /&gt;
 #SBATCH --time=hh:mm:ss&lt;br /&gt;
&lt;br /&gt;
to tell the job scheduler the maximum time that your job might run. You can use the command&lt;br /&gt;
&lt;br /&gt;
 scontrol show partitions&lt;br /&gt;
&lt;br /&gt;
to see the current configuration of the partitions including the maximum time limit you can specify for each partition, as given by the MaxTime field.  Alternatively, see the TIMELIMIT column in the output from&lt;br /&gt;
&lt;br /&gt;
 sinfo&lt;br /&gt;
&lt;br /&gt;
=== Hardware resource and job policy limits ===&lt;br /&gt;
There are limits on the number of cores, nodes and/or GPUs that one can use on ARC at any given time.  There is also a limit on the number of jobs that a user can have pending or running at a given time (the MaxSubmitJobs parameter in the command below). The limits are generally applied on a partition-by-partition basis, so, using resources in one partition should not affect the amount you can use in a different partition. To see the current limits you can run the command:&lt;br /&gt;
&lt;br /&gt;
 sacctmgr show qos format=Name,MaxWall,MaxTRESPU%20,MaxSubmitJobs&lt;br /&gt;
&lt;br /&gt;
== Support ==&lt;br /&gt;
Please send ARC-related questions to support@hpc.ucalgary.ca.&lt;/div&gt;</summary>
		<author><name>Phillips</name></author>
	</entry>
	<entry>
		<id>https://rcs.ucalgary.ca/index.php?title=ARC_Cluster_Guide&amp;diff=580</id>
		<title>ARC Cluster Guide</title>
		<link rel="alternate" type="text/html" href="https://rcs.ucalgary.ca/index.php?title=ARC_Cluster_Guide&amp;diff=580"/>
		<updated>2020-05-28T00:05:18Z</updated>

		<summary type="html">&lt;p&gt;Phillips: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:ARC Cluster]]&lt;br /&gt;
This guide gives an overview of the ARC (Advanced Research Computing) cluster at the University of Calgary.&lt;br /&gt;
&lt;br /&gt;
It is intended to be read by new account holders getting started on ARC, covering such topics as the hardware and performance characteristics, available software, usage policies and how to log in and run jobs. &lt;br /&gt;
&lt;br /&gt;
For ARC-related questions not answered here, please write to support@hpc.ucalgary.ca .&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Cybersecurity awareness at the U of C&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Please note that there are typically about 950 phishing attempts targeting University of Calgary accounts each month. This is just a reminder to be careful about computer security issues, both at home and at the University. See [https://it.ucalgary.ca/it-security] for more information, such as tips for secure computing and how to report suspected security problems.&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
ARC is a cluster primarily comprised of Linux-based computers repurposed from several separate older clusters (Breezy, Lattice, Parallel) that were formerly offered to researchers from across Canada.  In addition, a large-memory compute node (Bigbyte) was salvaged from the now-retired local Storm cluster. In January 2019, a major addition to ARC was purchased, with modern hardware.&lt;br /&gt;
&lt;br /&gt;
In this new configuration, as ARC, the computational resources of these clusters are now being restricted to research projects based at the University of Calgary.  ARC is meant to supplement the resources available to researchers through Compute Canada. You can read about those machines at the Compute Canada web site.&lt;br /&gt;
&lt;br /&gt;
The ARC cluster can be used for running large numbers (hundreds) of concurrent serial (one-core) jobs, OpenMP or other thread-based, shared-memory parallel codes using up to 40 threads per job (or even 80 on one large node), or distributed-memory (MPI-based) parallel codes using up to hundreds of cores.  Software that make use of Graphics Processing Units (GPUs) can also be used.&lt;br /&gt;
&lt;br /&gt;
== Accounts ==&lt;br /&gt;
If you have a project you think would be appropriate for ARC, please write to support@hpc.ucalgary.ca .  To assist you getting started, it would be helpful if you mention what software you plan to use.&lt;br /&gt;
&lt;br /&gt;
Note that University of Calgary Information Technologies computing account credentials are used for ARC (the same as used for University of Calgary email accounts). If you don&#039;t have a University of Calgary email address, please register for one at https://itregport.ucalgary.ca/ and include your email address in your request for a ARC account. &lt;br /&gt;
&lt;br /&gt;
If you don&#039;t have University of Calgary credentials because you are external to the University you may still apply for an account if you are collaborating on a project with a University of Calgary faculty member.  In your email, please explain your situation and mention the project leader involved.&lt;br /&gt;
&lt;br /&gt;
== Hardware ==&lt;br /&gt;
=== Processors ===&lt;br /&gt;
Besides login and administrative servers, the ARC hardware consists of compute nodes of several types. When submitting jobs to run on the cluster, you can specify a partition parameter to select the particular type of hardware that is most appropriate for your work. See the [[ARC Hardware|ARC Hardware page]] for further technical details about the hardware if you are interested, but, most users will only need to be aware of the processor count and memory characteristics given in the section on [[#Selecting a partition|selecting a partition]] below. &lt;br /&gt;
&lt;br /&gt;
=== Network (interconnect) ===&lt;br /&gt;
Most of the partitions have a high-speed interconnect between the compute nodes, making them suitable for multi-node parallel processing.  It is sometimes important to make a distinction in the type of network technology used, as some software may be built to work with libraries supporting one type of network and not another. &lt;br /&gt;
&lt;br /&gt;
The compute nodes in some of the partitions (cpu2019, apophis, apophis-bf, pawson, pawson-bf, razi and razi-bf) communicate via a 100 Gbit/s Omni-Path network, whereas the older compute nodes within the lattice and parallel cluster partitions use 40 Gbit/s InfiniBand.  A bit more detail is given on the [ARC Hardware page].&lt;br /&gt;
&lt;br /&gt;
=== Storage ===&lt;br /&gt;
About a petabyte of raw disk storage is available to the ARC cluster, but for error checking and performance reasons, the amount of usable storage for researchers&#039; projects is considerably less than that.  From a user&#039;s perspective, the total amount of storage is less important than the individual storage limits.  As described below, there are three storage areas: home, scratch and work, with different limits and usage policies.&lt;br /&gt;
&lt;br /&gt;
==== Home file system: /home ====&lt;br /&gt;
There is a per-user quota of 500 GB under /home. This limit is fixed and cannot be increased.  Each user has a directory under /home, which is the default working directory when logging in to ARC. It is expected that most researchers will be able to do their work from within their home directories, but, there are two options (/work and /scratch) for accessing more space.&lt;br /&gt;
&lt;br /&gt;
Note on file sharing: Due to security concerns, permissions set on your home directory with the chmod command, to allow others to share your files, will be automatically removed by a system monitoring process unless an explicit exception is made. If you need to share files with other researchers on the ARC cluster, please write to support@hpc.ucalgary.ca to ask for such an exception.&lt;br /&gt;
&lt;br /&gt;
==== Scratch file system for large job-oriented storage: /scratch ====&lt;br /&gt;
Associated with each job, under the /scratch directory, a subdirectory is created that can be referenced in job scripts as /scratch/${SLURM_JOB_ID}. You can use that directory for temporary files needed during the course of a job. Up to 30 TB of storage may be used, per user (total for all your jobs) in the /scratch file system.  Deletion policy: data in /scratch associated with a given job will be deleted automatically, without exception, five days after the job finishes.&lt;br /&gt;
&lt;br /&gt;
==== Work file system for larger projects: /work ====&lt;br /&gt;
If you need more space than provided in /home and the /scratch job-oriented space is not appropriate for you case, please write to support@hpc.ucalgary.ca with an explanation, including an indication of how much storage you expect to need and for how long.  If approved, you will then be assigned a directory under /work with an appropriately large quota.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Backup policy:&#039;&#039;&#039; you are responsible for your own backups.  Many researchers will have accounts with Compute Canada and may choose to back up their data there (the Project file system accessible through the Cedar cluster would often be used).  We can explain more about this option if you write to support@hpc.ucalgary.ca .&lt;br /&gt;
&lt;br /&gt;
== Software ==&lt;br /&gt;
Look for installed software under /global/software and through the module avail command. The setup of the environment for using some of the installed software is through the module command. An overview of [modules on WestGrid (external link) https://www.westgrid.ca//support/modules] is largely applicable to ARC.&lt;br /&gt;
&lt;br /&gt;
To list available modules, type:&lt;br /&gt;
&lt;br /&gt;
 module avail&lt;br /&gt;
&lt;br /&gt;
So, for example, to load a module for Python use:&lt;br /&gt;
&lt;br /&gt;
 module load python/anaconda-3.6-5.1.0&lt;br /&gt;
&lt;br /&gt;
and to remove it use:&lt;br /&gt;
&lt;br /&gt;
 module remove python/anaconda-3.6-5.1.0&lt;br /&gt;
&lt;br /&gt;
To see currently loaded modules, type:&lt;br /&gt;
&lt;br /&gt;
 module list&lt;br /&gt;
&lt;br /&gt;
Unlike some clusters, there are no modules loaded by default.  So, for example, to use Intel compilers, or to use Open MPI parallel programming, you must load an appropriate module.&lt;br /&gt;
&lt;br /&gt;
Write to support@hpc.ucalgary.ca if you need additional software installed.&lt;br /&gt;
&lt;br /&gt;
== Using ARC ==&lt;br /&gt;
=== Logging in ===&lt;br /&gt;
To log in to ARC, connect to arc.ucalgary.ca using an ssh (secure shell) client. For more information about connecting and setting up your environment, the WestGrid [http://www.westgrid.ca/support/quickstart/new_users QuickStart Guide for New Users] may be helpful.  Note that connections are accepted only from on-campus IP addresses. You can connect from off-campus by using Virtual Private Network (VPN) software available from [https://ucalgary.service-now.com/it?id=kb_article&amp;amp;sys_id=880e71071381ae006f3afbb2e144b05c Information Techologies].&lt;br /&gt;
&lt;br /&gt;
=== Storage ===&lt;br /&gt;
Please review the [[#Storage|Storage]] section above for important policies and advice regarding file storage and file sharing.&lt;br /&gt;
&lt;br /&gt;
=== Working interactively ===&lt;br /&gt;
ARC uses the Linux operating system. The program that responds to your typed commands and allows you to run other programs is called the Linux shell. There are several different shells available, but, by default you will use one called bash. It is useful to have some knowledge of the shell and a variety of other command-line programs that you can use to manipulate files. If you are new to Linux systems, we recommend that you work through one of the many online tutorials that are available, such as the [http://www.ee.surrey.ac.uk/Teaching/Unix/index.html UNIX Tutorial for Beginners (external link)] provided by the University of Surrey. The tutorial covers such fundamental topics, among others, as creating, renaming and deleting files and directories, how to produce a listing of your files and how to tell how much disk space you are using.  For a more comprehensive introduction to Linux, see [http://linuxcommand.sourceforge.net/tlcl.php The Linux Command Line (external link)].&lt;br /&gt;
&lt;br /&gt;
The ARC login node may be used for such tasks as editing files, compiling programs and running short tests while developing programs (under 15 minutes, say). Processors may also be reserved for interactive sessions using the salloc command specifying the resources needed through arguments on the salloc command line.&lt;br /&gt;
&lt;br /&gt;
=== Running non-interactive jobs (batch processing) ===&lt;br /&gt;
Production runs and longer test runs should be submitted as (non-interactive) batch jobs, in which commands to be executed are listed in a script (text file). Batch jobs scripts are submitted using the sbatch command, part of the Slurm job management and scheduling software. #SBATCH directive lines at the beginning of the script are used to specify the resources needed for the job (cores, memory, run time limit and any specialized hardware needed).&lt;br /&gt;
&lt;br /&gt;
Most of the information on the [https://docs.computecanada.ca/wiki/Running_jobs Running Jobs (external link)] page on the Compute Canada web site is also relevant for submitting and managing batch jobs and reserving processors for interactive work on ARC.  One major difference between running jobs on the ARC and Compute Canada clusters is in selecting the type of hardware that should be used for a job. On ARC, you choose the hardware to use primarily by specifying a partition, as described below.&lt;br /&gt;
&lt;br /&gt;
=== Selecting a partition ===&lt;br /&gt;
The type of computer on which a job can or should be run is determined by characteristics of your software, such as whether it supports parallel processing and by simulation or data-dependent factors such as the amount of memory required.  If the program you are running uses MPI (Message Passing Interface) for parallel processing, which allows the memory usage to be distributed across multiple compute nodes, then, the memory required per MPI process is an important factor.  If you are running a serial code (that is, it is not able to use multiple CPU cores) or one that is parallelized with OpenMP or other thread-based techniques that restrict it to running on just a single compute node, then, the total memory required is the main factor to consider.  If your program can make use of graphics processing units, then, that will be the determining factor.  If you have questions about which ARC hardware to use, please write to [[mailto:support@hpc.ucalgary.ca]] and we would be happy to discuss this with you.&lt;br /&gt;
&lt;br /&gt;
One you have decided what type of hardware best suits your calculations, you can select it on a job-by-job basis by including the &#039;&#039;&#039;partition&#039;&#039;&#039; keyword for an &#039;&#039;&#039;SBATCH&#039;&#039;&#039; directive in your batch job. The tables below summarize the characteristics of the various partitions&lt;br /&gt;
&lt;br /&gt;
If you omit the partition specification, the system will try to assign your job to appropriate hardware based on other aspects of your request, but, for more control you can specify one or more partitions yourself.  You are allowed to specify a comma-separate list of partitions. &lt;br /&gt;
&lt;br /&gt;
In some cases, you really should specify the partition explicitly.  For example, if you are running single-node jobs with thread-based parallel processing requesting 8 cores you could use:&lt;br /&gt;
&lt;br /&gt;
 #SBATCH --mem=0 &lt;br /&gt;
 #SBATCH --nodes=1 &lt;br /&gt;
 #SBATCH --ntasks=1 &lt;br /&gt;
 #SBATCH --cpus-per-task=8 &lt;br /&gt;
 #SBATCH --partition=single,lattice&lt;br /&gt;
&lt;br /&gt;
Since the single and lattice partitions both have the same type of hardware, it is appropriate to list them both.  Specifying --mem=0 allows you to use all the available memory (12000 MB) on the compute node assigned to the job.  Since the compute nodes in those partitions have 8 cores each and you will be using them all, you need not be concerned about other users&#039; jobs sharing the memory with your job.  However, if you didn&#039;t explicitly specify the partition in such a case, the system would try to assign your job to the cpu2019 or similar partition.  Those nodes have 40 cores and much more memory than the single and lattice partitions.  If you specified --mem=0 in such a case, you would be wasting 32 cores of processing.  So, if you don&#039;t specify a partition yourself, you have to give greater thought to the memory specification to make sure that the scheduler will not assign your job more resources than are needed.&lt;br /&gt;
&lt;br /&gt;
As time limits may be changed by administrators to adjust to maintenance schedules or system load, the values given in the tables are not definitive.  See the Time limits section below for commands you can use on ARC itself to determine current limits.&lt;br /&gt;
&lt;br /&gt;
Parameters such as &#039;&#039;&#039;--ntasks-per-cpu&#039;&#039;&#039;, &#039;&#039;&#039;--cpus-per-task&#039;&#039;&#039;, &#039;&#039;&#039;--mem&#039;&#039;&#039; and &#039;&#039;&#039;--mem-per-cpu&amp;gt;&#039;&#039;&#039; have to be adjusted according to the capabilities of the hardware also. The product of --ntasks-per-cpu and --cpus-per-task should be less than or equal to the number given in the &amp;quot;Cores/node&amp;quot; column.  The &#039;&#039;&#039;--mem&amp;gt;&#039;&#039;&#039; parameter (or the product of &#039;&#039;&#039;--mem-per-cpu&#039;&#039;&#039; and &#039;&#039;&#039;--cpus-per-task&#039;&#039;&#039;) should be less than the &amp;quot;Memory limit&amp;quot; shown. If using whole nodes, you can specify &#039;&#039;&#039;--mem=0&#039;&#039;&#039; to request the maximum amount of memory per node.&lt;br /&gt;
&lt;br /&gt;
==== Partitions for modern hardware: ====&lt;br /&gt;
&lt;br /&gt;
Note, MPI codes using this hardware should be compiled with Omni-Path networking support. This is provided by loading the openmpi/2.1.3-opa or openmpi/3.1.2-opa modules prior to compiling.&lt;br /&gt;
{| class=&amp;quot;wikitable&lt;br /&gt;
!Partition&lt;br /&gt;
!Cores/node&lt;br /&gt;
!Memory limit (MB)&lt;br /&gt;
!Time limit (h)&lt;br /&gt;
!GPUs/node&lt;br /&gt;
|-&lt;br /&gt;
|cpu2019&lt;br /&gt;
|40&lt;br /&gt;
|185000&lt;br /&gt;
|168	&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|apophis&amp;amp;dagger;&lt;br /&gt;
|40&lt;br /&gt;
|185000&lt;br /&gt;
|168&lt;br /&gt;
|	&lt;br /&gt;
|-&lt;br /&gt;
|apophis-bf&amp;amp;dagger;&lt;br /&gt;
|40&lt;br /&gt;
|185000&lt;br /&gt;
|5&lt;br /&gt;
|	&lt;br /&gt;
|-&lt;br /&gt;
|razi&amp;amp;dagger;&lt;br /&gt;
|40&lt;br /&gt;
|185000&lt;br /&gt;
|168&lt;br /&gt;
|	&lt;br /&gt;
|-&lt;br /&gt;
|razi-bf&amp;amp;dagger;&lt;br /&gt;
|40&lt;br /&gt;
|185000&lt;br /&gt;
|5&lt;br /&gt;
|	&lt;br /&gt;
|-&lt;br /&gt;
|bigmem&lt;br /&gt;
|80&lt;br /&gt;
|3000000&lt;br /&gt;
|24&lt;br /&gt;
|	&lt;br /&gt;
|-&lt;br /&gt;
|gpu-v100&lt;br /&gt;
|40&lt;br /&gt;
|753000&lt;br /&gt;
|24&lt;br /&gt;
|2&lt;br /&gt;
|}&lt;br /&gt;
&amp;amp;dagger; The apophis and razi partitions contain hardware contributed to ARC by particular researchers. They should be used only by members of those researchers&#039; groups.  However, they have generously allowed their compute nodes to be shared with others outside their research groups for relatively short jobs by specifying the apophis-bf and razi-bf partitions.  (In some cases in which a partition is not explicitly specified, these &amp;quot;back-fill&amp;quot; partitions may be automatically selected by the system).&lt;br /&gt;
&lt;br /&gt;
==== Partitions for legacy hardware: ====&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Partition&lt;br /&gt;
!Cores/node&lt;br /&gt;
!Memory limit (MB)&lt;br /&gt;
!Time limit (h)&lt;br /&gt;
!GPUs/node&lt;br /&gt;
|-&lt;br /&gt;
|cpu2013&lt;br /&gt;
|16&lt;br /&gt;
|120000&lt;br /&gt;
|168&lt;br /&gt;
|&lt;br /&gt;
|-	&lt;br /&gt;
|lattice&lt;br /&gt;
|8&lt;br /&gt;
|12000&lt;br /&gt;
|168&lt;br /&gt;
|&lt;br /&gt;
|-	&lt;br /&gt;
|parallel&lt;br /&gt;
|12&lt;br /&gt;
|23000&lt;br /&gt;
|168&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|breezy&amp;amp;Dagger;&lt;br /&gt;
|24&lt;br /&gt;
|255000&lt;br /&gt;
|72&lt;br /&gt;
|&lt;br /&gt;
|-	&lt;br /&gt;
|bigbyte&amp;amp;Dagger;&lt;br /&gt;
|32&lt;br /&gt;
|1000000&lt;br /&gt;
|24&lt;br /&gt;
|&lt;br /&gt;
|-	&lt;br /&gt;
|single&lt;br /&gt;
|8&lt;br /&gt;
|12000&lt;br /&gt;
|168&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|gpu&lt;br /&gt;
|12&lt;br /&gt;
|23000&lt;br /&gt;
|72&lt;br /&gt;
|3&lt;br /&gt;
|}&lt;br /&gt;
&amp;amp;Dagger; Update 2019-11-27 - the breezy and bigbyte partition nodes are being repurposed as a cluster to support teaching and learning activities and are no longer available as part of ARC.&lt;br /&gt;
&lt;br /&gt;
Here are some examples of specifying the various partitions.&lt;br /&gt;
&lt;br /&gt;
As mentioned in the [[#Hardware|Hardware]] section above, the ARC cluster was expanded in January 2019.  To select the 40-core general purpose nodes specify:&lt;br /&gt;
&lt;br /&gt;
 #SBATCH --partition=cpu2019&lt;br /&gt;
&lt;br /&gt;
To run on the Tesla V100 GPU-enabled nodes, use the &#039;&#039;&#039;gpu-v100&#039;&#039;&#039; partition.  You will also need to include an SBATCH directive in the form &#039;&#039;&#039;--gres=gpu:n&#039;&#039;&#039; to specify the number of GPUs, n, that you need.  For example, if the software you are running can make use of both GPUs on a gpu-v100 partition compute node, use:&lt;br /&gt;
&lt;br /&gt;
 #SBATCH --partition=gpu-v100 --gres=gpu:2&lt;br /&gt;
&lt;br /&gt;
For very large memory jobs (more than 185000 MB), specify the bigmem partition:&lt;br /&gt;
&lt;br /&gt;
 #SBATCH --partition=bigmem&lt;br /&gt;
&lt;br /&gt;
If the more modern computers are too busy or you have a job well-suited to run on the compute nodes described in the legacy hardware section above, choose the cpu2013,  Lattice or Parallel compute nodes (without graphics processing units) by specifying the corresponding partition keyword:&lt;br /&gt;
&lt;br /&gt;
 #SBATCH --partition=cpu2013&lt;br /&gt;
&lt;br /&gt;
 #SBATCH --partition=lattice&lt;br /&gt;
&lt;br /&gt;
or&lt;br /&gt;
&lt;br /&gt;
 #SBATCH --partition=parallel&lt;br /&gt;
&lt;br /&gt;
There is an additional partition called &#039;&#039;&#039;single&#039;&#039;&#039; that provides nodes similar to the lattice partition, but, is intended for single-node jobs. Select the single partition with&lt;br /&gt;
&lt;br /&gt;
 #SBATCH --partition=single&lt;br /&gt;
&lt;br /&gt;
For single-node jobs requiring more memory or processors than available through the breezy or single partitions, use the bigbyte partition:&lt;br /&gt;
&lt;br /&gt;
 #SBATCH --partition=bigbyte&lt;br /&gt;
&lt;br /&gt;
To select the nodes that have GPUs, specify the &#039;&#039;&#039;gpu&#039;&#039;&#039; partition. Use an SBATCH directive in the form &#039;&#039;&#039;--gres=gpu:n&#039;&#039;&#039; to specify the number of GPUs, n, that you need.  For example, if the software you are running can make use of all three GPUs on a compute node, use:&lt;br /&gt;
&lt;br /&gt;
 #SBATCH --partition=gpu --gres=gpu:3&lt;br /&gt;
&lt;br /&gt;
=== Time limits ===&lt;br /&gt;
Use a directive of the form&lt;br /&gt;
&lt;br /&gt;
 #SBATCH --time=hh:mm:ss&lt;br /&gt;
&lt;br /&gt;
to tell the job scheduler the maximum time that your job might run. You can use the command&lt;br /&gt;
&lt;br /&gt;
 scontrol show partitions&lt;br /&gt;
&lt;br /&gt;
to see the current configuration of the partitions including the maximum time limit you can specify for each partition, as given by the MaxTime field.  Alternatively, see the TIMELIMIT column in the output from&lt;br /&gt;
&lt;br /&gt;
 sinfo&lt;br /&gt;
&lt;br /&gt;
=== Hardware resource and job policy limits ===&lt;br /&gt;
There are limits on the number of cores, nodes and/or GPUs that one can use on ARC at any given time.  There is also a limit on the number of jobs that a user can have pending or running at a given time (the MaxSubmitJobs parameter in the command below). The limits are generally applied on a partition-by-partition basis, so, using resources in one partition should not affect the amount you can use in a different partition. To see the current limits you can run the command:&lt;br /&gt;
&lt;br /&gt;
 sacctmgr show qos format=Name,MaxWall,MaxTRESPU%20,MaxSubmitJobs&lt;br /&gt;
&lt;br /&gt;
== Support ==&lt;br /&gt;
Please send ARC-related questions to support@hpc.ucalgary.ca.&lt;/div&gt;</summary>
		<author><name>Phillips</name></author>
	</entry>
	<entry>
		<id>https://rcs.ucalgary.ca/index.php?title=ARC_Cluster_Guide&amp;diff=579</id>
		<title>ARC Cluster Guide</title>
		<link rel="alternate" type="text/html" href="https://rcs.ucalgary.ca/index.php?title=ARC_Cluster_Guide&amp;diff=579"/>
		<updated>2020-05-28T00:04:31Z</updated>

		<summary type="html">&lt;p&gt;Phillips: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:ARC Cluster]]&lt;br /&gt;
This guide gives an overview of the ARC (Advanced Research Computing) cluster at the University of Calgary.&lt;br /&gt;
&lt;br /&gt;
It is intended to be read by new account holders getting started on ARC, covering such topics as the hardware and performance characteristics, available software, usage policies and how to log in and run jobs. &lt;br /&gt;
&lt;br /&gt;
For ARC-related questions not answered here, please write to support@hpc.ucalgary.ca .&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Cybersecurity awareness at the U of C&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Please note that there are typically about 950 phishing attempts targeting University of Calgary accounts each month. This is just a reminder to be careful about computer security issues, both at home and at the University. See [https://it.ucalgary.ca/it-security] for more information, such as tips for secure computing and how to report suspected security problems.&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
ARC is a cluster primarily comprised of Linux-based computers repurposed from several separate older clusters (Breezy, Lattice, Parallel) that were formerly offered to researchers from across Canada.  In addition, a large-memory compute node (Bigbyte) was salvaged from the now-retired local Storm cluster. In January 2019, a major addition to ARC was purchased, with modern hardware.&lt;br /&gt;
&lt;br /&gt;
In this new configuration, as ARC, the computational resources of these clusters are now being restricted to research projects based at the University of Calgary.  ARC is meant to supplement the resources available to researchers through Compute Canada. You can read about those machines at the Compute Canada web site.&lt;br /&gt;
&lt;br /&gt;
The ARC cluster can be used for running large numbers (hundreds) of concurrent serial (one-core) jobs, OpenMP or other thread-based, shared-memory parallel codes using up to 40 threads per job (or even 80 on one large node), or distributed-memory (MPI-based) parallel codes using up to hundreds of cores.  Software that make use of Graphics Processing Units (GPUs) can also be used.&lt;br /&gt;
&lt;br /&gt;
== Accounts ==&lt;br /&gt;
If you have a project you think would be appropriate for ARC, please write to support@hpc.ucalgary.ca .  To assist you getting started, it would be helpful if you mention what software you plan to use.&lt;br /&gt;
&lt;br /&gt;
Note that University of Calgary Information Technologies computing account credentials are used for ARC (the same as used for University of Calgary email accounts). If you don&#039;t have a University of Calgary email address, please register for one at https://itregport.ucalgary.ca/ and include your email address in your request for a ARC account. &lt;br /&gt;
&lt;br /&gt;
If you don&#039;t have University of Calgary credentials because you are external to the University you may still apply for an account if you are collaborating on a project with a University of Calgary faculty member.  In your email, please explain your situation and mention the project leader involved.&lt;br /&gt;
&lt;br /&gt;
== Hardware ==&lt;br /&gt;
=== Processors ===&lt;br /&gt;
Besides login and administrative servers, the ARC hardware consists of compute nodes of several types. When submitting jobs to run on the cluster, you can specify a partition parameter to select the particular type of hardware that is most appropriate for your work. See the [[ARC Hardware|ARC Hardware page]] for further technical details about the hardware if you are interested, but, most users will only need to be aware of the processor count and memory characteristics given in the section on [[#Selecting a partition|selecting a partition]] below. &lt;br /&gt;
&lt;br /&gt;
=== Network (interconnect) ===&lt;br /&gt;
Most of the partitions have a high-speed interconnect between the compute nodes, making them suitable for multi-node parallel processing.  It is sometimes important to make a distinction in the type of network technology used, as some software may be built to work with libraries supporting one type of network and not another. &lt;br /&gt;
&lt;br /&gt;
The compute nodes in some of the partitions (cpu2019, apophis, apophis-bf, pawson, pawson-bf, razi and razi-bf) communicate via a 100 Gbit/s Omni-Path network, whereas the older compute nodes within the lattice and parallel cluster partitions use 40 Gbit/s InfiniBand.  A bit more detail is given on the [ARC Hardware page].&lt;br /&gt;
&lt;br /&gt;
=== Storage ===&lt;br /&gt;
About a petabyte of raw disk storage is available to the ARC cluster, but for error checking and performance reasons, the amount of usable storage for researchers&#039; projects is considerably less than that.  From a user&#039;s perspective, the total amount of storage is less important than the individual storage limits.  As described below, there are three storage areas: home, scratch and work, with different limits and usage policies.&lt;br /&gt;
&lt;br /&gt;
==== Home file system: /home ====&lt;br /&gt;
There is a per-user quota of 500 GB under /home. This limit is fixed and cannot be increased.  Each user has a directory under /home, which is the default working directory when logging in to ARC. It is expected that most researchers will be able to do their work from within their home directories, but, there are two options (/work and /scratch) for accessing more space.&lt;br /&gt;
&lt;br /&gt;
Note on file sharing: Due to security concerns, permissions set on your home directory with the chmod command, to allow others to share your files, will be automatically removed by a system monitoring process unless an explicit exception is made. If you need to share files with other researchers on the ARC cluster, please write to support@hpc.ucalgary.ca to ask for such an exception.&lt;br /&gt;
&lt;br /&gt;
==== Scratch file system for large job-oriented storage: /scratch ====&lt;br /&gt;
Associated with each job, under the /scratch directory, a subdirectory is created that can be referenced in job scripts as /scratch/${SLURM_JOB_ID}. You can use that directory for temporary files needed during the course of a job. Up to 30 TB of storage may be used, per user (total for all your jobs) in the /scratch file system.  Deletion policy: data in /scratch associated with a given job will be deleted automatically, without exception, five days after the job finishes.&lt;br /&gt;
&lt;br /&gt;
==== Work file system for larger projects: /work ====&lt;br /&gt;
If you need more space than provided in /home and the /scratch job-oriented space is not appropriate for you case, please write to support@hpc.ucalgary.ca with an explanation, including an indication of how much storage you expect to need and for how long.  If approved, you will then be assigned a directory under /work with an appropriately large quota.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Backup policy:&#039;&#039;&#039; you are responsible for your own backups.  Many researchers will have accounts with Compute Canada and may choose to back up their data there (the Project file system accessible through the Cedar cluster would often be used).  We can explain more about this option if you write to  support@hpc.ucalgary.ca .&lt;br /&gt;
&lt;br /&gt;
== Software ==&lt;br /&gt;
Look for installed software under /global/software and through the module avail command. The setup of the environment for using some of the installed software is through the module command. An overview of [modules on WestGrid https://www.westgrid.ca//support/modules] is largely applicable to ARC.&lt;br /&gt;
&lt;br /&gt;
To list available modules, type:&lt;br /&gt;
&lt;br /&gt;
 module avail&lt;br /&gt;
&lt;br /&gt;
So, for example, to load a module for Python use:&lt;br /&gt;
&lt;br /&gt;
 module load python/anaconda-3.6-5.1.0&lt;br /&gt;
&lt;br /&gt;
and to remove it use:&lt;br /&gt;
&lt;br /&gt;
 module remove python/anaconda-3.6-5.1.0&lt;br /&gt;
&lt;br /&gt;
To see currently loaded modules, type:&lt;br /&gt;
&lt;br /&gt;
 module list&lt;br /&gt;
&lt;br /&gt;
Unlike some clusters, there are no modules loaded by default.  So, for example, to use Intel compilers, or to use Open MPI parallel programming, you must load an appropriate module.&lt;br /&gt;
&lt;br /&gt;
Write to support@hpc.ucalgary.ca if you need additional software installed.&lt;br /&gt;
&lt;br /&gt;
== Using ARC ==&lt;br /&gt;
=== Logging in ===&lt;br /&gt;
To log in to ARC, connect to arc.ucalgary.ca using an ssh (secure shell) client. For more information about connecting and setting up your environment, the WestGrid [http://www.westgrid.ca/support/quickstart/new_users QuickStart Guide for New Users] may be helpful.  Note that connections are accepted only from on-campus IP addresses. You can connect from off-campus by using Virtual Private Network (VPN) software available from [https://ucalgary.service-now.com/it?id=kb_article&amp;amp;sys_id=880e71071381ae006f3afbb2e144b05c Information Techologies].&lt;br /&gt;
&lt;br /&gt;
=== Storage ===&lt;br /&gt;
Please review the [[#Storage|Storage]] section above for important policies and advice regarding file storage and file sharing.&lt;br /&gt;
&lt;br /&gt;
=== Working interactively ===&lt;br /&gt;
ARC uses the Linux operating system. The program that responds to your typed commands and allows you to run other programs is called the Linux shell. There are several different shells available, but, by default you will use one called bash. It is useful to have some knowledge of the shell and a variety of other command-line programs that you can use to manipulate files. If you are new to Linux systems, we recommend that you work through one of the many online tutorials that are available, such as the [http://www.ee.surrey.ac.uk/Teaching/Unix/index.html UNIX Tutorial for Beginners (external link)] provided by the University of Surrey. The tutorial covers such fundamental topics, among others, as creating, renaming and deleting files and directories, how to produce a listing of your files and how to tell how much disk space you are using.  For a more comprehensive introduction to Linux, see [http://linuxcommand.sourceforge.net/tlcl.php The Linux Command Line (external link)].&lt;br /&gt;
&lt;br /&gt;
The ARC login node may be used for such tasks as editing files, compiling programs and running short tests while developing programs (under 15 minutes, say). Processors may also be reserved for interactive sessions using the salloc command specifying the resources needed through arguments on the salloc command line.&lt;br /&gt;
&lt;br /&gt;
=== Running non-interactive jobs (batch processing) ===&lt;br /&gt;
Production runs and longer test runs should be submitted as (non-interactive) batch jobs, in which commands to be executed are listed in a script (text file). Batch jobs scripts are submitted using the sbatch command, part of the Slurm job management and scheduling software. #SBATCH directive lines at the beginning of the script are used to specify the resources needed for the job (cores, memory, run time limit and any specialized hardware needed).&lt;br /&gt;
&lt;br /&gt;
Most of the information on the [https://docs.computecanada.ca/wiki/Running_jobs Running Jobs (external link)] page on the Compute Canada web site is also relevant for submitting and managing batch jobs and reserving processors for interactive work on ARC.  One major difference between running jobs on the ARC and Compute Canada clusters is in selecting the type of hardware that should be used for a job. On ARC, you choose the hardware to use primarily by specifying a partition, as described below.&lt;br /&gt;
&lt;br /&gt;
=== Selecting a partition ===&lt;br /&gt;
The type of computer on which a job can or should be run is determined by characteristics of your software, such as whether it supports parallel processing and by simulation or data-dependent factors such as the amount of memory required.  If the program you are running uses MPI (Message Passing Interface) for parallel processing, which allows the memory usage to be distributed across multiple compute nodes, then, the memory required per MPI process is an important factor.  If you are running a serial code (that is, it is not able to use multiple CPU cores) or one that is parallelized with OpenMP or other thread-based techniques that restrict it to running on just a single compute node, then, the total memory required is the main factor to consider.  If your program can make use of graphics processing units, then, that will be the determining factor.  If you have questions about which ARC hardware to use, please write to [[mailto:support@hpc.ucalgary.ca]] and we would be happy to discuss this with you.&lt;br /&gt;
&lt;br /&gt;
One you have decided what type of hardware best suits your calculations, you can select it on a job-by-job basis by including the &#039;&#039;&#039;partition&#039;&#039;&#039; keyword for an &#039;&#039;&#039;SBATCH&#039;&#039;&#039; directive in your batch job. The tables below summarize the characteristics of the various partitions&lt;br /&gt;
&lt;br /&gt;
If you omit the partition specification, the system will try to assign your job to appropriate hardware based on other aspects of your request, but, for more control you can specify one or more partitions yourself.  You are allowed to specify a comma-separate list of partitions. &lt;br /&gt;
&lt;br /&gt;
In some cases, you really should specify the partition explicitly.  For example, if you are running single-node jobs with thread-based parallel processing requesting 8 cores you could use:&lt;br /&gt;
&lt;br /&gt;
 #SBATCH --mem=0 &lt;br /&gt;
 #SBATCH --nodes=1 &lt;br /&gt;
 #SBATCH --ntasks=1 &lt;br /&gt;
 #SBATCH --cpus-per-task=8 &lt;br /&gt;
 #SBATCH --partition=single,lattice&lt;br /&gt;
&lt;br /&gt;
Since the single and lattice partitions both have the same type of hardware, it is appropriate to list them both.  Specifying --mem=0 allows you to use all the available memory (12000 MB) on the compute node assigned to the job.  Since the compute nodes in those partitions have 8 cores each and you will be using them all, you need not be concerned about other users&#039; jobs sharing the memory with your job.  However, if you didn&#039;t explicitly specify the partition in such a case, the system would try to assign your job to the cpu2019 or similar partition.  Those nodes have 40 cores and much more memory than the single and lattice partitions.  If you specified --mem=0 in such a case, you would be wasting 32 cores of processing.  So, if you don&#039;t specify a partition yourself, you have to give greater thought to the memory specification to make sure that the scheduler will not assign your job more resources than are needed.&lt;br /&gt;
&lt;br /&gt;
As time limits may be changed by administrators to adjust to maintenance schedules or system load, the values given in the tables are not definitive.  See the Time limits section below for commands you can use on ARC itself to determine current limits.&lt;br /&gt;
&lt;br /&gt;
Parameters such as &#039;&#039;&#039;--ntasks-per-cpu&#039;&#039;&#039;, &#039;&#039;&#039;--cpus-per-task&#039;&#039;&#039;, &#039;&#039;&#039;--mem&#039;&#039;&#039; and &#039;&#039;&#039;--mem-per-cpu&amp;gt;&#039;&#039;&#039; have to be adjusted according to the capabilities of the hardware also. The product of --ntasks-per-cpu and --cpus-per-task should be less than or equal to the number given in the &amp;quot;Cores/node&amp;quot; column.  The &#039;&#039;&#039;--mem&amp;gt;&#039;&#039;&#039; parameter (or the product of &#039;&#039;&#039;--mem-per-cpu&#039;&#039;&#039; and &#039;&#039;&#039;--cpus-per-task&#039;&#039;&#039;) should be less than the &amp;quot;Memory limit&amp;quot; shown. If using whole nodes, you can specify &#039;&#039;&#039;--mem=0&#039;&#039;&#039; to request the maximum amount of memory per node.&lt;br /&gt;
&lt;br /&gt;
==== Partitions for modern hardware: ====&lt;br /&gt;
&lt;br /&gt;
Note, MPI codes using this hardware should be compiled with Omni-Path networking support. This is provided by loading the openmpi/2.1.3-opa or openmpi/3.1.2-opa modules prior to compiling.&lt;br /&gt;
{| class=&amp;quot;wikitable&lt;br /&gt;
!Partition&lt;br /&gt;
!Cores/node&lt;br /&gt;
!Memory limit (MB)&lt;br /&gt;
!Time limit (h)&lt;br /&gt;
!GPUs/node&lt;br /&gt;
|-&lt;br /&gt;
|cpu2019&lt;br /&gt;
|40&lt;br /&gt;
|185000&lt;br /&gt;
|168	&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|apophis&amp;amp;dagger;&lt;br /&gt;
|40&lt;br /&gt;
|185000&lt;br /&gt;
|168&lt;br /&gt;
|	&lt;br /&gt;
|-&lt;br /&gt;
|apophis-bf&amp;amp;dagger;&lt;br /&gt;
|40&lt;br /&gt;
|185000&lt;br /&gt;
|5&lt;br /&gt;
|	&lt;br /&gt;
|-&lt;br /&gt;
|razi&amp;amp;dagger;&lt;br /&gt;
|40&lt;br /&gt;
|185000&lt;br /&gt;
|168&lt;br /&gt;
|	&lt;br /&gt;
|-&lt;br /&gt;
|razi-bf&amp;amp;dagger;&lt;br /&gt;
|40&lt;br /&gt;
|185000&lt;br /&gt;
|5&lt;br /&gt;
|	&lt;br /&gt;
|-&lt;br /&gt;
|bigmem&lt;br /&gt;
|80&lt;br /&gt;
|3000000&lt;br /&gt;
|24&lt;br /&gt;
|	&lt;br /&gt;
|-&lt;br /&gt;
|gpu-v100&lt;br /&gt;
|40&lt;br /&gt;
|753000&lt;br /&gt;
|24&lt;br /&gt;
|2&lt;br /&gt;
|}&lt;br /&gt;
&amp;amp;dagger; The apophis and razi partitions contain hardware contributed to ARC by particular researchers. They should be used only by members of those researchers&#039; groups.  However, they have generously allowed their compute nodes to be shared with others outside their research groups for relatively short jobs by specifying the apophis-bf and razi-bf partitions.  (In some cases in which a partition is not explicitly specified, these &amp;quot;back-fill&amp;quot; partitions may be automatically selected by the system).&lt;br /&gt;
&lt;br /&gt;
==== Partitions for legacy hardware: ====&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Partition&lt;br /&gt;
!Cores/node&lt;br /&gt;
!Memory limit (MB)&lt;br /&gt;
!Time limit (h)&lt;br /&gt;
!GPUs/node&lt;br /&gt;
|-&lt;br /&gt;
|cpu2013&lt;br /&gt;
|16&lt;br /&gt;
|120000&lt;br /&gt;
|168&lt;br /&gt;
|&lt;br /&gt;
|-	&lt;br /&gt;
|lattice&lt;br /&gt;
|8&lt;br /&gt;
|12000&lt;br /&gt;
|168&lt;br /&gt;
|&lt;br /&gt;
|-	&lt;br /&gt;
|parallel&lt;br /&gt;
|12&lt;br /&gt;
|23000&lt;br /&gt;
|168&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|breezy&amp;amp;Dagger;&lt;br /&gt;
|24&lt;br /&gt;
|255000&lt;br /&gt;
|72&lt;br /&gt;
|&lt;br /&gt;
|-	&lt;br /&gt;
|bigbyte&amp;amp;Dagger;&lt;br /&gt;
|32&lt;br /&gt;
|1000000&lt;br /&gt;
|24&lt;br /&gt;
|&lt;br /&gt;
|-	&lt;br /&gt;
|single&lt;br /&gt;
|8&lt;br /&gt;
|12000&lt;br /&gt;
|168&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|gpu&lt;br /&gt;
|12&lt;br /&gt;
|23000&lt;br /&gt;
|72&lt;br /&gt;
|3&lt;br /&gt;
|}&lt;br /&gt;
&amp;amp;Dagger; Update 2019-11-27 - the breezy and bigbyte partition nodes are being repurposed as a cluster to support teaching and learning activities and are no longer available as part of ARC.&lt;br /&gt;
&lt;br /&gt;
Here are some examples of specifying the various partitions.&lt;br /&gt;
&lt;br /&gt;
As mentioned in the [[#Hardware|Hardware]] section above, the ARC cluster was expanded in January 2019.  To select the 40-core general purpose nodes specify:&lt;br /&gt;
&lt;br /&gt;
 #SBATCH --partition=cpu2019&lt;br /&gt;
&lt;br /&gt;
To run on the Tesla V100 GPU-enabled nodes, use the &#039;&#039;&#039;gpu-v100&#039;&#039;&#039; partition.  You will also need to include an SBATCH directive in the form &#039;&#039;&#039;--gres=gpu:n&#039;&#039;&#039; to specify the number of GPUs, n, that you need.  For example, if the software you are running can make use of both GPUs on a gpu-v100 partition compute node, use:&lt;br /&gt;
&lt;br /&gt;
 #SBATCH --partition=gpu-v100 --gres=gpu:2&lt;br /&gt;
&lt;br /&gt;
For very large memory jobs (more than 185000 MB), specify the bigmem partition:&lt;br /&gt;
&lt;br /&gt;
 #SBATCH --partition=bigmem&lt;br /&gt;
&lt;br /&gt;
If the more modern computers are too busy or you have a job well-suited to run on the compute nodes described in the legacy hardware section above, choose the cpu2013,  Lattice or Parallel compute nodes (without graphics processing units) by specifying the corresponding partition keyword:&lt;br /&gt;
&lt;br /&gt;
 #SBATCH --partition=cpu2013&lt;br /&gt;
&lt;br /&gt;
 #SBATCH --partition=lattice&lt;br /&gt;
&lt;br /&gt;
or&lt;br /&gt;
&lt;br /&gt;
 #SBATCH --partition=parallel&lt;br /&gt;
&lt;br /&gt;
There is an additional partition called &#039;&#039;&#039;single&#039;&#039;&#039; that provides nodes similar to the lattice partition, but, is intended for single-node jobs. Select the single partition with&lt;br /&gt;
&lt;br /&gt;
 #SBATCH --partition=single&lt;br /&gt;
&lt;br /&gt;
For single-node jobs requiring more memory or processors than available through the breezy or single partitions, use the bigbyte partition:&lt;br /&gt;
&lt;br /&gt;
 #SBATCH --partition=bigbyte&lt;br /&gt;
&lt;br /&gt;
To select the nodes that have GPUs, specify the &#039;&#039;&#039;gpu&#039;&#039;&#039; partition. Use an SBATCH directive in the form &#039;&#039;&#039;--gres=gpu:n&#039;&#039;&#039; to specify the number of GPUs, n, that you need.  For example, if the software you are running can make use of all three GPUs on a compute node, use:&lt;br /&gt;
&lt;br /&gt;
 #SBATCH --partition=gpu --gres=gpu:3&lt;br /&gt;
&lt;br /&gt;
=== Time limits ===&lt;br /&gt;
Use a directive of the form&lt;br /&gt;
&lt;br /&gt;
 #SBATCH --time=hh:mm:ss&lt;br /&gt;
&lt;br /&gt;
to tell the job scheduler the maximum time that your job might run. You can use the command&lt;br /&gt;
&lt;br /&gt;
 scontrol show partitions&lt;br /&gt;
&lt;br /&gt;
to see the current configuration of the partitions including the maximum time limit you can specify for each partition, as given by the MaxTime field.  Alternatively, see the TIMELIMIT column in the output from&lt;br /&gt;
&lt;br /&gt;
 sinfo&lt;br /&gt;
&lt;br /&gt;
=== Hardware resource and job policy limits ===&lt;br /&gt;
There are limits on the number of cores, nodes and/or GPUs that one can use on ARC at any given time.  There is also a limit on the number of jobs that a user can have pending or running at a given time (the MaxSubmitJobs parameter in the command below). The limits are generally applied on a partition-by-partition basis, so, using resources in one partition should not affect the amount you can use in a different partition. To see the current limits you can run the command:&lt;br /&gt;
&lt;br /&gt;
 sacctmgr show qos format=Name,MaxWall,MaxTRESPU%20,MaxSubmitJobs&lt;br /&gt;
&lt;br /&gt;
== Support ==&lt;br /&gt;
Please send ARC-related questions to support@hpc.ucalgary.ca.&lt;/div&gt;</summary>
		<author><name>Phillips</name></author>
	</entry>
	<entry>
		<id>https://rcs.ucalgary.ca/index.php?title=MATLAB&amp;diff=578</id>
		<title>MATLAB</title>
		<link rel="alternate" type="text/html" href="https://rcs.ucalgary.ca/index.php?title=MATLAB&amp;diff=578"/>
		<updated>2020-05-27T14:59:19Z</updated>

		<summary type="html">&lt;p&gt;Phillips: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:MATLAB]]&lt;br /&gt;
[[Category:Software]]&lt;br /&gt;
[[Category:ARC]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;contents&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= &amp;lt;span id=&amp;quot;intro&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Introduction =&lt;br /&gt;
&lt;br /&gt;
[http://www.mathworks.com/ MATLAB] is a general-purpose high-level programming package for numerical work such as linear algebra, signal processing and other calculations involving matrices or vectors of data. Visualization tools are also included for presentation of results. The basic MATLAB package is extended through add-on components including SIMULINK, and the Image Processing, Optimization, Neural Network, Signal Processing, Statistics and Wavelet Toolboxes, among others.&lt;br /&gt;
&lt;br /&gt;
The main purpose of this page is to show how to use MATLAB on the University of Calgary [[ ARC_Cluster_Guide |ARC (Advanced Research Computing) cluster]]. It is presumed that you already have an account an ARC and have read the material on reserving resources and [[Running jobs|running jobs]] with the Slurm job management system.&lt;br /&gt;
&lt;br /&gt;
= &amp;lt;span id=&amp;quot;license&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Ways to run MATLAB - License considerations =&lt;br /&gt;
At the University of Calgary, Information Technologies has purchased a MATLAB Total Academic Headcount license that allows installation and use of MATLAB on central clusters, such as ARC, as well as on personal workstations throughout the University. Potentially thousands of instances of MATLAB can be run simultaneously, each checking out a license from a central license server. An alternative is to compile MATLAB code into a standalone application. When such an application is run, it does not need to contact the server for a license. This allows researchers to run their calculations on compatible hardware, not necessarily at the University of Calgary, such as on [https://docs.computecanada.ca/wiki/Getting_started Compute Canada clusters (external link)].&lt;br /&gt;
&lt;br /&gt;
For information about installing MATLAB on your own computer, see the Information Technologies Knowledge Base [https://ucalgary.service-now.com/it?id=kb_article&amp;amp;sys_id=787d708213fdbec08246f7b2e144b0d4 article on MATLAB].&lt;br /&gt;
&lt;br /&gt;
= Running MATLAB on the ARC cluster =&lt;br /&gt;
Although it is possible to run MATLAB interactively, the expectation is that most calculations with MATLAB will be completed by submitting a batch job script to the Slurm job scheduler with the sbatch command.&lt;br /&gt;
&lt;br /&gt;
For many researchers, the main reason for using ARC for MATLAB-based calculations is to be able to run many instances at the same time.  It is recommended in such cases that any parallel processing features be removed from the code and each instance of MATLAB be run on a single CPU core.  It is also possible to run MATLAB on multiple cores in an attempt to speed up individual instances, but, this generally results in a less efficient use of the cluster hardware.  In the sections that follow, serial and then parallel processing examples are shown.&lt;br /&gt;
&lt;br /&gt;
== Serial MATLAB example==&lt;br /&gt;
&lt;br /&gt;
For the purposes of illustration, suppose the following serial MATLAB code, in a file sawtooth.m, is to be run. If your code does not already have them, add a function statement at the beginning and matching end statement at the end as shown in the example. Other features of this example include calling a function with both numerical and string arguments, incorporating a Slurm environment variable into the MATLAB code and producing graphical output in a non-interactive environment.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
function sawtooth(nterms,nppcycle,ncycle,pngfilebase)&lt;br /&gt;
&lt;br /&gt;
% MATLAB file example to approximate a sawtooth&lt;br /&gt;
% with a truncated Fourier expansion.&lt;br /&gt;
&lt;br /&gt;
% nterms = number of terms in expansion.&lt;br /&gt;
% nppcycle = number of points per cycle.&lt;br /&gt;
% ncycle = number of complete cycles to plot.&lt;br /&gt;
% pngfilebase = base of file name for graph of results.&lt;br /&gt;
&lt;br /&gt;
% 2020-05-14&lt;br /&gt;
&lt;br /&gt;
np=nppcycle*ncycle;&lt;br /&gt;
&lt;br /&gt;
fourbypi=4.0/pi;&lt;br /&gt;
y(1:np)=pi/2.0;&lt;br /&gt;
x(1:np)=linspace(-pi*ncycle,pi*ncycle,np);&lt;br /&gt;
&lt;br /&gt;
for k=1:nterms&lt;br /&gt;
  twokm=2*k-1;&lt;br /&gt;
  y=y-fourbypi*cos(twokm*x)/twokm^2;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
% Prepare output&lt;br /&gt;
% Construct the output file name from the base file name and number of terms&lt;br /&gt;
% Also append the Slurm JOBID to keep file names unique from run to run.&lt;br /&gt;
&lt;br /&gt;
job=getenv(&#039;SLURM_JOB_ID&#039;)&lt;br /&gt;
pngfile=strcat(pngfilebase,&#039;_&#039;,num2str(nterms),&#039;_&#039;,job)&lt;br /&gt;
disp([&#039;Writing file: &#039;,pngfile,&#039;.png&#039;])&lt;br /&gt;
&lt;br /&gt;
fig=figure;&lt;br /&gt;
plot(x,y);&lt;br /&gt;
print(fig,pngfile,&#039;-dpng&#039;);&lt;br /&gt;
&lt;br /&gt;
quit&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
In preparation to run the sawtooth.m code, create a batch job script, sawtooth.slurm of the form:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH --time=03:00:00     # Adjust this to match the walltime of your job&lt;br /&gt;
#SBATCH --nodes=1           # For serial code, always specify just one node.&lt;br /&gt;
#SBATCH --ntasks=1          # For serial code, always specify just one task.&lt;br /&gt;
#SBATCH --cpus-per-task=1   # For serial code, always specify just one CPU per task.&lt;br /&gt;
#SBATCH --mem=4000m         # Adjust to match total memory required, in MB.&lt;br /&gt;
#SBATCH --partition=pawson-bf,apophis-bf,razi-bf,single,lattice,parallel,cpu2013,cpu2019&lt;br /&gt;
&lt;br /&gt;
# Sample batch job script for running a MATLAB function with both numerical and string arguments&lt;br /&gt;
# 2020-05-14&lt;br /&gt;
&lt;br /&gt;
# Specify the name of the main MATLAB function to be run.&lt;br /&gt;
# This would normally be the same as the MATLAB source code file name without a .m suffix).&lt;br /&gt;
MAIN=&amp;quot;sawtooth&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Define key parameters for the example calculation.&lt;br /&gt;
NTERMS=100&lt;br /&gt;
NPPCYCLE=20&lt;br /&gt;
NCYCLE=3&lt;br /&gt;
PNGFILEBASE=&amp;quot;sawtooth&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Contruct a complete function call to pass to MATLAB&lt;br /&gt;
# Note, string arguments should appear to MATLAB enclosed in single quotes&lt;br /&gt;
ARGS=&amp;quot;($NTERMS,$NPPCYCLE,$NCYCLE,&#039;$PNGFILEBASE&#039;)&amp;quot;&lt;br /&gt;
MAIN_WITH_ARGS=${MAIN}${ARGS}&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Calling MATLAB function: ${MAIN_WITH_ARGS}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Starting run at $(date)&amp;quot;&lt;br /&gt;
echo &amp;quot;Running on compute node $(hostname)&amp;quot;&lt;br /&gt;
echo &amp;quot;Running from directory $(pwd)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Choose a version of MATLAB by loading a module:&lt;br /&gt;
module load matlab/r2019b&lt;br /&gt;
echo &amp;quot;Using MATLAB version: $(which matlab)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Use -singleCompThread below for serial MATLAB code:&lt;br /&gt;
matlab -singleCompThread -batch &amp;quot;${MAIN_WITH_ARGS}&amp;quot; &amp;gt; ${MAIN}_${SLURM_JOB_ID}.out 2&amp;gt;&amp;amp;1&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Finished run at $(date)&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Note that the above script uses the -batch option on the matlab command line.  The MathWorks web page on [https://www.mathworks.com/help/matlab/ref/matlablinux.html running MATLAB on Linux (external link)] starting with Release 2019a of MATLAB, recommends using the -batch option for non-interactive use instead of the similar -r option that is recommended in interactive sessions.&lt;br /&gt;
&lt;br /&gt;
To submit the job to be executed, run:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sbatch sawtooth.slurm&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The job should produce three output files: Slurm script output, MATLAB command output and a PNG file, all tagged with the Slurm Job ID.&lt;br /&gt;
&lt;br /&gt;
== Parallel MATLAB examples==&lt;br /&gt;
&lt;br /&gt;
MATLAB provides several ways of speeding up calculations through parallel processing.  These include relying on internal parallelization in which multiple threads are used or by using explicit language features, such as parfor, to start up multiple workers on a compute node. Examples of both approaches are shown below. Using multiple compute nodes for a single MATLAB calculation, which depends on the MATLAB Parallel Server product, is not considered here as there has not been sufficient demand to configure that software on ARC.&lt;br /&gt;
&lt;br /&gt;
For many researchers, submitting many independent serial jobs is a better approach to efficient parallelization than using parallel programming in MATLAB itself.  An example of job-based parallelism is also shown below.&lt;br /&gt;
&lt;br /&gt;
=== Thread-based parallel processing ===&lt;br /&gt;
First consider an example using multiple cores with MATLAB&#039;s built-in thread-based parallelization.&lt;br /&gt;
&lt;br /&gt;
Suppose the following code to calculate eigenvalues of a number of random matrices is in a file eig_thread_test.m .  Note the use of the maxNumCompThreads function to control the number of threads (one thread per CPU core). For some years now, MathWorks has marked that function as deprecated, but, it still provides a useful limit to ensure that MATLAB doesn&#039;t use more cores than assigned by Slurm. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
function eig_thread_test(nthreads,matrix_size,nmatrices,results_file)&lt;br /&gt;
&lt;br /&gt;
% Calculate the absolute value of the maximum eigenvalue for each of a number of matrices&lt;br /&gt;
% possibly using multiple threads.&lt;br /&gt;
&lt;br /&gt;
% nthreads = number of computational threads to use.&lt;br /&gt;
% matrix_size = order of two-dimensional random matrix.&lt;br /&gt;
% nmatrices = number of matrices to process.&lt;br /&gt;
% results_file = name of file in which to save the maximum eigenvalues&lt;br /&gt;
&lt;br /&gt;
% 2020-05-25&lt;br /&gt;
&lt;br /&gt;
matlab_ncores=feature(&#039;numcores&#039;)&lt;br /&gt;
&lt;br /&gt;
slurm_ncores_per_task=str2num(getenv(&#039;SLURM_CPUS_PER_TASK&#039;))&lt;br /&gt;
if(isempty(slurm_ncores_per_task))&lt;br /&gt;
  slurm_ncores_per_task=1;&lt;br /&gt;
  disp(&#039;SLURM_CPUS_PER_TASK not set&#039;)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
% Set number of computational threads to the minimum of matlab_ncores and slurm_ncores_per_task&lt;br /&gt;
% Note Mathworks warns that the maxNumCompThreads function will&lt;br /&gt;
% be removed in future versions of MATLAB.&lt;br /&gt;
&lt;br /&gt;
% Use only thread-based parallel processing&lt;br /&gt;
&lt;br /&gt;
intial_matlab_max_ncores = maxNumCompThreads(min([nthreads,slurm_ncores_per_task]));&lt;br /&gt;
&lt;br /&gt;
disp([&#039;Using a maximum of &#039;,num2str(maxNumCompThreads()),&#039; computational threads.&#039;])&lt;br /&gt;
&lt;br /&gt;
tic &lt;br /&gt;
&lt;br /&gt;
for i = 1:nmatrices&lt;br /&gt;
  e=eig(rand(matrix_size));&lt;br /&gt;
  eigenvalues(i) = max(abs(e));&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
toc&lt;br /&gt;
&lt;br /&gt;
save(results_file,&#039;eigenvalues&#039;,&#039;-ascii&#039;)&lt;br /&gt;
&lt;br /&gt;
quit&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here is a job script, eig_thread_test.slurm that can be used to run the eig_thread_test.m code.&lt;br /&gt;
The number of threads used for the calculation is controlled by specifying the --cpus-per-task parameter that Slurm uses to control the number of CPU cores assigned to the job.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
&lt;br /&gt;
#SBATCH --time=01:00:00     # Adjust this to match the walltime of your job&lt;br /&gt;
#SBATCH --nodes=1           # Always specify just one node.&lt;br /&gt;
#SBATCH --ntasks=1          # Specify just one task.&lt;br /&gt;
#SBATCH --cpus-per-task=8   # The number of threads to use&lt;br /&gt;
#SBATCH --mem=4000m         # Adjust to match total memory required, in MB.&lt;br /&gt;
#SBATCH --partition=pawson-bf,apophis-bf,razi-bf,single,lattice,parallel,cpu2013,cpu2019&lt;br /&gt;
&lt;br /&gt;
# Sample batch job script for running a MATLAB function to test thread-based parallel processing features.&lt;br /&gt;
# 2020-05-25&lt;br /&gt;
&lt;br /&gt;
# Specify the name of the main MATLAB function to be run.&lt;br /&gt;
# This would normally be the same as the MATLAB source code file name without a .m suffix).&lt;br /&gt;
MAIN=&amp;quot;eig_thread_test&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Define key parameters for the example calculation.&lt;br /&gt;
NTHREADS=${SLURM_CPUS_PER_TASK}&lt;br /&gt;
MATRIX_SIZE=10000&lt;br /&gt;
NMATRICES=10&lt;br /&gt;
RESULTS_FILE=&amp;quot;maximum_eigenvalues_${SLURM_JOB_ID}.txt&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Contruct a complete function call to pass to MATLAB&lt;br /&gt;
# Note, string arguments should appear to MATLAB enclosed in single quotes&lt;br /&gt;
ARGS=&amp;quot;($NTHREADS,$MATRIX_SIZE,$NMATRICES,&#039;$RESULTS_FILE&#039;)&amp;quot;&lt;br /&gt;
MAIN_WITH_ARGS=${MAIN}${ARGS}&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Calling MATLAB function: ${MAIN_WITH_ARGS}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Starting run at $(date)&amp;quot;&lt;br /&gt;
echo &amp;quot;Running on compute node $(hostname)&amp;quot;&lt;br /&gt;
echo &amp;quot;Running from directory $(pwd)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Choose a version of MATLAB by loading a module:&lt;br /&gt;
module load matlab/r2020a&lt;br /&gt;
echo &amp;quot;Using MATLAB version: $(which matlab)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
matlab -batch &amp;quot;${MAIN_WITH_ARGS}&amp;quot; &amp;gt; ${MAIN}_${SLURM_JOB_ID}.out 2&amp;gt;&amp;amp;1&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Finished run at $(date)&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The above job can be submitted with&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sbatch eig_thread_test.slurm&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If assigned to one of the modern partitions (as opposed to the older single, lattice or parallel partitions) the job took about 16 minutes, about 4 times faster than a comparable serial job.  Using 8 cores to obtain just a factor of four speed-up is not an efficient use of ARC, but, might be justified in some cases.  In some cases, using multiple workers (as discussed in the next section) may be faster than using the same number of cores with thread-based parallelization.&lt;br /&gt;
&lt;br /&gt;
=== Explicit parallel processing using a pool of workers ===&lt;br /&gt;
&lt;br /&gt;
Now consider the more complicated case of creating a pool of workers and using a parfor loop to explicitly parallelize a section of code. Each worker may use one or more cores through MATLAB&#039;s internal thread-based parallelization, as in the preceding example.  Suppose the following code is in a file eig_parallel_test.m.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
function eig_parallel_test(nworkers,nthreads,matrix_size,nmatrices,results_file)&lt;br /&gt;
&lt;br /&gt;
% Calculate the absolute value of the maximum eigenvalue for each of a number of matrices&lt;br /&gt;
% possibly using multiple threads and multiple MATLAB workers.&lt;br /&gt;
&lt;br /&gt;
% nworkers = number of MATLAB workers to use.&lt;br /&gt;
% nthreads = number of threads per worker.&lt;br /&gt;
% matrix_size = order of two-dimensional random matrix.&lt;br /&gt;
% nmatrices = number of matrices to process.&lt;br /&gt;
% results_file = name of file in which to save the maximum eigenvalues&lt;br /&gt;
&lt;br /&gt;
% 2020-05-25&lt;br /&gt;
&lt;br /&gt;
matlab_ncores=feature(&#039;numcores&#039;)&lt;br /&gt;
&lt;br /&gt;
slurm_ncores_per_task=str2num(getenv(&#039;SLURM_CPUS_PER_TASK&#039;))&lt;br /&gt;
if(isempty(slurm_ncores_per_task))&lt;br /&gt;
  slurm_ncores_per_task=1;&lt;br /&gt;
  disp(&#039;SLURM_CPUS_PER_TASK not set&#039;)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
% Set number of computational threads to the minimum of matlab_ncores and slurm_ncores&lt;br /&gt;
% Note Mathworks warns that the maxNumCompThreads function will&lt;br /&gt;
% be removed in future versions of MATLAB.&lt;br /&gt;
% Testing based on remarks at&lt;br /&gt;
% https://www.mathworks.com/matlabcentral/answers/158192-maxnumcompthreads-hyperthreading-and-parpool&lt;br /&gt;
% shows the maxNumCompThreads has to be called inside the parfor loop.&lt;br /&gt;
&lt;br /&gt;
tic&lt;br /&gt;
&lt;br /&gt;
if ( nworkers &amp;gt; 1 )&lt;br /&gt;
&lt;br /&gt;
% Process with multiple workers&lt;br /&gt;
% Check on properties of the local MATLAB cluster.&lt;br /&gt;
% One can set properties such as c.NumThreads and c.NumWorkers&lt;br /&gt;
&lt;br /&gt;
parallel.defaultClusterProfile(&#039;local&#039;)&lt;br /&gt;
c = parcluster()&lt;br /&gt;
c.NumThreads=nthreads&lt;br /&gt;
c.NumWorkers=nworkers&lt;br /&gt;
&lt;br /&gt;
% Create a pool of workers with the current cluster settings.&lt;br /&gt;
% Note, testing without the nworkers argument showed a limit of 12 workers even if c.NumWorkers is defined.&lt;br /&gt;
parpool(c,nworkers)&lt;br /&gt;
&lt;br /&gt;
ticBytes(gcp);&lt;br /&gt;
&lt;br /&gt;
parfor i = 1:nmatrices&lt;br /&gt;
  e=eig(rand(matrix_size));&lt;br /&gt;
  eigenvalues(i) = max(abs(e));&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
tocBytes(gcp)&lt;br /&gt;
&lt;br /&gt;
% Close down the pool.&lt;br /&gt;
delete(gcp(&#039;nocreate&#039;));&lt;br /&gt;
&lt;br /&gt;
else&lt;br /&gt;
&lt;br /&gt;
% Use only thread-based parallel processing&lt;br /&gt;
&lt;br /&gt;
intial_matlab_max_ncores = maxNumCompThreads(min([nthreads,slurm_ncores_per_task]))&lt;br /&gt;
&lt;br /&gt;
for i = 1:nmatrices&lt;br /&gt;
  e=eig(rand(matrix_size));&lt;br /&gt;
  eigenvalues(i) = max(abs(e));&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
end % nworkers test&lt;br /&gt;
&lt;br /&gt;
toc&lt;br /&gt;
&lt;br /&gt;
save(results_file,&#039;eigenvalues&#039;,&#039;-ascii&#039;)&lt;br /&gt;
&lt;br /&gt;
quit&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Of particular note in the preceding example is the section of lines (copied below) that creates a cluster object, c, and modifies the number of threads associated with this object (c.NumThreads=nthreads). In a similar way, one can modify the number of workers (c.NumWorkers=nworkers).  Testing showed that if one then used the MATLAB gcp or parpool commands without arguments to create a pool of workers, at most 12 workers were created. However, it was found that by using parpool(c,nworkers), the requested number of workers would be started, even if nworkers &amp;gt; 12.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
parallel.defaultClusterProfile(&#039;local&#039;)&lt;br /&gt;
c = parcluster()&lt;br /&gt;
c.NumThreads=nthreads&lt;br /&gt;
c.NumWorkers=nworkers&lt;br /&gt;
parpool(c,nworkers)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
An example Slurm batch job script, eig_parallel_test.slurm, used to test the above code was:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
&lt;br /&gt;
#SBATCH --time=03:00:00     # Adjust this to match the walltime of your job&lt;br /&gt;
#SBATCH --nodes=1           # Always specify just one node.&lt;br /&gt;
#SBATCH --ntasks=1          # Always specify just one task.&lt;br /&gt;
#SBATCH --cpus-per-task=8   # Choose --cpus-per-task to match the number of workers * threads per worker&lt;br /&gt;
#SBATCH --mem=10000m         # Adjust to match total memory required, in MB.&lt;br /&gt;
#SBATCH --partition=pawson-bf,apophis-bf,razi-bf,single,lattice,parallel,cpu2013,cpu2019&lt;br /&gt;
&lt;br /&gt;
# Sample batch job script for running a MATLAB function to test parallel processing features&lt;br /&gt;
# 2020-05-25&lt;br /&gt;
&lt;br /&gt;
# Specify the name of the main MATLAB function to be run.&lt;br /&gt;
# This would normally be the same as the MATLAB source code file name without a .m suffix).&lt;br /&gt;
MAIN=&amp;quot;eig_parallel_test&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Define key parameters for the example calculation.&lt;br /&gt;
NWORKERS=${SLURM_NTASKS}&lt;br /&gt;
NTHREADS=${SLURM_CPUS_PER_TASK}&lt;br /&gt;
MATRIX_SIZE=10000&lt;br /&gt;
NMATRICES=10&lt;br /&gt;
RESULTS_FILE=&amp;quot;maximum_eigenvalues_${SLURM_JOB_ID}.txt&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Contruct a complete function call to pass to MATLAB&lt;br /&gt;
# Note, string arguments should appear to MATLAB enclosed in single quotes&lt;br /&gt;
ARGS=&amp;quot;($NWORKERS,$NTHREADS,$MATRIX_SIZE,$NMATRICES,&#039;$RESULTS_FILE&#039;)&amp;quot;&lt;br /&gt;
MAIN_WITH_ARGS=${MAIN}${ARGS}&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Calling MATLAB function: ${MAIN_WITH_ARGS}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Starting run at $(date)&amp;quot;&lt;br /&gt;
echo &amp;quot;Running on compute node $(hostname)&amp;quot;&lt;br /&gt;
echo &amp;quot;Running from directory $(pwd)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Choose a version of MATLAB by loading a module:&lt;br /&gt;
module load matlab/r2020a&lt;br /&gt;
echo &amp;quot;Using MATLAB version: $(which matlab)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
matlab -batch &amp;quot;${MAIN_WITH_ARGS}&amp;quot; &amp;gt; ${MAIN}_${SLURM_JOB_ID}.out 2&amp;gt;&amp;amp;1&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Finished run at $(date)&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Note that the Slurm SBATCH parameter --cpus-per-task, the total number of cores to use, should be the product of the number of workers and the threads per worker.  (It might be argued that one more core should be requested beyond the product of workers and threads, to use for the main MATLAB process, but, for a fully parallelized code, the workers do the great bulk of the calculation and the main MATLAB process uses relatively little CPU time.)&lt;br /&gt;
 &lt;br /&gt;
Variations on the above code were tested with many combinations of workers and threads per worker.  It was found that if many jobs were started in close succession that some of the jobs failed to start properly. The problem can be avoided by introducing a short delay between job submissions, as illustrated in the section on job arrays below.&lt;br /&gt;
&lt;br /&gt;
Also note that in the above example, the number of cores requested is not well matched to the number of workers.  If there are 8 workers processing 10 matrices and each worker gets assigned one matrix, there are two left over. The total time for 10 matrices (or for any number of matrices from 9 to 16) would be about double that for 8 matrices.  For example, in testing the above code, the time for processing 10 matrices with 8 workers with just one computational thread was 1050 seconds, whereas processing just 8 matrices with 8 workers took only 560 seconds.&lt;br /&gt;
&lt;br /&gt;
=== Job-based parallel processing ===&lt;br /&gt;
&lt;br /&gt;
Slurm provides a feature called job arrays that can sometimes be conveniently used to submit a large number of similar jobs.  This can be used effectively when doing a parameter sweep, in which one key value (or several) in the code are changed from run to run. For example, in the eigenvalue calculation code considered in the previous section, one may want to study the effect of changing the matrix size. Alternatively, there may be cases in which the only change from one job to another is the name of an input file that contains the data to be processed.&lt;br /&gt;
&lt;br /&gt;
The key to using the job array feature is to set up the code to depend on a single integer value, the job array index, $SLURM_ARRAY_TASK_ID . When a job is run, the array index variable is replaced by Slurm with a specific value, taken from a corresponding --array argument on the sbatch command line.  For example, if the job script shown below is called eig_parallel_array_test.slurm and you run the script as&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sbatch --array=1000,2000,3000 eig_parallel_array_test.slurm&lt;br /&gt;
&amp;lt;/pre&amp;gt; &lt;br /&gt;
then three jobs will be run, with $SLURM_ARRAY_TASK_ID taking on the values 1000, 2000 and 3000 for the three cases, respectively.&lt;br /&gt;
&lt;br /&gt;
If you had a case in which input files to be processed were data_1.in, data_2.in, ... data_100.in, you could submit 100 jobs to each process one data file with &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sbatch --array=1-100 script_to_process_one_file.slurm&lt;br /&gt;
&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
where the job script refers to the files as data_${SLURM_ARRAY_TASK_ID}.in . (Putting the curly brackets around the variable name helps the bash shell from being confused with other text in the file name.)&lt;br /&gt;
&lt;br /&gt;
Testing shows that starting large numbers of jobs in a short period of time, such as can occur when job arrays are used and there are many free compute nodes, can lead to failures.  This kind of error appears to be related to delayed file system access when MATLAB tries to write job information to a hidden subdirectory under your home directory.   One way to avoid this problem is to introduce a delay between job submissions.  This can be done by using a loop containing a sleep command:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
for job in $(seq 1 100)&lt;br /&gt;
do&lt;br /&gt;
sbatch --array=$job script_to_process_one_file.slurm&lt;br /&gt;
sleep 5&lt;br /&gt;
done&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The &amp;quot;sleep 5&amp;quot; causes a 5-second delay between each job submission.&lt;br /&gt;
&lt;br /&gt;
One other caveat regarding the use of job arrays is that the resources requested with the SBATCH directives are for a single instance of the calculation to be completed. So, if the resource requirements are expected to differ significantly from one job to another, you may have to write separate job scripts for each case or group of cases, rather than using a single job array script.&lt;br /&gt;
&lt;br /&gt;
Here is an example of a job script to calculate the maximum eigenvalue of a number of random matrices of a given size.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
&lt;br /&gt;
#SBATCH --time=01:00:00     # Adjust this to match the walltime of your job&lt;br /&gt;
#SBATCH --nodes=1           # Always specify just one node.&lt;br /&gt;
#SBATCH --ntasks=1          # Always specify just one task.&lt;br /&gt;
#SBATCH --cpus-per-task=1   # For serial code, always specify just one CPU per task.&lt;br /&gt;
#SBATCH --mem=4000m         # Adjust to match total memory required, in MB.&lt;br /&gt;
#SBATCH --partition=pawson-bf,apophis-bf,razi-bf,single,lattice,parallel,cpu2013,cpu2019&lt;br /&gt;
&lt;br /&gt;
# Sample batch job script for running a MATLAB function to illustrate job-based parallel processing with job arrays&lt;br /&gt;
# 2020-05-27&lt;br /&gt;
&lt;br /&gt;
# The order of the matrix is specified using the job array index.&lt;br /&gt;
&lt;br /&gt;
# Specify the name of the main MATLAB function to be run.&lt;br /&gt;
# This would normally be the same as the MATLAB source code file name without a .m suffix).&lt;br /&gt;
MAIN=&amp;quot;eig_parallel_test&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Define key parameters for the example calculation.&lt;br /&gt;
NWORKERS=1&lt;br /&gt;
NTHREADS=1&lt;br /&gt;
MATRIX_SIZE=$SLURM_ARRAY_TASK_ID&lt;br /&gt;
NMATRICES=10&lt;br /&gt;
RESULTS_FILE=&amp;quot;maximum_eigenvalues_${MATRIX_SIZE}_${SLURM_JOB_ID}.txt&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Contruct a complete function call to pass to MATLAB&lt;br /&gt;
# Note, string arguments should appear to MATLAB enclosed in single quotes&lt;br /&gt;
ARGS=&amp;quot;($NWORKERS,$NTHREADS,$MATRIX_SIZE,$NMATRICES,&#039;$RESULTS_FILE&#039;)&amp;quot;&lt;br /&gt;
MAIN_WITH_ARGS=${MAIN}${ARGS}&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Calling MATLAB function: ${MAIN_WITH_ARGS}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Starting run at $(date)&amp;quot;&lt;br /&gt;
echo &amp;quot;Running on compute node $(hostname)&amp;quot;&lt;br /&gt;
echo &amp;quot;Running from directory $(pwd)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Choose a version of MATLAB by loading a module:&lt;br /&gt;
module load matlab/r2020a&lt;br /&gt;
echo &amp;quot;Using MATLAB version: $(which matlab)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
matlab -batch &amp;quot;${MAIN_WITH_ARGS}&amp;quot; &amp;gt; ${MAIN}_${SLURM_JOB_ID}.out 2&amp;gt;&amp;amp;1&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Finished run at $(date)&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Standalone Applications =&lt;br /&gt;
&lt;br /&gt;
When running MATLAB code as described in the preceding sections, a connection to the campus MATLAB license server, checking out licenses for MATLAB and any specialized toolboxes needed, is made for each job that is submitted. Currently, with the University of Calgary&#039;s Total Academic Headcount license, there are sufficient license tokens to support thousands of simultaneous MATLAB sessions (although ARC usage policy and cluster load will limit individual users to smaller numbers of jobs). However, there may be times at which the license server is slow to respond when large numbers of requests are being handled, or the server may be unavailable temporarily due to network problems. MathWorks offers an alternative way of running MATLAB code that can avoid license server issues by compiling it into a standalone application.  A license is required only during the compilation process and not when the code is run.  This allows calculations to be run on ARC without concerns regarding the license server.  The compiled code can also be run on compatible (64-bit Linux) hardware, not necessarily at the University of Calgary, such as on [https://docs.computecanada.ca/wiki/Getting_started Compute Canada (external link)] clusters.&lt;br /&gt;
&lt;br /&gt;
== Creating a standalone application ==&lt;br /&gt;
&lt;br /&gt;
The MATLAB &#039;&#039;&#039;mcc&#039;&#039;&#039; command is used to compile source code (.m files) into a standalone executable. There are a couple of important considerations to keep in mind when creating an executable that can be run in a batch-oriented cluster environment. One is that there is no graphical display attached to your session and another is that the number of threads used by the standalone application has to be controlled.  There is also an important difference in the way arguments of the main function are handled.&lt;br /&gt;
&lt;br /&gt;
Let&#039;s illustrate the process of creating a standalone application for the sawtooth.m code used previously. Unfortunately, if that code is compiled as it is, the resulting compiled application will fail to run properly.  The reason is that the compiled code sees all the input arguments as strings instead of interpreting them as numbers. To work around this problem, use a MATLAB function, &#039;&#039;&#039;isdeployed&#039;&#039;&#039;, to determine whether or not the code is being run as a standalone application. Here is a modified version of code, called sawtooth_standalone.m that can be successfully compiled and run as a standalone application.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
function sawtooth_standalone(nterms,nppcycle,ncycle,pngfilebase)&lt;br /&gt;
&lt;br /&gt;
% MATLAB file example to approximate a sawtooth&lt;br /&gt;
% with a truncated Fourier expansion.&lt;br /&gt;
&lt;br /&gt;
% nterms = number of terms in expansion.&lt;br /&gt;
% nppcycle = number of points per cycle.&lt;br /&gt;
% ncycle = number of complete cycles to plot.&lt;br /&gt;
% pngfilebase = base of file name for graph of results.&lt;br /&gt;
&lt;br /&gt;
% 2020-05-21&lt;br /&gt;
&lt;br /&gt;
% Test to see if the code is running as a standalone application&lt;br /&gt;
% If it is, convert the arguments intended to be numeric from &lt;br /&gt;
% the input strings to numbers&lt;br /&gt;
&lt;br /&gt;
if isdeployed&lt;br /&gt;
  nterms=str2num(nterms)&lt;br /&gt;
  nppcycle=str2num(nppcycle)&lt;br /&gt;
  ncycle=str2num(ncycle)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
np=nppcycle*ncycle;&lt;br /&gt;
&lt;br /&gt;
fourbypi=4.0/pi;&lt;br /&gt;
y(1:np)=pi/2.0;&lt;br /&gt;
x(1:np)=linspace(-pi*ncycle,pi*ncycle,np);&lt;br /&gt;
&lt;br /&gt;
for k=1:nterms&lt;br /&gt;
  twokm=2*k-1;&lt;br /&gt;
  y=y-fourbypi*cos(twokm*x)/twokm^2;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
% Prepare output&lt;br /&gt;
% Construct the output file name from the base file name and number of terms&lt;br /&gt;
% Also append the Slurm JOBID to keep file names unique from run to run.&lt;br /&gt;
&lt;br /&gt;
job=getenv(&#039;SLURM_JOB_ID&#039;)&lt;br /&gt;
pngfile=strcat(pngfilebase,&#039;_&#039;,num2str(nterms),&#039;_&#039;,job)&lt;br /&gt;
disp([&#039;Writing file: &#039;,pngfile,&#039;.png&#039;])&lt;br /&gt;
&lt;br /&gt;
fig=figure;&lt;br /&gt;
plot(x,y);&lt;br /&gt;
print(fig,pngfile,&#039;-dpng&#039;);&lt;br /&gt;
&lt;br /&gt;
quit&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Suppose that the sawtooth_standalone.m file is in a subdirectory src below your current working directory and that the compiled files are going to be written to a subdirectory called deploy. The following commands (at the Linux shell prompt) could be used to compile the code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mkdir deploy&lt;br /&gt;
cd src&lt;br /&gt;
module load matlab/r2019b&lt;br /&gt;
mcc -R -nodisplay \&lt;br /&gt;
 -R -singleCompThread \&lt;br /&gt;
 -m -v -w enable \&lt;br /&gt;
 -d ../deploy \&lt;br /&gt;
 sawtooth_standalone.m&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note the option -singleCompThread has been included in order to limit the executable to just one computational thread.&lt;br /&gt;
&lt;br /&gt;
In the deploy directory, an executable, sawtooth_standalone, will be created along with a script, run_sawtooth_standalone.sh. These two files should be copied to the target machine where the code is to be run.&lt;br /&gt;
&lt;br /&gt;
== Running a standalone application ==&lt;br /&gt;
&lt;br /&gt;
After the standalone executable sawtooth_standalone and corresponding script run_sawtooth_standalone.sh have been transferred to a directory on the target system on which they will be run (whether to a different directory on ARC or to a completely different cluster), a batch job script needs to be created in that same directory. Here is an example batch job script, sawtooth_standalone.slurm, appropriate for the ARC cluster.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH --time=03:00:00     # Adjust this to match the walltime of your job&lt;br /&gt;
#SBATCH --nodes=1           # For serial code, always specify just one node.&lt;br /&gt;
#SBATCH --ntasks=1          # For serial code, always specify just one task.&lt;br /&gt;
#SBATCH --cpus-per-task=1   # For serial code, always specify just one CPU per task.&lt;br /&gt;
#SBATCH --mem=4000m         # Adjust to match total memory required, in MB.&lt;br /&gt;
#SBATCH --partition=pawson-bf,apophis-bf,razi-bf,single,lattice,parallel,cpu2013,cpu2019&lt;br /&gt;
&lt;br /&gt;
# Sample batch job script for running a compiled MATLAB function&lt;br /&gt;
# 2020-05-21&lt;br /&gt;
&lt;br /&gt;
# Specify the name of the compiled MATLAB standalone executable&lt;br /&gt;
MAIN=&amp;quot;sawtooth_standalone&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Define key parameters for the example calculation.&lt;br /&gt;
NTERMS=100&lt;br /&gt;
NPPCYCLE=20&lt;br /&gt;
NCYCLE=3&lt;br /&gt;
PNGFILEBASE=$MAIN&lt;br /&gt;
&lt;br /&gt;
ARGS=&amp;quot;$NTERMS $NPPCYCLE $NCYCLE $PNGFILEBASE&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Choose the MCR directory according to the compiler version used&lt;br /&gt;
MCR=/global/software/matlab/mcr/v97&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Starting run at $(date)&amp;quot;&lt;br /&gt;
echo &amp;quot;Running on compute node $(hostname)&amp;quot;&lt;br /&gt;
echo &amp;quot;Running from directory $(pwd)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
./run_${MAIN}.sh $MCR $ARGS &amp;gt; ${MAIN}_${SLURM_JOB_ID}.out 2&amp;gt;&amp;amp;1&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Finished run at $(date)&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The job is then submitted with sbatch:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sbatch sawtooth_standalone.slurm&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
An important part of the above script is the definition of the variable &#039;&#039;&#039;MCR&#039;&#039;&#039;, which defines the location of the MATLAB Compiler Runtime (MCR) directory. This directory contains files necessary for the standalone application to run. The version of the MCR files specified (v97 in the example, which corresponds to MATLAB R2019b) must match the version of MATLAB used to compile the code.&lt;br /&gt;
&lt;br /&gt;
A list of MATLAB distributions and the corresponding MCR versions is given on the [https://www.mathworks.com/products/compiler/matlab-runtime.html Mathworks web site (external link)]. Some versions installed on ARC are listed below, along with the corresponding installation directory to which the MCR variable should be set if running on ARC. (As of this writing on May 21, 2020, installation of release R2020a has not quite been finished, but, should be ready before the end of the month). If the MCR version you need does not appear in /global/software/matlab/mcr, write to support@hpc.ucalgary.ca to request that it be installed, or use a different version of MATLAB for your compilation.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;WG_Indent3&amp;quot; style=&amp;quot;height: 150px; width: 576px&amp;quot; border=&amp;quot;2&amp;quot;&lt;br /&gt;
| style=&amp;quot;text-align: center&amp;quot; | &#039;&#039;&#039;MATLAB Release&#039;&#039;&#039;&lt;br /&gt;
| style=&amp;quot;text-align: center&amp;quot; | &#039;&#039;&#039;MCR Version&#039;&#039;&#039;&lt;br /&gt;
| style=&amp;quot;text-align: center&amp;quot; | &#039;&#039;&#039;MCR directory&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: center&amp;quot; | R2017a&lt;br /&gt;
| style=&amp;quot;text-align: center&amp;quot; | 9.2&lt;br /&gt;
| class=&amp;quot;WG_Inline_Code&amp;quot; style=&amp;quot;text-align: center&amp;quot; | /global/software/matlab/mcr/v92&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: center&amp;quot; | R2017b&lt;br /&gt;
| style=&amp;quot;text-align: center&amp;quot; | 9.3&lt;br /&gt;
| class=&amp;quot;WG_Inline_Code&amp;quot; style=&amp;quot;text-align: center&amp;quot; | /global/software/matlab/mcr/v93&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: center&amp;quot; | R2018a&lt;br /&gt;
| style=&amp;quot;text-align: center&amp;quot; | 9.4&lt;br /&gt;
| class=&amp;quot;WG_Inline_Code&amp;quot; style=&amp;quot;text-align: center&amp;quot; | /global/software/matlab/mcr/v94&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: center&amp;quot; | R2019b&lt;br /&gt;
| style=&amp;quot;text-align: center&amp;quot; | 9.7&lt;br /&gt;
| class=&amp;quot;WG_Inline_Code&amp;quot; style=&amp;quot;text-align: center&amp;quot; | /global/software/matlab/mcr/v97&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: center&amp;quot; | R2020a&lt;br /&gt;
| style=&amp;quot;text-align: center&amp;quot; | 9.8&lt;br /&gt;
| class=&amp;quot;WG_Inline_Code&amp;quot; style=&amp;quot;text-align: center&amp;quot; | /global/software/matlab/mcr/v98&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Phillips</name></author>
	</entry>
	<entry>
		<id>https://rcs.ucalgary.ca/index.php?title=MATLAB&amp;diff=577</id>
		<title>MATLAB</title>
		<link rel="alternate" type="text/html" href="https://rcs.ucalgary.ca/index.php?title=MATLAB&amp;diff=577"/>
		<updated>2020-05-27T14:53:34Z</updated>

		<summary type="html">&lt;p&gt;Phillips: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:MATLAB]]&lt;br /&gt;
[[Category:Software]]&lt;br /&gt;
[[Category:ARC]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;contents&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= &amp;lt;span id=&amp;quot;intro&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Introduction =&lt;br /&gt;
&lt;br /&gt;
[http://www.mathworks.com/ MATLAB] is a general-purpose high-level programming package for numerical work such as linear algebra, signal processing and other calculations involving matrices or vectors of data. Visualization tools are also included for presentation of results. The basic MATLAB package is extended through add-on components including SIMULINK, and the Image Processing, Optimization, Neural Network, Signal Processing, Statistics and Wavelet Toolboxes, among others.&lt;br /&gt;
&lt;br /&gt;
The main purpose of this page is to show how to use MATLAB on the University of Calgary [[ ARC_Cluster_Guide |ARC (Advanced Research Computing) cluster]]. It is presumed that you already have an account an ARC and have read the material on reserving resources and [[Running jobs|running jobs]] with the Slurm job management system.&lt;br /&gt;
&lt;br /&gt;
= &amp;lt;span id=&amp;quot;license&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Ways to run MATLAB - License considerations =&lt;br /&gt;
At the University of Calgary, Information Technologies has purchased a MATLAB Total Academic Headcount license that allows installation and use of MATLAB on central clusters, such as ARC, as well as on personal workstations throughout the University. Potentially thousands of instances of MATLAB can be run simultaneously, each checking out a license from a central license server. An alternative is to compile MATLAB code into a standalone application. When such an application is run, it does not need to contact the server for a license. This allows researchers to run their calculations on compatible hardware, not necessarily at the University of Calgary, such as on [https://docs.computecanada.ca/wiki/Getting_started Compute Canada clusters (external link)].&lt;br /&gt;
&lt;br /&gt;
For information about installing MATLAB on your own computer, see the Information Technologies Knowledge Base [https://ucalgary.service-now.com/it?id=kb_article&amp;amp;sys_id=787d708213fdbec08246f7b2e144b0d4 article on MATLAB].&lt;br /&gt;
&lt;br /&gt;
= Running MATLAB on the ARC cluster =&lt;br /&gt;
Although it is possible to run MATLAB interactively, the expectation is that most calculations with MATLAB will be completed by submitting a batch job script to the Slurm job scheduler with the sbatch command.&lt;br /&gt;
&lt;br /&gt;
For many researchers, the main reason for using ARC for MATLAB-based calculations is to be able to run many instances at the same time.  It is recommended in such cases that any parallel processing features be removed from the code and each instance of MATLAB be run on a single CPU core.  It is also possible to run MATLAB on multiple cores in an attempt to speed up individual instances, but, this generally results in a less efficient use of the cluster hardware.  In the sections that follow, serial and then parallel processing examples are shown.&lt;br /&gt;
&lt;br /&gt;
== Serial MATLAB example==&lt;br /&gt;
&lt;br /&gt;
For the purposes of illustration, suppose the following serial MATLAB code, in a file sawtooth.m, is to be run. If your code does not already have them, add a function statement at the beginning and matching end statement at the end as shown in the example. Other features of this example include calling a function with both numerical and string arguments, incorporating a Slurm environment variable into the MATLAB code and producing graphical output in a non-interactive environment.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
function sawtooth(nterms,nppcycle,ncycle,pngfilebase)&lt;br /&gt;
&lt;br /&gt;
% MATLAB file example to approximate a sawtooth&lt;br /&gt;
% with a truncated Fourier expansion.&lt;br /&gt;
&lt;br /&gt;
% nterms = number of terms in expansion.&lt;br /&gt;
% nppcycle = number of points per cycle.&lt;br /&gt;
% ncycle = number of complete cycles to plot.&lt;br /&gt;
% pngfilebase = base of file name for graph of results.&lt;br /&gt;
&lt;br /&gt;
% 2020-05-14&lt;br /&gt;
&lt;br /&gt;
np=nppcycle*ncycle;&lt;br /&gt;
&lt;br /&gt;
fourbypi=4.0/pi;&lt;br /&gt;
y(1:np)=pi/2.0;&lt;br /&gt;
x(1:np)=linspace(-pi*ncycle,pi*ncycle,np);&lt;br /&gt;
&lt;br /&gt;
for k=1:nterms&lt;br /&gt;
  twokm=2*k-1;&lt;br /&gt;
  y=y-fourbypi*cos(twokm*x)/twokm^2;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
% Prepare output&lt;br /&gt;
% Construct the output file name from the base file name and number of terms&lt;br /&gt;
% Also append the Slurm JOBID to keep file names unique from run to run.&lt;br /&gt;
&lt;br /&gt;
job=getenv(&#039;SLURM_JOB_ID&#039;)&lt;br /&gt;
pngfile=strcat(pngfilebase,&#039;_&#039;,num2str(nterms),&#039;_&#039;,job)&lt;br /&gt;
disp([&#039;Writing file: &#039;,pngfile,&#039;.png&#039;])&lt;br /&gt;
&lt;br /&gt;
fig=figure;&lt;br /&gt;
plot(x,y);&lt;br /&gt;
print(fig,pngfile,&#039;-dpng&#039;);&lt;br /&gt;
&lt;br /&gt;
quit&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
In preparation to run the sawtooth.m code, create a batch job script, sawtooth.slurm of the form:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH --time=03:00:00     # Adjust this to match the walltime of your job&lt;br /&gt;
#SBATCH --nodes=1           # For serial code, always specify just one node.&lt;br /&gt;
#SBATCH --ntasks=1          # For serial code, always specify just one task.&lt;br /&gt;
#SBATCH --cpus-per-task=1   # For serial code, always specify just one CPU per task.&lt;br /&gt;
#SBATCH --mem=4000m         # Adjust to match total memory required, in MB.&lt;br /&gt;
#SBATCH --partition=pawson-bf,apophis-bf,razi-bf,single,lattice,parallel,cpu2013,cpu2019&lt;br /&gt;
&lt;br /&gt;
# Sample batch job script for running a MATLAB function with both numerical and string arguments&lt;br /&gt;
# 2020-05-14&lt;br /&gt;
&lt;br /&gt;
# Specify the name of the main MATLAB function to be run.&lt;br /&gt;
# This would normally be the same as the MATLAB source code file name without a .m suffix).&lt;br /&gt;
MAIN=&amp;quot;sawtooth&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Define key parameters for the example calculation.&lt;br /&gt;
NTERMS=100&lt;br /&gt;
NPPCYCLE=20&lt;br /&gt;
NCYCLE=3&lt;br /&gt;
PNGFILEBASE=&amp;quot;sawtooth&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Contruct a complete function call to pass to MATLAB&lt;br /&gt;
# Note, string arguments should appear to MATLAB enclosed in single quotes&lt;br /&gt;
ARGS=&amp;quot;($NTERMS,$NPPCYCLE,$NCYCLE,&#039;$PNGFILEBASE&#039;)&amp;quot;&lt;br /&gt;
MAIN_WITH_ARGS=${MAIN}${ARGS}&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Calling MATLAB function: ${MAIN_WITH_ARGS}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Starting run at $(date)&amp;quot;&lt;br /&gt;
echo &amp;quot;Running on compute node $(hostname)&amp;quot;&lt;br /&gt;
echo &amp;quot;Running from directory $(pwd)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Choose a version of MATLAB by loading a module:&lt;br /&gt;
module load matlab/r2019b&lt;br /&gt;
echo &amp;quot;Using MATLAB version: $(which matlab)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Use -singleCompThread below for serial MATLAB code:&lt;br /&gt;
matlab -singleCompThread -batch &amp;quot;${MAIN_WITH_ARGS}&amp;quot; &amp;gt; ${MAIN}_${SLURM_JOB_ID}.out 2&amp;gt;&amp;amp;1&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Finished run at $(date)&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Note that the above script uses the -batch option on the matlab command line.  The MathWorks web page on [https://www.mathworks.com/help/matlab/ref/matlablinux.html running MATLAB on Linux (external link)] starting with Release 2019a of MATLAB, recommends using the -batch option for non-interactive use instead of the similar -r option that is recommended in interactive sessions.&lt;br /&gt;
&lt;br /&gt;
To submit the job to be executed, run:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sbatch sawtooth.slurm&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The job should produce three output files: Slurm script output, MATLAB command output and a PNG file, all tagged with the Slurm Job ID.&lt;br /&gt;
&lt;br /&gt;
== Parallel MATLAB examples==&lt;br /&gt;
&lt;br /&gt;
MATLAB provides several ways of speeding up calculations through parallel processing.  These include relying on internal parallelization in which multiple threads are used or by using explicit language features, such as parfor, to start up multiple workers on a compute node. Examples of both approaches are shown below. Using multiple compute nodes for a single MATLAB calculation, which depends on the MATLAB Parallel Server product, is not considered here as there has not been sufficient demand to configure that software on ARC.&lt;br /&gt;
&lt;br /&gt;
For many researchers, submitting many independent serial jobs is a better approach to efficient parallelization than using parallel programming in MATLAB itself.  An example of job-based parallelism is also shown below.&lt;br /&gt;
&lt;br /&gt;
=== Thread-based parallel processing ===&lt;br /&gt;
First consider an example using multiple cores with MATLAB&#039;s built-in thread-based parallelization.&lt;br /&gt;
&lt;br /&gt;
Suppose the following code to calculate eigenvalues of a number of random matrices is in a file eig_thread_test.m .  Note the use of the maxNumCompThreads function to control the number of threads (one thread per CPU core). For some years now, MathWorks has marked that function as deprecated, but, it still provides a useful limit to ensure that MATLAB doesn&#039;t use more cores than assigned by Slurm. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
function eig_thread_test(nthreads,matrix_size,nmatrices,results_file)&lt;br /&gt;
&lt;br /&gt;
% Calculate the absolute value of the maximum eigenvalue for each of a number of matrices&lt;br /&gt;
% possibly using multiple threads.&lt;br /&gt;
&lt;br /&gt;
% nthreads = number of computational threads to use.&lt;br /&gt;
% matrix_size = order of two-dimensional random matrix.&lt;br /&gt;
% nmatrices = number of matrices to process.&lt;br /&gt;
% results_file = name of file in which to save the maximum eigenvalues&lt;br /&gt;
&lt;br /&gt;
% 2020-05-25&lt;br /&gt;
&lt;br /&gt;
matlab_ncores=feature(&#039;numcores&#039;)&lt;br /&gt;
&lt;br /&gt;
slurm_ncores_per_task=str2num(getenv(&#039;SLURM_CPUS_PER_TASK&#039;))&lt;br /&gt;
if(isempty(slurm_ncores_per_task))&lt;br /&gt;
  slurm_ncores_per_task=1;&lt;br /&gt;
  disp(&#039;SLURM_CPUS_PER_TASK not set&#039;)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
% Set number of computational threads to the minimum of matlab_ncores and slurm_ncores_per_task&lt;br /&gt;
% Note Mathworks warns that the maxNumCompThreads function will&lt;br /&gt;
% be removed in future versions of MATLAB.&lt;br /&gt;
&lt;br /&gt;
% Use only thread-based parallel processing&lt;br /&gt;
&lt;br /&gt;
intial_matlab_max_ncores = maxNumCompThreads(min([nthreads,slurm_ncores_per_task]));&lt;br /&gt;
&lt;br /&gt;
disp([&#039;Using a maximum of &#039;,num2str(maxNumCompThreads()),&#039; computational threads.&#039;])&lt;br /&gt;
&lt;br /&gt;
tic &lt;br /&gt;
&lt;br /&gt;
for i = 1:nmatrices&lt;br /&gt;
  e=eig(rand(matrix_size));&lt;br /&gt;
  eigenvalues(i) = max(abs(e));&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
toc&lt;br /&gt;
&lt;br /&gt;
save(results_file,&#039;eigenvalues&#039;,&#039;-ascii&#039;)&lt;br /&gt;
&lt;br /&gt;
quit&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here is a job script, eig_thread_test.slurm that can be used to run the eig_thread_test.m code.&lt;br /&gt;
The number of threads used for the calculation is controlled by specifying the --cpus-per-task parameter that Slurm uses to control the number of CPU cores assigned to the job.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
&lt;br /&gt;
#SBATCH --time=01:00:00     # Adjust this to match the walltime of your job&lt;br /&gt;
#SBATCH --nodes=1           # Always specify just one node.&lt;br /&gt;
#SBATCH --ntasks=1          # Specify just one task.&lt;br /&gt;
#SBATCH --cpus-per-task=8   # The number of threads to use&lt;br /&gt;
#SBATCH --mem=4000m         # Adjust to match total memory required, in MB.&lt;br /&gt;
#SBATCH --partition=pawson-bf,apophis-bf,razi-bf,single,lattice,parallel,cpu2013,cpu2019&lt;br /&gt;
&lt;br /&gt;
# Sample batch job script for running a MATLAB function to test thread-based parallel processing features.&lt;br /&gt;
# 2020-05-25&lt;br /&gt;
&lt;br /&gt;
# Specify the name of the main MATLAB function to be run.&lt;br /&gt;
# This would normally be the same as the MATLAB source code file name without a .m suffix).&lt;br /&gt;
MAIN=&amp;quot;eig_thread_test&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Define key parameters for the example calculation.&lt;br /&gt;
NTHREADS=${SLURM_CPUS_PER_TASK}&lt;br /&gt;
MATRIX_SIZE=10000&lt;br /&gt;
NMATRICES=10&lt;br /&gt;
RESULTS_FILE=&amp;quot;maximum_eigenvalues_${SLURM_JOB_ID}.txt&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Contruct a complete function call to pass to MATLAB&lt;br /&gt;
# Note, string arguments should appear to MATLAB enclosed in single quotes&lt;br /&gt;
ARGS=&amp;quot;($NTHREADS,$MATRIX_SIZE,$NMATRICES,&#039;$RESULTS_FILE&#039;)&amp;quot;&lt;br /&gt;
MAIN_WITH_ARGS=${MAIN}${ARGS}&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Calling MATLAB function: ${MAIN_WITH_ARGS}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Starting run at $(date)&amp;quot;&lt;br /&gt;
echo &amp;quot;Running on compute node $(hostname)&amp;quot;&lt;br /&gt;
echo &amp;quot;Running from directory $(pwd)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Choose a version of MATLAB by loading a module:&lt;br /&gt;
module load matlab/r2020a&lt;br /&gt;
echo &amp;quot;Using MATLAB version: $(which matlab)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
matlab -batch &amp;quot;${MAIN_WITH_ARGS}&amp;quot; &amp;gt; ${MAIN}_${SLURM_JOB_ID}.out 2&amp;gt;&amp;amp;1&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Finished run at $(date)&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The above job can be submitted with&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sbatch eig_thread_test.slurm&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If assigned to one of the modern partitions (as opposed to the older single, lattice or parallel partitions) the job took about 16 minutes, about 4 times faster than a comparable serial job.  Using 8 cores to obtain just a factor of four speed-up is not an efficient use of ARC, but, might be justified in some cases.  In some cases, using multiple workers (as discussed in the next section) may be faster than using the same number of cores with thread-based parallelization.&lt;br /&gt;
&lt;br /&gt;
=== Explicit parallel processing using a pool of workers ===&lt;br /&gt;
&lt;br /&gt;
Now consider the more complicated case of creating a pool of workers and using a parfor loop to explicitly parallelize a section of code. Each worker may use one or more cores through MATLAB&#039;s internal thread-based parallelization, as in the preceding example.  Suppose the following code is in a file eig_parallel_test.m.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
function eig_parallel_test(nworkers,nthreads,matrix_size,nmatrices,results_file)&lt;br /&gt;
&lt;br /&gt;
% Calculate the absolute value of the maximum eigenvalue for each of a number of matrices&lt;br /&gt;
% possibly using multiple threads and multiple MATLAB workers.&lt;br /&gt;
&lt;br /&gt;
% nworkers = number of MATLAB workers to use.&lt;br /&gt;
% nthreads = number of threads per worker.&lt;br /&gt;
% matrix_size = order of two-dimensional random matrix.&lt;br /&gt;
% nmatrices = number of matrices to process.&lt;br /&gt;
% results_file = name of file in which to save the maximum eigenvalues&lt;br /&gt;
&lt;br /&gt;
% 2020-05-25&lt;br /&gt;
&lt;br /&gt;
matlab_ncores=feature(&#039;numcores&#039;)&lt;br /&gt;
&lt;br /&gt;
slurm_ncores_per_task=str2num(getenv(&#039;SLURM_CPUS_PER_TASK&#039;))&lt;br /&gt;
if(isempty(slurm_ncores_per_task))&lt;br /&gt;
  slurm_ncores_per_task=1;&lt;br /&gt;
  disp(&#039;SLURM_CPUS_PER_TASK not set&#039;)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
% Set number of computational threads to the minimum of matlab_ncores and slurm_ncores&lt;br /&gt;
% Note Mathworks warns that the maxNumCompThreads function will&lt;br /&gt;
% be removed in future versions of MATLAB.&lt;br /&gt;
% Testing based on remarks at&lt;br /&gt;
% https://www.mathworks.com/matlabcentral/answers/158192-maxnumcompthreads-hyperthreading-and-parpool&lt;br /&gt;
% shows the maxNumCompThreads has to be called inside the parfor loop.&lt;br /&gt;
&lt;br /&gt;
tic&lt;br /&gt;
&lt;br /&gt;
if ( nworkers &amp;gt; 1 )&lt;br /&gt;
&lt;br /&gt;
% Process with multiple workers&lt;br /&gt;
% Check on properties of the local MATLAB cluster.&lt;br /&gt;
% One can set properties such as c.NumThreads and c.NumWorkers&lt;br /&gt;
&lt;br /&gt;
parallel.defaultClusterProfile(&#039;local&#039;)&lt;br /&gt;
c = parcluster()&lt;br /&gt;
c.NumThreads=nthreads&lt;br /&gt;
c.NumWorkers=nworkers&lt;br /&gt;
&lt;br /&gt;
% Create a pool of workers with the current cluster settings.&lt;br /&gt;
% Note, testing without the nworkers argument showed a limit of 12 workers even if c.NumWorkers is defined.&lt;br /&gt;
parpool(c,nworkers)&lt;br /&gt;
&lt;br /&gt;
ticBytes(gcp);&lt;br /&gt;
&lt;br /&gt;
parfor i = 1:nmatrices&lt;br /&gt;
  e=eig(rand(matrix_size));&lt;br /&gt;
  eigenvalues(i) = max(abs(e));&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
tocBytes(gcp)&lt;br /&gt;
&lt;br /&gt;
% Close down the pool.&lt;br /&gt;
delete(gcp(&#039;nocreate&#039;));&lt;br /&gt;
&lt;br /&gt;
else&lt;br /&gt;
&lt;br /&gt;
% Use only thread-based parallel processing&lt;br /&gt;
&lt;br /&gt;
intial_matlab_max_ncores = maxNumCompThreads(min([nthreads,slurm_ncores_per_task]))&lt;br /&gt;
&lt;br /&gt;
for i = 1:nmatrices&lt;br /&gt;
  e=eig(rand(matrix_size));&lt;br /&gt;
  eigenvalues(i) = max(abs(e));&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
end % nworkers test&lt;br /&gt;
&lt;br /&gt;
toc&lt;br /&gt;
&lt;br /&gt;
save(results_file,&#039;eigenvalues&#039;,&#039;-ascii&#039;)&lt;br /&gt;
&lt;br /&gt;
quit&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Of particular note in the preceding example is the section of lines (copied below) that creates a cluster object, c, and modifies the number of threads associated with this object (c.NumThreads=nthreads). In a similar way, one can modify the number of workers (c.NumWorkers=nworkers).  Testing showed that if one then used the MATLAB gcp or parpool commands without arguments to create a pool of workers, at most 12 workers were created. However, it was found that by using parpool(c,nworkers), the requested number of workers would be started, even if nworkers &amp;gt; 12.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
parallel.defaultClusterProfile(&#039;local&#039;)&lt;br /&gt;
c = parcluster()&lt;br /&gt;
c.NumThreads=nthreads&lt;br /&gt;
c.NumWorkers=nworkers&lt;br /&gt;
parpool(c,nworkers)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
An example Slurm batch job script, eig_parallel_test.slurm, used to test the above code was:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
&lt;br /&gt;
#SBATCH --time=03:00:00     # Adjust this to match the walltime of your job&lt;br /&gt;
#SBATCH --nodes=1           # Always specify just one node.&lt;br /&gt;
#SBATCH --ntasks=1          # Always specify just one task.&lt;br /&gt;
#SBATCH --cpus-per-task=8   # Choose --cpus-per-task to match the number of workers * threads per worker&lt;br /&gt;
#SBATCH --mem=10000m         # Adjust to match total memory required, in MB.&lt;br /&gt;
#SBATCH --partition=pawson-bf,apophis-bf,razi-bf,single,lattice,parallel,cpu2013,cpu2019&lt;br /&gt;
&lt;br /&gt;
# Sample batch job script for running a MATLAB function to test parallel processing features&lt;br /&gt;
# 2020-05-25&lt;br /&gt;
&lt;br /&gt;
# Specify the name of the main MATLAB function to be run.&lt;br /&gt;
# This would normally be the same as the MATLAB source code file name without a .m suffix).&lt;br /&gt;
MAIN=&amp;quot;eig_parallel_test&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Define key parameters for the example calculation.&lt;br /&gt;
NWORKERS=${SLURM_NTASKS}&lt;br /&gt;
NTHREADS=${SLURM_CPUS_PER_TASK}&lt;br /&gt;
MATRIX_SIZE=10000&lt;br /&gt;
NMATRICES=10&lt;br /&gt;
RESULTS_FILE=&amp;quot;maximum_eigenvalues_${SLURM_JOB_ID}.txt&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Contruct a complete function call to pass to MATLAB&lt;br /&gt;
# Note, string arguments should appear to MATLAB enclosed in single quotes&lt;br /&gt;
ARGS=&amp;quot;($NWORKERS,$NTHREADS,$MATRIX_SIZE,$NMATRICES,&#039;$RESULTS_FILE&#039;)&amp;quot;&lt;br /&gt;
MAIN_WITH_ARGS=${MAIN}${ARGS}&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Calling MATLAB function: ${MAIN_WITH_ARGS}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Starting run at $(date)&amp;quot;&lt;br /&gt;
echo &amp;quot;Running on compute node $(hostname)&amp;quot;&lt;br /&gt;
echo &amp;quot;Running from directory $(pwd)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Choose a version of MATLAB by loading a module:&lt;br /&gt;
module load matlab/r2020a&lt;br /&gt;
echo &amp;quot;Using MATLAB version: $(which matlab)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
matlab -batch &amp;quot;${MAIN_WITH_ARGS}&amp;quot; &amp;gt; ${MAIN}_${SLURM_JOB_ID}.out 2&amp;gt;&amp;amp;1&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Finished run at $(date)&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Note that the Slurm SBATCH parameter --cpus-per-task, the total number of cores to use, should be the product of the number of workers and the threads per worker.  (It might be argued that one more core should be requested beyond the product of workers and threads, to use for the main MATLAB process, but, for a fully parallelized code, the workers do the great bulk of the calculation and the main MATLAB process uses relatively little CPU time.)&lt;br /&gt;
 &lt;br /&gt;
Variations on the above code were tested with many combinations of workers and threads per worker.  It was found that if many jobs were started in close succession that some of the jobs failed to start properly. The problem can be avoided by introducing a short delay between job submissions, as illustrated in the section on job arrays below.&lt;br /&gt;
&lt;br /&gt;
Also note that in the above example, the number of cores requested is not well matched to the number of workers.  If there are 8 workers processing 10 matrices and each worker gets assigned one matrix, there are two left over. The total time for 10 matrices (or for any number of matrices from 9 to 16) would be about double that for 8 matrices.  For example, in testing the above code, the time for processing 10 matrices with 8 workers with just one computational thread was 1050 seconds, whereas processing just 8 matrices with 8 workers took only 560 seconds.&lt;br /&gt;
&lt;br /&gt;
=== Job-based parallel processing ===&lt;br /&gt;
&lt;br /&gt;
Slurm provides a feature called job arrays that can sometimes be conveniently used to submit a large number of similar jobs.  This can be used effectively when doing a parameter sweep, in which one key value (or several) in the code are changed from run to run. For example, in the eigenvalue calculation code considered in the previous section, one may want to study the effect of changing the matrix size. Alternatively, there may be cases in which the only change from one job to another is the name of an input file that contains the data to be processed.&lt;br /&gt;
&lt;br /&gt;
The key to using the job array feature is to set up the code to depend on a single integer value, the job array index, $SLURM_ARRAY_TASK_ID . When a job is run, the array index variable is replaced by Slurm with a specific value, taken from a corresponding --array argument on the sbatch command line.  For example, if the job script shown below is called eig_parallel_array_test.slurm and you run the script as&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sbatch --array=1000,2000,3000 eig_parallel_array_test.slurm&lt;br /&gt;
&amp;lt;/pre&amp;gt; &lt;br /&gt;
then three jobs will be run, with $SLURM_ARRAY_TASK_ID taking on the values 1000, 2000 and 3000 for the three cases, respectively.&lt;br /&gt;
&lt;br /&gt;
If you had a case in which input files to be processed were data_1.in, data_2.in, ... data_100.in, you could submit 100 jobs to each process one data file with &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sbatch --array=1-100 script_to_process_one_file.slurm&lt;br /&gt;
&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
where the job script refers to the files as data_${SLURM_ARRAY_TASK_ID}.in . (Putting the curly brackets around the variable name helps the bash shell from being confused with other text in the file name.)&lt;br /&gt;
&lt;br /&gt;
Testing shows that starting large numbers of jobs in a short period of time, such as can occur when job arrays are used and there are many free compute nodes, can lead to failures.  This kind of error appears to be related to delayed file system access when MATLAB tries to write job information to a hidden subdirectory under your home directory.   One way to avoid this problem is to introduce a delay between job submissions.  This can be done by using a loop of the form:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
for job in $(seq 1 100)&lt;br /&gt;
do&lt;br /&gt;
sbatch --array=$job script_to_process_one_file.slurm&lt;br /&gt;
done&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
One other caveat regarding the use of job arrays is that the resources requested with the SBATCH directives are for a single instance of the calculation to be completed. So, if the resource requirements are expected to differ significantly from one job to another, you may have to write separate job scripts for each case, rather than using a job array.&lt;br /&gt;
&lt;br /&gt;
Here is an example of a job script to calculate the maximum eigenvalue of a number of random matrices of a given size.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
&lt;br /&gt;
#SBATCH --time=01:00:00     # Adjust this to match the walltime of your job&lt;br /&gt;
#SBATCH --nodes=1           # Always specify just one node.&lt;br /&gt;
#SBATCH --ntasks=1          # Always specify just one task.&lt;br /&gt;
#SBATCH --cpus-per-task=1   # For serial code, always specify just one CPU per task.&lt;br /&gt;
#SBATCH --mem=4000m         # Adjust to match total memory required, in MB.&lt;br /&gt;
#SBATCH --partition=pawson-bf,apophis-bf,razi-bf,single,lattice,parallel,cpu2013,cpu2019&lt;br /&gt;
&lt;br /&gt;
# Sample batch job script for running a MATLAB function to illustrate job-based parallel processing with job arrays&lt;br /&gt;
# 2020-05-27&lt;br /&gt;
&lt;br /&gt;
# The order of the matrix is specified using the job array index.&lt;br /&gt;
&lt;br /&gt;
# Specify the name of the main MATLAB function to be run.&lt;br /&gt;
# This would normally be the same as the MATLAB source code file name without a .m suffix).&lt;br /&gt;
MAIN=&amp;quot;eig_parallel_test&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Define key parameters for the example calculation.&lt;br /&gt;
NWORKERS=1&lt;br /&gt;
NTHREADS=1&lt;br /&gt;
MATRIX_SIZE=$SLURM_ARRAY_TASK_ID&lt;br /&gt;
NMATRICES=10&lt;br /&gt;
RESULTS_FILE=&amp;quot;maximum_eigenvalues_${MATRIX_SIZE}_${SLURM_JOB_ID}.txt&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Contruct a complete function call to pass to MATLAB&lt;br /&gt;
# Note, string arguments should appear to MATLAB enclosed in single quotes&lt;br /&gt;
ARGS=&amp;quot;($NWORKERS,$NTHREADS,$MATRIX_SIZE,$NMATRICES,&#039;$RESULTS_FILE&#039;)&amp;quot;&lt;br /&gt;
MAIN_WITH_ARGS=${MAIN}${ARGS}&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Calling MATLAB function: ${MAIN_WITH_ARGS}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Starting run at $(date)&amp;quot;&lt;br /&gt;
echo &amp;quot;Running on compute node $(hostname)&amp;quot;&lt;br /&gt;
echo &amp;quot;Running from directory $(pwd)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Choose a version of MATLAB by loading a module:&lt;br /&gt;
module load matlab/r2020a&lt;br /&gt;
echo &amp;quot;Using MATLAB version: $(which matlab)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
matlab -batch &amp;quot;${MAIN_WITH_ARGS}&amp;quot; &amp;gt; ${MAIN}_${SLURM_JOB_ID}.out 2&amp;gt;&amp;amp;1&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Finished run at $(date)&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Standalone Applications =&lt;br /&gt;
&lt;br /&gt;
When running MATLAB code as described in the preceding sections, a connection to the campus MATLAB license server, checking out licenses for MATLAB and any specialized toolboxes needed, is made for each job that is submitted. Currently, with the University of Calgary&#039;s Total Academic Headcount license, there are sufficient license tokens to support thousands of simultaneous MATLAB sessions (although ARC usage policy and cluster load will limit individual users to smaller numbers of jobs). However, there may be times at which the license server is slow to respond when large numbers of requests are being handled, or the server may be unavailable temporarily due to network problems. MathWorks offers an alternative way of running MATLAB code that can avoid license server issues by compiling it into a standalone application.  A license is required only during the compilation process and not when the code is run.  This allows calculations to be run on ARC without concerns regarding the license server.  The compiled code can also be run on compatible (64-bit Linux) hardware, not necessarily at the University of Calgary, such as on [https://docs.computecanada.ca/wiki/Getting_started Compute Canada (external link)] clusters.&lt;br /&gt;
&lt;br /&gt;
== Creating a standalone application ==&lt;br /&gt;
&lt;br /&gt;
The MATLAB &#039;&#039;&#039;mcc&#039;&#039;&#039; command is used to compile source code (.m files) into a standalone executable. There are a couple of important considerations to keep in mind when creating an executable that can be run in a batch-oriented cluster environment. One is that there is no graphical display attached to your session and another is that the number of threads used by the standalone application has to be controlled.  There is also an important difference in the way arguments of the main function are handled.&lt;br /&gt;
&lt;br /&gt;
Let&#039;s illustrate the process of creating a standalone application for the sawtooth.m code used previously. Unfortunately, if that code is compiled as it is, the resulting compiled application will fail to run properly.  The reason is that the compiled code sees all the input arguments as strings instead of interpreting them as numbers. To work around this problem, use a MATLAB function, &#039;&#039;&#039;isdeployed&#039;&#039;&#039;, to determine whether or not the code is being run as a standalone application. Here is a modified version of code, called sawtooth_standalone.m that can be successfully compiled and run as a standalone application.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
function sawtooth_standalone(nterms,nppcycle,ncycle,pngfilebase)&lt;br /&gt;
&lt;br /&gt;
% MATLAB file example to approximate a sawtooth&lt;br /&gt;
% with a truncated Fourier expansion.&lt;br /&gt;
&lt;br /&gt;
% nterms = number of terms in expansion.&lt;br /&gt;
% nppcycle = number of points per cycle.&lt;br /&gt;
% ncycle = number of complete cycles to plot.&lt;br /&gt;
% pngfilebase = base of file name for graph of results.&lt;br /&gt;
&lt;br /&gt;
% 2020-05-21&lt;br /&gt;
&lt;br /&gt;
% Test to see if the code is running as a standalone application&lt;br /&gt;
% If it is, convert the arguments intended to be numeric from &lt;br /&gt;
% the input strings to numbers&lt;br /&gt;
&lt;br /&gt;
if isdeployed&lt;br /&gt;
  nterms=str2num(nterms)&lt;br /&gt;
  nppcycle=str2num(nppcycle)&lt;br /&gt;
  ncycle=str2num(ncycle)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
np=nppcycle*ncycle;&lt;br /&gt;
&lt;br /&gt;
fourbypi=4.0/pi;&lt;br /&gt;
y(1:np)=pi/2.0;&lt;br /&gt;
x(1:np)=linspace(-pi*ncycle,pi*ncycle,np);&lt;br /&gt;
&lt;br /&gt;
for k=1:nterms&lt;br /&gt;
  twokm=2*k-1;&lt;br /&gt;
  y=y-fourbypi*cos(twokm*x)/twokm^2;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
% Prepare output&lt;br /&gt;
% Construct the output file name from the base file name and number of terms&lt;br /&gt;
% Also append the Slurm JOBID to keep file names unique from run to run.&lt;br /&gt;
&lt;br /&gt;
job=getenv(&#039;SLURM_JOB_ID&#039;)&lt;br /&gt;
pngfile=strcat(pngfilebase,&#039;_&#039;,num2str(nterms),&#039;_&#039;,job)&lt;br /&gt;
disp([&#039;Writing file: &#039;,pngfile,&#039;.png&#039;])&lt;br /&gt;
&lt;br /&gt;
fig=figure;&lt;br /&gt;
plot(x,y);&lt;br /&gt;
print(fig,pngfile,&#039;-dpng&#039;);&lt;br /&gt;
&lt;br /&gt;
quit&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Suppose that the sawtooth_standalone.m file is in a subdirectory src below your current working directory and that the compiled files are going to be written to a subdirectory called deploy. The following commands (at the Linux shell prompt) could be used to compile the code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mkdir deploy&lt;br /&gt;
cd src&lt;br /&gt;
module load matlab/r2019b&lt;br /&gt;
mcc -R -nodisplay \&lt;br /&gt;
 -R -singleCompThread \&lt;br /&gt;
 -m -v -w enable \&lt;br /&gt;
 -d ../deploy \&lt;br /&gt;
 sawtooth_standalone.m&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note the option -singleCompThread has been included in order to limit the executable to just one computational thread.&lt;br /&gt;
&lt;br /&gt;
In the deploy directory, an executable, sawtooth_standalone, will be created along with a script, run_sawtooth_standalone.sh. These two files should be copied to the target machine where the code is to be run.&lt;br /&gt;
&lt;br /&gt;
== Running a standalone application ==&lt;br /&gt;
&lt;br /&gt;
After the standalone executable sawtooth_standalone and corresponding script run_sawtooth_standalone.sh have been transferred to a directory on the target system on which they will be run (whether to a different directory on ARC or to a completely different cluster), a batch job script needs to be created in that same directory. Here is an example batch job script, sawtooth_standalone.slurm, appropriate for the ARC cluster.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH --time=03:00:00     # Adjust this to match the walltime of your job&lt;br /&gt;
#SBATCH --nodes=1           # For serial code, always specify just one node.&lt;br /&gt;
#SBATCH --ntasks=1          # For serial code, always specify just one task.&lt;br /&gt;
#SBATCH --cpus-per-task=1   # For serial code, always specify just one CPU per task.&lt;br /&gt;
#SBATCH --mem=4000m         # Adjust to match total memory required, in MB.&lt;br /&gt;
#SBATCH --partition=pawson-bf,apophis-bf,razi-bf,single,lattice,parallel,cpu2013,cpu2019&lt;br /&gt;
&lt;br /&gt;
# Sample batch job script for running a compiled MATLAB function&lt;br /&gt;
# 2020-05-21&lt;br /&gt;
&lt;br /&gt;
# Specify the name of the compiled MATLAB standalone executable&lt;br /&gt;
MAIN=&amp;quot;sawtooth_standalone&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Define key parameters for the example calculation.&lt;br /&gt;
NTERMS=100&lt;br /&gt;
NPPCYCLE=20&lt;br /&gt;
NCYCLE=3&lt;br /&gt;
PNGFILEBASE=$MAIN&lt;br /&gt;
&lt;br /&gt;
ARGS=&amp;quot;$NTERMS $NPPCYCLE $NCYCLE $PNGFILEBASE&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Choose the MCR directory according to the compiler version used&lt;br /&gt;
MCR=/global/software/matlab/mcr/v97&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Starting run at $(date)&amp;quot;&lt;br /&gt;
echo &amp;quot;Running on compute node $(hostname)&amp;quot;&lt;br /&gt;
echo &amp;quot;Running from directory $(pwd)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
./run_${MAIN}.sh $MCR $ARGS &amp;gt; ${MAIN}_${SLURM_JOB_ID}.out 2&amp;gt;&amp;amp;1&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Finished run at $(date)&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The job is then submitted with sbatch:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sbatch sawtooth_standalone.slurm&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
An important part of the above script is the definition of the variable &#039;&#039;&#039;MCR&#039;&#039;&#039;, which defines the location of the MATLAB Compiler Runtime (MCR) directory. This directory contains files necessary for the standalone application to run. The version of the MCR files specified (v97 in the example, which corresponds to MATLAB R2019b) must match the version of MATLAB used to compile the code.&lt;br /&gt;
&lt;br /&gt;
A list of MATLAB distributions and the corresponding MCR versions is given on the [https://www.mathworks.com/products/compiler/matlab-runtime.html Mathworks web site (external link)]. Some versions installed on ARC are listed below, along with the corresponding installation directory to which the MCR variable should be set if running on ARC. (As of this writing on May 21, 2020, installation of release R2020a has not quite been finished, but, should be ready before the end of the month). If the MCR version you need does not appear in /global/software/matlab/mcr, write to support@hpc.ucalgary.ca to request that it be installed, or use a different version of MATLAB for your compilation.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;WG_Indent3&amp;quot; style=&amp;quot;height: 150px; width: 576px&amp;quot; border=&amp;quot;2&amp;quot;&lt;br /&gt;
| style=&amp;quot;text-align: center&amp;quot; | &#039;&#039;&#039;MATLAB Release&#039;&#039;&#039;&lt;br /&gt;
| style=&amp;quot;text-align: center&amp;quot; | &#039;&#039;&#039;MCR Version&#039;&#039;&#039;&lt;br /&gt;
| style=&amp;quot;text-align: center&amp;quot; | &#039;&#039;&#039;MCR directory&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: center&amp;quot; | R2017a&lt;br /&gt;
| style=&amp;quot;text-align: center&amp;quot; | 9.2&lt;br /&gt;
| class=&amp;quot;WG_Inline_Code&amp;quot; style=&amp;quot;text-align: center&amp;quot; | /global/software/matlab/mcr/v92&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: center&amp;quot; | R2017b&lt;br /&gt;
| style=&amp;quot;text-align: center&amp;quot; | 9.3&lt;br /&gt;
| class=&amp;quot;WG_Inline_Code&amp;quot; style=&amp;quot;text-align: center&amp;quot; | /global/software/matlab/mcr/v93&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: center&amp;quot; | R2018a&lt;br /&gt;
| style=&amp;quot;text-align: center&amp;quot; | 9.4&lt;br /&gt;
| class=&amp;quot;WG_Inline_Code&amp;quot; style=&amp;quot;text-align: center&amp;quot; | /global/software/matlab/mcr/v94&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: center&amp;quot; | R2019b&lt;br /&gt;
| style=&amp;quot;text-align: center&amp;quot; | 9.7&lt;br /&gt;
| class=&amp;quot;WG_Inline_Code&amp;quot; style=&amp;quot;text-align: center&amp;quot; | /global/software/matlab/mcr/v97&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: center&amp;quot; | R2020a&lt;br /&gt;
| style=&amp;quot;text-align: center&amp;quot; | 9.8&lt;br /&gt;
| class=&amp;quot;WG_Inline_Code&amp;quot; style=&amp;quot;text-align: center&amp;quot; | /global/software/matlab/mcr/v98&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Phillips</name></author>
	</entry>
	<entry>
		<id>https://rcs.ucalgary.ca/index.php?title=MATLAB&amp;diff=576</id>
		<title>MATLAB</title>
		<link rel="alternate" type="text/html" href="https://rcs.ucalgary.ca/index.php?title=MATLAB&amp;diff=576"/>
		<updated>2020-05-27T14:50:04Z</updated>

		<summary type="html">&lt;p&gt;Phillips: Added job array section&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:MATLAB]]&lt;br /&gt;
[[Category:Software]]&lt;br /&gt;
[[Category:ARC]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;contents&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= &amp;lt;span id=&amp;quot;intro&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Introduction =&lt;br /&gt;
&lt;br /&gt;
[http://www.mathworks.com/ MATLAB] is a general-purpose high-level programming package for numerical work such as linear algebra, signal processing and other calculations involving matrices or vectors of data. Visualization tools are also included for presentation of results. The basic MATLAB package is extended through add-on components including SIMULINK, and the Image Processing, Optimization, Neural Network, Signal Processing, Statistics and Wavelet Toolboxes, among others.&lt;br /&gt;
&lt;br /&gt;
The main purpose of this page is to show how to use MATLAB on the University of Calgary [[ ARC_Cluster_Guide |ARC (Advanced Research Computing) cluster]]. It is presumed that you already have an account an ARC and have read the material on reserving resources and [[Running jobs|running jobs]] with the Slurm job management system.&lt;br /&gt;
&lt;br /&gt;
= &amp;lt;span id=&amp;quot;license&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Ways to run MATLAB - License considerations =&lt;br /&gt;
At the University of Calgary, Information Technologies has purchased a MATLAB Total Academic Headcount license that allows installation and use of MATLAB on central clusters, such as ARC, as well as on personal workstations throughout the University. Potentially thousands of instances of MATLAB can be run simultaneously, each checking out a license from a central license server. An alternative is to compile MATLAB code into a standalone application. When such an application is run, it does not need to contact the server for a license. This allows researchers to run their calculations on compatible hardware, not necessarily at the University of Calgary, such as on [https://docs.computecanada.ca/wiki/Getting_started Compute Canada clusters (external link)].&lt;br /&gt;
&lt;br /&gt;
For information about installing MATLAB on your own computer, see the Information Technologies Knowledge Base [https://ucalgary.service-now.com/it?id=kb_article&amp;amp;sys_id=787d708213fdbec08246f7b2e144b0d4 article on MATLAB].&lt;br /&gt;
&lt;br /&gt;
= Running MATLAB on the ARC cluster =&lt;br /&gt;
Although it is possible to run MATLAB interactively, the expectation is that most calculations with MATLAB will be completed by submitting a batch job script to the Slurm job scheduler with the sbatch command.&lt;br /&gt;
&lt;br /&gt;
For many researchers, the main reason for using ARC for MATLAB-based calculations is to be able to run many instances at the same time.  It is recommended in such cases that any parallel processing features be removed from the code and each instance of MATLAB be run on a single CPU core.  It is also possible to run MATLAB on multiple cores in an attempt to speed up individual instances, but, this generally results in a less efficient use of the cluster hardware.  In the sections that follow, serial and then parallel processing examples are shown.&lt;br /&gt;
&lt;br /&gt;
== Serial MATLAB example==&lt;br /&gt;
&lt;br /&gt;
For the purposes of illustration, suppose the following serial MATLAB code, in a file sawtooth.m, is to be run. If your code does not already have them, add a function statement at the beginning and matching end statement at the end as shown in the example. Other features of this example include calling a function with both numerical and string arguments, incorporating a Slurm environment variable into the MATLAB code and producing graphical output in a non-interactive environment.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
function sawtooth(nterms,nppcycle,ncycle,pngfilebase)&lt;br /&gt;
&lt;br /&gt;
% MATLAB file example to approximate a sawtooth&lt;br /&gt;
% with a truncated Fourier expansion.&lt;br /&gt;
&lt;br /&gt;
% nterms = number of terms in expansion.&lt;br /&gt;
% nppcycle = number of points per cycle.&lt;br /&gt;
% ncycle = number of complete cycles to plot.&lt;br /&gt;
% pngfilebase = base of file name for graph of results.&lt;br /&gt;
&lt;br /&gt;
% 2020-05-14&lt;br /&gt;
&lt;br /&gt;
np=nppcycle*ncycle;&lt;br /&gt;
&lt;br /&gt;
fourbypi=4.0/pi;&lt;br /&gt;
y(1:np)=pi/2.0;&lt;br /&gt;
x(1:np)=linspace(-pi*ncycle,pi*ncycle,np);&lt;br /&gt;
&lt;br /&gt;
for k=1:nterms&lt;br /&gt;
  twokm=2*k-1;&lt;br /&gt;
  y=y-fourbypi*cos(twokm*x)/twokm^2;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
% Prepare output&lt;br /&gt;
% Construct the output file name from the base file name and number of terms&lt;br /&gt;
% Also append the Slurm JOBID to keep file names unique from run to run.&lt;br /&gt;
&lt;br /&gt;
job=getenv(&#039;SLURM_JOB_ID&#039;)&lt;br /&gt;
pngfile=strcat(pngfilebase,&#039;_&#039;,num2str(nterms),&#039;_&#039;,job)&lt;br /&gt;
disp([&#039;Writing file: &#039;,pngfile,&#039;.png&#039;])&lt;br /&gt;
&lt;br /&gt;
fig=figure;&lt;br /&gt;
plot(x,y);&lt;br /&gt;
print(fig,pngfile,&#039;-dpng&#039;);&lt;br /&gt;
&lt;br /&gt;
quit&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
In preparation to run the sawtooth.m code, create a batch job script, sawtooth.slurm of the form:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH --time=03:00:00     # Adjust this to match the walltime of your job&lt;br /&gt;
#SBATCH --nodes=1           # For serial code, always specify just one node.&lt;br /&gt;
#SBATCH --ntasks=1          # For serial code, always specify just one task.&lt;br /&gt;
#SBATCH --cpus-per-task=1   # For serial code, always specify just one CPU per task.&lt;br /&gt;
#SBATCH --mem=4000m         # Adjust to match total memory required, in MB.&lt;br /&gt;
#SBATCH --partition=pawson-bf,apophis-bf,razi-bf,single,lattice,parallel,cpu2013,cpu2019&lt;br /&gt;
&lt;br /&gt;
# Sample batch job script for running a MATLAB function with both numerical and string arguments&lt;br /&gt;
# 2020-05-14&lt;br /&gt;
&lt;br /&gt;
# Specify the name of the main MATLAB function to be run.&lt;br /&gt;
# This would normally be the same as the MATLAB source code file name without a .m suffix).&lt;br /&gt;
MAIN=&amp;quot;sawtooth&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Define key parameters for the example calculation.&lt;br /&gt;
NTERMS=100&lt;br /&gt;
NPPCYCLE=20&lt;br /&gt;
NCYCLE=3&lt;br /&gt;
PNGFILEBASE=&amp;quot;sawtooth&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Contruct a complete function call to pass to MATLAB&lt;br /&gt;
# Note, string arguments should appear to MATLAB enclosed in single quotes&lt;br /&gt;
ARGS=&amp;quot;($NTERMS,$NPPCYCLE,$NCYCLE,&#039;$PNGFILEBASE&#039;)&amp;quot;&lt;br /&gt;
MAIN_WITH_ARGS=${MAIN}${ARGS}&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Calling MATLAB function: ${MAIN_WITH_ARGS}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Starting run at $(date)&amp;quot;&lt;br /&gt;
echo &amp;quot;Running on compute node $(hostname)&amp;quot;&lt;br /&gt;
echo &amp;quot;Running from directory $(pwd)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Choose a version of MATLAB by loading a module:&lt;br /&gt;
module load matlab/r2019b&lt;br /&gt;
echo &amp;quot;Using MATLAB version: $(which matlab)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Use -singleCompThread below for serial MATLAB code:&lt;br /&gt;
matlab -singleCompThread -batch &amp;quot;${MAIN_WITH_ARGS}&amp;quot; &amp;gt; ${MAIN}_${SLURM_JOB_ID}.out 2&amp;gt;&amp;amp;1&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Finished run at $(date)&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Note that the above script uses the -batch option on the matlab command line.  The MathWorks web page on [https://www.mathworks.com/help/matlab/ref/matlablinux.html running MATLAB on Linux (external link)] starting with Release 2019a of MATLAB, recommends using the -batch option for non-interactive use instead of the similar -r option that is recommended in interactive sessions.&lt;br /&gt;
&lt;br /&gt;
To submit the job to be executed, run:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sbatch sawtooth.slurm&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The job should produce three output files: Slurm script output, MATLAB command output and a PNG file, all tagged with the Slurm Job ID.&lt;br /&gt;
&lt;br /&gt;
== Parallel MATLAB examples==&lt;br /&gt;
&lt;br /&gt;
MATLAB provides several ways of speeding up calculations through parallel processing.  These include relying on internal parallelization in which multiple threads are used or by using explicit language features, such as parfor, to start up multiple workers on a compute node. Examples of both approaches are shown below. Using multiple compute nodes for a single MATLAB calculation, which depends on the MATLAB Parallel Server product, is not considered here as there has not been sufficient demand to configure that software on ARC.&lt;br /&gt;
&lt;br /&gt;
For many researchers, submitting many independent serial jobs is a better approach to efficient parallelization than using parallel programming in MATLAB itself.  An example of job-based parallelism is also shown below.&lt;br /&gt;
&lt;br /&gt;
=== Thread-based parallel processing ===&lt;br /&gt;
First consider an example using multiple cores with MATLAB&#039;s built-in thread-based parallelization.&lt;br /&gt;
&lt;br /&gt;
Suppose the following code to calculate eigenvalues of a number of random matrices is in a file eig_thread_test.m .  Note the use of the maxNumCompThreads function to control the number of threads (one thread per CPU core). For some years now, MathWorks has marked that function as deprecated, but, it still provides a useful limit to ensure that MATLAB doesn&#039;t use more cores than assigned by Slurm. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
function eig_thread_test(nthreads,matrix_size,nmatrices,results_file)&lt;br /&gt;
&lt;br /&gt;
% Calculate the absolute value of the maximum eigenvalue for each of a number of matrices&lt;br /&gt;
% possibly using multiple threads.&lt;br /&gt;
&lt;br /&gt;
% nthreads = number of computational threads to use.&lt;br /&gt;
% matrix_size = order of two-dimensional random matrix.&lt;br /&gt;
% nmatrices = number of matrices to process.&lt;br /&gt;
% results_file = name of file in which to save the maximum eigenvalues&lt;br /&gt;
&lt;br /&gt;
% 2020-05-25&lt;br /&gt;
&lt;br /&gt;
matlab_ncores=feature(&#039;numcores&#039;)&lt;br /&gt;
&lt;br /&gt;
slurm_ncores_per_task=str2num(getenv(&#039;SLURM_CPUS_PER_TASK&#039;))&lt;br /&gt;
if(isempty(slurm_ncores_per_task))&lt;br /&gt;
  slurm_ncores_per_task=1;&lt;br /&gt;
  disp(&#039;SLURM_CPUS_PER_TASK not set&#039;)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
% Set number of computational threads to the minimum of matlab_ncores and slurm_ncores_per_task&lt;br /&gt;
% Note Mathworks warns that the maxNumCompThreads function will&lt;br /&gt;
% be removed in future versions of MATLAB.&lt;br /&gt;
&lt;br /&gt;
% Use only thread-based parallel processing&lt;br /&gt;
&lt;br /&gt;
intial_matlab_max_ncores = maxNumCompThreads(min([nthreads,slurm_ncores_per_task]));&lt;br /&gt;
&lt;br /&gt;
disp([&#039;Using a maximum of &#039;,num2str(maxNumCompThreads()),&#039; computational threads.&#039;])&lt;br /&gt;
&lt;br /&gt;
tic &lt;br /&gt;
&lt;br /&gt;
for i = 1:nmatrices&lt;br /&gt;
  e=eig(rand(matrix_size));&lt;br /&gt;
  eigenvalues(i) = max(abs(e));&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
toc&lt;br /&gt;
&lt;br /&gt;
save(results_file,&#039;eigenvalues&#039;,&#039;-ascii&#039;)&lt;br /&gt;
&lt;br /&gt;
quit&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here is a job script, eig_thread_test.slurm that can be used to run the eig_thread_test.m code.&lt;br /&gt;
The number of threads used for the calculation is controlled by specifying the --cpus-per-task parameter that Slurm uses to control the number of CPU cores assigned to the job.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
&lt;br /&gt;
#SBATCH --time=01:00:00     # Adjust this to match the walltime of your job&lt;br /&gt;
#SBATCH --nodes=1           # Always specify just one node.&lt;br /&gt;
#SBATCH --ntasks=1          # Specify just one task.&lt;br /&gt;
#SBATCH --cpus-per-task=8   # The number of threads to use&lt;br /&gt;
#SBATCH --mem=4000m         # Adjust to match total memory required, in MB.&lt;br /&gt;
#SBATCH --partition=pawson-bf,apophis-bf,razi-bf,single,lattice,parallel,cpu2013,cpu2019&lt;br /&gt;
&lt;br /&gt;
# Sample batch job script for running a MATLAB function to test thread-based parallel processing features.&lt;br /&gt;
# 2020-05-25&lt;br /&gt;
&lt;br /&gt;
# Specify the name of the main MATLAB function to be run.&lt;br /&gt;
# This would normally be the same as the MATLAB source code file name without a .m suffix).&lt;br /&gt;
MAIN=&amp;quot;eig_thread_test&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Define key parameters for the example calculation.&lt;br /&gt;
NTHREADS=${SLURM_CPUS_PER_TASK}&lt;br /&gt;
MATRIX_SIZE=10000&lt;br /&gt;
NMATRICES=10&lt;br /&gt;
RESULTS_FILE=&amp;quot;maximum_eigenvalues_${SLURM_JOB_ID}.txt&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Contruct a complete function call to pass to MATLAB&lt;br /&gt;
# Note, string arguments should appear to MATLAB enclosed in single quotes&lt;br /&gt;
ARGS=&amp;quot;($NTHREADS,$MATRIX_SIZE,$NMATRICES,&#039;$RESULTS_FILE&#039;)&amp;quot;&lt;br /&gt;
MAIN_WITH_ARGS=${MAIN}${ARGS}&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Calling MATLAB function: ${MAIN_WITH_ARGS}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Starting run at $(date)&amp;quot;&lt;br /&gt;
echo &amp;quot;Running on compute node $(hostname)&amp;quot;&lt;br /&gt;
echo &amp;quot;Running from directory $(pwd)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Choose a version of MATLAB by loading a module:&lt;br /&gt;
module load matlab/r2020a&lt;br /&gt;
echo &amp;quot;Using MATLAB version: $(which matlab)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
matlab -batch &amp;quot;${MAIN_WITH_ARGS}&amp;quot; &amp;gt; ${MAIN}_${SLURM_JOB_ID}.out 2&amp;gt;&amp;amp;1&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Finished run at $(date)&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The above job can be submitted with&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sbatch eig_thread_test.slurm&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If assigned to one of the modern partitions (as opposed to the older single, lattice or parallel partitions) the job took about 16 minutes, about 4 times faster than a comparable serial job.  Using 8 cores to obtain just a factor of four speed-up is not an efficient use of ARC, but, might be justified in some cases.  In some cases, using multiple workers (as discussed in the next section) may be faster than using the same number of cores with thread-based parallelization.&lt;br /&gt;
&lt;br /&gt;
=== Explicit parallel processing using a pool of workers ===&lt;br /&gt;
&lt;br /&gt;
Now consider the more complicated case of creating a pool of workers and using a parfor loop to explicitly parallelize a section of code. Each worker may use one or more cores through MATLAB&#039;s internal thread-based parallelization, as in the preceding example.  Suppose the following code is in a file eig_parallel_test.m.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
function eig_parallel_test(nworkers,nthreads,matrix_size,nmatrices,results_file)&lt;br /&gt;
&lt;br /&gt;
% Calculate the absolute value of the maximum eigenvalue for each of a number of matrices&lt;br /&gt;
% possibly using multiple threads and multiple MATLAB workers.&lt;br /&gt;
&lt;br /&gt;
% nworkers = number of MATLAB workers to use.&lt;br /&gt;
% nthreads = number of threads per worker.&lt;br /&gt;
% matrix_size = order of two-dimensional random matrix.&lt;br /&gt;
% nmatrices = number of matrices to process.&lt;br /&gt;
% results_file = name of file in which to save the maximum eigenvalues&lt;br /&gt;
&lt;br /&gt;
% 2020-05-25&lt;br /&gt;
&lt;br /&gt;
matlab_ncores=feature(&#039;numcores&#039;)&lt;br /&gt;
&lt;br /&gt;
slurm_ncores_per_task=str2num(getenv(&#039;SLURM_CPUS_PER_TASK&#039;))&lt;br /&gt;
if(isempty(slurm_ncores_per_task))&lt;br /&gt;
  slurm_ncores_per_task=1;&lt;br /&gt;
  disp(&#039;SLURM_CPUS_PER_TASK not set&#039;)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
% Set number of computational threads to the minimum of matlab_ncores and slurm_ncores&lt;br /&gt;
% Note Mathworks warns that the maxNumCompThreads function will&lt;br /&gt;
% be removed in future versions of MATLAB.&lt;br /&gt;
% Testing based on remarks at&lt;br /&gt;
% https://www.mathworks.com/matlabcentral/answers/158192-maxnumcompthreads-hyperthreading-and-parpool&lt;br /&gt;
% shows the maxNumCompThreads has to be called inside the parfor loop.&lt;br /&gt;
&lt;br /&gt;
tic&lt;br /&gt;
&lt;br /&gt;
if ( nworkers &amp;gt; 1 )&lt;br /&gt;
&lt;br /&gt;
% Process with multiple workers&lt;br /&gt;
% Check on properties of the local MATLAB cluster.&lt;br /&gt;
% One can set properties such as c.NumThreads and c.NumWorkers&lt;br /&gt;
&lt;br /&gt;
parallel.defaultClusterProfile(&#039;local&#039;)&lt;br /&gt;
c = parcluster()&lt;br /&gt;
c.NumThreads=nthreads&lt;br /&gt;
c.NumWorkers=nworkers&lt;br /&gt;
&lt;br /&gt;
% Create a pool of workers with the current cluster settings.&lt;br /&gt;
% Note, testing without the nworkers argument showed a limit of 12 workers even if c.NumWorkers is defined.&lt;br /&gt;
parpool(c,nworkers)&lt;br /&gt;
&lt;br /&gt;
ticBytes(gcp);&lt;br /&gt;
&lt;br /&gt;
parfor i = 1:nmatrices&lt;br /&gt;
  e=eig(rand(matrix_size));&lt;br /&gt;
  eigenvalues(i) = max(abs(e));&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
tocBytes(gcp)&lt;br /&gt;
&lt;br /&gt;
% Close down the pool.&lt;br /&gt;
delete(gcp(&#039;nocreate&#039;));&lt;br /&gt;
&lt;br /&gt;
else&lt;br /&gt;
&lt;br /&gt;
% Use only thread-based parallel processing&lt;br /&gt;
&lt;br /&gt;
intial_matlab_max_ncores = maxNumCompThreads(min([nthreads,slurm_ncores_per_task]))&lt;br /&gt;
&lt;br /&gt;
for i = 1:nmatrices&lt;br /&gt;
  e=eig(rand(matrix_size));&lt;br /&gt;
  eigenvalues(i) = max(abs(e));&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
end % nworkers test&lt;br /&gt;
&lt;br /&gt;
toc&lt;br /&gt;
&lt;br /&gt;
save(results_file,&#039;eigenvalues&#039;,&#039;-ascii&#039;)&lt;br /&gt;
&lt;br /&gt;
quit&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Of particular note in the preceding example is the section of lines (copied below) that creates a cluster object, c, and modifies the number of threads associated with this object (c.NumThreads=nthreads). In a similar way, one can modify the number of workers (c.NumWorkers=nworkers).  Testing showed that if one then used the MATLAB gcp or parpool commands without arguments to create a pool of workers, at most 12 workers were created. However, it was found that by using parpool(c,nworkers), the requested number of workers would be started, even if nworkers &amp;gt; 12.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
parallel.defaultClusterProfile(&#039;local&#039;)&lt;br /&gt;
c = parcluster()&lt;br /&gt;
c.NumThreads=nthreads&lt;br /&gt;
c.NumWorkers=nworkers&lt;br /&gt;
parpool(c,nworkers)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
An example Slurm batch job script, eig_parallel_test.slurm, used to test the above code was:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
&lt;br /&gt;
#SBATCH --time=03:00:00     # Adjust this to match the walltime of your job&lt;br /&gt;
#SBATCH --nodes=1           # Always specify just one node.&lt;br /&gt;
#SBATCH --ntasks=1          # Always specify just one task.&lt;br /&gt;
#SBATCH --cpus-per-task=8   # Choose --cpus-per-task to match the number of workers * threads per worker&lt;br /&gt;
#SBATCH --mem=10000m         # Adjust to match total memory required, in MB.&lt;br /&gt;
#SBATCH --partition=pawson-bf,apophis-bf,razi-bf,single,lattice,parallel,cpu2013,cpu2019&lt;br /&gt;
&lt;br /&gt;
# Sample batch job script for running a MATLAB function to test parallel processing features&lt;br /&gt;
# 2020-05-25&lt;br /&gt;
&lt;br /&gt;
# Specify the name of the main MATLAB function to be run.&lt;br /&gt;
# This would normally be the same as the MATLAB source code file name without a .m suffix).&lt;br /&gt;
MAIN=&amp;quot;eig_parallel_test&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Define key parameters for the example calculation.&lt;br /&gt;
NWORKERS=${SLURM_NTASKS}&lt;br /&gt;
NTHREADS=${SLURM_CPUS_PER_TASK}&lt;br /&gt;
MATRIX_SIZE=10000&lt;br /&gt;
NMATRICES=10&lt;br /&gt;
RESULTS_FILE=&amp;quot;maximum_eigenvalues_${SLURM_JOB_ID}.txt&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Contruct a complete function call to pass to MATLAB&lt;br /&gt;
# Note, string arguments should appear to MATLAB enclosed in single quotes&lt;br /&gt;
ARGS=&amp;quot;($NWORKERS,$NTHREADS,$MATRIX_SIZE,$NMATRICES,&#039;$RESULTS_FILE&#039;)&amp;quot;&lt;br /&gt;
MAIN_WITH_ARGS=${MAIN}${ARGS}&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Calling MATLAB function: ${MAIN_WITH_ARGS}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Starting run at $(date)&amp;quot;&lt;br /&gt;
echo &amp;quot;Running on compute node $(hostname)&amp;quot;&lt;br /&gt;
echo &amp;quot;Running from directory $(pwd)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Choose a version of MATLAB by loading a module:&lt;br /&gt;
module load matlab/r2020a&lt;br /&gt;
echo &amp;quot;Using MATLAB version: $(which matlab)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
matlab -batch &amp;quot;${MAIN_WITH_ARGS}&amp;quot; &amp;gt; ${MAIN}_${SLURM_JOB_ID}.out 2&amp;gt;&amp;amp;1&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Finished run at $(date)&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Note that the Slurm SBATCH parameter --cpus-per-task, the total number of cores to use, should be the product of the number of workers and the threads per worker.  (It might be argued that one more core should be requested beyond the product of workers and threads, to use for the main MATLAB process, but, for a fully parallelized code, the workers do the great bulk of the calculation and the main MATLAB process uses relatively little CPU time.)&lt;br /&gt;
 &lt;br /&gt;
Variations on the above code was tested with many combinations of workers and threads per worker.  It was found that if many jobs were started in close succession that some of the jobs failed to start properly.&lt;br /&gt;
&lt;br /&gt;
Also note that in the above example, the number of cores requested is not well matched to the number of workers.  If there are 8 workers processing 10 matrices and each worker gets assigned one matrix, there are two left over. The total time for 10 matrices (or for any number of matrices from 9 to 16) would be about double that for 8 matrices.  For example, in testing the above code, the time for processing 10 matrices with 8 workers with just one computational thread was 1050 seconds, whereas processing just 8 matrices with 8 workers took only 560 seconds.&lt;br /&gt;
&lt;br /&gt;
=== Job-based parallel processing ===&lt;br /&gt;
&lt;br /&gt;
Slurm provides a feature called job arrays that can sometimes be conveniently used to submit a large number of similar jobs.  This can be used effectively when doing a parameter sweep, in which one key value (or several) in the code are changed from run to run. For example, in the eigenvalue calculation code considered in the previous section, one may want to study the effect of changing the matrix size. Alternatively, there may be cases in which the only change from one job to another is the name of an input file that contains the data to be processed.&lt;br /&gt;
&lt;br /&gt;
The key to using the job array feature is to set up the code to depend on a single integer value, the job array index, $SLURM_ARRAY_TASK_ID . When a job is run, the array index variable is replaced by Slurm with a specific value, taken from a corresponding --array argument on the sbatch command line.  For example, if the job script shown below is called eig_parallel_array_test.slurm and you run the script as&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sbatch --array=1000,2000,3000 eig_parallel_array_test.slurm&lt;br /&gt;
&amp;lt;/pre&amp;gt; &lt;br /&gt;
then three jobs will be run, with $SLURM_ARRAY_TASK_ID taking on the values 1000, 2000 and 3000 for the three cases, respectively.&lt;br /&gt;
&lt;br /&gt;
If you had a case in which input files to be processed were data_1.in, data_2.in, ... data_100.in, you could submit 100 jobs to each process one data file with &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sbatch --array=1-100 script_to_process_one_file.slurm&lt;br /&gt;
&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
where the job script refers to the files as data_${SLURM_ARRAY_TASK_ID}.in . (Putting the curly brackets around the variable name helps the bash shell from being confused with other text in the file name.)&lt;br /&gt;
&lt;br /&gt;
Testing shows that starting large numbers of jobs in a short period of time, such as can occur when job arrays are used and there are many free compute nodes, can lead to failures.  This kind of error appears to be related to delayed file system access when MATLAB tries to write job information to a hidden subdirectory under your home directory.   One way to avoid this problem is to introduce a delay between job submissions.  This can be done by using a loop of the form:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
for job in $(seq 1 100)&lt;br /&gt;
do&lt;br /&gt;
sbatch --array=$job script_to_process_one_file.slurm&lt;br /&gt;
done&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
One other caveat regarding the use of job arrays is that the resources requested with the SBATCH directives are for a single instance of the calculation to be completed. So, if the resource requirements are expected to differ significantly from one job to another, you may have to write separate job scripts for each case, rather than using a job array.&lt;br /&gt;
&lt;br /&gt;
Here is an example of a job script to calculate the maximum eigenvalue of a number of random matrices of a given size.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
&lt;br /&gt;
#SBATCH --time=01:00:00     # Adjust this to match the walltime of your job&lt;br /&gt;
#SBATCH --nodes=1           # Always specify just one node.&lt;br /&gt;
#SBATCH --ntasks=1          # Always specify just one task.&lt;br /&gt;
#SBATCH --cpus-per-task=1   # For serial code, always specify just one CPU per task.&lt;br /&gt;
#SBATCH --mem=4000m         # Adjust to match total memory required, in MB.&lt;br /&gt;
#SBATCH --partition=pawson-bf,apophis-bf,razi-bf,single,lattice,parallel,cpu2013,cpu2019&lt;br /&gt;
&lt;br /&gt;
# Sample batch job script for running a MATLAB function to illustrate job-based parallel processing with job arrays&lt;br /&gt;
# 2020-05-27&lt;br /&gt;
&lt;br /&gt;
# The order of the matrix is specified using the job array index.&lt;br /&gt;
&lt;br /&gt;
# Specify the name of the main MATLAB function to be run.&lt;br /&gt;
# This would normally be the same as the MATLAB source code file name without a .m suffix).&lt;br /&gt;
MAIN=&amp;quot;eig_parallel_test&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Define key parameters for the example calculation.&lt;br /&gt;
NWORKERS=1&lt;br /&gt;
NTHREADS=1&lt;br /&gt;
MATRIX_SIZE=$SLURM_ARRAY_TASK_ID&lt;br /&gt;
NMATRICES=10&lt;br /&gt;
RESULTS_FILE=&amp;quot;maximum_eigenvalues_${MATRIX_SIZE}_${SLURM_JOB_ID}.txt&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Contruct a complete function call to pass to MATLAB&lt;br /&gt;
# Note, string arguments should appear to MATLAB enclosed in single quotes&lt;br /&gt;
ARGS=&amp;quot;($NWORKERS,$NTHREADS,$MATRIX_SIZE,$NMATRICES,&#039;$RESULTS_FILE&#039;)&amp;quot;&lt;br /&gt;
MAIN_WITH_ARGS=${MAIN}${ARGS}&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Calling MATLAB function: ${MAIN_WITH_ARGS}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Starting run at $(date)&amp;quot;&lt;br /&gt;
echo &amp;quot;Running on compute node $(hostname)&amp;quot;&lt;br /&gt;
echo &amp;quot;Running from directory $(pwd)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Choose a version of MATLAB by loading a module:&lt;br /&gt;
module load matlab/r2020a&lt;br /&gt;
echo &amp;quot;Using MATLAB version: $(which matlab)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
matlab -batch &amp;quot;${MAIN_WITH_ARGS}&amp;quot; &amp;gt; ${MAIN}_${SLURM_JOB_ID}.out 2&amp;gt;&amp;amp;1&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Finished run at $(date)&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Standalone Applications =&lt;br /&gt;
&lt;br /&gt;
When running MATLAB code as described in the preceding sections, a connection to the campus MATLAB license server, checking out licenses for MATLAB and any specialized toolboxes needed, is made for each job that is submitted. Currently, with the University of Calgary&#039;s Total Academic Headcount license, there are sufficient license tokens to support thousands of simultaneous MATLAB sessions (although ARC usage policy and cluster load will limit individual users to smaller numbers of jobs). However, there may be times at which the license server is slow to respond when large numbers of requests are being handled, or the server may be unavailable temporarily due to network problems. MathWorks offers an alternative way of running MATLAB code that can avoid license server issues by compiling it into a standalone application.  A license is required only during the compilation process and not when the code is run.  This allows calculations to be run on ARC without concerns regarding the license server.  The compiled code can also be run on compatible (64-bit Linux) hardware, not necessarily at the University of Calgary, such as on [https://docs.computecanada.ca/wiki/Getting_started Compute Canada (external link)] clusters.&lt;br /&gt;
&lt;br /&gt;
== Creating a standalone application ==&lt;br /&gt;
&lt;br /&gt;
The MATLAB &#039;&#039;&#039;mcc&#039;&#039;&#039; command is used to compile source code (.m files) into a standalone executable. There are a couple of important considerations to keep in mind when creating an executable that can be run in a batch-oriented cluster environment. One is that there is no graphical display attached to your session and another is that the number of threads used by the standalone application has to be controlled.  There is also an important difference in the way arguments of the main function are handled.&lt;br /&gt;
&lt;br /&gt;
Let&#039;s illustrate the process of creating a standalone application for the sawtooth.m code used previously. Unfortunately, if that code is compiled as it is, the resulting compiled application will fail to run properly.  The reason is that the compiled code sees all the input arguments as strings instead of interpreting them as numbers. To work around this problem, use a MATLAB function, &#039;&#039;&#039;isdeployed&#039;&#039;&#039;, to determine whether or not the code is being run as a standalone application. Here is a modified version of code, called sawtooth_standalone.m that can be successfully compiled and run as a standalone application.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
function sawtooth_standalone(nterms,nppcycle,ncycle,pngfilebase)&lt;br /&gt;
&lt;br /&gt;
% MATLAB file example to approximate a sawtooth&lt;br /&gt;
% with a truncated Fourier expansion.&lt;br /&gt;
&lt;br /&gt;
% nterms = number of terms in expansion.&lt;br /&gt;
% nppcycle = number of points per cycle.&lt;br /&gt;
% ncycle = number of complete cycles to plot.&lt;br /&gt;
% pngfilebase = base of file name for graph of results.&lt;br /&gt;
&lt;br /&gt;
% 2020-05-21&lt;br /&gt;
&lt;br /&gt;
% Test to see if the code is running as a standalone application&lt;br /&gt;
% If it is, convert the arguments intended to be numeric from &lt;br /&gt;
% the input strings to numbers&lt;br /&gt;
&lt;br /&gt;
if isdeployed&lt;br /&gt;
  nterms=str2num(nterms)&lt;br /&gt;
  nppcycle=str2num(nppcycle)&lt;br /&gt;
  ncycle=str2num(ncycle)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
np=nppcycle*ncycle;&lt;br /&gt;
&lt;br /&gt;
fourbypi=4.0/pi;&lt;br /&gt;
y(1:np)=pi/2.0;&lt;br /&gt;
x(1:np)=linspace(-pi*ncycle,pi*ncycle,np);&lt;br /&gt;
&lt;br /&gt;
for k=1:nterms&lt;br /&gt;
  twokm=2*k-1;&lt;br /&gt;
  y=y-fourbypi*cos(twokm*x)/twokm^2;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
% Prepare output&lt;br /&gt;
% Construct the output file name from the base file name and number of terms&lt;br /&gt;
% Also append the Slurm JOBID to keep file names unique from run to run.&lt;br /&gt;
&lt;br /&gt;
job=getenv(&#039;SLURM_JOB_ID&#039;)&lt;br /&gt;
pngfile=strcat(pngfilebase,&#039;_&#039;,num2str(nterms),&#039;_&#039;,job)&lt;br /&gt;
disp([&#039;Writing file: &#039;,pngfile,&#039;.png&#039;])&lt;br /&gt;
&lt;br /&gt;
fig=figure;&lt;br /&gt;
plot(x,y);&lt;br /&gt;
print(fig,pngfile,&#039;-dpng&#039;);&lt;br /&gt;
&lt;br /&gt;
quit&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Suppose that the sawtooth_standalone.m file is in a subdirectory src below your current working directory and that the compiled files are going to be written to a subdirectory called deploy. The following commands (at the Linux shell prompt) could be used to compile the code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mkdir deploy&lt;br /&gt;
cd src&lt;br /&gt;
module load matlab/r2019b&lt;br /&gt;
mcc -R -nodisplay \&lt;br /&gt;
 -R -singleCompThread \&lt;br /&gt;
 -m -v -w enable \&lt;br /&gt;
 -d ../deploy \&lt;br /&gt;
 sawtooth_standalone.m&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note the option -singleCompThread has been included in order to limit the executable to just one computational thread.&lt;br /&gt;
&lt;br /&gt;
In the deploy directory, an executable, sawtooth_standalone, will be created along with a script, run_sawtooth_standalone.sh. These two files should be copied to the target machine where the code is to be run.&lt;br /&gt;
&lt;br /&gt;
== Running a standalone application ==&lt;br /&gt;
&lt;br /&gt;
After the standalone executable sawtooth_standalone and corresponding script run_sawtooth_standalone.sh have been transferred to a directory on the target system on which they will be run (whether to a different directory on ARC or to a completely different cluster), a batch job script needs to be created in that same directory. Here is an example batch job script, sawtooth_standalone.slurm, appropriate for the ARC cluster.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH --time=03:00:00     # Adjust this to match the walltime of your job&lt;br /&gt;
#SBATCH --nodes=1           # For serial code, always specify just one node.&lt;br /&gt;
#SBATCH --ntasks=1          # For serial code, always specify just one task.&lt;br /&gt;
#SBATCH --cpus-per-task=1   # For serial code, always specify just one CPU per task.&lt;br /&gt;
#SBATCH --mem=4000m         # Adjust to match total memory required, in MB.&lt;br /&gt;
#SBATCH --partition=pawson-bf,apophis-bf,razi-bf,single,lattice,parallel,cpu2013,cpu2019&lt;br /&gt;
&lt;br /&gt;
# Sample batch job script for running a compiled MATLAB function&lt;br /&gt;
# 2020-05-21&lt;br /&gt;
&lt;br /&gt;
# Specify the name of the compiled MATLAB standalone executable&lt;br /&gt;
MAIN=&amp;quot;sawtooth_standalone&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Define key parameters for the example calculation.&lt;br /&gt;
NTERMS=100&lt;br /&gt;
NPPCYCLE=20&lt;br /&gt;
NCYCLE=3&lt;br /&gt;
PNGFILEBASE=$MAIN&lt;br /&gt;
&lt;br /&gt;
ARGS=&amp;quot;$NTERMS $NPPCYCLE $NCYCLE $PNGFILEBASE&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Choose the MCR directory according to the compiler version used&lt;br /&gt;
MCR=/global/software/matlab/mcr/v97&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Starting run at $(date)&amp;quot;&lt;br /&gt;
echo &amp;quot;Running on compute node $(hostname)&amp;quot;&lt;br /&gt;
echo &amp;quot;Running from directory $(pwd)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
./run_${MAIN}.sh $MCR $ARGS &amp;gt; ${MAIN}_${SLURM_JOB_ID}.out 2&amp;gt;&amp;amp;1&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Finished run at $(date)&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The job is then submitted with sbatch:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sbatch sawtooth_standalone.slurm&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
An important part of the above script is the definition of the variable &#039;&#039;&#039;MCR&#039;&#039;&#039;, which defines the location of the MATLAB Compiler Runtime (MCR) directory. This directory contains files necessary for the standalone application to run. The version of the MCR files specified (v97 in the example, which corresponds to MATLAB R2019b) must match the version of MATLAB used to compile the code.&lt;br /&gt;
&lt;br /&gt;
A list of MATLAB distributions and the corresponding MCR versions is given on the [https://www.mathworks.com/products/compiler/matlab-runtime.html Mathworks web site (external link)]. Some versions installed on ARC are listed below, along with the corresponding installation directory to which the MCR variable should be set if running on ARC. (As of this writing on May 21, 2020, installation of release R2020a has not quite been finished, but, should be ready before the end of the month). If the MCR version you need does not appear in /global/software/matlab/mcr, write to support@hpc.ucalgary.ca to request that it be installed, or use a different version of MATLAB for your compilation.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;WG_Indent3&amp;quot; style=&amp;quot;height: 150px; width: 576px&amp;quot; border=&amp;quot;2&amp;quot;&lt;br /&gt;
| style=&amp;quot;text-align: center&amp;quot; | &#039;&#039;&#039;MATLAB Release&#039;&#039;&#039;&lt;br /&gt;
| style=&amp;quot;text-align: center&amp;quot; | &#039;&#039;&#039;MCR Version&#039;&#039;&#039;&lt;br /&gt;
| style=&amp;quot;text-align: center&amp;quot; | &#039;&#039;&#039;MCR directory&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: center&amp;quot; | R2017a&lt;br /&gt;
| style=&amp;quot;text-align: center&amp;quot; | 9.2&lt;br /&gt;
| class=&amp;quot;WG_Inline_Code&amp;quot; style=&amp;quot;text-align: center&amp;quot; | /global/software/matlab/mcr/v92&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: center&amp;quot; | R2017b&lt;br /&gt;
| style=&amp;quot;text-align: center&amp;quot; | 9.3&lt;br /&gt;
| class=&amp;quot;WG_Inline_Code&amp;quot; style=&amp;quot;text-align: center&amp;quot; | /global/software/matlab/mcr/v93&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: center&amp;quot; | R2018a&lt;br /&gt;
| style=&amp;quot;text-align: center&amp;quot; | 9.4&lt;br /&gt;
| class=&amp;quot;WG_Inline_Code&amp;quot; style=&amp;quot;text-align: center&amp;quot; | /global/software/matlab/mcr/v94&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: center&amp;quot; | R2019b&lt;br /&gt;
| style=&amp;quot;text-align: center&amp;quot; | 9.7&lt;br /&gt;
| class=&amp;quot;WG_Inline_Code&amp;quot; style=&amp;quot;text-align: center&amp;quot; | /global/software/matlab/mcr/v97&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: center&amp;quot; | R2020a&lt;br /&gt;
| style=&amp;quot;text-align: center&amp;quot; | 9.8&lt;br /&gt;
| class=&amp;quot;WG_Inline_Code&amp;quot; style=&amp;quot;text-align: center&amp;quot; | /global/software/matlab/mcr/v98&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Phillips</name></author>
	</entry>
	<entry>
		<id>https://rcs.ucalgary.ca/index.php?title=MATLAB&amp;diff=575</id>
		<title>MATLAB</title>
		<link rel="alternate" type="text/html" href="https://rcs.ucalgary.ca/index.php?title=MATLAB&amp;diff=575"/>
		<updated>2020-05-27T14:04:37Z</updated>

		<summary type="html">&lt;p&gt;Phillips: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:MATLAB]]&lt;br /&gt;
[[Category:Software]]&lt;br /&gt;
[[Category:ARC]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;contents&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= &amp;lt;span id=&amp;quot;intro&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Introduction =&lt;br /&gt;
&lt;br /&gt;
[http://www.mathworks.com/ MATLAB] is a general-purpose high-level programming package for numerical work such as linear algebra, signal processing and other calculations involving matrices or vectors of data. Visualization tools are also included for presentation of results. The basic MATLAB package is extended through add-on components including SIMULINK, and the Image Processing, Optimization, Neural Network, Signal Processing, Statistics and Wavelet Toolboxes, among others.&lt;br /&gt;
&lt;br /&gt;
The main purpose of this page is to show how to use MATLAB on the University of Calgary [[ ARC_Cluster_Guide |ARC (Advanced Research Computing) cluster]]. It is presumed that you already have an account an ARC and have read the material on reserving resources and [[Running jobs|running jobs]] with the Slurm job management system.&lt;br /&gt;
&lt;br /&gt;
= &amp;lt;span id=&amp;quot;license&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;Ways to run MATLAB - License considerations =&lt;br /&gt;
At the University of Calgary, Information Technologies has purchased a MATLAB Total Academic Headcount license that allows installation and use of MATLAB on central clusters, such as ARC, as well as on personal workstations throughout the University. Potentially thousands of instances of MATLAB can be run simultaneously, each checking out a license from a central license server. An alternative is to compile MATLAB code into a standalone application. When such an application is run, it does not need to contact the server for a license. This allows researchers to run their calculations on compatible hardware, not necessarily at the University of Calgary, such as on [https://docs.computecanada.ca/wiki/Getting_started Compute Canada clusters (external link)].&lt;br /&gt;
&lt;br /&gt;
For information about installing MATLAB on your own computer, see the Information Technologies Knowledge Base [https://ucalgary.service-now.com/it?id=kb_article&amp;amp;sys_id=787d708213fdbec08246f7b2e144b0d4 article on MATLAB].&lt;br /&gt;
&lt;br /&gt;
= Running MATLAB on the ARC cluster =&lt;br /&gt;
Although it is possible to run MATLAB interactively, the expectation is that most calculations with MATLAB will be completed by submitting a batch job script to the Slurm job scheduler with the sbatch command.&lt;br /&gt;
&lt;br /&gt;
For many researchers, the main reason for using ARC for MATLAB-based calculations is to be able to run many instances at the same time.  It is recommended in such cases that any parallel processing features be removed from the code and each instance of MATLAB be run on a single CPU core.  It is also possible to run MATLAB on multiple cores in an attempt to speed up individual instances, but, this is generally results in a less efficient use of the cluster hardware.  In the sections that follow, serial and then parallel processing examples are shown.&lt;br /&gt;
&lt;br /&gt;
== Serial MATLAB example==&lt;br /&gt;
&lt;br /&gt;
For the purposes of illustration, suppose the following serial MATLAB code, in a file sawtooth.m, is to be run. If your code does not already have them, add a function statement at the beginning and matching end statement at the end as shown in the example. Other features of this example include calling a function with both numerical and string arguments, incorporating a Slurm environment variable into the MATLAB code and producing graphical output in a non-interactive environment.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
function sawtooth(nterms,nppcycle,ncycle,pngfilebase)&lt;br /&gt;
&lt;br /&gt;
% MATLAB file example to approximate a sawtooth&lt;br /&gt;
% with a truncated Fourier expansion.&lt;br /&gt;
&lt;br /&gt;
% nterms = number of terms in expansion.&lt;br /&gt;
% nppcycle = number of points per cycle.&lt;br /&gt;
% ncycle = number of complete cycles to plot.&lt;br /&gt;
% pngfilebase = base of file name for graph of results.&lt;br /&gt;
&lt;br /&gt;
% 2020-05-14&lt;br /&gt;
&lt;br /&gt;
np=nppcycle*ncycle;&lt;br /&gt;
&lt;br /&gt;
fourbypi=4.0/pi;&lt;br /&gt;
y(1:np)=pi/2.0;&lt;br /&gt;
x(1:np)=linspace(-pi*ncycle,pi*ncycle,np);&lt;br /&gt;
&lt;br /&gt;
for k=1:nterms&lt;br /&gt;
  twokm=2*k-1;&lt;br /&gt;
  y=y-fourbypi*cos(twokm*x)/twokm^2;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
% Prepare output&lt;br /&gt;
% Construct the output file name from the base file name and number of terms&lt;br /&gt;
% Also append the Slurm JOBID to keep file names unique from run to run.&lt;br /&gt;
&lt;br /&gt;
job=getenv(&#039;SLURM_JOB_ID&#039;)&lt;br /&gt;
pngfile=strcat(pngfilebase,&#039;_&#039;,num2str(nterms),&#039;_&#039;,job)&lt;br /&gt;
disp([&#039;Writing file: &#039;,pngfile,&#039;.png&#039;])&lt;br /&gt;
&lt;br /&gt;
fig=figure;&lt;br /&gt;
plot(x,y);&lt;br /&gt;
print(fig,pngfile,&#039;-dpng&#039;);&lt;br /&gt;
&lt;br /&gt;
quit&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
In preparation to run the sawtooth.m code, create a batch job script, sawtooth.slurm of the form:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH --time=03:00:00     # Adjust this to match the walltime of your job&lt;br /&gt;
#SBATCH --nodes=1           # For serial code, always specify just one node.&lt;br /&gt;
#SBATCH --ntasks=1          # For serial code, always specify just one task.&lt;br /&gt;
#SBATCH --cpus-per-task=1   # For serial code, always specify just one CPU per task.&lt;br /&gt;
#SBATCH --mem=4000m         # Adjust to match total memory required, in MB.&lt;br /&gt;
#SBATCH --partition=pawson-bf,apophis-bf,razi-bf,single,lattice,parallel,cpu2013,cpu2019&lt;br /&gt;
&lt;br /&gt;
# Sample batch job script for running a MATLAB function with both numerical and string arguments&lt;br /&gt;
# 2020-05-14&lt;br /&gt;
&lt;br /&gt;
# Specify the name of the main MATLAB function to be run.&lt;br /&gt;
# This would normally be the same as the MATLAB source code file name without a .m suffix).&lt;br /&gt;
MAIN=&amp;quot;sawtooth&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Define key parameters for the example calculation.&lt;br /&gt;
NTERMS=100&lt;br /&gt;
NPPCYCLE=20&lt;br /&gt;
NCYCLE=3&lt;br /&gt;
PNGFILEBASE=&amp;quot;sawtooth&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Contruct a complete function call to pass to MATLAB&lt;br /&gt;
# Note, string arguments should appear to MATLAB enclosed in single quotes&lt;br /&gt;
ARGS=&amp;quot;($NTERMS,$NPPCYCLE,$NCYCLE,&#039;$PNGFILEBASE&#039;)&amp;quot;&lt;br /&gt;
MAIN_WITH_ARGS=${MAIN}${ARGS}&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Calling MATLAB function: ${MAIN_WITH_ARGS}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Starting run at $(date)&amp;quot;&lt;br /&gt;
echo &amp;quot;Running on compute node $(hostname)&amp;quot;&lt;br /&gt;
echo &amp;quot;Running from directory $(pwd)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Choose a version of MATLAB by loading a module:&lt;br /&gt;
module load matlab/r2019b&lt;br /&gt;
echo &amp;quot;Using MATLAB version: $(which matlab)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Use -singleCompThread below for serial MATLAB code:&lt;br /&gt;
matlab -singleCompThread -batch &amp;quot;${MAIN_WITH_ARGS}&amp;quot; &amp;gt; ${MAIN}_${SLURM_JOB_ID}.out 2&amp;gt;&amp;amp;1&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Finished run at $(date)&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Note that the above script uses the -batch option on the matlab command line.  The MathWorks web page on [https://www.mathworks.com/help/matlab/ref/matlablinux.html running MATLAB on Linux (external link)] starting with Release 2019a of MATLAB, recommends using the -batch option for non-interactive use instead of the similar -r option that is recommended in interactive sessions.&lt;br /&gt;
&lt;br /&gt;
To submit the job to be executed, run:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sbatch sawtooth.slurm&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The job should produce three output files: Slurm script output, MATLAB command output and a PNG file, all tagged with the Slurm Job ID.&lt;br /&gt;
&lt;br /&gt;
== Parallel MATLAB examples==&lt;br /&gt;
&lt;br /&gt;
MATLAB provides several ways of speeding up calculations through parallel processing.  These include relying on internal parallelization in which multiple threads are used or by using explicit language features, such as parfor, to start up multiple workers on a compute node. Examples of both approaches are shown below. Using multiple compute nodes for a single MATLAB calculation, which depends on the MATLAB Parallel Server product, is not considered here as there has not been sufficient demand to configure that software on ARC.&lt;br /&gt;
&lt;br /&gt;
=== Thread-based parallel processing ===&lt;br /&gt;
First consider an example using multiple cores with MATLAB&#039;s built-in thread-based parallelization.&lt;br /&gt;
&lt;br /&gt;
Suppose the following code to calculate eigenvalues of a number of random matrices is in a file eig_thread_test.m .  Note the use of the maxNumCompThreads function to control the number of threads (one thread per CPU core). For some years now, MathWorks has marked that function as deprecated, but, it still provides a useful limit to ensure that MATLAB doesn&#039;t use more cores than assigned by Slurm. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
function eig_thread_test(nthreads,matrix_size,nmatrices,results_file)&lt;br /&gt;
&lt;br /&gt;
% Calculate the absolute value of the maximum eigenvalue for each of a number of matrices&lt;br /&gt;
% possibly using multiple threads.&lt;br /&gt;
&lt;br /&gt;
% nthreads = number of computational threads to use.&lt;br /&gt;
% matrix_size = order of two-dimensional random matrix.&lt;br /&gt;
% nmatrices = number of matrices to process.&lt;br /&gt;
% results_file = name of file in which to save the maximum eigenvalues&lt;br /&gt;
&lt;br /&gt;
% 2020-05-25&lt;br /&gt;
&lt;br /&gt;
matlab_ncores=feature(&#039;numcores&#039;)&lt;br /&gt;
&lt;br /&gt;
slurm_ncores_per_task=str2num(getenv(&#039;SLURM_CPUS_PER_TASK&#039;))&lt;br /&gt;
if(isempty(slurm_ncores_per_task))&lt;br /&gt;
  slurm_ncores_per_task=1;&lt;br /&gt;
  disp(&#039;SLURM_CPUS_PER_TASK not set&#039;)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
% Set number of computational threads to the minimum of matlab_ncores and slurm_ncores_per_task&lt;br /&gt;
% Note Mathworks warns that the maxNumCompThreads function will&lt;br /&gt;
% be removed in future versions of MATLAB.&lt;br /&gt;
&lt;br /&gt;
% Use only thread-based parallel processing&lt;br /&gt;
&lt;br /&gt;
intial_matlab_max_ncores = maxNumCompThreads(min([nthreads,slurm_ncores_per_task]));&lt;br /&gt;
&lt;br /&gt;
disp([&#039;Using a maximum of &#039;,num2str(maxNumCompThreads()),&#039; computational threads.&#039;])&lt;br /&gt;
&lt;br /&gt;
tic &lt;br /&gt;
&lt;br /&gt;
for i = 1:nmatrices&lt;br /&gt;
  e=eig(rand(matrix_size));&lt;br /&gt;
  eigenvalues(i) = max(abs(e));&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
toc&lt;br /&gt;
&lt;br /&gt;
save(results_file,&#039;eigenvalues&#039;,&#039;-ascii&#039;)&lt;br /&gt;
&lt;br /&gt;
quit&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here is a job script, eig_thread_test.slurm that can be used to run the eig_thread_test.m code.&lt;br /&gt;
The number of threads used for the calculation is controlled by specifying the --cpus-per-task parameter that Slurm uses to control the number of CPU cores assigned to the job.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
&lt;br /&gt;
#SBATCH --time=01:00:00     # Adjust this to match the walltime of your job&lt;br /&gt;
#SBATCH --nodes=1           # Always specify just one node.&lt;br /&gt;
#SBATCH --ntasks=1          # Specify just one task.&lt;br /&gt;
#SBATCH --cpus-per-task=8   # The number of threads to use&lt;br /&gt;
#SBATCH --mem=4000m         # Adjust to match total memory required, in MB.&lt;br /&gt;
#SBATCH --partition=pawson-bf,apophis-bf,razi-bf,single,lattice,parallel,cpu2013,cpu2019&lt;br /&gt;
&lt;br /&gt;
# Sample batch job script for running a MATLAB function to test thread-based parallel processing features.&lt;br /&gt;
# 2020-05-25&lt;br /&gt;
&lt;br /&gt;
# Specify the name of the main MATLAB function to be run.&lt;br /&gt;
# This would normally be the same as the MATLAB source code file name without a .m suffix).&lt;br /&gt;
MAIN=&amp;quot;eig_thread_test&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Define key parameters for the example calculation.&lt;br /&gt;
NTHREADS=${SLURM_CPUS_PER_TASK}&lt;br /&gt;
MATRIX_SIZE=10000&lt;br /&gt;
NMATRICES=10&lt;br /&gt;
RESULTS_FILE=&amp;quot;maximum_eigenvalues_${SLURM_JOB_ID}.txt&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Contruct a complete function call to pass to MATLAB&lt;br /&gt;
# Note, string arguments should appear to MATLAB enclosed in single quotes&lt;br /&gt;
ARGS=&amp;quot;($NTHREADS,$MATRIX_SIZE,$NMATRICES,&#039;$RESULTS_FILE&#039;)&amp;quot;&lt;br /&gt;
MAIN_WITH_ARGS=${MAIN}${ARGS}&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Calling MATLAB function: ${MAIN_WITH_ARGS}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Starting run at $(date)&amp;quot;&lt;br /&gt;
echo &amp;quot;Running on compute node $(hostname)&amp;quot;&lt;br /&gt;
echo &amp;quot;Running from directory $(pwd)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Choose a version of MATLAB by loading a module:&lt;br /&gt;
module load matlab/r2020a&lt;br /&gt;
echo &amp;quot;Using MATLAB version: $(which matlab)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
matlab -batch &amp;quot;${MAIN_WITH_ARGS}&amp;quot; &amp;gt; ${MAIN}_${SLURM_JOB_ID}.out 2&amp;gt;&amp;amp;1&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Finished run at $(date)&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The above job can be submitted with&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sbatch eig_thread_test.slurm&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If assigned to one of the modern partitions (as opposed to the older single, lattice or parallel partitions) the job took about 16 minutes, about 4 times faster than a comparable serial job.  Using 8 cores to obtain just a factor of four speed-up is not an efficient use of ARC, but, might be justified in some cases.  In some cases, using multiple workers (as discussed in the next section) may be faster than using the same number of cores with thread-based parallelization.&lt;br /&gt;
&lt;br /&gt;
=== Explicit parallel processing using a pool of workers ===&lt;br /&gt;
&lt;br /&gt;
Now consider the more complicated case of creating a pool of workers and using a parfor loop to explicitly parallelize a section of code. Each worker may use one or more cores through MATLAB&#039;s internal thread-based parallelization, as in the preceding example.  Suppose the following code is in a file eig_parallel_test.m.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
function eig_parallel_test(nworkers,nthreads,matrix_size,nmatrices,results_file)&lt;br /&gt;
&lt;br /&gt;
% Calculate the absolute value of the maximum eigenvalue for each of a number of matrices&lt;br /&gt;
% possibly using multiple threads and multiple MATLAB workers.&lt;br /&gt;
&lt;br /&gt;
% nworkers = number of MATLAB workers to use.&lt;br /&gt;
% nthreads = number of threads per worker.&lt;br /&gt;
% matrix_size = order of two-dimensional random matrix.&lt;br /&gt;
% nmatrices = number of matrices to process.&lt;br /&gt;
% results_file = name of file in which to save the maximum eigenvalues&lt;br /&gt;
&lt;br /&gt;
% 2020-05-25&lt;br /&gt;
&lt;br /&gt;
matlab_ncores=feature(&#039;numcores&#039;)&lt;br /&gt;
&lt;br /&gt;
slurm_ncores_per_task=str2num(getenv(&#039;SLURM_CPUS_PER_TASK&#039;))&lt;br /&gt;
if(isempty(slurm_ncores_per_task))&lt;br /&gt;
  slurm_ncores_per_task=1;&lt;br /&gt;
  disp(&#039;SLURM_CPUS_PER_TASK not set&#039;)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
% Set number of computational threads to the minimum of matlab_ncores and slurm_ncores&lt;br /&gt;
% Note Mathworks warns that the maxNumCompThreads function will&lt;br /&gt;
% be removed in future versions of MATLAB.&lt;br /&gt;
% Testing based on remarks at&lt;br /&gt;
% https://www.mathworks.com/matlabcentral/answers/158192-maxnumcompthreads-hyperthreading-and-parpool&lt;br /&gt;
% shows the maxNumCompThreads has to be called inside the parfor loop.&lt;br /&gt;
&lt;br /&gt;
tic&lt;br /&gt;
&lt;br /&gt;
if ( nworkers &amp;gt; 1 )&lt;br /&gt;
&lt;br /&gt;
% Process with multiple workers&lt;br /&gt;
% Check on properties of the local MATLAB cluster.&lt;br /&gt;
% One can set properties such as c.NumThreads and c.NumWorkers&lt;br /&gt;
&lt;br /&gt;
parallel.defaultClusterProfile(&#039;local&#039;)&lt;br /&gt;
c = parcluster()&lt;br /&gt;
c.NumThreads=nthreads&lt;br /&gt;
c.NumWorkers=nworkers&lt;br /&gt;
&lt;br /&gt;
% Create a pool of workers with the current cluster settings.&lt;br /&gt;
% Note, testing without the nworkers argument showed a limit of 12 workers even if c.NumWorkers is defined.&lt;br /&gt;
parpool(c,nworkers)&lt;br /&gt;
&lt;br /&gt;
ticBytes(gcp);&lt;br /&gt;
&lt;br /&gt;
parfor i = 1:nmatrices&lt;br /&gt;
  e=eig(rand(matrix_size));&lt;br /&gt;
  eigenvalues(i) = max(abs(e));&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
tocBytes(gcp)&lt;br /&gt;
&lt;br /&gt;
% Close down the pool.&lt;br /&gt;
delete(gcp(&#039;nocreate&#039;));&lt;br /&gt;
&lt;br /&gt;
else&lt;br /&gt;
&lt;br /&gt;
% Use only thread-based parallel processing&lt;br /&gt;
&lt;br /&gt;
intial_matlab_max_ncores = maxNumCompThreads(min([nthreads,slurm_ncores_per_task]))&lt;br /&gt;
&lt;br /&gt;
for i = 1:nmatrices&lt;br /&gt;
  e=eig(rand(matrix_size));&lt;br /&gt;
  eigenvalues(i) = max(abs(e));&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
end % nworkers test&lt;br /&gt;
&lt;br /&gt;
toc&lt;br /&gt;
&lt;br /&gt;
save(results_file,&#039;eigenvalues&#039;,&#039;-ascii&#039;)&lt;br /&gt;
&lt;br /&gt;
quit&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Of particular note in the preceding example is the section of lines (copied below) that creates a cluster object, c, and modifies the number of threads associated with this object (c.NumThreads=nthreads). In a similar way, one can modify the number of workers (c.NumWorkers=nworkers).  Testing showed that if one then used the MATLAB gcp or parpool commands without arguments to create a pool of workers, at most 12 workers were created. However, it was found that by using parpool(c,nworkers), the requested number of workers would be started, even if nworkers &amp;gt; 12.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
parallel.defaultClusterProfile(&#039;local&#039;)&lt;br /&gt;
c = parcluster()&lt;br /&gt;
c.NumThreads=nthreads&lt;br /&gt;
c.NumWorkers=nworkers&lt;br /&gt;
parpool(c,nworkers)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
An example Slurm batch job script, eig_parallel_test.slurm, used to test the above code was:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
&lt;br /&gt;
#SBATCH --time=03:00:00     # Adjust this to match the walltime of your job&lt;br /&gt;
#SBATCH --nodes=1           # Always specify just one node.&lt;br /&gt;
#SBATCH --ntasks=1          # Always specify just one task.&lt;br /&gt;
#SBATCH --cpus-per-task=8   # Choose --cpus-per-task to match the number of workers * threads per worker&lt;br /&gt;
#SBATCH --mem=10000m         # Adjust to match total memory required, in MB.&lt;br /&gt;
#SBATCH --partition=pawson-bf,apophis-bf,razi-bf,single,lattice,parallel,cpu2013,cpu2019&lt;br /&gt;
&lt;br /&gt;
# Sample batch job script for running a MATLAB function to test parallel processing features&lt;br /&gt;
# 2020-05-25&lt;br /&gt;
&lt;br /&gt;
# Specify the name of the main MATLAB function to be run.&lt;br /&gt;
# This would normally be the same as the MATLAB source code file name without a .m suffix).&lt;br /&gt;
MAIN=&amp;quot;eig_parallel_test&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Define key parameters for the example calculation.&lt;br /&gt;
NWORKERS=${SLURM_NTASKS}&lt;br /&gt;
NTHREADS=${SLURM_CPUS_PER_TASK}&lt;br /&gt;
MATRIX_SIZE=10000&lt;br /&gt;
NMATRICES=10&lt;br /&gt;
RESULTS_FILE=&amp;quot;maximum_eigenvalues_${SLURM_JOB_ID}.txt&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Contruct a complete function call to pass to MATLAB&lt;br /&gt;
# Note, string arguments should appear to MATLAB enclosed in single quotes&lt;br /&gt;
ARGS=&amp;quot;($NWORKERS,$NTHREADS,$MATRIX_SIZE,$NMATRICES,&#039;$RESULTS_FILE&#039;)&amp;quot;&lt;br /&gt;
MAIN_WITH_ARGS=${MAIN}${ARGS}&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Calling MATLAB function: ${MAIN_WITH_ARGS}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Starting run at $(date)&amp;quot;&lt;br /&gt;
echo &amp;quot;Running on compute node $(hostname)&amp;quot;&lt;br /&gt;
echo &amp;quot;Running from directory $(pwd)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Choose a version of MATLAB by loading a module:&lt;br /&gt;
module load matlab/r2020a&lt;br /&gt;
echo &amp;quot;Using MATLAB version: $(which matlab)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
matlab -batch &amp;quot;${MAIN_WITH_ARGS}&amp;quot; &amp;gt; ${MAIN}_${SLURM_JOB_ID}.out 2&amp;gt;&amp;amp;1&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Finished run at $(date)&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Note that the Slurm SBATCH parameter --cpus-per-task, the total number of cores to use, should be the product of the number of workers and the threads per worker.  (It might be argued that one more core should be requested beyond the product of workers and threads, to use for the main MATLAB process, but, for a fully parallelized code, the workers do the great bulk of the calculation and the main MATLAB process uses relatively little CPU time.)&lt;br /&gt;
 &lt;br /&gt;
Variations on the above code was tested with many combinations of workers and threads per worker.  It was found that if many jobs were started in close succession that some of the jobs failed to start properly.&lt;br /&gt;
&lt;br /&gt;
Also note that in the above example, the number of cores requested is not well matched to the number of workers.  If there are 8 workers processing 10 matrices and each worker gets assigned one matrix, there are two left over. The total time for 10 matrices (or for any number of matrices from 9 to 16) would be about double that for 8 matrices.  For example, in testing the above code, the time for processing 10 matrices with 8 workers with just one computational thread was 1050 seconds, whereas processing just 8 matrices with 8 workers took only 560 seconds.&lt;br /&gt;
&lt;br /&gt;
= Standalone Applications =&lt;br /&gt;
&lt;br /&gt;
When running MATLAB code as described in the preceding section, a connection to the campus MATLAB license server, checking out licenses for MATLAB and any specialized toolboxes needed, is made for each job that is submitted. Currently, with the University of Calgary&#039;s Total Academic Headcount license, there are sufficient license tokens to support thousands of simultaneous MATLAB sessions (although ARC usage policy and cluster load will limit individual users to smaller numbers of jobs). However, there may be times at which the license server is slow to respond when large numbers of requests are being handled, or the server may be unavailable temporarily due to network problems. MathWorks offers an alternative way of running MATLAB code that can avoid license server issues by compiling it into a standalone application.  A license is required only during the compilation process and not when the code is run.  This allows calculations to be run on ARC without concerns regarding the license server.  The compiled code can also be run on compatible (64-bit Linux) hardware, not necessarily at the University of Calgary, such as on [https://docs.computecanada.ca/wiki/Getting_started Compute Canada (external link)] clusters.&lt;br /&gt;
&lt;br /&gt;
== Creating a standalone application ==&lt;br /&gt;
&lt;br /&gt;
The MATLAB &#039;&#039;&#039;mcc&#039;&#039;&#039; command is used to compile source code (.m files) into a standalone executable. There are a couple of important considerations to keep in mind when creating an executable that can be run in a batch-oriented cluster environment. One is that there is no graphical display attached to your session and another is that the number of threads used by the standalone application has to be controlled.  There is also an important difference in the way arguments of the main function are handled.&lt;br /&gt;
&lt;br /&gt;
Let&#039;s illustrate the process of creating a standalone application for the sawtooth.m code used previously. Unfortunately, if that code is compiled as it is, the resulting compiled application will fail to run properly.  The reason is that the compiled code sees all the input arguments as strings instead of interpreting them as numbers. To work around this problem, use a MATLAB function, &#039;&#039;&#039;isdeployed&#039;&#039;&#039;, to determine whether or not the code is being run as a standalone application. Here is a modified version of code, called sawtooth_standalone.m that can be successfully compiled and run as a standalone application.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
function sawtooth_standalone(nterms,nppcycle,ncycle,pngfilebase)&lt;br /&gt;
&lt;br /&gt;
% MATLAB file example to approximate a sawtooth&lt;br /&gt;
% with a truncated Fourier expansion.&lt;br /&gt;
&lt;br /&gt;
% nterms = number of terms in expansion.&lt;br /&gt;
% nppcycle = number of points per cycle.&lt;br /&gt;
% ncycle = number of complete cycles to plot.&lt;br /&gt;
% pngfilebase = base of file name for graph of results.&lt;br /&gt;
&lt;br /&gt;
% 2020-05-21&lt;br /&gt;
&lt;br /&gt;
% Test to see if the code is running as a standalone application&lt;br /&gt;
% If it is, convert the arguments intended to be numeric from &lt;br /&gt;
% the input strings to numbers&lt;br /&gt;
&lt;br /&gt;
if isdeployed&lt;br /&gt;
  nterms=str2num(nterms)&lt;br /&gt;
  nppcycle=str2num(nppcycle)&lt;br /&gt;
  ncycle=str2num(ncycle)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
np=nppcycle*ncycle;&lt;br /&gt;
&lt;br /&gt;
fourbypi=4.0/pi;&lt;br /&gt;
y(1:np)=pi/2.0;&lt;br /&gt;
x(1:np)=linspace(-pi*ncycle,pi*ncycle,np);&lt;br /&gt;
&lt;br /&gt;
for k=1:nterms&lt;br /&gt;
  twokm=2*k-1;&lt;br /&gt;
  y=y-fourbypi*cos(twokm*x)/twokm^2;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
% Prepare output&lt;br /&gt;
% Construct the output file name from the base file name and number of terms&lt;br /&gt;
% Also append the Slurm JOBID to keep file names unique from run to run.&lt;br /&gt;
&lt;br /&gt;
job=getenv(&#039;SLURM_JOB_ID&#039;)&lt;br /&gt;
pngfile=strcat(pngfilebase,&#039;_&#039;,num2str(nterms),&#039;_&#039;,job)&lt;br /&gt;
disp([&#039;Writing file: &#039;,pngfile,&#039;.png&#039;])&lt;br /&gt;
&lt;br /&gt;
fig=figure;&lt;br /&gt;
plot(x,y);&lt;br /&gt;
print(fig,pngfile,&#039;-dpng&#039;);&lt;br /&gt;
&lt;br /&gt;
quit&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Suppose that the sawtooth_standalone.m file is in a subdirectory src below your current working directory and that the compiled files are going to be written to a subdirectory called deploy. The following commands (at the Linux shell prompt) could be used to compile the code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mkdir deploy&lt;br /&gt;
cd src&lt;br /&gt;
module load matlab/r2019b&lt;br /&gt;
mcc -R -nodisplay \&lt;br /&gt;
 -R -singleCompThread \&lt;br /&gt;
 -m -v -w enable \&lt;br /&gt;
 -d ../deploy \&lt;br /&gt;
 sawtooth_standalone.m&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note the option -singleCompThread has been included in order to limit the executable to just one computational thread.&lt;br /&gt;
&lt;br /&gt;
In the deploy directory, an executable, sawtooth_standalone, will be created along with a script, run_sawtooth_standalone.sh. These two files should be copied to the target machine where the code is to be run.&lt;br /&gt;
&lt;br /&gt;
== Running a standalone application ==&lt;br /&gt;
&lt;br /&gt;
After the standalone executable sawtooth_standalone and corresponding script run_sawtooth_standalone.sh have been transferred to a directory on the target system on which they will be run (whether to a different directory on ARC or to a completely different cluster), a batch job script needs to be created in that same directory. Here is an example batch job script, sawtooth_standalone.slurm, appropriate for the ARC cluster.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH --time=03:00:00     # Adjust this to match the walltime of your job&lt;br /&gt;
#SBATCH --nodes=1           # For serial code, always specify just one node.&lt;br /&gt;
#SBATCH --ntasks=1          # For serial code, always specify just one task.&lt;br /&gt;
#SBATCH --cpus-per-task=1   # For serial code, always specify just one CPU per task.&lt;br /&gt;
#SBATCH --mem=4000m         # Adjust to match total memory required, in MB.&lt;br /&gt;
#SBATCH --partition=pawson-bf,apophis-bf,razi-bf,single,lattice,parallel,cpu2013,cpu2019&lt;br /&gt;
&lt;br /&gt;
# Sample batch job script for running a compiled MATLAB function&lt;br /&gt;
# 2020-05-21&lt;br /&gt;
&lt;br /&gt;
# Specify the name of the compiled MATLAB standalone executable&lt;br /&gt;
MAIN=&amp;quot;sawtooth_standalone&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Define key parameters for the example calculation.&lt;br /&gt;
NTERMS=100&lt;br /&gt;
NPPCYCLE=20&lt;br /&gt;
NCYCLE=3&lt;br /&gt;
PNGFILEBASE=$MAIN&lt;br /&gt;
&lt;br /&gt;
ARGS=&amp;quot;$NTERMS $NPPCYCLE $NCYCLE $PNGFILEBASE&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Choose the MCR directory according to the compiler version used&lt;br /&gt;
MCR=/global/software/matlab/mcr/v97&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Starting run at $(date)&amp;quot;&lt;br /&gt;
echo &amp;quot;Running on compute node $(hostname)&amp;quot;&lt;br /&gt;
echo &amp;quot;Running from directory $(pwd)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
./run_${MAIN}.sh $MCR $ARGS &amp;gt; ${MAIN}_${SLURM_JOB_ID}.out 2&amp;gt;&amp;amp;1&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;Finished run at $(date)&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The job is then submitted with sbatch:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sbatch sawtooth_standalone.slurm&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
An important part of the above script is the definition of the variable &#039;&#039;&#039;MCR&#039;&#039;&#039;, which defines the location of the MATLAB Compiler Runtime (MCR) directory. This directory contains files necessary for the standalone application to run. The version of the MCR files specified (v97 in the example, which corresponds to MATLAB R2019b) must match the version of MATLAB used to compile the code.&lt;br /&gt;
&lt;br /&gt;
A list of MATLAB distributions and the corresponding MCR versions is given on the [https://www.mathworks.com/products/compiler/matlab-runtime.html Mathworks web site (external link)]. Some versions installed on ARC are listed below, along with the corresponding installation directory to which the MCR variable should be set if running on ARC. (As of this writing on May 21, 2020, installation of release R2020a has not quite been finished, but, should be ready before the end of the month). If the MCR version you need does not appear in /global/software/matlab/mcr, write to support@hpc.ucalgary.ca to request that it be installed, or use a different version of MATLAB for your compilation.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;WG_Indent3&amp;quot; style=&amp;quot;height: 150px; width: 576px&amp;quot; border=&amp;quot;2&amp;quot;&lt;br /&gt;
| style=&amp;quot;text-align: center&amp;quot; | &#039;&#039;&#039;MATLAB Release&#039;&#039;&#039;&lt;br /&gt;
| style=&amp;quot;text-align: center&amp;quot; | &#039;&#039;&#039;MCR Version&#039;&#039;&#039;&lt;br /&gt;
| style=&amp;quot;text-align: center&amp;quot; | &#039;&#039;&#039;MCR directory&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: center&amp;quot; | R2017a&lt;br /&gt;
| style=&amp;quot;text-align: center&amp;quot; | 9.2&lt;br /&gt;
| class=&amp;quot;WG_Inline_Code&amp;quot; style=&amp;quot;text-align: center&amp;quot; | /global/software/matlab/mcr/v92&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: center&amp;quot; | R2017b&lt;br /&gt;
| style=&amp;quot;text-align: center&amp;quot; | 9.3&lt;br /&gt;
| class=&amp;quot;WG_Inline_Code&amp;quot; style=&amp;quot;text-align: center&amp;quot; | /global/software/matlab/mcr/v93&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: center&amp;quot; | R2018a&lt;br /&gt;
| style=&amp;quot;text-align: center&amp;quot; | 9.4&lt;br /&gt;
| class=&amp;quot;WG_Inline_Code&amp;quot; style=&amp;quot;text-align: center&amp;quot; | /global/software/matlab/mcr/v94&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: center&amp;quot; | R2019b&lt;br /&gt;
| style=&amp;quot;text-align: center&amp;quot; | 9.7&lt;br /&gt;
| class=&amp;quot;WG_Inline_Code&amp;quot; style=&amp;quot;text-align: center&amp;quot; | /global/software/matlab/mcr/v97&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: center&amp;quot; | R2020a&lt;br /&gt;
| style=&amp;quot;text-align: center&amp;quot; | 9.8&lt;br /&gt;
| class=&amp;quot;WG_Inline_Code&amp;quot; style=&amp;quot;text-align: center&amp;quot; | /global/software/matlab/mcr/v98&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Phillips</name></author>
	</entry>
</feed>