<?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: Formula Parallelization of new columns in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Formula-Parallelization-of-new-columns/m-p/941025#M109425</link>
    <description>&lt;P&gt;There is a tool to manage to manage parallelization for matrices: Parallel Assign.&lt;/P&gt;
&lt;P&gt;I am not confident this will actually speed things up unless you are making a lot of new columns based on a small number of input columns, and you are very limited on what functions you use.&lt;/P&gt;
&lt;P&gt;Here is an example:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names default to here(1);

dt = Open("$Sample_data/Pollen.jmp");

//first a simple demo of parallel assign to calculate column means
moutmeans = J(n col(dt), 1, .);         //blank matrix that will be populated
mdata = dt &amp;lt;&amp;lt; get as matrix;            //input data as a matrix
Parallel Assign(
	{ mdata = mdata },                  //variables needed in the 'worker thread'
	moutmeans[a, b] = mean(mdata[0,a]); //this fills in one cell
);
show(moutmeans);                        //col means are here

// Now for new columns
//mdata = mdata[1::2,0];                //a way to start small if you add show()
nrows = nrow(mdata);
cnames = dt &amp;lt;&amp;lt; get column names();      //used to find position of columns in matrix

// Write formulas for each columns using column names as placeholders
// to be replaced by matrix values later, this would work for pretty simple logic
formulas = Eval List({
	Expr(edge + nub + 10),
	Eval Expr(nub - Expr( col mean(dt:nub) ) ) //note this col mean evaluates now
});
newcnames = {"a","b"};                  //new column names used later

mout = J(nrows, length(formulas), .);   //empty matrix to populate

Parallel Assign(
	{
		mdata = mdata,
		formulas = formulas,
		cnames = cnames
	}, 
	mout[a, b] = (
		f = formulas[b];
		
		//assign values to all potential variables used in matricies 
		//(bad idea if lots of unused columns)	
		for(i=1, i&amp;lt;= n items(cnames), i++,
		
			//Make a list with the variable to assign and value to assign it to,
			// then replace the list with assign
			Eval( Substitute(
				Eval List( {as name( name expr( cnames[i] ) ), mdata[a,i]} ),
				Expr({}),
				Expr( assign() )
			) );
		);
		eval(f);
	);
);

//put new columns in table
for each({c,i}, newcnames, dt &amp;lt;&amp;lt; New Column(c,Numeric,Continuous, &amp;lt;&amp;lt; Set Values(mout[0,i])));

//add columns to double check it worked
dt &amp;lt;&amp;lt; New Column("a-check", Numeric, "Continuous", Format("Best", 12), Formula(:edge + :nub + 10));
dt &amp;lt;&amp;lt; New Column("b-check", Numeric, "Continuous", Format("Best", 12), Formula(:nub - Col Mean(:nub)));&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 10 Apr 2026 17:29:32 GMT</pubDate>
    <dc:creator>ih</dc:creator>
    <dc:date>2026-04-10T17:29:32Z</dc:date>
    <item>
      <title>Formula Parallelization of new columns</title>
      <link>https://community.jmp.com/t5/Discussions/Formula-Parallelization-of-new-columns/m-p/940920#M109418</link>
      <description>&lt;DIV&gt;Hello JMP community,&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;in my JSL scripts I often generate new columns one after another like this:&lt;/DIV&gt;
&lt;DIV&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;...
DT &amp;lt;&amp;lt; New Column( "Some Name1", Numeric, "Continuous", Formula( Some Formula1 ) );
DT &amp;lt;&amp;lt; New Column( "Some Name2", Numeric, "Continuous", Formula( Some Formula2 ) );
DT &amp;lt;&amp;lt; New Column( "Some Name3", Numeric, "Continuous", Formula( Some Formula3 ) );
...&lt;/CODE&gt;&lt;/PRE&gt;
&lt;DIV&gt;Usually my data tables are pretty large and can reach 100 Mio Rows. The formulas that I use often include statistical functions like &lt;FONT face="courier new,courier"&gt;Col Mean()&lt;/FONT&gt;, &lt;FONT face="courier new,courier"&gt;Col Maximum()&lt;/FONT&gt; etc. which makes them slower and slower the more rows I have. It might be the case that a few new columns depend on each other but please assume for the moment they do not.&lt;/DIV&gt;
&lt;DIV&gt;&lt;BR /&gt;When my script evaluates I am seeing JMP 19.1 using just 3-4% of my CPU (16 cores, 32 threads)&lt;BR /&gt;Is it possible to accelerate the computation e.g. by parallelization but without building subsets and having to merge subset results back? Can I work in parallel on one and the same data table using JSL in JMP?&lt;BR /&gt;If not, do you think the "subset-formula computation-merge back" approach is worth a try?&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;Cheers&lt;BR /&gt;Rob&lt;/DIV&gt;
&lt;/DIV&gt;</description>
      <pubDate>Fri, 10 Apr 2026 05:59:00 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Formula-Parallelization-of-new-columns/m-p/940920#M109418</guid>
      <dc:creator>Robbb</dc:creator>
      <dc:date>2026-04-10T05:59:00Z</dc:date>
    </item>
    <item>
      <title>Re: Formula Parallelization of new columns</title>
      <link>https://community.jmp.com/t5/Discussions/Formula-Parallelization-of-new-columns/m-p/940945#M109419</link>
      <description>&lt;P&gt;Depending on your calculation (and if you need formulas or not), you could possibly create Summary table, do calculations there and update them back to your table.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 10 Apr 2026 07:54:05 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Formula-Parallelization-of-new-columns/m-p/940945#M109419</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2026-04-10T07:54:05Z</dc:date>
    </item>
    <item>
      <title>Re: Formula Parallelization of new columns</title>
      <link>https://community.jmp.com/t5/Discussions/Formula-Parallelization-of-new-columns/m-p/941025#M109425</link>
      <description>&lt;P&gt;There is a tool to manage to manage parallelization for matrices: Parallel Assign.&lt;/P&gt;
&lt;P&gt;I am not confident this will actually speed things up unless you are making a lot of new columns based on a small number of input columns, and you are very limited on what functions you use.&lt;/P&gt;
&lt;P&gt;Here is an example:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names default to here(1);

dt = Open("$Sample_data/Pollen.jmp");

//first a simple demo of parallel assign to calculate column means
moutmeans = J(n col(dt), 1, .);         //blank matrix that will be populated
mdata = dt &amp;lt;&amp;lt; get as matrix;            //input data as a matrix
Parallel Assign(
	{ mdata = mdata },                  //variables needed in the 'worker thread'
	moutmeans[a, b] = mean(mdata[0,a]); //this fills in one cell
);
show(moutmeans);                        //col means are here

// Now for new columns
//mdata = mdata[1::2,0];                //a way to start small if you add show()
nrows = nrow(mdata);
cnames = dt &amp;lt;&amp;lt; get column names();      //used to find position of columns in matrix

// Write formulas for each columns using column names as placeholders
// to be replaced by matrix values later, this would work for pretty simple logic
formulas = Eval List({
	Expr(edge + nub + 10),
	Eval Expr(nub - Expr( col mean(dt:nub) ) ) //note this col mean evaluates now
});
newcnames = {"a","b"};                  //new column names used later

mout = J(nrows, length(formulas), .);   //empty matrix to populate

Parallel Assign(
	{
		mdata = mdata,
		formulas = formulas,
		cnames = cnames
	}, 
	mout[a, b] = (
		f = formulas[b];
		
		//assign values to all potential variables used in matricies 
		//(bad idea if lots of unused columns)	
		for(i=1, i&amp;lt;= n items(cnames), i++,
		
			//Make a list with the variable to assign and value to assign it to,
			// then replace the list with assign
			Eval( Substitute(
				Eval List( {as name( name expr( cnames[i] ) ), mdata[a,i]} ),
				Expr({}),
				Expr( assign() )
			) );
		);
		eval(f);
	);
);

//put new columns in table
for each({c,i}, newcnames, dt &amp;lt;&amp;lt; New Column(c,Numeric,Continuous, &amp;lt;&amp;lt; Set Values(mout[0,i])));

//add columns to double check it worked
dt &amp;lt;&amp;lt; New Column("a-check", Numeric, "Continuous", Format("Best", 12), Formula(:edge + :nub + 10));
dt &amp;lt;&amp;lt; New Column("b-check", Numeric, "Continuous", Format("Best", 12), Formula(:nub - Col Mean(:nub)));&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 10 Apr 2026 17:29:32 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Formula-Parallelization-of-new-columns/m-p/941025#M109425</guid>
      <dc:creator>ih</dc:creator>
      <dc:date>2026-04-10T17:29:32Z</dc:date>
    </item>
    <item>
      <title>Re: Formula Parallelization of new columns</title>
      <link>https://community.jmp.com/t5/Discussions/Formula-Parallelization-of-new-columns/m-p/941026#M109426</link>
      <description>&lt;P&gt;You could try &lt;A href="https://www.jmp.com/support/help/en/19.1/index.shtml#page/jmp/evaluate-formulas-in-data-tables.shtml" target="_blank" rel="noopener"&gt;suppressing formula evaluation&lt;/A&gt; until all columns have been created then use Run Formulas.&lt;/P&gt;</description>
      <pubDate>Fri, 10 Apr 2026 17:55:37 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Formula-Parallelization-of-new-columns/m-p/941026#M109426</guid>
      <dc:creator>Ryan_Gilmore</dc:creator>
      <dc:date>2026-04-10T17:55:37Z</dc:date>
    </item>
    <item>
      <title>Re: Formula Parallelization of new columns</title>
      <link>https://community.jmp.com/t5/Discussions/Formula-Parallelization-of-new-columns/m-p/941178#M109432</link>
      <description>&lt;P&gt;(&amp;nbsp;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/14379"&gt;@Ryan_Gilmore&lt;/a&gt;&amp;nbsp;,&amp;nbsp;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/14411"&gt;@Robbb&lt;/a&gt;&amp;nbsp;)&amp;nbsp;&amp;nbsp;dt&amp;lt;&amp;lt;runFormulas is the answer. Without it you'll see JMP using some of the background CPU cycles to do the eval and leaving most available for your interactive foreground use...you can continue scrolling the table for example.&amp;nbsp;It is a bit of a pain to runformulas interactively, and you might not have to; almost always JMP will do it for you when you try to use the table with a platform (make a graph, analyze data). If you see JMP working with the table before it is completely evaluated, that's a bug and should be reported. But if you are watching the slow evaluation, scrolling the table looking for the rows to fill in, the behavior is not ideal.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here's a wish list item to vote for&lt;/P&gt;
&lt;P&gt;&lt;LI-MESSAGE title="background formula evaluation" uid="941169" url="https://community.jmp.com/t5/JMP-Wish-List/background-formula-evaluation/m-p/941169#U941169" discussion_style_icon_css="lia-mention-container-editor-message lia-img-icon-idea-thread lia-fa-icon lia-fa-idea lia-fa-thread lia-fa"&gt;&lt;/LI-MESSAGE&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 11 Apr 2026 17:12:57 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Formula-Parallelization-of-new-columns/m-p/941178#M109432</guid>
      <dc:creator>Craige_Hales</dc:creator>
      <dc:date>2026-04-11T17:12:57Z</dc:date>
    </item>
  </channel>
</rss>

