HP MLIB User's Guide Vol. 2 7th Ed.

Chapter 11 Introduction to Distributed SuperLU 755
Sample programs
/* void superlu_gridexit(gridinfo_t *grid)
* releases the SuperLU_DIST 2D process grid:
*
* grid points to the storage of the SuperLU_DIST
* 2D process grid.
*/
superlu_gridexit(&grid);
MPI_Finalize();
}
2. Sample program for using the driver routine pdgssvx.
#include <math.h>
#include <stdlib.h>
#include "/opt/mlib/include/superlu_ddefs.h"
#define int_t int
main(int_t argc, char *argv[])
/*
* Purpose
* =======
*
* This example illustrates how to use pdgssvx to solve
* the following linear system. The solution is
* x1=x2=x3=x4=x5=1.
*
* -- -- - - - -
* | 1.1 0 1.3 1.4 0 | | x1 | | 3.8 |
* | | | | | |
* | 0 0 2.3 2.4 0 | | x2 | | 4.7 |
* | | | | | |
* | 3.1 3.2 3.3 3.4 0 | | x3 | = | 13.0 |
* | | | | | |
* | 0 4.2 0 4.4 0 | | x4 | | 8.6 |
* | | | | | |
* | 5.1 5.2 0 0 5.5 | | x5 | | 15.8 |
* -- -- - - - -
*
* Five basic steps are required:
* 1. Initialize MPI environment and SuperLU_DIST process grid.
* 2. Set up the input matrix and the right-hand side.
* 3. Set the options arguments.
* 4. Call pdgssvx to solve the linear system.
* 5. Release the process grid and terminate the MPI environment.
*
* Assume the generated executable program is dexample. Then, this
* program can be run by typing:
*
* mpirun -np <procs> dexample -r <proc rows> -c <proc columns>
*
* Note that <procs> should be no less than <proc rows>*<proc columns>
* Note in this example, <proc rows>*<proc columns> should not exceed