Intel® oneAPI Math Kernel Library
Ask questions and share information with other developers who use Intel® Math Kernel Library.
7220 Discussions

How to copy from a global matrix to distributed matrix in Scalapack?

jsjie
Beginner
525 Views

I would like to use pzhengst and others to solve an eigenvalue problem Ax=λBx. Thus, I need to copy from global A and B matrix to distributed ones. However, when calculating A and B, mpi_allreduce is used, so every process has the whole global A and B matrix.

I suppose in this case, zgebs2d and zgebr2d are inefficient, because there is no need for broadcasting? If this is the case, how should I copy from global A matrix to the distributed ones? Should I just pretend that A is a distributed matrix, like suggested in this thread , maybe by generating a context with nprow = npcol = 1, and then generating a desc with nb = n = lld?

Besides, what is the difference between p?lacp2 and p?lacpy? I've checked their documentatino, and found no difference except for the direction of copy.

0 Kudos
1 Solution
Fengrui
Moderator
403 Views

Thank you for posting in the forum!


One thing you could try is to use infog2l function like in the in-package examples (in the file matrix_generator.h). It is to loop over the global matrix and only copy the data to local when iarow==myrow and iacol==mycol. No communication is needed as all processes possess the whole A and B.


For the difference between p?lacp2 and p?lacpy, the former requires that only one dimension of the matrix is distributed, that is the local columns of A are in the same process column or the local rows of A are in the same process row.


Best,

Fengrui



View solution in original post

0 Kudos
1 Reply
Fengrui
Moderator
404 Views

Thank you for posting in the forum!


One thing you could try is to use infog2l function like in the in-package examples (in the file matrix_generator.h). It is to loop over the global matrix and only copy the data to local when iarow==myrow and iacol==mycol. No communication is needed as all processes possess the whole A and B.


For the difference between p?lacp2 and p?lacpy, the former requires that only one dimension of the matrix is distributed, that is the local columns of A are in the same process column or the local rows of A are in the same process row.


Best,

Fengrui



0 Kudos
Reply