HP MLIB User's Guide Vol. 2 7th Ed.
750 HP MLIB LAPACK User’s Guide
Sample programs
*
* 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>
*
*/
{
superlu_options_t options;
SuperLUStat_t stat;
SuperMatrix A;
NCformat *Astore;
ScalePermstruct_t ScalePermstruct;
LUstruct_t LUstruct;
gridinfo_t grid;
double *berr;
double *a, *b;
int_t *rowind, *colptr;
int_t m, n, nnz;
int_t nprow, npcol;
int_t iam, info, ldb, ldx, nrhs, i;
char trans[1];
char **cpp, c;
nprow = 1; /* Set default process rows. */
npcol = 1; /* Set default process columns. */
nrhs = 1; /* Number of right-hand side. */
/* Parse command line argv[]. */
for (cpp = argv+1; *cpp; ++cpp) {
if ( **cpp == ‘-’ ) {
c = *(*cpp+1);
++cpp;
switch (c) {
case ‘r’: nprow = atoi(*cpp);
break;
case ‘c’: npcol = atoi(*cpp);
break;
}
}
}
/* ------------------------------------------------------------
Initialize MPI environment and SuperLU_DIST process grid.
------------------------------------------------------------*/
MPI_Init( &argc, &argv );
/* void superlu_gridinit(MPI_Comm Bcomm, int_t nprow, int_t npcol,
* gridinfo_t *grid)