In this section, we show how the PLAPACK API can be used to generate the contents of linear algebra objects.
In Chapter 2, Example 2.3 showed how to initialize the PLAPACK library, create objects, call a simple PLAPACK matrix-vector multiplication routine, and clean up the PLAPACK environment. In that example, we assumed the existence of a routine, A_x_fill, that filled global matrix A and vector x and another, process_vector that extracted the global result vector y . In our first example, we show how one can generate matrix A and vector x on node zero, and distribute them to the global objects.
Notice that the above example is useful when one wishes to validate the results from a PLAPACK implementation of an algorithm against a sequential version of the algorithm. To complete such a validation, we need to be able to bring the result of the computation back to node zero. In the next example, we show how the contents of a global vector can be gathered to node zero.
Naturally, it is unreasonable to generate problems on a single node, since then the local available memory restricts the problem size and no parallelism is attained during the matrix generation phase of an application. In the next example, we show how different blocks in a matrix can be generated and distributed in parallel.