The example continues
8 July 2011 Leave a comment
Yesterday we have seen how can we scatter a matrix which resides on a core among the processes. Now I want to make the code clearer and encapsulate it into a function. I call the function dscatter and the following are the parameters:
- const int& context: input, the blacs context
- const double* const& GlobalMatrix: input, only relevant for the root process; for the other processes it is safe to use a random pointer or NULL
- double*& LocalMatrix: output, the given pointer is useless; a new one will be stored there; an allocation will be performed, so after the execution the user has to free the memory using delete[].
- int& GlobalRows: input for root, output for the other processes; after the execution contains the global number of rows
- int& GlobalCols: input for root, output for the other processes; after the execution contains the global number of columns
- int& BlockRows: input for root, output for the other processes; after the execution contains the number of rows in each block
- int& BlockCols: input for root, output for the other processes; after the execution contains the number of columns in each block
- int& LocalRows: output, after the execution contains the number of rows of the local matrix
- int& LocalCols: output, after the execution contains the number of columns of the local matrix
- const int& root: input, the BLACS id of the matrix that owns the global matrix.
