ScaLAPACKFX
List of all members
linecomm_module::linecomm Type Reference

Type for communicating a row or a column of a distributed matrix. More...

Detailed Description

Type for communicating a row or a column of a distributed matrix.

The type linecomm collects/distributes a line (row or column) of a distributed matrix into/from a buffer on the master node. It communicate the entire line at once or blockwise, with the blocks having the size of the BLACS block size.

The code below demonstrates how to write out a distributed matrix columnwise to disc with the help of linecomm:

type(linecomm) :: collector
real(dp), allocatable :: iobuffer(:)

allocate(iobuffer(desc(M_))
call collector%init(mygrid, desc, "c")
do icol = 1, desc(N_)
  if (mygrid%master) then
    call collector%getline_master(mygrid, icol, mtxloc, iobuffer)
    write(fd, formatstr) iobuffer(:)
  else
    call collector%getline_slave(mygrid, icol, mtxloc)
  end if
end do

Similarly, to read from a file columnwise, you could do the following:

type(linecomm) :: distributor
real(dp), allocatable :: iobuffer(:)

allocate(iobuffer(desc(M_))
call distributor%init(desc, "c")
do icol = 1, ncol
  if (mygrid%master) then
    read(fd, *) iobuffer(:)
    call distributor%setline_master(mygrid, icol, iobuffer, mtxloc)
  else
    call distributor%setline_slave(mygrid, icol, mtxloc)
  end if
end do

The documentation for this type was generated from the following file: