<?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: Input output bottleneck!! in SAS/IML Software and Matrix Computations</title>
    <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Input-output-bottleneck/m-p/125276#M965</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ian,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I will try it. I think each iteration will have 10000 rows. The inner most loop generates one and only one row once T &amp;gt; h.&lt;/P&gt;&lt;P&gt;I have a lot of memory on this machine, 64GB, but you never really know with SAS.&lt;/P&gt;&lt;P&gt;Thank you for your suggestions and help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Jamil&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 24 May 2012 14:16:01 GMT</pubDate>
    <dc:creator>jhzeinab_yahoo_com</dc:creator>
    <dc:date>2012-05-24T14:16:01Z</dc:date>
    <item>
      <title>Input output bottleneck!!</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Input-output-bottleneck/m-p/125266#M955</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt; I have a simulation code (ATTACHED) that is functional and works well, but is very slow. We are talking 4-5 days of continuous run time.&lt;/P&gt;&lt;P&gt;I think there is an input/output bottleneck in appending matrices (vertically). Is there something that could be done to reduce time, memory, permanent instead of work of temporary That might make this code run faster.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am saving qualifying records as vectors and appending them to a matrix called RESULT. At the end of loop grid, I am appending the matrix to a permanent SAS data set for further analysis.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have done all I can with my limited knowledge of IML and I am desperate for help.&lt;/P&gt;&lt;P&gt;Many thanks,&lt;/P&gt;&lt;P&gt;Jamil&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 May 2012 00:49:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Input-output-bottleneck/m-p/125266#M955</guid>
      <dc:creator>jhzeinab_yahoo_com</dc:creator>
      <dc:date>2012-05-24T00:49:44Z</dc:date>
    </item>
    <item>
      <title>Re: Input output bottleneck!!</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Input-output-bottleneck/m-p/125267#M956</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;1) move all allocations outside the do loops. you only need to allocate X at the top of the program, not inside four nested DO loops&lt;/P&gt;&lt;P&gt;2) You don't need to allocate zm, T, or any other arrays that you are going to assign. If you execute "zm = equation", do not allocate zm first, since zm just gets overwritten&lt;/P&gt;&lt;P&gt;3) You don't need x1 and x2. Just send X into the RAND function to fill up both columns.&lt;/P&gt;&lt;P&gt;3) Get rid of the lines&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;SPAN style="background: white; color: black; font-family: 'Courier New';"&gt;COV_INV_Z=inv (COV_Z);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;SPAN style="background: white; color: black; font-family: 'Courier New';"&gt;T=&amp;nbsp; Z * COV_INV_Z *t(Z);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;and use the SOLVE function instead as shown in&lt;/P&gt;&lt;P&gt;&lt;A href="http://blogs.sas.com/content/iml/2011/08/10/do-you-really-need-to-compute-that-matrix-inverse/"&gt;http://blogs.sas.com/content/iml/2011/08/10/do-you-really-need-to-compute-that-matrix-inverse/&lt;/A&gt;&lt;/P&gt;&lt;P&gt;and&lt;/P&gt;&lt;P&gt;&lt;A href="http://blogs.sas.com/content/iml/2011/08/17/solving-linear-systems-which-technique-is-fastest/" title="http://blogs.sas.com/content/iml/2011/08/17/solving-linear-systems-which-technique-is-fastest/"&gt;http://blogs.sas.com/content/iml/2011/08/17/solving-linear-systems-which-technique-is-fastest/&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background: white; color: black; font-family: arial,helvetica,sans-serif;"&gt;4) The line that is &lt;STRONG&gt;REALLY&lt;/STRONG&gt; killing your performance is &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;RESULT=RESULT // R;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial,helvetica,sans-serif; font-size: 10pt;"&gt;Read Section 2.9 on p. 34-35 of my book &lt;EM&gt;Statistical Programming with SAS/IML Software.&lt;/EM&gt; That chapter is available as a &lt;A href="http://support.sas.com/publishing/authors/wicklin.html"&gt;free download &lt;/A&gt;.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial,helvetica,sans-serif; font-size: 10pt;"&gt;Start with (4); the performance will improve incredibly.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 May 2012 01:28:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Input-output-bottleneck/m-p/125267#M956</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2012-05-24T01:28:05Z</dc:date>
    </item>
    <item>
      <title>Re: Input output bottleneck!!</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Input-output-bottleneck/m-p/125268#M957</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you Rick. I will work on these changes and see if perfrmance improves.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 May 2012 02:14:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Input-output-bottleneck/m-p/125268#M957</guid>
      <dc:creator>jhzeinab_yahoo_com</dc:creator>
      <dc:date>2012-05-24T02:14:09Z</dc:date>
    </item>
    <item>
      <title>Re: Input output bottleneck!!</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Input-output-bottleneck/m-p/125269#M958</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Rick, by the way, I hav your book, which is excellent, I am on teh other hand is a novice in IML.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How would the SOLVE function work in this case. I have an original X (n x p) matrix and a Z matrix (1 x p)?&lt;/P&gt;&lt;P&gt;Is the following remotely correct instead of the above. I need to calculate T (scalar) from&amp;nbsp; a quadratic form &lt;SPAN style="background: white; color: black; font-family: 'Courier New';"&gt;T=&amp;nbsp; Z * COV_INV_Z *t(Z)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;T= SOLVE (X,Z); ???&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 May 2012 02:33:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Input-output-bottleneck/m-p/125269#M958</guid>
      <dc:creator>jhzeinab_yahoo_com</dc:creator>
      <dc:date>2012-05-24T02:33:36Z</dc:date>
    </item>
    <item>
      <title>Re: Input output bottleneck!!</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Input-output-bottleneck/m-p/125270#M959</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I haven't run your program, but I believe that you are dealing with a 2x2 matrix, so the the time taken for the matrix inversion is not going to be significant no matter how you do it.&amp;nbsp; Have you addressed Rick's comment in bold?&amp;nbsp; I think it is in bold for a good reason.&amp;nbsp;&amp;nbsp; For every iteration you make, you are effectively declaring a new data structure Result, copying &lt;STRONG&gt;all&lt;/STRONG&gt; of the old results to it as well as the most recent result.&amp;nbsp; So as the iteration count rises, larger and larger amounts of data are shifted around killing the performance.&amp;nbsp; Perhaps try to structure the program so that you declare a matrix at the start to hold the results for every iteration of your inner most loop, and then add each result to the matrix with a statement like Result[m,]=R;&amp;nbsp;&amp;nbsp; After the innermost loop has finished then you could dump the contents of Result to a SAS data set.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 May 2012 10:06:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Input-output-bottleneck/m-p/125270#M959</guid>
      <dc:creator>IanWakeling</dc:creator>
      <dc:date>2012-05-24T10:06:45Z</dc:date>
    </item>
    <item>
      <title>Re: Input output bottleneck!!</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Input-output-bottleneck/m-p/125271#M960</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;try T=z*solve(COV_Z, z`);&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 May 2012 10:07:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Input-output-bottleneck/m-p/125271#M960</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2012-05-24T10:07:53Z</dc:date>
    </item>
    <item>
      <title>Re: Input output bottleneck!!</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Input-output-bottleneck/m-p/125272#M961</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Good one! I didn't even notice these were 2x2 matrices!&amp;nbsp; (But it's good to learn how to use SOLVE anyway!)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 May 2012 10:10:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Input-output-bottleneck/m-p/125272#M961</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2012-05-24T10:10:31Z</dc:date>
    </item>
    <item>
      <title>Re: Input output bottleneck!!</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Input-output-bottleneck/m-p/125273#M962</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you folks. I will make these changes and see if overll perfomance gets better.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 May 2012 13:23:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Input-output-bottleneck/m-p/125273#M962</guid>
      <dc:creator>jhzeinab_yahoo_com</dc:creator>
      <dc:date>2012-05-24T13:23:32Z</dc:date>
    </item>
    <item>
      <title>Re: Input output bottleneck!!</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Input-output-bottleneck/m-p/125274#M963</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ian,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Does it matter where I declare the matrix in this case? Should I declare it outside of the first loop or before the inner most loop.&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Jamil&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 May 2012 13:39:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Input-output-bottleneck/m-p/125274#M963</guid>
      <dc:creator>jhzeinab_yahoo_com</dc:creator>
      <dc:date>2012-05-24T13:39:45Z</dc:date>
    </item>
    <item>
      <title>Re: Input output bottleneck!!</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Input-output-bottleneck/m-p/125275#M964</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Jamil,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Outside the first loop declare something like RESULT=j(15000,4);&amp;nbsp; Then move your append just after the inner most loop.&amp;nbsp; Of course you could make RESULT big enough to contain all the results from all the loops, but I think then you might run in to memory problems.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ian.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 May 2012 14:03:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Input-output-bottleneck/m-p/125275#M964</guid>
      <dc:creator>IanWakeling</dc:creator>
      <dc:date>2012-05-24T14:03:51Z</dc:date>
    </item>
    <item>
      <title>Re: Input output bottleneck!!</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Input-output-bottleneck/m-p/125276#M965</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ian,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I will try it. I think each iteration will have 10000 rows. The inner most loop generates one and only one row once T &amp;gt; h.&lt;/P&gt;&lt;P&gt;I have a lot of memory on this machine, 64GB, but you never really know with SAS.&lt;/P&gt;&lt;P&gt;Thank you for your suggestions and help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Jamil&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 May 2012 14:16:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Input-output-bottleneck/m-p/125276#M965</guid>
      <dc:creator>jhzeinab_yahoo_com</dc:creator>
      <dc:date>2012-05-24T14:16:01Z</dc:date>
    </item>
    <item>
      <title>Re: Input output bottleneck!!</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Input-output-bottleneck/m-p/125277#M966</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I made the changes and it seems to be running faster. Although I am not sure if I have the optimal append location.&lt;/P&gt;&lt;P&gt;I am appending every 10,000 rows for each &lt;EM&gt;lambda &lt;/EM&gt;and&lt;EM&gt; K&lt;/EM&gt; combination. &lt;/P&gt;&lt;P&gt;I will post another update and my find code soon.&lt;/P&gt;&lt;P&gt;Thanks again.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 May 2012 16:11:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Input-output-bottleneck/m-p/125277#M966</guid>
      <dc:creator>jhzeinab_yahoo_com</dc:creator>
      <dc:date>2012-05-24T16:11:26Z</dc:date>
    </item>
  </channel>
</rss>

