c++mpidistributed-computingintel-mklscalapack

Should I place a barrier before calling pdpotri()?


I am using pdpotrf() in order to perform the Cholesky decomposition. Then I want to call pdpotri(), in order to invert the matrix. The function is called from every process, just after pdpotrf(). Should I put a barrier there, so that I am sure that all the processes are done with the Cholesky factorization, and then move on to the inversion part, or it's not needed?

I wrote some examples with tiny inputs, which show that it's not needed, but I want to be sure that I am not just (un)lucky and face a problem with larger inputs.

Note that by a barrier I mean this: MPI_Barrier(MPI_COMM_WORLD);


EDIT

I just worry that inverting may start, before some other process has terminated the Cholesky decomposition. Does pdpotri() take care of this? I mean, it checks and waits if needed. Or does pdpotri() work only in the submatrix of its calling process? If so, then no barrier is needed.


Solution

  • While I have not looked into the details of pdpotri() and pdpotrf(), I see two cases:

    1) There needs to be a barrier between the two functions. In this case, however, because pdpotri() must always come after pdpotrf(), it would make the most sense for there to be an implicit boundary built-in to the beginning of pdpotri().

    2) There does not need to be a barrier between the two functions.

    In either case, it should not be necessary for you to write your own explicit barrier using MPI_Barrier().