I am using Base SAS (server license) and have increased the CPUCOUNT to 48 and the MEMSIZE to 2147483648 in the config file. I am using the code below to simulate C levels (~7000) within B levels (~500) within A levels (~5000). I have been testing the code using 960 A levels and it is taking ~ 5 hrs to run. Our R version of the model runs in about 20 minutes for all 5000 A levels. We want to run the model in SAS so we can track each A-B-C combination through the system (i.e. run an agent-based model), which our R model doesn't do. We also want to compare the SAS and R results. I start by randomly generating the A levels. I then split this dataset into sub-datasets that will be used in each thread. I originally didn't do this but tried it because I was concerned that each thread opening the original dataset was slowing things down. I then use parallel processing to simulate the B levels and the C levels using data steps, which do quite a number of calculations. From the log, it appears that the threads are running sequentially instead of asynchronously. I have attached the performance metrics during the run. %do i=1 %to &numthreads; %let begin=%eval((&i-1)*(&num_sim_thread) + 1); %let end=%eval(&begin + (&num_sim_thread) - 1); %if &end>&num_sim %then %let end=%eval(&num_sim); data risk.level_a_sim_t&i; set risk.level_a_sim (where=(&begin <= level_a_num <= &end)); run; %end; %macro parallel(thr); signon task&thr inheritlib=(risk); %syslput _all_ /remote=task&thr; rsubmit wait=no; %put THREAD START TIME: %sysfunc(datetime(),datetime18.1); %put _all_; data step to simulate level b within each level a… data step to simulate level c within each level b… proc datasets to create index for level a, b and c… data step to sample level c and calculate metrics… data step to merge metrics back onto overall dataset and finish simulation… %put THREAD END TIME: %sysfunc(datetime(),datetime18.1); %put PROCESSING TIME: %sysfunc(putn(%sysevalf(%sysfunc(TIME())-&datetime_start.),mmss.)) (mm:ss) ; endrsubmit; %mend parallel_processing; %do i=1 %to &numthreads; %parallel(&i); %end; waitfor _ALL_ %do i=1 %to &numthreads; task&i %end; ; %do i=1 %to &numthreads; signoff task&i; %end;
... View more