<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Hi, <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 floated the idea of eliminating </div><div>a loop that was considered wasteful by you, but convenient from an implementation </div><div>standpoint by me. </div><div><br></div><div>Specifically: </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; "> <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; "> ADIC_SPARSE_Create1DimArray(&__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; "> <span style="color: #7f0055">for</span> (__adic_temp0 = 0; __adic_temp0 < 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; "> __adic_temp_f[__adic_temp0] = (area * ((p5 * fquad[__adic_temp0]) </div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; "> + 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; "> }</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; "> ADIC_SPARSE_Summation(f,__adic_temp_f,ad_var_max);</div></div><div> </div><div><br></div><div>where the grad_array of f is dense and large in size. f is an object of the class <span class="Apple-style-span" style="color: rgb(0, 80, 50); font-family: Monaco; font-size: 11px; ">SparseDerivSeparable. </span></div><div>The grad_array of <span class="Apple-style-span" style="font-family: Monaco; font-size: 11px; ">__adic_temp_f, </span><span class="Apple-style-span" style="font-family: Monaco; font-size: 11px; ">fquad, and 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 <span class="Apple-style-span" style="color: rgb(0, 80, 50); font-family: Monaco; font-size: 11px; ">SparseDeriv. </span><span class="Apple-style-span" style="color: rgb(0, 80, 50); font-family: Monaco; font-size: 11px; ">DERIV_TYPE </span>is typedeffed to <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 <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 <span class="Apple-style-span" style="color: rgb(0, 80, 50); ">SparseDerivSeparable </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"> </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 <span class="Apple-style-span" style="color: rgb(0, 80, 50); font-family: Monaco; font-size: 11px; ">SparseDeriv </span>object is used to compute a <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 <span class="Apple-style-span" style="font-family: Monaco; font-size: 11px; ">ADIC_SPARSE_Summation </span>function. In the</div><div>sparsity detection mode <span class="Apple-style-span" style="font-family: Monaco; font-size: 11px; ">ADIC_SPARSE_Summation </span>registers the sparsity patterns of <span class="Apple-style-span" style="font-family: Monaco; font-size: 11px; ">__adic_temp_f</span>.</div><div>In the computation mode, uses the registered patterns along with the ColPack routines to </div><div>compute <span class="Apple-style-span" style="font-family: Monaco; font-size: 11px; ">f from </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 <span class="Apple-style-span" style="font-family: Monaco; font-size: 11px; ">__adic_temp_f. </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; "> <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; "> <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; "> 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; "> 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; "> 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; "> 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; "> 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; "> 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; "> 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; "> 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; "> 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; "> 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; "> 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; "> 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; "> 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; "> 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; "> 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; "> 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; "> 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 <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 <span class="Apple-style-span" style="font-family: Monaco; font-size: 11px; ">ADIC_SPARSE_Summation </span></div><div>that assign values to the temporary variables <span class="Apple-style-span" style="font-family: Monaco; font-size: 11px; ">__adic_temp_flin and </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 <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 <span class="Apple-style-span" style="font-family: Monaco; font-size: 11px; ">ADIC_Sax_# and SetDeriv </span>calls which causes</div><div>assignments of <span class="Apple-style-span" style="color: rgb(0, 80, 50); font-family: Monaco; font-size: 11px; ">SparseDeriv to </span><span class="Apple-style-span" style="color: rgb(0, 80, 50); font-family: Monaco; font-size: 11px; ">SparseDerivSeparable </span></div><div>and vice-versa. </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; "> 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. </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; "> 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 a <span class="Apple-style-span" style="color: rgb(0, 80, 50); font-family: Monaco; font-size: 11px; ">SparseDeriv </span>type and a <span class="Apple-style-span" style="color: rgb(0, 80, 50); font-family: Monaco; font-size: 11px; ">SparseDerivSeparable </span>type. </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; "> </span>is just a temporary holding the grad_arrary of <span class="Apple-style-span" style="font-family: Monaco; font-size: 11px; ">ad_area</span></div><div><div>which is a <span class="Apple-style-span" style="color: rgb(0, 80, 50); font-family: Monaco; font-size: 11px; ">SparseDeriv object. </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. </div><div>So if we integrate ActivityAnalysis, we should be able to keep ad_area inactive (double type) and so </div><div>the above situation should not occur. </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 <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. </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 </span></div></div><div><span class="Apple-style-span" style="font-family: Monaco; font-size: 11px; "><br></span></div></body></html>