<html><head><meta http-equiv="Content-Type" content="text/html; charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><div class=""><br class=""></div><div class="">   Sajid,</div><div class=""><br class=""></div>   Are the rows truly compute from first to last in order and all entries for a row are available together? <div class=""><br class=""></div><div class="">   Barry<br class=""><div><br class=""><blockquote type="cite" class=""><div class="">On Aug 14, 2020, at 1:00 PM, Sajid Ali <<a href="mailto:sajidsyed2021@u.northwestern.edu" class="">sajidsyed2021@u.northwestern.edu</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class=""><div class=""><br class=""></div><a class="gmail_plusreply" id="m_2948797837340609125m_-3262850175246017405m_2959600615827043074m_-6124977479374237173plusReplyChip-0" href="mailto:knepley@gmail.com" target="_blank">@Matthew Knepley</a> : Thanks for the explanation on preallocation.<br class="">
<div class=""><br class="">>However, why not have a flag so that on the first pass you do not compute entries, just the indices?<br class=""></div><div class=""><br class="">The matrix computes the projection of an image onto a detector so generating this involves computing all possible ray-rectangle intersections and computing the values only differs from computing the indices by a call to calculate intersection lengths. The process to set up the geometry and check for intersections is the same to generate indices and values. <br class=""><br class=""></div><div class="">So, in this case the tradeoff would be to either compute everything twice and save on storage cost or compute everything once and use more memory (essentially compute the matrix rows on each rank, preallocate and then set the matrix values). <br class=""><br class=""></div><div class=""><a class="gmail_plusreply" id="m_2948797837340609125m_-3262850175246017405m_2959600615827043074m_-6124977479374237173plusReplyChip-1" href="mailto:stefano.zampini@gmail.com" target="_blank">@Stefano Zampini</a> : Yes, I only need MatMult and MatMultTranspose in the TAO objective/gradient evaluation but in the current state 
it's cheaper to use a matrix instead of computing the intersections for each objective/gradient evaluation. About ~70% of the application time is spent in MatMult and MatMultTranspose so we're hoping that this would benefit from running on GPU's.  <br class=""><br class="">Thanks for the pointer to MatShell, implementing a matrix free method is something we might pursue in the future.<br class=""></div>

<div class=""><br class="">-- <br class=""><div dir="ltr" class=""><div dir="ltr" class=""><div class=""><div dir="ltr" class=""><div class=""><div dir="ltr" class=""><div style="font-size:12.8px" class="">Sajid Ali | PhD Candidate<br class=""></div><div style="font-size:12.8px" class="">Applied Physics<br class=""></div><div style="font-size:12.8px" class="">Northwestern University</div><div style="font-size:12.8px" class=""><a href="http://s-sajid-ali.github.io/" target="_blank" class="">s-sajid-ali.github.io</a></div></div></div></div></div></div></div></div></div>
</div></blockquote></div><br class=""></div></body></html>