<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: parallel  processing for loops &amp;amp; under macro in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/parallel-processing-for-loops-amp-under-macro/m-p/319247#M70054</link>
    <description>&lt;P&gt;Before embarking on parallel processing, take a good look at why your current process performs badly. If your process is already running at saturation level of your I/O subsystem, parallelization will only make it worse.&lt;/P&gt;
&lt;P&gt;So you have to check if you have the computing infrastructure upon which you can spread your parallel processes&lt;/P&gt;
&lt;P&gt;- multiple CPU cores that are not yet used&lt;/P&gt;
&lt;P&gt;- multiple I/O paths that are not yet used, or I/O capability in reserve&lt;/P&gt;
&lt;P&gt;- memory that is not yet used&lt;/P&gt;
&lt;P&gt;and so on.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 15 Dec 2016 13:45:46 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2016-12-15T13:45:46Z</dc:date>
    <item>
      <title>parallel  processing for loops &amp; under macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/parallel-processing-for-loops-amp-under-macro/m-p/319244#M70053</link>
      <description>&lt;P&gt;Hi SAS users,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;due to heavy run time, i was thinking of trying approch of parallell processing. But my code structure is like below and not sure whether there is a chance to do parallell process or not?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;do loop i &amp;nbsp;&lt;/P&gt;&lt;P&gt;do loop j &amp;nbsp;&lt;/P&gt;&lt;P&gt;do loop k&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;macro test1 &amp;nbsp; &amp;nbsp; ( macro test -10 are same but with 1 parameter being diff which made them run 10 times)&lt;/P&gt;&lt;P&gt;macro &amp;nbsp;test2&lt;/P&gt;&lt;P&gt;macro test3&lt;/P&gt;&lt;P&gt;..&lt;/P&gt;&lt;P&gt;..&lt;/P&gt;&lt;P&gt;macro test10&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;do loop ends &amp;nbsp; k&lt;/P&gt;&lt;P&gt;do loop ends &amp;nbsp; j&lt;/P&gt;&lt;P&gt;do loop ends &amp;nbsp;k&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Ana&lt;/P&gt;</description>
      <pubDate>Thu, 15 Dec 2016 13:21:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/parallel-processing-for-loops-amp-under-macro/m-p/319244#M70053</guid>
      <dc:creator>SASAna</dc:creator>
      <dc:date>2016-12-15T13:21:27Z</dc:date>
    </item>
    <item>
      <title>Re: parallel  processing for loops &amp; under macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/parallel-processing-for-loops-amp-under-macro/m-p/319247#M70054</link>
      <description>&lt;P&gt;Before embarking on parallel processing, take a good look at why your current process performs badly. If your process is already running at saturation level of your I/O subsystem, parallelization will only make it worse.&lt;/P&gt;
&lt;P&gt;So you have to check if you have the computing infrastructure upon which you can spread your parallel processes&lt;/P&gt;
&lt;P&gt;- multiple CPU cores that are not yet used&lt;/P&gt;
&lt;P&gt;- multiple I/O paths that are not yet used, or I/O capability in reserve&lt;/P&gt;
&lt;P&gt;- memory that is not yet used&lt;/P&gt;
&lt;P&gt;and so on.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 15 Dec 2016 13:45:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/parallel-processing-for-loops-amp-under-macro/m-p/319247#M70054</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2016-12-15T13:45:46Z</dc:date>
    </item>
    <item>
      <title>Re: parallel  processing for loops &amp; under macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/parallel-processing-for-loops-amp-under-macro/m-p/319250#M70055</link>
      <description>&lt;P&gt;What do the macro's resolve to, that is the key question here. &amp;nbsp;The code the derive to is being run once per inner loop * middle loop * outer loop, so could be many times. &amp;nbsp;I find it highly unlikely that this is a good methodology of working, but without seeing it all I can't really say. &amp;nbsp;Moving to parallel processing *may* help, it wont change the macro part as macro is just a text replacement facility, and if there is heavy read/write then it wont help. &amp;nbsp;But is hard to advie without seeing some test data (in the form of a datastep) and the code.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also, just re-reading your post, if your running the same macro, but with a different parameter, then a simple change to your data structure - so that each parameter is a row rather than a column, can sometimes a) reduce your coding effort, b) be far more efficient that coding each item (due to by group processing).&lt;/P&gt;</description>
      <pubDate>Thu, 15 Dec 2016 13:55:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/parallel-processing-for-loops-amp-under-macro/m-p/319250#M70055</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2016-12-15T13:55:21Z</dc:date>
    </item>
    <item>
      <title>Re: parallel  processing for loops &amp; under macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/parallel-processing-for-loops-amp-under-macro/m-p/319253#M70057</link>
      <description>&lt;P&gt;Hi Kurt,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;UNIX System is very good and database is also fine where i connect and do 50% &amp;nbsp;of the work in my code.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;since the data size is 75K to 1 million records per month, i thought parallel process may help in processing macro test1 to macr test10&lt;/P&gt;</description>
      <pubDate>Thu, 15 Dec 2016 13:56:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/parallel-processing-for-loops-amp-under-macro/m-p/319253#M70057</guid>
      <dc:creator>SASAna</dc:creator>
      <dc:date>2016-12-15T13:56:46Z</dc:date>
    </item>
    <item>
      <title>Re: parallel  processing for loops &amp; under macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/parallel-processing-for-loops-amp-under-macro/m-p/319255#M70058</link>
      <description>&lt;P&gt;Mutitask 8 batch jobs.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My inexpensive workstation(SAS calls it PC-SAS) has 64gb and dual Xeons(3gz) and two raid 0 arrays (about $600 off lease Dell T7400)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Because the macro cascon was compute bound the 8 processes below cut the elapsed time by about factor of eight.&lt;/P&gt;&lt;P&gt;Eight small datasets(4 million obs) were created which you will need to either append or keep as a view after the tasks complete.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If the largest temp or perm table is less than a 1TB(Big Data) &amp;nbsp;you may be able to run on a workstation otherwise I suggest&amp;nbsp;&lt;/P&gt;&lt;P&gt;EG GRID on a SAS server. If you are doing a large simulation that requires more than 16 cores you should also consider&lt;/P&gt;&lt;P&gt;the EG GRID.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You need to think about mutiple SPDE(libnames) &amp;nbsp;each with partitioed data if you have more I/O intensive work.&lt;/P&gt;&lt;P&gt;SPDE does not support mutiple tasks? Only the server addition does?&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;%let _s=%sysfunc(compbl(C:\Progra~1\SASHome\SASFoundation\9.4\sas.exe -sysin c:\nul -sasautos c:\oto -autoexec c:\oto\Tut_Oto.sas&lt;BR /&gt;-work d:\wrk));&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;options noxwait noxsync;&lt;BR /&gt;%let tym=%sysfunc(time());&lt;BR /&gt;systask kill sys1 sys2 sys3 sys4 sys5 sys6 sys7 sys8;&lt;BR /&gt;systask command "&amp;amp;_s -termstmt %nrstr(%cascon(beg=0000001,end=0125000);) -log d:\log\a1.log" taskname=sys1;&lt;BR /&gt;systask command "&amp;amp;_s -termstmt %nrstr(%cascon(beg=0125001,end=0250000);) -log d:\log\a2.log" taskname=sys2;&lt;BR /&gt;systask command "&amp;amp;_s -termstmt %nrstr(%cascon(beg=0250001,end=0375000);) -log d:\log\a3.log" taskname=sys3;&lt;BR /&gt;systask command "&amp;amp;_s -termstmt %nrstr(%cascon(beg=0375001,end=0500000);) -log d:\log\a4.log" taskname=sys4;&lt;BR /&gt;systask command "&amp;amp;_s -termstmt %nrstr(%cascon(beg=0500001,end=0625000);) -log d:\log\a5.log" taskname=sys5;&lt;BR /&gt;systask command "&amp;amp;_s -termstmt %nrstr(%cascon(beg=0625001,end=0750000);) -log d:\log\a6.log" taskname=sys6;&lt;BR /&gt;systask command "&amp;amp;_s -termstmt %nrstr(%cascon(beg=0750001,end=0875000);) -log d:\log\a7.log" taskname=sys7;&lt;BR /&gt;systask command "&amp;amp;_s -termstmt %nrstr(%cascon(beg=0875001,end=1000000);) -log d:\log\a8.log" taskname=sys8;&lt;BR /&gt;waitfor sys1 sys2 sys3 sys4 sys5 sys6 sys7 sys8;&lt;BR /&gt;%put %sysevalf( %sysfunc(time()) - &amp;amp;tym);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 15 Dec 2016 14:04:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/parallel-processing-for-loops-amp-under-macro/m-p/319255#M70058</guid>
      <dc:creator>rogerjdeangelis</dc:creator>
      <dc:date>2016-12-15T14:04:08Z</dc:date>
    </item>
    <item>
      <title>Re: parallel  processing for loops &amp; under macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/parallel-processing-for-loops-amp-under-macro/m-p/319257#M70059</link>
      <description>&lt;P&gt;Define "very good". I could have a system with 16 POWER cores, 512 GB of RAM and a nominal I/O throughput of 1GB/sec, and 2 silly SQLs could bring it to a standstill by riding one disk to death.&lt;/P&gt;
&lt;P&gt;You need to identify what parts of your process take so long, and how your server(s) perform during those steps.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;One approach that you could take would be this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Suppose your outer loop performs 10 iterations.&lt;/P&gt;
&lt;P&gt;Paramaterize those loops (ie retrieve loop_start and loop_end from commandline parameters)&lt;/P&gt;
&lt;P&gt;Run the program in two parallel batch jobs with suiting commandline options (1 to 5 and 6 to 10) and measure your performance&lt;/P&gt;
&lt;P&gt;If performance increases, increase parallelization until peformance stops getting better.&lt;/P&gt;</description>
      <pubDate>Thu, 15 Dec 2016 14:09:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/parallel-processing-for-loops-amp-under-macro/m-p/319257#M70059</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2016-12-15T14:09:55Z</dc:date>
    </item>
    <item>
      <title>Re: parallel  processing for loops &amp; under macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/parallel-processing-for-loops-amp-under-macro/m-p/319260#M70060</link>
      <description>&lt;P&gt;The answer is short and easy:&amp;nbsp; No.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;There is nothing about macro loops that creates parallel processing.&amp;nbsp; SAS programs (whether macro language is involved or not) process one DATA or PROC step at a time, sequentially.&amp;nbsp; There are SAS language techniques that can parallelize a single step in some cases, but introducing macro language does not bring any of those SAS language techniques into play.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you want to post whichever macro is taking longest to run, you could probably get some suggestions on how to speed up the SAS steps within.&lt;/P&gt;</description>
      <pubDate>Thu, 15 Dec 2016 14:13:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/parallel-processing-for-loops-amp-under-macro/m-p/319260#M70060</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2016-12-15T14:13:43Z</dc:date>
    </item>
    <item>
      <title>Re: parallel  processing for loops &amp; under macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/parallel-processing-for-loops-amp-under-macro/m-p/319291#M70079</link>
      <description>Thanks Asto, Macro is pretty simple with DB connectivity, insert, update &amp;amp; delete SQL's only. But data is huge. running 7 loops is taking extra hours.</description>
      <pubDate>Thu, 15 Dec 2016 15:18:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/parallel-processing-for-loops-amp-under-macro/m-p/319291#M70079</guid>
      <dc:creator>SASAna</dc:creator>
      <dc:date>2016-12-15T15:18:16Z</dc:date>
    </item>
    <item>
      <title>Re: parallel  processing for loops &amp; under macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/parallel-processing-for-loops-amp-under-macro/m-p/319293#M70081</link>
      <description>&lt;P&gt;In that case, it becomes a matter of strategy.&amp;nbsp; As others have mentioned above:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Consider whether several steps could logically be combined into one.&amp;nbsp; (How to adjust the program to combine those steps is a secondary issue.)&lt;/LI&gt;
&lt;LI&gt;Consider splitting up the job into several jobs.&amp;nbsp; SAS will run several jobs in parallel, although there may be contention for either processing power or for access to the database that is being updated.&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 15 Dec 2016 15:28:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/parallel-processing-for-loops-amp-under-macro/m-p/319293#M70081</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2016-12-15T15:28:19Z</dc:date>
    </item>
  </channel>
</rss>

