📜 ⬆️ ⬇️

SAS BASE procedures with direct control of the number of processor cores

Some SAS procedures have the ability to directly control the number of processor cores.

So for example in SAS 9.3 these are procedures:


In SAS 9.4, this list has expanded significantly:
')

The number of processor cores can be set using the cpucount option. Then, directly in the procedure, apply the required number using the threads | nothreads

Test performance consider the example of PROC SORT :
To do this, we will conduct three tests:


Training


Generate test data for further use:

%let anzahl = 10000000; data work.test; do i = 1 to &anzahl.; x = 10 * ranuni(1234); y = 1 + 2 * sqrt(10 * ranuni(1234)) + .5 * rannor(5678); s = y + round(rand('uniform'), 1.0); output; end; RUN; 

Result:

 NOTE: THE DATA SET WORK.TEST HAS 100000000 OBSERVATIONS AND 4 VARIABLES. NOTE: COMPRESSING DATA SET WORK.TEST INCREASED SIZE BY 74.87 PERCENT. COMPRESSED IS 691191 PAGES; UN-COMPRESSED WOULD REQUIRE 395258 PAGES. NOTE: DATA STATEMENT USED (TOTAL PROCESS TIME): REAL TIME 1:16.46 USER CPU TIME 1:02.09 SYSTEM CPU TIME 14.11 SECONDS MEMORY 297.09K OS MEMORY 6696.00K TIMESTAMP 05/09/2018 11:33:27 AM PAGE FAULTS 0 PAGE RECLAIMS 0 PAGE SWAPS 0 VOLUNTARY CONTEXT SWITCHES 84 INVOLUNTARY CONTEXT SWITCHES 8106 BLOCK INPUT OPERATIONS 0 BLOCK OUTPUT OPERATIONS 0 

Test 1 (without multicore)


  proc sort data = work.test out = work.test_str nothreads; by xys; run; 

Result 6 minutes 19 seconds:

 NOTE: There were 100000000 observations read from the data set WORK.TEST. NOTE: The data set WORK.TEST_STR has 100000000 observations and 4 variables. NOTE: Compressing data set WORK.TEST_STR increased size by 74.87 percent. Compressed is 691191 pages; un-compressed would require 395258 pages. NOTE: PROCEDURE SORT used (Total process time): real time 6:19.21 user cpu time 5:25.75 system cpu time 52.98 seconds memory 7067869.50k OS Memory 7075500.00k Timestamp 05/09/2018 11:48:58 AM Page Faults 0 Page Reclaims 0 Page Swaps 0 Voluntary Context Switches 3132 Involuntary Context Switches 13769 Block Input Operations 0 Block Output Operations 0 

Test 2 (Using 2 processor cores)


 /* Set the threads option and number of CPU's that SAS will use */ options threads cpucount=2; /* PROC OPTIONS will display the options and used CPUCORES */ proc options group=performance; run; proc sort data = work.test out = work.test_str threads; by xys; run; 

Result 2 min 49 seconds:

 NOTE: There were 100000000 observations read from the data set WORK.TEST. NOTE: The data set WORK.TEST_STR has 100000000 observations and 4 variables. NOTE: Compressing data set WORK.TEST_STR increased size by 74.87 percent. Compressed is 691191 pages; un-compressed would require 395258 pages. NOTE: PROCEDURE SORT used (Total process time): real time 2:49.20 user cpu time 5:07.38 system cpu time 1:05.13 memory 8628050.15k OS Memory 8636632.00k Timestamp 05/09/2018 12:05:47 PM Page Faults 0 Page Reclaims 0 Page Swaps 0 Voluntary Context Switches 12985 Involuntary Context Switches 22069 Block Input Operations 0 Block Output Operations 0 

Test 3 (Maximum allowable number of cores)


 /* Set the threads option and number of CPU's that SAS will use */ options threads cpucount=ACTUAL; /* PROC OPTIONS will display the options and used CPUCORES */ proc options group=performance; run; proc sort data = work.test out = work.test_str threads; by xys; run; 

Result 2 minutes 3 seconds:

 NOTE: There were 100000000 observations read from the data set WORK.TEST. NOTE: The data set WORK.TEST_STR has 100000000 observations and 4 variables. NOTE: Compressing data set WORK.TEST_STR increased size by 74.87 percent. Compressed is 691191 pages; un-compressed would require 395258 pages. NOTE: PROCEDURE SORT used (Total process time): real time 2:03.55 user cpu time 4:07.55 system cpu time 43.94 seconds memory 8634428.25k OS Memory 8642784.00k Timestamp 05/09/2018 12:09:37 PM Page Faults 0 Page Reclaims 0 Page Swaps 0 Voluntary Context Switches 20068 Involuntary Context Switches 12946 Block Input Operations 0 Block Output Operations 0 

Thus, by examples, we considered the influence of the number of processor cores on the speed of data processing. It can be concluded that the inclusion of parallel processing has significantly affected the speed, although a further increase in the cores did not have a strong effect and other optimization methods should be used for acceleration.

Source: https://habr.com/ru/post/358158/


All Articles