SAS Institute. The Power to Know

FOCUS AREAS

Hot Topics

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.

Syntax for SAS/CONNECT Grid Functions

Sample Program to Verify Grid Environment Setup

Sample Code to Grid Enable Existing SAS Programs

Key Definition for Automatic Program Submission to the Grid

A How To Guide for Submitting Enterprise Guide Programs and Tasks to a SAS Grid


The SAS programming language has been enhanced to allow SAS products, such as ETLS and EM, to produce grid enabled SAS applications as well as to allow you to develop your own SAS grid applications. SAS functions have been created in SAS/CONNECT to provide the syntax to enable applications to utilize the grid capabilities provided with SAS Grid Manager. One of the goals driving the creation of these functions was to provide a way for user-written applications that currently utilize the parallel capabilities of SAS/CONNECT to easily leverage the new grid capabilities with minimal code modification.

The following capabilities for grid enabling SAS applications are supported:



Syntax for SAS/CONNECT Grid Functions

The following functions provide the functionality described above:



Sample Program to Verify Grid Environment Setup

The following sample program is 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:

  1. the Platform Suite for SAS
  2. the SAS products and components licensed for your SAS grid environment.
before running the following 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):

  1. 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.
  2. Open the SAS Editor (by starting SAS).
  3. Cut and paste the following code into the editor:

/* The grdsvc_enable call will go out to the SAS Metadata Server and   */
/* find the SAS Grid Server definition. A return code of 0 means that  */
/* all signons will use the grid. A non-0 return code means that there */
/* is a problem that should be investigated.                           */

/* This program assumes a SAS application server of SASMain. If you */ /* are using SASApp or some other SAS application server, you must */ /* modify the enable and nodes function calls to specify your SAS */ /* application server. */ %let rc=%sysfunc(grdsvc_enable(_all_,resource=SASMain)); %put SAMPLE NOTE: Expecting rc to be 0.; %put SAMPLE NOTE: Value of rc=&rc.; %put SAMPLE NOTE: Do not proceed if rc is not 0.; /* The grdsvc_nnodes call will provide the number of grid nodes */ /* available in the grid. */ %let nnodes=%sysfunc(grdsvc_nnodes(resource=SASMain)); /* You can view the progress of the signons using the Grid Manager. */ /* Watch for Job Names such as SASGrid:xxxx where xxxx is the value of */ /* the sysjobid of this SAS session. */ %put Job Name=SASGrid:&sysjobid; /* Define a macro to loop to make sure that the grid nodes have been */ /* set up correctly. */ %macro loop; %do i=1 %to &nnodes; signon grdn&i; %put Session started on grid node %sysfunc(grdsvc_getname(grdn&i)); %end; %mend; /* Monitor the progress of the signon to the nodes using SAS */ /* Management Console and the Grid Manager. */ /* Invoke the loop macro to issue the signon. */ %loop; /* Stop SAS running on the grid nodes. */ signoff _all_;


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:

The following steps describe how to set up such a key definition.

  1. 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;
    
  2. 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: