プロセッサコアの数を直接制御するSAS BASEプロシージャ

一部のSASプロシージャには、プロセッサコアの数を直接制御する機能があります。



したがって、たとえばSAS 9.3での手順は次のとおりです。





SAS 9.4では、このリストは大幅に拡大しました:





プロセッサコアの数は、 cpucountオプションを使用して設定できます。 次に、手順で直接、 スレッドを使用して必要な数量を適用します| nothreads



PROC SORTの例を使用してパフォーマンステストを検討します。

これを行うために、3つのテストを実施します。





準備する



将来使用するためのテストデータを生成します。



%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;
      
      





結果:



 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
      
      





テスト1(マルチコアなし)



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





結果は6分19秒です。



 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
      
      





テスト2(2つのCPUコアを使用)



 /* 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;
      
      





結果2分49秒:



 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
      
      





テスト3(最大許容コア)



 /* 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;
      
      





結果2分3秒:



 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
      
      





したがって、例では、データ処理速度に対するプロセッサコアの数の影響を調べました。 並列処理を含めることは速度に大きな影響を与えたと結論づけることができますが、核のさらなる増加は強力な効果がなく、加速には他の最適化手法を使用する必要があります。



All Articles