Difference between revisions of "Applications/SAS"

From HPC
Jump to: navigation , search
(Created page with "__TOC__ === Application Details === * Description: SAS (Statistical Analysis System) is a software suite developed by SAS Institute for advanced analytics, business intelligen...")
 
m (Further Information)
 
(21 intermediate revisions by 3 users not shown)
Line 5: Line 5:
 
* Module names: SAS/9.4
 
* Module names: SAS/9.4
 
* License: Departmental research only multi-platform license, restricted to Accounting and Finance department
 
* License: Departmental research only multi-platform license, restricted to Accounting and Finance department
* Forum support: https://www.hpc.hull.ac.uk/forum/viewforum.php?f=22
 
* Further information: http://www.sas.com/en_gb/home.html
 
 
  
 
== Usage Examples ==
 
== Usage Examples ==
 +
=== Executables ===
 +
{| class="wikitable" style="background-color:#f5f5dc;"
 +
! Executable
 +
! Description
 +
|-
 +
| sas_en
 +
| The main SAS executable is sas_en. Depending on the options provided, this will either start SAS with the full graphical user interface, start SAS in interactive line mode, or allow you to run SAS in batch mode.
 +
|}
  
 
=== Interactive ===
 
=== Interactive ===
 
+
<pre style="background-color: #000000; color: white; border: 2px solid black; font-family: monospace, sans-serif;">
<pre style="background-color: #C8C8C8; color: black; border: 2px solid black; font-family: monospace, sans-serif;">
 
 
[username@login01 ~]$ interactive
 
[username@login01 ~]$ interactive
 
salloc: Granted job allocation 289669
 
salloc: Granted job allocation 289669
Line 22: Line 26:
  
 
To use the full SAS GUI, make sure you have your environment setup as detailed in LINK and run '''sas_en''':  
 
To use the full SAS GUI, make sure you have your environment setup as detailed in LINK and run '''sas_en''':  
<pre style="background-color: #C8C8C8; color: black; border: 2px solid black; font-family: monospace, sans-serif;">
+
<pre style="background-color: #000000; color: white; border: 2px solid black; font-family: monospace, sans-serif;">
 
[username@c170 ~]$ sas_en
 
[username@c170 ~]$ sas_en
 
</pre>
 
</pre>
 +
This will open up a number of SAS windows, including Program Editor, Results, Explorer, Session Manager, Toolbox, Output and Log:
 +
[[File:SASGUI.png]]
  
 
To use the command line interactive line mode and not the GUI, run '''sas_en –nodms''':  
 
To use the command line interactive line mode and not the GUI, run '''sas_en –nodms''':  
<pre style="background-color: #C8C8C8; color: black; border: 2px solid black; font-family: monospace, sans-serif;">
+
<pre style="background-color: #000000; color: white; border: 2px solid black; font-family: monospace, sans-serif;">
 
[username@c170 ~]$ sas_en –nodms
 
[username@c170 ~]$ sas_en –nodms
 
</pre>
 
</pre>
  
 
Some functions invoke a SAS window even in interactive line mode, for full line mode use '''–noterminal''' flag, i.e.:
 
Some functions invoke a SAS window even in interactive line mode, for full line mode use '''–noterminal''' flag, i.e.:
<pre style="background-color: #C8C8C8; color: black; border: 2px solid black; font-family: monospace, sans-serif;">
+
<pre style="background-color: #000000; color: white; border: 2px solid black; font-family: monospace, sans-serif;">
 
[username@c170 ~]$ sas_en -nodms –noterminal
 
[username@c170 ~]$ sas_en -nodms –noterminal
 
</pre>
 
</pre>
  
 
You can then run your task using a SAS script with the following command:
 
You can then run your task using a SAS script with the following command:
<pre style="background-color: #C8C8C8; color: black; border: 2px solid black; font-family: monospace, sans-serif;">
+
<pre style="background-color: #000000; color: white; border: 2px solid black; font-family: monospace, sans-serif;">
 
[username@c170 ~]$ sas_en -noteminal sas_file.sas
 
[username@c170 ~]$ sas_en -noteminal sas_file.sas
 
</pre>
 
</pre>
  
 +
=== Batch Submission ===
 +
A better approach is to submit tasks to run automatically without any interaction. To do this, you need a job submission script, an example of which is:
  
=== Batch Submission ===
+
<pre style="background-color: #E5E4E2; color: black; font-family: monospace, sans-serif;">
<pre style="background-color: #C8C8C8; color: black; border: 2px solid blue; font-family: monospace, sans-serif;">
 
 
#!/bin/bash
 
#!/bin/bash
#SBATCH -J MATLAB
+
#SBATCH -J SASjob          # Job name, you can change it to whatever you want
#SBATCH -N 1
+
#SBATCH -N 1               # Number of nodes (for SAS should be always one)
#SBATCH -o %N.%j.out
+
#SBATCH -n 1                # Number of cores (for SAS should generally be one, see tuning)
#SBATCH -e %N.%j.err
+
#SBATCH -o %N-%j.log        # Standard output will be written here
#SBATCH -p compute
+
#SBATCH -e %N-%j.err       # Standard error will be written here
#SBATCH --exclusive
+
#SBATCH -p compute         # Slurm partition, where you want the job to be queued
 +
 +
module add test-modules SAS/9.4
 
   
 
   
module add matlab/2016a
+
sas_en -cpucount 1 -nothreads -noterminal my_sas_script.sas
 +
</pre>
 
   
 
   
matlab -nodisplay -nojvm -nodesktop -nosplash -r my_matlab_m_file
+
'''Note:''' that the –cpucount in the sas_en command should match the #SBATCH -n number. Change the last .sas filename as appropriate<br />
</pre>
+
 
 
This submission script can be found at /path/to/sample/script
 
This submission script can be found at /path/to/sample/script
Matlab
 
  
<pre style="background-color: #C8C8C8; color: black; border: 2px solid black; font-family: monospace, sans-serif;">
+
<pre style="background-color:#000000; color: white; font-family: monospace, sans-serif;">
[username@login01 ~]$ sbatch MATLABtest.job
+
[username@login01 ~]$ sbatch SAStest.job
Submitted batch job 289522
+
Submitted batch job 289552
 
</pre>
 
</pre>
  
== Parallel Matlab ==
+
=== Tuning SAS tasks ===
By default Matlab on Viper will run on a single core as mutli-threading conflicts with the schedulers resource management, however there are three ways in which Matlab can utilise multiple processors:
+
==== Memory ====
 +
By default the memory allocation for a SAS is 2GB.  As long as the appropriate resources are requested in the job submission script ('''#SBATCH --mem=XXG''') this can be increased as required. The value provided with the SBATCH flag should match that provided to SAS via the '''-memsize''' option (see submission script below).
  
=== Multi-threading ===
+
==== cpucount and threads ====
Matlab can use multiple threads for certain built in functions for example linear algebra and numerical functions such as fft, \ (mldivide), eig, svd, and sort. These functions automatically execute on multiple computational threads in a single MATLAB session, allowing them to execute faster on multicore-enabled machines. Additionally, many functions in Image Processing Toolbox are multithreaded
+
By default SAS uses 1 CPU core, however certain functions can use additional resources if they are available, which may result in performance improvements. These functions include SORT, SUMMARY, MEANS, REPORT, TABULATE, and SQL. In order to make use of additional CPU cores, you should request the appropriate resource ('''#SBATCH -n XX''') in your job submission script and amend your SAS command with the '''threads''' and '''cpucount''' flags, see below:
  
=== Parallel Computing Toolbox ===
+
<pre style="background-color: #E5E4E2; color: black; font-family: monospace, sans-serif;">
The Parallel Computing Toolbox allows you to open a number of workers (separate Matlab engines) on the local node, up to the number of cores on that node (28 for standard nodes in an exclusive session).
+
#!/bin/bash
 
+
#SBATCH -J SASjob
<pre style="background-color: #C8C8C8; color: black; border: 2px solid green; font-family: monospace, sans-serif;">
+
#SBATCH -N 1
>> parpool('local',28)
+
#SBATCH -n 28
Starting parallel pool (parpool) using the 'local' profile ... connected to 28 workers.
+
#SBATCH -o %N-%j.log
 
+
#SBATCH -e %N-%j.err
ans =  
+
#SBATCH -p compute
 
+
#SBATCH --mem=40G
  Pool with properties:
+
   
 
+
module add test-modules SAS/9.4
            Connected: true
+
          NumWorkers: 28
+
sas_en -memsize 40G -cpucount 28 -threads -noterminal my_sas_script.sas
              Cluster: local
 
        AttachedFiles: {}
 
          IdleTimeout: 30 minute(s) (30 minutes remaining)
 
          SpmdEnabled: true
 
 
</pre>
 
</pre>
  
=== Distributed Computing Toolbox ===
+
== Further Information ==
The distributed computing toolbox is not currently supported on Viper
+
* [http://www.sas.com/en_gb/home.html SAS website]
 +
* [http://support.sas.com/documentation/cdl/en/hostunx/69602/HTML/default/viewer.htm#titlepage.htm SAS 9.4 Companion for UNIX <Linux> Environments ]
  
== Change Log ==
+
{{Licensepagenav}}
[2017-01-30] Changed default Matlab launch command in module to matlab -singleCompThread to disable multi-threading
 

Latest revision as of 11:21, 16 November 2022

Application Details

  • Description: SAS (Statistical Analysis System) is a software suite developed by SAS Institute for advanced analytics, business intelligence, data management, and predictive analytics.
  • Versions: 9.4
  • Module names: SAS/9.4
  • License: Departmental research only multi-platform license, restricted to Accounting and Finance department

Usage Examples

Executables

Executable Description
sas_en The main SAS executable is sas_en. Depending on the options provided, this will either start SAS with the full graphical user interface, start SAS in interactive line mode, or allow you to run SAS in batch mode.

Interactive

[username@login01 ~]$ interactive
salloc: Granted job allocation 289669
Job ID 289669 connecting to c170, please wait...
Last login: Thu Jan 26 12:59:11 2017 from 10.254.5.246
[username@c170 ~]$ module add test-modules SAS/9.4

To use the full SAS GUI, make sure you have your environment setup as detailed in LINK and run sas_en:

[username@c170 ~]$ sas_en

This will open up a number of SAS windows, including Program Editor, Results, Explorer, Session Manager, Toolbox, Output and Log: SASGUI.png

To use the command line interactive line mode and not the GUI, run sas_en –nodms:

[username@c170 ~]$ sas_en –nodms

Some functions invoke a SAS window even in interactive line mode, for full line mode use –noterminal flag, i.e.:

[username@c170 ~]$ sas_en -nodms –noterminal

You can then run your task using a SAS script with the following command:

[username@c170 ~]$ sas_en -noteminal sas_file.sas

Batch Submission

A better approach is to submit tasks to run automatically without any interaction. To do this, you need a job submission script, an example of which is:

#!/bin/bash
#SBATCH -J SASjob           # Job name, you can change it to whatever you want
#SBATCH -N 1                # Number of nodes (for SAS should be always one)
#SBATCH -n 1                # Number of cores (for SAS should generally be one, see tuning)
#SBATCH -o %N-%j.log        # Standard output will be written here
#SBATCH -e %N-%j.err        # Standard error will be written here
#SBATCH -p compute          # Slurm partition, where you want the job to be queued
 
module add test-modules SAS/9.4
 
sas_en -cpucount 1 -nothreads -noterminal my_sas_script.sas

Note: that the –cpucount in the sas_en command should match the #SBATCH -n number. Change the last .sas filename as appropriate

This submission script can be found at /path/to/sample/script

[username@login01 ~]$ sbatch SAStest.job
Submitted batch job 289552

Tuning SAS tasks

Memory

By default the memory allocation for a SAS is 2GB. As long as the appropriate resources are requested in the job submission script (#SBATCH --mem=XXG) this can be increased as required. The value provided with the SBATCH flag should match that provided to SAS via the -memsize option (see submission script below).

cpucount and threads

By default SAS uses 1 CPU core, however certain functions can use additional resources if they are available, which may result in performance improvements. These functions include SORT, SUMMARY, MEANS, REPORT, TABULATE, and SQL. In order to make use of additional CPU cores, you should request the appropriate resource (#SBATCH -n XX) in your job submission script and amend your SAS command with the threads and cpucount flags, see below:

#!/bin/bash
#SBATCH -J SASjob
#SBATCH -N 1
#SBATCH -n 28
#SBATCH -o %N-%j.log
#SBATCH -e %N-%j.err
#SBATCH -p compute
#SBATCH --mem=40G
 
module add test-modules SAS/9.4
 
sas_en -memsize 40G -cpucount 28 -threads -noterminal my_sas_script.sas

Further Information





Special License Applications | Main Page | Further Topics