<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Hi,&nbsp;<div><br></div><div>During our intermittent discussions about the partial separability work, both before</div><div>the submission and during the AMR proposal writing we&nbsp;floated the idea of eliminating&nbsp;</div><div>a loop that was considered wasteful by you,&nbsp;but convenient from an implementation&nbsp;</div><div>standpoint by me.&nbsp;</div><div><br></div><div>Specifically:&nbsp;</div><div>The statements:</div><div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; ">&nbsp;&nbsp;<span style="color: #7f0055">#pragma</span> $adic_partiallyseparable, fquad, flin</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; "><span class="Apple-tab-span" style="white-space:pre">        </span>*f = area*(p5*fquad+flin);</div></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; "><br></div><div>were converted originally to:</div><div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; "><span style="color: #7f0055">#pragma</span> $adic_partiallyseparable, fquad, flin</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; ">&nbsp;ADIC_SPARSE_Create1DimArray(&amp;__adic_temp_f, ad_var_max);</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; ">&nbsp;<span style="color: #7f0055">for</span> (__adic_temp0 = 0; __adic_temp0 &lt; ad_var_max; __adic_temp0++) {</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; ">&nbsp; &nbsp; __adic_temp_f[__adic_temp0] = (area * ((p5 * fquad[__adic_temp0])&nbsp;</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; ">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; + flin[__adic_temp0]));</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; ">&nbsp; }</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; ">&nbsp; ADIC_SPARSE_Summation(f,__adic_temp_f,ad_var_max);</div></div><div>&nbsp;</div><div><br></div><div>where the grad_array of f is dense and large in size. f is an object of the class&nbsp;<span class="Apple-style-span" style="color: rgb(0, 80, 50); font-family: Monaco; font-size: 11px; ">SparseDerivSeparable.&nbsp;</span></div><div>The grad_array of&nbsp;<span class="Apple-style-span" style="font-family: Monaco; font-size: 11px; ">__adic_temp_f,&nbsp;</span><span class="Apple-style-span" style="font-family: Monaco; font-size: 11px; ">fquad, and &nbsp;flin</span></div><div>are of size p, where p is the number of colors used by ColPack to compress the sparse elemental Jacobian.</div><div>These variables are objects of the class&nbsp;<span class="Apple-style-span" style="color: rgb(0, 80, 50); font-family: Monaco; font-size: 11px; ">SparseDeriv.&nbsp;</span><span class="Apple-style-span" style="color: rgb(0, 80, 50); font-family: Monaco; font-size: 11px; ">DERIV_TYPE&nbsp;</span>is typedeffed to&nbsp;<span class="Apple-style-span" style="color: rgb(0, 80, 50); font-family: Monaco; font-size: 11px; ">SparseDeriv</span></div><div><span class="Apple-style-span" style="color: rgb(0, 80, 50); font-family: Monaco; font-size: 11px; ">SparseDerivSeparable </span>is a child of&nbsp;<span class="Apple-style-span" style="color: rgb(0, 80, 50); font-family: Monaco; font-size: 11px; ">SparseDeriv.SparseDeriv</span></div><div>contains a static array:</div><div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; "><span style="color: #7f0055">double</span> <span style="color: #0000c0">grad</span>[ADIC_GRADVEC_LENGTH];</div></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; ">and&nbsp;<span class="Apple-style-span" style="color: rgb(0, 80, 50); ">SparseDerivSeparable&nbsp;</span><span class="Apple-style-span" style="font-family: Helvetica; font-size: medium; ">contains a dynamically allocated array:</span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: rgb(127, 0, 85); "><span style="color: #000000">&nbsp;&nbsp;</span>double<span style="color: #000000"> *</span><span style="color: #0000c0">grad</span><span style="color: #000000">;.</span></div><div>The only location where a&nbsp;<span class="Apple-style-span" style="color: rgb(0, 80, 50); font-family: Monaco; font-size: 11px; ">SparseDeriv&nbsp;</span>object is used to compute a &nbsp;<span class="Apple-style-span" style="color: rgb(0, 80, 50); font-family: Monaco; font-size: 11px; ">SparseDerivSeparable</span></div><div>object is in the&nbsp;<span class="Apple-style-span" style="font-family: Monaco; font-size: 11px; ">ADIC_SPARSE_Summation&nbsp;</span>function. &nbsp;In the</div><div>sparsity detection mode&nbsp;<span class="Apple-style-span" style="font-family: Monaco; font-size: 11px; ">ADIC_SPARSE_Summation&nbsp;</span>registers the sparsity patterns of&nbsp;<span class="Apple-style-span" style="font-family: Monaco; font-size: 11px; ">__adic_temp_f</span>.</div><div>In the computation mode, &nbsp;uses the registered patterns along with the ColPack routines to&nbsp;</div><div>compute&nbsp;<span class="Apple-style-span" style="font-family: Monaco; font-size: 11px; ">f from&nbsp;</span><span class="Apple-style-span" style="font-family: Monaco; font-size: 11px; ">__adic_temp_f.</span></div><div><font class="Apple-style-span" face="Monaco"></font></div><div><font class="Apple-style-span" face="Monaco"><span class="Apple-style-span" style="font-size: 11px;"><br></span></font></div><div>I went ahead an implemented a version that did not require a loop that</div><div>calculates each element of &nbsp;<span class="Apple-style-span" style="font-family: Monaco; font-size: 11px; ">__adic_temp_f.&nbsp;</span></div><div>The output is given below:</div><div><br></div><div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; "><span style="color: #7f0055">#pragma</span> $adic_partiallyseparable, fquad, flin</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; ">&nbsp; <span style="color: #005032">DERIV_TYPE</span> *__adic_temp_flin;</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; ">&nbsp; <span style="color: #005032">DERIV_TYPE</span> *__adic_temp_fquad;</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; ">&nbsp; ad_var_26 = ADIC_SPARSE_max(ad_var_0,ad_var_1);</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; ">&nbsp; ADIC_SPARSE_Summation(__adic_temp_fquad,ad_fquad,ad_var_26);</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; ">&nbsp; ad_var_27 = ADIC_SPARSE_max(ad_var_0,ad_var_1);</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; ">&nbsp; ADIC_SPARSE_Summation(__adic_temp_flin,ad_flin,ad_var_27);</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; ">&nbsp; ad_TempVartmp_7 = DERIV_val(ad_p5) * DERIV_val( *__adic_temp_fquad) + DERIV_val( *__adic_temp_flin);</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; ">&nbsp; ad_TempVarSymbol_12 = DERIV_val(ad_area) * ad_TempVartmp_7;</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; ">&nbsp; ad_TempVarlin_30 = ad_TempVartmp_7;</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; ">&nbsp; ad_TempVarlin_32 = DERIV_val( *__adic_temp_fquad);</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; ">&nbsp; ad_TempVarlin_33 = DERIV_val(ad_p5);</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; ">&nbsp; ad_TempVarlin_31 = DERIV_val(ad_area);</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; ">&nbsp; ADIC_SetValue( *f,ad_TempVarSymbol_12);</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; ">&nbsp; ADIC_SetDeriv(DERIV_TYPE_ref(ad_area),DERIV_TYPE_ref(ad_TempVarprop_55));</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; ">&nbsp; ADIC_SetDeriv(DERIV_TYPE_ref(ad_p5),DERIV_TYPE_ref(ad_TempVarprop_56));</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; ">&nbsp; ADIC_SetDeriv(DERIV_TYPE_ref( *__adic_temp_fquad),DERIV_TYPE_ref(ad_TempVarprop_57));</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; ">&nbsp; ADIC_SetDeriv(DERIV_TYPE_ref( *__adic_temp_flin),DERIV_TYPE_ref(ad_TempVarprop_58));</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; ">&nbsp; ADIC_Sax_3(1,DERIV_TYPE_ref(ad_TempVarprop_58),ad_TempVarlin_32,DERIV_TYPE_ref(ad_TempVarprop_56),ad_TempVarlin_33,DERIV_TYPE_ref(ad_TempVarprop_57),DERIV_TYPE_ref(ad_TempVarprop_59));</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; ">&nbsp; ADIC_Sax_2(ad_TempVarlin_30,DERIV_TYPE_ref(ad_TempVarprop_55),ad_TempVarlin_31,DERIV_TYPE_ref(ad_TempVarprop_59),DERIV_TYPE_ref( *f));</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; ">}</div></div><div><br></div><div>Right now, all temporary variables are objects of&nbsp;<span class="Apple-style-span" style="color: rgb(0, 80, 50); font-family: Monaco; font-size: 11px; ">SparseDeriv.</span></div><div>There are two calls to&nbsp;<span class="Apple-style-span" style="font-family: Monaco; font-size: 11px; ">ADIC_SPARSE_Summation&nbsp;</span></div><div>that assign values to the temporary variables&nbsp;<span class="Apple-style-span" style="font-family: Monaco; font-size: 11px; ">__adic_temp_flin and&nbsp;</span><span class="Apple-style-span" style="font-family: Monaco; font-size: 11px; ">__adic_temp_fquad</span></div><div>These variables will be defined as &nbsp;<span class="Apple-style-span" style="color: rgb(0, 80, 50); font-family: Monaco; font-size: 11px; ">SparseDerivSeparable</span></div><div>within<span class="Apple-style-span" style="font-family: Monaco; font-size: 11px; "> ADIC_SPARSE_Summation.</span></div><div><br></div><div>Here begins the problem, the XAIFBooster output for the statement</div><div><span class="Apple-style-span" style="font-family: Monaco; font-size: 11px; ">area*(p5*fquad+flin);</span></div><div>requires&nbsp;<span class="Apple-style-span" style="font-family: Monaco; font-size: 11px; ">ADIC_Sax_# and SetDeriv&nbsp;</span>calls which causes</div><div>assignments of&nbsp;<span class="Apple-style-span" style="color: rgb(0, 80, 50); font-family: Monaco; font-size: 11px; ">SparseDeriv to&nbsp;</span><span class="Apple-style-span" style="color: rgb(0, 80, 50); font-family: Monaco; font-size: 11px; ">SparseDerivSeparable&nbsp;</span></div><div>and vice-versa.&nbsp;</div><div><br></div><div>Statements such as:</div><div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; ">&nbsp;&nbsp;ADIC_SetDeriv(DERIV_TYPE_ref( *__adic_temp_fquad),DERIV_TYPE_ref(ad_TempVarprop_57));</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; "><span class="Apple-style-span" style="font-family: Helvetica; font-size: medium; ">can probably be handled by intelligent declaration of temporaries.&nbsp;</span></div></div><div><br></div><div>However, the statement</div><div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; ">&nbsp;&nbsp;ADIC_Sax_3(1,DERIV_TYPE_ref(ad_TempVarprop_58),ad_TempVarlin_32,DERIV_TYPE_ref(ad_TempVarprop_56),ad_TempVarlin_33,DERIV_TYPE_ref(ad_TempVarprop_57),DERIV_TYPE_ref(ad_TempVarprop_59));</div></div><div>is trickier to handle as it requires us to define the computation between &nbsp;a&nbsp;<span class="Apple-style-span" style="color: rgb(0, 80, 50); font-family: Monaco; font-size: 11px; ">SparseDeriv&nbsp;</span>type and a&nbsp;<span class="Apple-style-span" style="color: rgb(0, 80, 50); font-family: Monaco; font-size: 11px; ">SparseDerivSeparable&nbsp;</span>type.&nbsp;</div><div><span class="Apple-style-span" style="font-family: Monaco; font-size: 11px; ">ad_TempVarprop_56</span><span class="Apple-style-span" style="font-family: Monaco; font-size: 11px; ">&nbsp;</span>is just a temporary holding the grad_arrary of&nbsp;<span class="Apple-style-span" style="font-family: Monaco; font-size: 11px; ">ad_area</span></div><div><div>which is &nbsp;a&nbsp;<span class="Apple-style-span" style="color: rgb(0, 80, 50); font-family: Monaco; font-size: 11px; ">SparseDeriv object.&nbsp;</span></div><div><font class="Apple-style-span" color="#005032" face="Monaco"><span class="Apple-style-span" style="font-size: 11px;"><br></span></font></div><div>What can be noted is that ad_area is a non_elemental value that is also in effect inactive.&nbsp;</div><div>So if we integrate ActivityAnalysis, we should be able to keep ad_area inactive (double type) and so&nbsp;</div><div>the above situation should not occur.&nbsp;</div><div><br></div><div>Are there any thoughts on this?</div><div><br></div><div>I have not yet talked about possibly using f later on in the code in this email. I am assuming that</div><div>the succeeding code is all&nbsp;<span class="Apple-style-span" style="color: rgb(0, 80, 50); font-family: Monaco; font-size: 11px; ">SparseDerivSeparable.</span></div><div>We will have to work out how to have different types and variables declaration co-existing harmoniously.&nbsp;</div><div><br></div><div><div><div><span class="Apple-style-span" style="font-family: Monaco; font-size: 11px; ">Thanks,</span></div></div></div><div><span class="Apple-style-span" style="font-family: Monaco; font-size: 11px; ">Krishna&nbsp;</span></div></div><div><span class="Apple-style-span" style="font-family: Monaco; font-size: 11px; "><br></span></div></body></html>