![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
When you run large analysis projects in SAS® Risk Dimensions®, you can often improve performance by using the %RDCSPAWN macro. This macro divides your work into subtasks that can run on multiple CPUs.
This sample demonstrates how to set up and use the %RDCSPAWN macro in SAS Risk Dimensions.
The %RDCSPAWN macro uses the MP CONNECT facility in SAS/CONNECT® software to divide a risk analysis project into subtasks and run them in parallel as independent processes on multiple CPUs. The %RDCSPAWN macro is defined in the rdcspawn.sas file, which is by default stored in the following locations on the SAS Risk Dimensions server:
!SASROOT\risk\sasmacro
!SASROOT/sasautos
To use MP CONNECT, you need to first install, configure, and start a spawner. The following links provide instructions for setting up a spawner:
Replace the REMOTE=, USER=, and PASSWORD= options with values specific to your environment. When you test the spawner sign-on process, your SAS log should show notes like the following:
NOTE: Remote signon to server-ID complete. "server-ID" -------------- Type: SAS/CONNECT Process State: READY NOTE: Remote signoff from server-ID commencing. NOTE: Remote signoff from server-ID complete.
As with the Windows example, enter specific values for the REMOTE=, USER=, and PASSWORD= options.
If you encounter connection errors, you need to resolve the problem so that the %RDCSPAWN macro can run properly. For more information about using the SIGNON and SIGNOFF statements, see Syntax for the SIGNON and the SIGNOFF Statements and Commands in the SAS/CONNECT® 9.2 User's Guide.
The Full Code tab contains a sample SAS program that you can use to call the %RDCSPAWN macro in a SAS session on your SAS Risk Dimensions server. Before running the program, make sure that you have performed the following steps:
tmpfiles
subdirectory in the directory for the ROOT macro variable. Assign Read and Write permissions to the tmpfiles
directory for the user that runs the program.When you run the SAS program that is on the Full Code tab, the results are stored in the ROOT macro variable's subdirectory sampcopy/outspawn
.
The sample code on the Full Code tab runs the risk-analysis project both with and without the %RDCSPAWN macro. The results from the project that does not use the %RDCSPAWN macro are stored in the sampcopy/outreg
subdirectory in the directory for the ROOT macro variable.
You can then use the COMPARE procedure to compare the spawned results with the non-spawned results. The PROC COMPARE output is located on the Output tab. Notice that the results are exactly the same.
These sample files and code examples are provided by SAS Institute Inc. "as is" without warranty of any kind, either express or implied, including but not limited to the implied warranties of merchantability and fitness for a particular purpose. Recipients acknowledge and agree that SAS Institute shall not be liable for any damages whatsoever arising out of their use of this material. In addition, SAS Institute will provide no support for the materials contained herein.
Prior to running the following code, you need to make sure:
tmpfiles
subdirectory exists in the directory for the ROOT macro variable and has Read and Write permissions for the user that runs the program/* specify root path for environment files */
%let root=your-directory;
/* specify connect data that is necessary for the rdcspawn macro */
data work.connectdata;
length host userid $24 password $64;
host="server-ID"; * hostname for mp connect processes;
port=port-number; * port number for mp connect processes;
cpus=2; * number of cpu's for mp connect;
userid="user-ID"; * userid and password for mp connect;
password="password";
run;
/* create working environment based on sampenv */
libname rdlib "&root";
proc risk;
setoptions nobacksave;
env new=rdlib.sampcopy inherit=risksamp.sampenv;
env save;
run;
/* run the project using %rdcspawn */
%rdcspawn( connectData = work.connectdata,
env = sampcopy,
proj = my_project,
port = firmwide,
envLibname = rdlib,
netPathEnv = "&root",
netPathTemp = "&root/tmpfiles",
blocks = -1,
splitby = states,
rpoptions = out=outspawn);
/* run the project without spawning */
proc risk;
setoptions nobacksave;
env open=rdlib.sampcopy;
runproject my_project out=outreg;
run;
/* compare results between the spawned and non-spawned projects */
libname nospnres "&root/sampcopy/outreg";
libname spawnres "&root/sampcopy/outspawn";
proc compare base=nospnres.allprice_v compare=spawnres.allprice_v;
run;
These sample files and code examples are provided by SAS Institute Inc. "as is" without warranty of any kind, either express or implied, including but not limited to the implied warranties of merchantability and fitness for a particular purpose. Recipients acknowledge and agree that SAS Institute shall not be liable for any damages whatsoever arising out of their use of this material. In addition, SAS Institute will provide no support for the materials contained herein.
The COMPARE Procedure Comparison of NOSPNRES.ALLPRICE_V with SPAWNRES.ALLPRICE_V (Method=EXACT) Data Set Summary Dataset Created Modified NVar NObs NOSPNRES.ALLPRICE_V 19JAN11:18:41:17 19JAN11:18:41:17 9 30988 SPAWNRES.ALLPRICE_V 19JAN11:18:41:10 19JAN11:18:41:10 9 30988 Variables Summary Number of Variables in Common: 9. Observation Summary Observation Base Compare First Obs 1 1 Last Obs 30988 30988 Number of Observations in Common: 30988. Total Number of Observations Read from NOSPNRES.ALLPRICE_V: 30988. Total Number of Observations Read from SPAWNRES.ALLPRICE_V: 30988. Number of Observations with Some Compared Variables Unequal: 0. Number of Observations with All Compared Variables Equal: 30988. NOTE: No unequal values were found. All values compared are exactly equal.
Type: | Sample |
Topic: | Analytics ==> Financial Analysis Analytics ==> Simulation Common Programming Tasks ==> Improving Performance SAS Reference ==> Procedures Software Components ==> Connect Spawner System Administration ==> Communication System Administration ==> Performance ==> SAS |
Date Modified: | 2011-02-03 14:40:22 |
Date Created: | 2011-01-19 14:53:04 |
Product Family | Product | Host | Product Release | SAS Release | ||
Starting | Ending | Starting | Ending | |||
SAS System | SAS Risk Dimensions Enterprise Edition | Windows 7 Ultimate 32 bit | 5.2 | 9.2 TS2M2 | ||
Windows 7 Professional x64 | 5.2 | 9.2 TS2M2 | ||||
Windows 7 Professional 32 bit | 5.2 | 9.2 TS2M2 | ||||
Windows 7 Home Premium x64 | 5.2 | 9.2 TS2M2 | ||||
Windows 7 Home Premium 32 bit | 5.2 | 9.2 TS2M2 | ||||
Windows 7 Enterprise x64 | 5.2 | 9.2 TS2M2 | ||||
Windows 7 Enterprise 32 bit | 5.2 | 9.2 TS2M2 | ||||
Microsoft Windows XP Professional | 5.2 | 9.2 TS2M2 | ||||
Microsoft Windows Server 2008 for x64 | 5.2 | 9.2 TS2M2 | ||||
Microsoft Windows Server 2008 | 5.2 | 9.2 TS2M2 | ||||
Microsoft Windows Server 2003 for x64 | 5.2 | 9.2 TS2M2 | ||||
Microsoft Windows Server 2003 Standard Edition | 5.2 | 9.2 TS2M2 | ||||
Microsoft Windows Server 2003 Enterprise Edition | 5.2 | 9.2 TS2M2 | ||||
Microsoft Windows Server 2003 Datacenter Edition | 5.2 | 9.2 TS2M2 | ||||
Microsoft® Windows® for x64 | 5.2 | 9.2 TS2M2 | ||||
Windows 7 Ultimate x64 | 5.2 | 9.2 TS2M2 | ||||
Windows Vista | 5.2 | 9.2 TS2M2 | ||||
Windows Vista for x64 | 5.2 | 9.2 TS2M2 | ||||
64-bit Enabled AIX | 5.2 | 9.2 TS2M2 | ||||
64-bit Enabled HP-UX | 5.2 | 9.2 TS2M2 | ||||
64-bit Enabled Solaris | 5.2 | 9.2 TS2M2 | ||||
HP-UX IPF | 5.2 | 9.2 TS2M2 | ||||
Linux | 5.2 | 9.2 TS2M2 | ||||
Linux for x64 | 5.2 | 9.2 TS2M2 | ||||
Solaris for x64 | 5.2 | 9.2 TS2M2 |