25 int main (
int argc,
char **argv)
29 double dparm[DPARM_SIZE];
31 char *filename = NULL;
32 spmatrix_t *spm, spm2;
33 void *x, *b, *x0 = NULL;
53 &check, &scatter, &driver, &filename );
58 pastixInit( &pastix_data, MPI_COMM_WORLD, iparm, dparm );
63 spm = malloc(
sizeof( spmatrix_t ) );
65 rc = spmReadDriverDist( driver, filename, spm, MPI_COMM_WORLD );
68 rc = spmReadDriver( driver, filename, spm );
71 if ( rc != SPM_SUCCESS ) {
76 spmPrintInfo( spm, stdout );
78 rc = spmCheckAndCorrect( spm, &spm2 );
88 if ( spm->flttype == SpmPattern ) {
89 spmGenFakeValues( spm );
103 double normA = spmNorm( SpmFrobeniusNorm, spm );
104 spmScal( 1./normA, spm );
106 size = pastix_size_of( spm->flttype ) * spm->nexp * nrhs;
114 for (i = 0; i < nfact; i++)
122 for (j = 0; j < nsolv; j++)
130 spmGenRHS( SpmRhsRndX, nrhs, spm, x0, spm->nexp, b, spm->nexp );
131 memcpy( x, b, size );
134 spmGenRHS( SpmRhsRndB, nrhs, spm, NULL, spm->nexp, x, spm->nexp );
137 spmScalMat( 1./normA, spm, nrhs, b, spm->nexp );
140 memcpy( b, x, size );
BEGIN_C_DECLS typedef int pastix_int_t
int pastix_subtask_symbfact(pastix_data_t *pastix_data)
Computes the symbolic factorization step.
int pastix_subtask_order(pastix_data_t *pastix_data, const spmatrix_t *spm, pastix_order_t *myorder)
Computes the ordering of the given graph in parameters.
int pastix_subtask_blend(pastix_data_t *pastix_data)
Compute the proportional mapping and the final solver structure.
int pastix_subtask_reordering(pastix_data_t *pastix_data)
Apply the reordering step to compact off-diagonal blocks.
void pastixFinalize(pastix_data_t **pastix_data)
Finalize the solver instance.
void pastixInitParam(pastix_int_t *iparm, double *dparm)
Initialize the iparm and dparm arrays to their default values.
void pastixInit(pastix_data_t **pastix_data, PASTIX_Comm pastix_comm, pastix_int_t *iparm, double *dparm)
Initialize the solver instance.
@ DPARM_EPSILON_REFINEMENT
void pastixGetOptions(int argc, char **argv, pastix_int_t *iparm, double *dparm, int *check, int *scatter, spm_driver_t *driver, char **filename)
PaStiX helper function to read command line options in examples.
int pastix_subtask_sopalin(pastix_data_t *pastix_data)
Factorize the given problem using Cholesky or LU decomposition.
int pastix_subtask_spm2bcsc(pastix_data_t *pastix_data, spmatrix_t *spm)
Fill the internal block CSC structure.
int pastix_subtask_bcsc2ctab(pastix_data_t *pastix_data)
Fill the internal solver matrix structure.
int pastix_task_refine(pastix_data_t *pastix_data, pastix_int_t n, pastix_int_t nrhs, void *B, pastix_int_t ldb, void *X, pastix_int_t ldx)
Perform iterative refinement.
int pastix_task_solve(pastix_data_t *pastix_data, pastix_int_t m, pastix_int_t nrhs, void *B, pastix_int_t ldb)
Solve the given problem.
Main PaStiX data structure.