<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Thu, Feb 23, 2017 at 12:44 PM, Fangbo Wang <span dir="ltr"><<a href="mailto:fangbowa@buffalo.edu" target="_blank">fangbowa@buffalo.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Assume I need to use Petsc function <font color="#0000ff">Matmult, </font> I need to define a Petsc matrix "<font color="#0000ff">A</font>" and a Petsc vector "<font color="#0000ff">b</font>".<div><font color="#0000ff"><br></font></div><div><font color="#0000ff">Mat A;</font></div><div><font color="#0000ff">Vec b;</font></div><div><font color="#0000ff"><br></font></div><div>can I do MPI_bcast on this vector <font color="#0000ff">b</font>?</div></div></blockquote><div><br></div><div>1) I assume the Bcast has nothing to do with the MatMult.</div><div><br></div><div>2) MPI_Bcast applies only to MPI datatypes. Vec is a pointer to an object structure.</div><div><br></div><div>3) If you want to Bcast the values of a serial vector to all procs, do this:</div><div><br></div><div>  <a href="http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Vec/VecScatterCreateToAll.html#VecScatterCreateToAll">http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Vec/VecScatterCreateToAll.html#VecScatterCreateToAll</a></div><div><br></div><div>  Thanks,</div><div><br></div><div>     Matt</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>Thank you very much!</div><div><font color="#0000ff"><br></font></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Feb 23, 2017 at 1:23 PM, Matthew Knepley <span dir="ltr"><<a href="mailto:knepley@gmail.com" target="_blank">knepley@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Thu, Feb 23, 2017 at 12:09 PM, Fangbo Wang <span dir="ltr"><<a href="mailto:fangbowa@buffalo.edu" target="_blank">fangbowa@buffalo.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">thank you very much!<br></div></blockquote><div><br></div><div>I do not know what you mean about "on PETSc Vectors", but yes you can always call MPI functions whenever you want.</div><div><br></div><div>  Matt</div><span><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><span class="gmail-m_-2801956213819447872m_-942037063756966345HOEnZb"><font color="#888888">-- <br><div class="gmail-m_-2801956213819447872m_-942037063756966345m_3822201598106505606gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><font size="1" color="#9900ff">Fangbo Wang, PhD student</font></div><div><font size="1" color="#9900ff">Stochastic Geomechanics Research Group</font></div><div><span style="color:rgb(153,0,255);font-size:x-small">Department of Civil, Structural and Environmental Engineering</span></div><div><font size="1" color="#9900ff">University at Buffalo</font></div><div><font size="1" color="#9900ff">Email: <u><a href="mailto:fangbowa@buffalo.edu" target="_blank">fangbowa@buffalo.edu</a></u></font></div></div></div></div></div>
</font></span></div>
</blockquote></span></div><span class="gmail-m_-2801956213819447872HOEnZb"><font color="#888888"><br><br clear="all"><span class="gmail-HOEnZb"><font color="#888888"><div><br></div>-- <br><div class="gmail-m_-2801956213819447872m_-942037063756966345gmail_signature">What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br>-- Norbert Wiener</div>
</font></span></font></span></div></div><span class="gmail-HOEnZb"><font color="#888888">
</font></span></blockquote></div><span class="gmail-HOEnZb"><font color="#888888"><br><br clear="all"><div><br></div>-- <br><div class="gmail-m_-2801956213819447872gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><font size="1" color="#9900ff">Fangbo Wang, PhD student</font></div><div><font size="1" color="#9900ff">Stochastic Geomechanics Research Group</font></div><div><span style="color:rgb(153,0,255);font-size:x-small">Department of Civil, Structural and Environmental Engineering</span></div><div><font size="1" color="#9900ff">University at Buffalo</font></div><div><font size="1" color="#9900ff">Email: <u><a href="mailto:fangbowa@buffalo.edu" target="_blank">fangbowa@buffalo.edu</a></u></font></div></div></div></div></div>
</font></span></div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature">What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br>-- Norbert Wiener</div>
</div></div>