<?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 how to run ds2 actionset runmodel on multiple threads in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/how-to-run-ds2-actionset-runmodel-on-multiple-threads/m-p/811180#M319955</link>
    <description>&lt;P&gt;It takes a long time to score and once finished in the log a note states that only one thread was used.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc cas;
      loadactionset "DS2";
      runmodel /
      modelname="Forest_recovery_maig2_tarde",
      modeltable={caslib="DNA", name="sas_model_table" },
      table = {caslib="public", name="recovery_candidates2" },
      casout={caslib="busidev", name="ac_scored"};
run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Tue, 03 May 2022 10:06:36 GMT</pubDate>
    <dc:creator>acordes</dc:creator>
    <dc:date>2022-05-03T10:06:36Z</dc:date>
    <item>
      <title>how to run ds2 actionset runmodel on multiple threads</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-run-ds2-actionset-runmodel-on-multiple-threads/m-p/811180#M319955</link>
      <description>&lt;P&gt;It takes a long time to score and once finished in the log a note states that only one thread was used.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc cas;
      loadactionset "DS2";
      runmodel /
      modelname="Forest_recovery_maig2_tarde",
      modeltable={caslib="DNA", name="sas_model_table" },
      table = {caslib="public", name="recovery_candidates2" },
      casout={caslib="busidev", name="ac_scored"};
run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 03 May 2022 10:06:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-run-ds2-actionset-runmodel-on-multiple-threads/m-p/811180#M319955</guid>
      <dc:creator>acordes</dc:creator>
      <dc:date>2022-05-03T10:06:36Z</dc:date>
    </item>
    <item>
      <title>Re: how to run ds2 actionset runmodel on multiple threads</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-run-ds2-actionset-runmodel-on-multiple-threads/m-p/811187#M319956</link>
      <description>&lt;P&gt;The documentation for the DS2.runModel action&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://go.documentation.sas.com/doc/en/pgmsascdc/v_017/caspg/n0kk5ezhtskpncn1vgfxrv6eobgt.htm" target="_blank"&gt;SAS Help Center: DS2 Details&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;includes this caution: "&lt;SPAN&gt;It is recommended that the DS2 code that is run with the runModel action include a THREAD program. This allows the DS2 code to run as a DS2 parallel program and therefore leverage the full set of worker nodes on the CAS server."&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;You can see the DS2 documentation for more information about how to use the THREAD/ENDTRHEAD block for parallel processing:&amp;nbsp;&lt;A href="https://go.documentation.sas.com/doc/en/pgmsascdc/v_017/ds2ref/n1vsbu90nrt615n11eu9hp2qd66m.htm" target="_blank"&gt;SAS Help Center: THREAD Statement&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 03 May 2022 10:17:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-run-ds2-actionset-runmodel-on-multiple-threads/m-p/811187#M319956</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2022-05-03T10:17:14Z</dc:date>
    </item>
    <item>
      <title>Re: how to run ds2 actionset runmodel on multiple threads</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-run-ds2-actionset-runmodel-on-multiple-threads/m-p/811195#M319958</link>
      <description>&lt;P&gt;I don't understand what I'm doing... I copy/paste from the link you shared.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Fact is that I don't succeed in getting the table&amp;nbsp;PUBLIC.RECOVERY_CANDIDATES2 scored.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The code without thread works but is very slow.&lt;/P&gt;
&lt;P&gt;The thread option is resolved correctly but I don't know what the runmodel statement should look like.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;here is my failed intent.&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc cas;
  loadactionset "modelPublishing";
  publishModel  /                                       /*5*/
  modelName="Forest_recovery_maig2_tarde",
  modelTable={caslib="DNA", name="sas_model_table" },
  program= "
     thread cars_thd / overwrite=yes;
       method run();
         set PUBLIC.RECOVERY_CANDIDATES2;
/*          if (msrp &amp;gt; 100000) then do; */
/*            put make= model= msrp=; */
/*            output; */
/*          end; */
       end;
     endthread;
     data busidev.cars_luxury /overwrite=yes;
       dcl thread cars_thd t;
       method run();
         set from t threads=8;
       end;
     enddata;";
  run;

      loadactionset "DS2";
      runmodel /
      modelname="Forest_recovery_maig2_tarde",
      modeltable={caslib="DNA", name="sas_model_table" }
/*       table = {caslib="public", name="recovery_candidates2" }, */
      table = {caslib="busidev", name="cars_luxury" },
      casout={caslib="busidev", name="ac_scored2"};
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 03 May 2022 11:54:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-run-ds2-actionset-runmodel-on-multiple-threads/m-p/811195#M319958</guid>
      <dc:creator>acordes</dc:creator>
      <dc:date>2022-05-03T11:54:35Z</dc:date>
    </item>
    <item>
      <title>Re: how to run ds2 actionset runmodel on multiple threads</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-run-ds2-actionset-runmodel-on-multiple-threads/m-p/811196#M319959</link>
      <description>&lt;P&gt;Ok, I'm starting to understand a little bit.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I overwrite my model&amp;nbsp;Forest_recovery_maig2_tarde with the publishing option and then nothing happens because I do not define a 'model' in the program statement...&lt;/P&gt;
&lt;P&gt;So I need to copy/paste the method run() block from the model studio where I trained the model, right?&lt;/P&gt;
&lt;P&gt;Or how do I run the EXISTING model in multiple threads without the modelpublishing block?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 03 May 2022 12:12:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-run-ds2-actionset-runmodel-on-multiple-threads/m-p/811196#M319959</guid>
      <dc:creator>acordes</dc:creator>
      <dc:date>2022-05-03T12:12:35Z</dc:date>
    </item>
    <item>
      <title>Re: how to run ds2 actionset runmodel on multiple threads</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-run-ds2-actionset-runmodel-on-multiple-threads/m-p/811198#M319960</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13684"&gt;@Rick_SAS&lt;/a&gt;&amp;nbsp;I can use alternatively the proc astore and it works.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But I want to use the ds2 actionset because I want to score within the IMLactionset calling 'submit'.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It works, but it's slow if it's not multithread.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 03 May 2022 12:21:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-run-ds2-actionset-runmodel-on-multiple-threads/m-p/811198#M319960</guid>
      <dc:creator>acordes</dc:creator>
      <dc:date>2022-05-03T12:21:38Z</dc:date>
    </item>
    <item>
      <title>Re: how to run ds2 actionset runmodel on multiple threads</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-run-ds2-actionset-runmodel-on-multiple-threads/m-p/811202#M319961</link>
      <description>&lt;P&gt;I do not have any experience doing what you are attempting to do. However, when I want to write a complicated program, it always goes better when I slowly study and implement each individual piece. Start with a regular DS2 program that has a THREAD statement. Get it working in multiple threads. Move on to creating and publishing a model, and so forth.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Good luck!&lt;/P&gt;</description>
      <pubDate>Tue, 03 May 2022 12:40:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-run-ds2-actionset-runmodel-on-multiple-threads/m-p/811202#M319961</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2022-05-03T12:40:25Z</dc:date>
    </item>
    <item>
      <title>Re: how to run ds2 actionset runmodel on multiple threads</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-run-ds2-actionset-runmodel-on-multiple-threads/m-p/811273#M319971</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/32"&gt;@BrunoMueller&lt;/a&gt;&amp;nbsp;can you help me out?&lt;/P&gt;</description>
      <pubDate>Tue, 03 May 2022 16:27:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-run-ds2-actionset-runmodel-on-multiple-threads/m-p/811273#M319971</guid>
      <dc:creator>acordes</dc:creator>
      <dc:date>2022-05-03T16:27:50Z</dc:date>
    </item>
    <item>
      <title>Re: how to run ds2 actionset runmodel on multiple threads</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-run-ds2-actionset-runmodel-on-multiple-threads/m-p/811335#M319991</link>
      <description>&lt;P&gt;I think that I'm close to the solution.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I run the runmodel.action which executes but slowly.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I copy/paste the log information to the thread program.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It creates the desired table including the prediction variables but quits before writing any observations to it.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The error message is.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;ERROR: Line 14: Error reported by DS2 package d2score:&lt;BR /&gt;ERROR: Line 14: Store identified by the key 6031C39C5FDB19CC9D86D42C7A7E7FE76987AEB2 is not in memory.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;When using the runmodel action the store is found and executes correctly.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;cas mysession sessopts=(caslib="casuser");
proc cas; 
   session mysession; 
   source myprogram1;
      thread datagen / overwrite=yes;              
          dcl package score _BAY103MSXS55GR1KJPG052A1W();
          dcl double "P_target_recovery1" having label n'Predicted: target_recovery=1';
          dcl double "P_target_recovery0" having label n'Predicted: target_recovery=0';
          dcl nchar(32) "I_target_recovery" having label n'Into: target_recovery';
          dcl nchar(4) "_WARN_" having label n'Warnings';
          dcl double EM_EVENTPROBABILITY;
          dcl nchar(8) EM_CLASSIFICATION;
          dcl double EM_PROBABILITY;
          varlist allvars [_all_];
                    
          method init();
          _BAY103MSXS55GR1KJPG052A1W.setvars(allvars);
          _BAY103MSXS55GR1KJPG052A1W.setkey(n'6031C39C5FDB19CC9D86D42C7A7E7FE76987AEB2');
          end;
                   method post_BAY103MSXS55GR1KJPG052A1W();
          dcl double _P_;
                       if "P_TARGET_RECOVERY0" = . then "P_TARGET_RECOVERY0" = 0.6131360717;
          if "P_TARGET_RECOVERY1" = . then "P_TARGET_RECOVERY1" = 0.3868639283;
          if MISSING("I_TARGET_RECOVERY") then do ;
          _P_ = 0.0;
          if "P_TARGET_RECOVERY1" &amp;gt; _P_ then do ;
          _P_ = "P_TARGET_RECOVERY1";
          "I_TARGET_RECOVERY" = '1';
          end;
          if "P_TARGET_RECOVERY0" &amp;gt; _P_ then do ;
          _P_ = "P_TARGET_RECOVERY0";
          "I_TARGET_RECOVERY" = '0';
          end;
          end;
          EM_EVENTPROBABILITY = "P_TARGET_RECOVERY1";
          EM_CLASSIFICATION = "I_TARGET_RECOVERY";
          EM_PROBABILITY = MAX("P_TARGET_RECOVERY1", "P_TARGET_RECOVERY0");
                   end;
                 
          method run();
          set "CASUSER(DKXENLO)"."bigdata";
          _BAY103MSXS55GR1KJPG052A1W.scoreRecord();
          post_BAY103MSXS55GR1KJPG052A1W();
end;
         method term();
end;


      endthread;

/* Run the DATA program on all CAS workers. */
   data bigdata_sc / overwrite=yes;                          
         dcl thread datagen dg;                              
         method run();                                       
            set from dg threads=8;                       /*5*/
         end;
      enddata;
   endsource;

   ds2.runDS2 program=myprogram1; 
   run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 03 May 2022 22:04:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-run-ds2-actionset-runmodel-on-multiple-threads/m-p/811335#M319991</guid>
      <dc:creator>acordes</dc:creator>
      <dc:date>2022-05-03T22:04:37Z</dc:date>
    </item>
    <item>
      <title>Re: how to run ds2 actionset runmodel on multiple threads</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-run-ds2-actionset-runmodel-on-multiple-threads/m-p/811617#M320144</link>
      <description>I am sorry but I can not help with this.</description>
      <pubDate>Thu, 05 May 2022 08:23:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-run-ds2-actionset-runmodel-on-multiple-threads/m-p/811617#M320144</guid>
      <dc:creator>BrunoMueller</dc:creator>
      <dc:date>2022-05-05T08:23:35Z</dc:date>
    </item>
    <item>
      <title>Re: how to run ds2 actionset runmodel on multiple threads</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-run-ds2-actionset-runmodel-on-multiple-threads/m-p/814084#M321333</link>
      <description>&lt;P&gt;&lt;EM&gt;Hi Koen&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/60547"&gt;@sbxkoenk&lt;/a&gt;&amp;nbsp;&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;Perhaps you know the solution. I should have placed this post in data science I guess.&lt;/EM&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 18 May 2022 14:46:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-run-ds2-actionset-runmodel-on-multiple-threads/m-p/814084#M321333</guid>
      <dc:creator>acordes</dc:creator>
      <dc:date>2022-05-18T14:46:13Z</dc:date>
    </item>
    <item>
      <title>Re: how to run ds2 actionset runmodel on multiple threads</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-run-ds2-actionset-runmodel-on-multiple-threads/m-p/814168#M321385</link>
      <description>&lt;P&gt;Yes, you should have put it in 'SAS Data Science Board' indeed.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Is it possible for you to open a track at Technical Support in your country?&lt;/P&gt;
&lt;P&gt;Technical Support (TS) knows about this problem.&lt;/P&gt;
&lt;P&gt;I refer you to TS because the root cause and the work-around (there is no real 'solution')&amp;nbsp;is a very long explanation that they can probably do better than me.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;BR,&lt;/P&gt;
&lt;P&gt;Koen&lt;/P&gt;</description>
      <pubDate>Wed, 18 May 2022 19:47:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-run-ds2-actionset-runmodel-on-multiple-threads/m-p/814168#M321385</guid>
      <dc:creator>sbxkoenk</dc:creator>
      <dc:date>2022-05-18T19:47:11Z</dc:date>
    </item>
  </channel>
</rss>

