<?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: Does an IML action run automatically on several nodes? in SAS/IML Software and Matrix Computations</title>
    <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Does-an-IML-action-run-automatically-on-several-nodes/m-p/825700#M5836</link>
    <description>&lt;P&gt;&lt;EM&gt;&amp;gt;&amp;nbsp;Does an IML action run automatically on several nodes?&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;No, it doesn't. Your session determines how many nodes are available, but the program only uses multiple nodes for distributed functions. Examples of a distributed function are MapReduce, ParTasks, and reading/writing CAS tables. See&amp;nbsp;&lt;A href="https://go.documentation.sas.com/doc/en/pgmsascdc/v_026/casactiml/casactiml_iml_details08.htm" target="_blank"&gt;https://go.documentation.sas.com/doc/en/pgmsascdc/v_026/casactiml/casactiml_iml_details08.htm&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;&amp;gt;&amp;nbsp;Or do I have to use the 'nthreads' option?&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;The NTHREADS= option determines how many threads are available on each node. But only multithreaded operations use the threads. Multithreaded operations include the distributed functions (as above) and linear algebra operations such as SOLVE and SVD. See&amp;nbsp;&lt;A href="https://go.documentation.sas.com/doc/en/pgmsascdc/v_029/casimllang/casimllang_common_sect015.htm#casimllang.common.hardwareaccelerated" target="_blank"&gt;https://go.documentation.sas.com/doc/en/pgmsascdc/v_029/casimllang/casimllang_common_sect015.htm#casimllang.common.hardwareaccelerated&lt;/A&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;With the exception of the read/write operations, your program will run in a single thread on the controller node.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I cannot determine what your program is supposed to do, but if you explain it a little and include some example data, we might be able to offer a way to improve its efficiency.&lt;/P&gt;</description>
    <pubDate>Wed, 27 Jul 2022 15:35:57 GMT</pubDate>
    <dc:creator>Rick_SAS</dc:creator>
    <dc:date>2022-07-27T15:35:57Z</dc:date>
    <item>
      <title>Does an IML action run automatically on several nodes?</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Does-an-IML-action-run-automatically-on-several-nodes/m-p/825684#M5835</link>
      <description>&lt;P&gt;Or do I have to use the 'nthreads' option?&lt;/P&gt;
&lt;P&gt;My code runs successfully but it takes a long time to execute.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
options casdatalimit=all;
proc cas;
   loadactionset 'iml';    /* load the iml action set (only once per session) */
run;

source imly;
KeepStmt1 = 'KEEP=codidoc codopera  ';
KeepStmt2 = 'KEEP=_numeric_  ';
KeepStmt3 = 'KEEP=QNUMMESE  ';
x = matrixCreateFromCAS('PUBLIC', 'exp2', KeepStmt2 );
y=matrixCreateFromCAS('PUBLIC', 'EXP2', KeepStmt1);
QNUMMESE = matrixCreateFromCAS('PUBLIC', 'EXP2', KeepStmt3);

varnames={&amp;amp;var2s.};

X=X||J(NROW(X),1,0);
XT=(SHAPE(DIF(X), NROW(X)) [, 2:NCOL(X)])#2;
idx=loc((x[, 2:NCOL(X)]+xt)=1);
xt[idx]=1;

y=y[,2]||y[,1];

t2=unique(qnummese);
/* rowhead=char(t2); */

t22=(repeat(t2, nrow(x))=qnummese)`*(xt = 2);

t22_sum=t22 [+];
ctr=(xt = 2) [+]; 

idx1=loc(t22 &amp;lt;&amp;gt; 0);
s = ndx2sub(dimension(t22), idx1);

/* PRINT QNUMMESE y XT T2 T22 T22_SUM CTR IDX1 S; */



res0=j(nrow(s), ncol(x)-1, .);
res0_perc=res0;

do i=1 to ncol(idx1);
idx2=loc( ( (qnummese=t2[s[i,1]])# (xt[, s[i,2]]=2) )=1);
/* PRINT IDX2; */
res0[i,s[i,2]] = t22[idx1[i]];
/* PRINT RES0; */
res0[i,(s[i,2]+1):ncol(xt)]=(x [loc(element(y[,1], y[idx2,1])),(s[i,2]+1):ncol(x)-1] &amp;lt;&amp;gt;0) [+,];
/* PRINT RES0; */
res0_perc[i,(s[i,2]):ncol(xt)]=res0[i,(s[i,2]):ncol(xt)]/res0[i,s[i,2]];
end;

/* endsource; */
/* iml / code=imly; */
/* run; */


rown=catx("|", t2 [s[,1]], varnames[s[,2]]);

call MatrixWriteToCAS(res0, '', '_crm_fun', varnames);
call MatrixWriteToCAS(res0_perc, '', '_crm_fun_perc', varnames);
call MatrixWriteToCAS(rown, '', '_crm_fun_id');
    
endsource;
iml / code=imly;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 27 Jul 2022 15:39:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Does-an-IML-action-run-automatically-on-several-nodes/m-p/825684#M5835</guid>
      <dc:creator>acordes</dc:creator>
      <dc:date>2022-07-27T15:39:06Z</dc:date>
    </item>
    <item>
      <title>Re: Does an IML action run automatically on several nodes?</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Does-an-IML-action-run-automatically-on-several-nodes/m-p/825700#M5836</link>
      <description>&lt;P&gt;&lt;EM&gt;&amp;gt;&amp;nbsp;Does an IML action run automatically on several nodes?&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;No, it doesn't. Your session determines how many nodes are available, but the program only uses multiple nodes for distributed functions. Examples of a distributed function are MapReduce, ParTasks, and reading/writing CAS tables. See&amp;nbsp;&lt;A href="https://go.documentation.sas.com/doc/en/pgmsascdc/v_026/casactiml/casactiml_iml_details08.htm" target="_blank"&gt;https://go.documentation.sas.com/doc/en/pgmsascdc/v_026/casactiml/casactiml_iml_details08.htm&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;&amp;gt;&amp;nbsp;Or do I have to use the 'nthreads' option?&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;The NTHREADS= option determines how many threads are available on each node. But only multithreaded operations use the threads. Multithreaded operations include the distributed functions (as above) and linear algebra operations such as SOLVE and SVD. See&amp;nbsp;&lt;A href="https://go.documentation.sas.com/doc/en/pgmsascdc/v_029/casimllang/casimllang_common_sect015.htm#casimllang.common.hardwareaccelerated" target="_blank"&gt;https://go.documentation.sas.com/doc/en/pgmsascdc/v_029/casimllang/casimllang_common_sect015.htm#casimllang.common.hardwareaccelerated&lt;/A&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;With the exception of the read/write operations, your program will run in a single thread on the controller node.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I cannot determine what your program is supposed to do, but if you explain it a little and include some example data, we might be able to offer a way to improve its efficiency.&lt;/P&gt;</description>
      <pubDate>Wed, 27 Jul 2022 15:35:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Does-an-IML-action-run-automatically-on-several-nodes/m-p/825700#M5836</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2022-07-27T15:35:57Z</dc:date>
    </item>
  </channel>
</rss>

