Using SAS on a Grid
The SAS Grid Manager components make grid enabled SAS applications available to a variety of SAS customers. SAS DI Studio 3.4
and SAS Enterprise Miner 5.2 have enhanced their integrated development environments (IDE) to provide grid automation by
automatically generating SAS applications that are enabled to execute in a grid. Users of these applications can produce grid
enabled SAS applications without any programming knowledge or knowledge of the underlying grid infrastructure. These SAS
applications are able to detect the existence of a grid environment at run-time and distribute the execution accordingly.
Furthermore, these grid enabled applications can be saved as SAS stored processes and subsequently executed by the SAS Business
Intelligence components including Web Report Studio, Information Map Studio and the SAS Add-In for Microsoft Office.
Sample Program to Verify Grid Environment Setup
Click here for a sample program designed to verify the basic setup and configuration of a SAS grid environment. Be sure that
you have completed the steps necessary to install and configure:
-
the Platform Suite for SAS
-
the SAS products and components licensed for your SAS grid environment.
before running this program.
Note: On UNIX systems, make sure that you have initialized the LSF environment by running one of the following (where
% and $ represent UNIX command line prompts):
-
for csh or tcsh: % source LSF-install-dir/conf/cshrc.lsf
-
for sh, ksh, or bash: $ . LSF-install-dir/conf/profile.lsf
-
Make sure that no one else is using the grid. Otherwise, the program might not finish because it requires all job slots
to be free.
-
Open the SAS Editor (by starting SAS).
-
Cut and paste the gridtest.sas program into the editor:
Sample Code to Grid Enable Existing SAS Programs
Minimal modification is required to any existing SAS program that utilizes the parallel processing capabilities of
SAS/CONNECT in order to use SAS Grid Manager in a grid environment. The following statements can be added either to your
autoexec.sas file or to the beginning of your SAS program:
options metaserver='xxx.yyy.zzz.com';
options metaport=8561;
options metarepository='Foundation';
options metauser='userxyz';
options metapass='passwd';
%let rc=%sysfunc(grdsvc_enable(_all_, resource=SASMain));
Key Definition for Automatic Program Submission to the Grid
You can easily use the SAS Display Manager key definition capability to define a key that can be used to submit a SAS program
in its entirety to a SAS grid environment with absolutely no change to the program that is being submitted to the grid. You
might want to do this in order to allow the execution of multiple SAS programs from one or more SAS users to a virtualized pool
of resources in order to:
-
eliminate the need to know which resource is executing a specific program
-
provide load balancing, policy enforcement and efficient resource utilization across multiple SAS applications sharing a
common pool of resources.
The following steps describe how to set up such a key definition.
-
Save the following statements to an external file (c:\gpre.sas for example).
options noconnectpersist;
options noconnectwait;
options metaserver='dnnnn';
options metaport=8561;
options metarepository='Foundation';
options metauser='sasdemo';
options metapass='passwd'; /* should be encrypted password */
%let rc=%sysfunc(grdsvc_enable(grid, resource=SASMain));
signon grid;
-
In a SAS Display Manager Session (DMS) open the keys window and enter the following for any available key (F12 for
example):
gsubmit "%include 'c:\gpre.sas';"; rsubmit;
You can then type or include any SAS program into your program editor and then press F12 and the program will be submitted
to computing resources on your SAS grid instead of executed locally.
Notes of interest:
-
This will not work correctly if the SAS Explorer is enabled. Be sure to close the SAS Explorer window prior to submitting to the
grid with this key definition.
-
Your local editor will be busy until the SIGNON completes and the RSUBMIT sends the code to the grid. At that point your
local machine is available for further processing.
-
Multiple submissions in a row using the same key definition (F12 in this case) will cause the multiple jobs to be queued
and each job will be submitted to the grid when the subsequent job has completed. If you need to be able to submit
multiple jobs to the grid at nearly the same time from the same SAS session, you will need to define multiple keys, each
with a unique remote session id on the signon statement. For example, signon grid1, signon grid2, etc.