64 #define __FUNC__ "Euclid_dhCreate"
131 #define __FUNC__ "Euclid_dhDestroy"
161 if (ctx->
scale != NULL)
166 if (ctx->
work != NULL)
171 if (ctx->
work2 != NULL)
176 if (ctx->
slist != NULL)
197 #define __FUNC__ "Euclid_dhSetup"
243 SET_V_ERROR (
"must set ctx->A before calling init");
253 (
"setting up linear system; global rows: %i local rows: %i (on P_0)\n",
257 sprintf (
msgBuf_dh,
"localRow= %i; globalRows= %i; beg_row= %i", m, n,
300 goto END_OF_FUNCTION;
319 if (ctx->
scale == NULL)
326 for (i = 0; i <
m; ++i)
333 if (ctx->
work == NULL)
338 if (ctx->
work2 == NULL)
409 #define __FUNC__ "get_runtime_params_private"
449 if (!strcmp (ctx->
algo_par,
"none"))
453 else if (!strcmp (ctx->
algo_ilu,
"none"))
489 #define __FUNC__ "invert_diagonals_private"
494 int *diag = ctx->
F->
diag;
495 if (aval == NULL || diag == NULL)
497 SET_INFO (
"can't invert diags; either F->aval or F->diag is NULL");
501 int i,
m = ctx->
F->
m;
502 for (i = 0; i <
m; ++i)
504 aval[diag[i]] = 1.0 / aval[diag[i]];
512 #define __FUNC__ "compute_rho_private"
518 double bufLocal[3], bufGlobal[3];
528 bufGlobal[0] = bufLocal[0];
529 bufGlobal[1] = bufLocal[1];
530 bufGlobal[2] = bufLocal[2];
534 MPI_Reduce (bufLocal, bufGlobal, 3, MPI_DOUBLE, MPI_SUM, 0,
542 if (bufGlobal[0] && bufGlobal[1])
544 ctx->
rho_final = bufGlobal[1] / bufGlobal[0];
552 if (bufGlobal[0] && bufGlobal[2])
555 100.0 * bufGlobal[2] / bufGlobal[0];
566 #define __FUNC__ "factor_private"
574 if (!strcmp (ctx->
algo_par,
"none"))
607 if (!strcmp (ctx->
algo_ilu,
"iluk"))
618 (
"only use -mpi, which invokes ilu_mpi_pilu(), for np = 1 and -blocks 1");
634 else if (!strcmp (ctx->
algo_ilu,
"ilut"))
645 sprintf (
msgBuf_dh,
"factorization method: %s is not implemented",
666 else if (!strcmp (ctx->
algo_ilu,
"iluk"))
739 sprintf (
msgBuf_dh,
"factorization method: %s is not implemented",
752 #define __FUNC__ "discard_indices_private"
758 int *rp = ctx->
F->
rp, *cval = ctx->
F->
cval;
759 double *aval = ctx->
F->
aval;
760 int m =
F->
m, *nabors = ctx->nabors, nc = ctx->naborCount;
761 int i, j, k, idx, count = 0, start_of_row;
762 int beg_row = ctx->beg_row, end_row = beg_row +
m;
763 int *diag = ctx->
F->
diag;
770 for (i = 0; i <
m; ++i)
772 for (j = rp[i]; j < rp[i + 1]; ++j)
775 if (col < beg_row || col >= end_row)
778 int owner = find_owner_private_mpi (ctx, col);
781 for (k = 0; k < nc; ++k)
783 if (nabors[k] == owner)
800 "deleting %i indices that would alter the subdomain graph", count);
806 for (i = 0; i <
m; ++i)
808 for (j = start_of_row; j < rp[i + 1]; ++j)
811 double val = aval[j];
819 start_of_row = rp[i + 1];
824 for (i = 0; i <
m; ++i)
826 for (j = rp[i]; j < rp[i + 1]; ++j)
828 if (cval[j] == i + beg_row)
840 #define __FUNC__ "Euclid_dhSolve"
866 #define __FUNC__ "Euclid_dhPrintStats"
885 "\n==================== Euclid report (start) ====================\n");
894 fprintf_dh (fp,
" matrix row count: %i\n", ctx->
n);
902 fprintf_dh (fp,
" solves total: %0.2f (see docs)\n",
906 fprintf_dh (fp,
" subdomain graph setup: %0.2f\n",
913 fprintf_dh (fp,
" misc (should be small): %0.2f\n",
914 timing[SETUP_T] - (timing[SUB_GRAPH_T] + timing[FACTOR_T] +
915 timing[SOLVE_SETUP_T] +
927 fprintf_dh (fp,
"\nApplicable if Euclid's internal solvers were used:\n");
928 fprintf_dh (fp,
"---------------------------------------------------\n");
934 "\n==================== Euclid report (end) ======================\n");
943 #define __FUNC__ "Euclid_dhPrintStatsShort"
967 apply_per_it = apply_total / (double) ctx->
its;
969 perIt = solve / (
double) ctx->
its;
972 fprintf_dh (fp,
"%6s %6s %6s %6s %6s %6s %6s %6s %6s %6s XX\n",
973 "method",
"subdms",
"level",
"its",
"setup",
"solve",
"total",
974 "perIt",
"perIt",
"rows");
976 "------ ----- ----- ----- ----- ----- ----- ----- ----- ----- XX\n");
977 fprintf_dh (fp,
"%6s %6i %6i %6i %6.2f %6.2f %6.2f %6.4f %6.5f %6g XXX\n", ctx->
algo_par,
994 fprintf_dh (fp,
"%6s %6s %6s %6s %6s %6s %6s %6s %6s %6s %6s %6s %6s XX\n",
995 "",
"",
"",
"",
"",
"setup",
"setup",
"",
"",
"",
"",
"",
"");
997 fprintf_dh (fp,
"%6s %6s %6s %6s %6s %6s %6s %6s %6s %6s %6s %6s %6s XX\n",
998 "method",
"subdms",
"level",
"its",
"total",
"factor",
999 "other",
"apply",
"perIt",
"rho",
"A_tol",
"A_%",
"rows");
1001 "------ ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- XX\n");
1004 fprintf_dh (fp,
"%6s %6i %6i %6i %6.2f %6.2f %6.2f %6.2f %6.4f %6.1f %6g %6.2f %6g XXX\n", ctx->
algo_par,
1023 fprintf_dh (fp,
"\n%6s %6s %6s %6s %6s %6s WW\n",
"method",
"level",
1024 "subGph",
"factor",
"solveS",
"perIt");
1025 fprintf_dh (fp,
"------ ----- ----- ----- ----- ----- WW\n");
1026 fprintf_dh (fp,
"%6s %6i %6.2f %6.2f %6.2f %6.4f WWW\n",
1037 #define __FUNC__ "Euclid_dhPrintStatsShorter"
1048 fprintf_dh (fp,
"\nStats from last linear solve: YY\n");
1049 fprintf_dh (fp,
"%6s %6s %6s YY\n",
"its",
"rho",
"A_%");
1051 fprintf_dh (fp,
"%6i %6.2f %6.2f YYY\n", its, rho, nzUsedRatio);
1056 #define __FUNC__ "Euclid_dhPrintScaling"
1065 if (ctx->
scale == NULL)
1067 SET_V_ERROR (
"ctx->scale is NULL; was Euclid_dhSetup() called?");
1070 fprintf (fp,
"\n---------- 1st %i row scaling values:\n", m);
1071 for (i = 0; i <
m; ++i)
1073 fprintf (fp,
" %i %g \n", i + 1, ctx->
scale[i]);
1079 #define __FUNC__ "reduce_timings_private"
1096 #define __FUNC__ "Euclid_dhPrintHypreReport"
1118 "@@@@@@@@@@@@@@@@@@@@@@ Euclid statistical report (start)\n");
1125 if (!strcmp (ctx->
algo_ilu,
"iluk"))
1135 fprintf_dh (fp,
" global matrix row count: %i\n", ctx->
n);
1142 fprintf_dh (fp,
" solves total: %0.2f (see docs)\n",
1146 fprintf_dh (fp,
" subdomain graph setup: %0.2f\n",
1154 fprintf_dh (fp,
" misc (should be small): %0.2f\n",
1155 timing[SETUP_T] - (timing[SUB_GRAPH_T] + timing[FACTOR_T] +
1156 timing[SOLVE_SETUP_T] +
1159 if (ctx->
sg != NULL)
1168 "@@@@@@@@@@@@@@@@@@@@@@ Euclid statistical report (end)\n");
1175 #define __FUNC__ "Euclid_dhPrintTestData"
1186 fprintf (fp,
" setups: %i\n", ctx->
setupCount);
1187 fprintf (fp,
" tri solves: %i\n", ctx->
its);
1188 fprintf (fp,
" parallelization method: %s\n", ctx->
algo_par);
1189 fprintf (fp,
" factorization method: %s\n", ctx->
algo_ilu);
1190 fprintf (fp,
" level: %i\n", ctx->
level);
1191 fprintf (fp,
" row scaling: %i\n", ctx->
isScaled);
void SortedList_dhDestroy(SortedList_dh sList)
void ilut_seq(Euclid_dh ctx)
void ExternalRows_dhSendRows(ExternalRows_dh er)
void SortedList_dhInit(SortedList_dh sList, SubdomainGraph_dh sg)
void SubdomainGraph_dhCreate(SubdomainGraph_dh *s)
double timing[TIMING_BINS]
static void factor_private(Euclid_dh ctx)
void Euclid_dhPrintStatsShorter(Euclid_dh ctx, FILE *fp)
char algo_par[MAX_OPT_LEN]
void Factor_dhInit(void *A, bool fillFlag, bool avalFlag, double rho, int id, int beg_rowP, Factor_dh *Fout)
void Euclid_dhPrintScaling(Euclid_dh ctx, FILE *fp)
bool Parser_dhHasSwitch(Parser_dh p, char *s)
static void reduce_timings_private(Euclid_dh ctx)
static void get_runtime_params_private(Euclid_dh ctx)
void ExternalRows_dhRecvRows(ExternalRows_dh er)
void SubdomainGraph_dhPrintRatios(SubdomainGraph_dh s, FILE *fp)
void SubdomainGraph_dhPrintStats(SubdomainGraph_dh sg, FILE *fp)
char krylovMethod[MAX_OPT_LEN]
void cg_euclid(Mat_dh A, Euclid_dh ctx, double *x, double *b, int *itsOUT)
void printf_dh(char *fmt,...)
void Parser_dhInsert(Parser_dh p, char *option, char *value)
bool Parser_dhReadDouble(Parser_dh p, char *in, double *out)
bool Parser_dhReadInt(Parser_dh p, char *in, int *out)
void iluk_mpi_bj(Euclid_dh ctx)
void Euclid_dhPrintTestData(Euclid_dh ctx, FILE *fp)
void bicgstab_euclid(Mat_dh A, Euclid_dh ctx, double *x, double *b, int *itsOUT)
void fprintf_dh(FILE *fp, char *fmt,...)
void Factor_dhSolveSetup(Factor_dh mat, SubdomainGraph_dh sg)
void iluk_mpi_pilu(Euclid_dh ctx)
static void compute_rho_private(Euclid_dh ctx)
void Euclid_dhPrintStats(Euclid_dh ctx, FILE *fp)
void Euclid_dhCreate(Euclid_dh *ctxOUT)
#define PIVOT_FIX_DEFAULT
void SubdomainGraph_dhDestroy(SubdomainGraph_dh s)
bool Parser_dhReadString(Parser_dh p, char *in, char **out)
void iluk_seq_block(Euclid_dh ctx)
char algo_ilu[MAX_OPT_LEN]
void ExternalRows_dhInit(ExternalRows_dh er, Euclid_dh ctx)
void ExternalRows_dhDestroy(ExternalRows_dh er)
static void invert_diagonals_private(Euclid_dh ctx)
void Euclid_dhDestroy(Euclid_dh ctx)
void ExternalRows_dhCreate(ExternalRows_dh *er)
void Euclid_dhSolve(Euclid_dh ctx, Vec_dh x, Vec_dh b, int *its)
void iluk_seq(Euclid_dh ctx)
void SortedList_dhCreate(SortedList_dh *sList)
void Euclid_dhSetup(Euclid_dh ctx)
void Euclid_dhPrintHypreReport(Euclid_dh ctx, FILE *fp)
char msgBuf_dh[MSG_BUF_SIZE_DH]
void EuclidGetDimensions(void *A, int *beg_row, int *rowsLocal, int *rowsGlobal)
int Factor_dhReadNz(Factor_dh mat)
void SubdomainGraph_dhInit(SubdomainGraph_dh s, int blocks, bool bj, void *A)
void Euclid_dhPrintStatsShort(Euclid_dh ctx, double setup, double solve, FILE *fp)
void Factor_dhDestroy(Factor_dh mat)