43#define EPETRA_HAVE_JADMATRIX
44#define EPETRA_VERY_SHORT_PERFTEST
45#define EPETRA_HAVE_STATICPROFILE
64#include "../epetra_test_err.h"
66#ifdef EPETRA_HAVE_JADMATRIX
72void GenerateCrsProblem(
int numNodesX,
int numNodesY,
int numProcsX,
int numProcsY,
int numPoints,
73 int * xoff,
int * yoff,
74 const Epetra_Comm &comm,
bool verbose,
bool summary,
79 Epetra_Vector *&xexact,
bool StaticProfile,
bool MakeLocalOnly);
81void GenerateCrsProblem(
int numNodesX,
int numNodesY,
int numProcsX,
int numProcsY,
int numPoints,
82 int * xoff,
int * yoff,
int nrhs,
83 const Epetra_Comm &comm,
bool verbose,
bool summary,
90void GenerateVbrProblem(
int numNodesX,
int numNodesY,
int numProcsX,
int numProcsY,
int numPoints,
91 int * xoff,
int * yoff,
92 int nsizes,
int * sizes,
93 const Epetra_Comm &comm,
bool verbose,
bool summary,
98 Epetra_Vector *&xexact,
bool StaticProfile,
bool MakeLocalOnly);
100void GenerateVbrProblem(
int numNodesX,
int numNodesY,
int numProcsX,
int numProcsY,
int numPoints,
101 int * xoff,
int * yoff,
102 int nsizes,
int * sizes,
int nrhs,
103 const Epetra_Comm &comm,
bool verbose,
bool summary,
111 int myPID,
int * & myGlobalElements);
115#ifdef EPETRA_HAVE_JADMATRIX
121 bool StaticProfile,
bool verbose,
bool summary);
122int main(
int argc,
char *argv[])
133 MPI_Init(&argc,&argv);
139 bool verbose =
false;
140 bool summary =
false;
143 if (argc>6)
if (argv[6][0]==
'-' && argv[6][1]==
'v') verbose =
true;
146 if (argc>6)
if (argv[6][0]==
'-' && argv[6][1]==
's') summary =
true;
149 cerr <<
"Usage: " << argv[0]
150 <<
" NumNodesX NumNodesY NumProcX NumProcY NumPoints [-v|-s]" << endl
152 <<
"NumNodesX - Number of mesh nodes in X direction per processor" << endl
153 <<
"NumNodesY - Number of mesh nodes in Y direction per processor" << endl
154 <<
"NumProcX - Number of processors to use in X direction" << endl
155 <<
"NumProcY - Number of processors to use in Y direction" << endl
156 <<
"NumPoints - Number of points to use in stencil (5, 9 or 25 only)" << endl
157 <<
"-v|-s - (Optional) Run in verbose mode if -v present or summary mode if -s present" << endl
158 <<
" NOTES: NumProcX*NumProcY must equal the number of processors used to run the problem." << endl << endl
159 <<
" Serial example:" << endl
160 << argv[0] <<
" 16 12 1 1 25 -v" << endl
161 <<
" Run this program in verbose mode on 1 processor using a 16 X 12 grid with a 25 point stencil."<< endl <<endl
162 <<
" MPI example:" << endl
163 <<
"mpirun -np 32 " << argv[0] <<
" 10 12 4 8 9 -v" << endl
164 <<
" Run this program in verbose mode on 32 processors putting a 10 X 12 subgrid on each processor using 4 processors "<< endl
165 <<
" in the X direction and 8 in the Y direction. Total grid size is 40 points in X and 96 in Y with a 9 point stencil."<< endl
176 if (verbose && comm.
MyPID()==0)
178 if (summary && comm.
MyPID()==0) {
182 cout << endl << endl;
185 if (verbose) cout << comm <<endl;
190 if (verbose && comm.
MyPID()!=0) verbose =
false;
191 if (summary && comm.
MyPID()!=0) summary =
false;
193 int numNodesX = atoi(argv[1]);
194 int numNodesY = atoi(argv[2]);
195 int numProcsX = atoi(argv[3]);
196 int numProcsY = atoi(argv[4]);
197 int numPoints = atoi(argv[5]);
199 if (verbose || (summary && comm.
NumProc()==1)) {
200 cout <<
" Number of local nodes in X direction = " << numNodesX << endl
201 <<
" Number of local nodes in Y direction = " << numNodesY << endl
202 <<
" Number of global nodes in X direction = " << numNodesX*numProcsX << endl
203 <<
" Number of global nodes in Y direction = " << numNodesY*numProcsY << endl
204 <<
" Number of local nonzero entries = " << numNodesX*numNodesY*numPoints << endl
205 <<
" Number of global nonzero entries = " << numNodesX*numNodesY*numPoints*numProcsX*numProcsY << endl
206 <<
" Number of Processors in X direction = " << numProcsX << endl
207 <<
" Number of Processors in Y direction = " << numProcsY << endl
208 <<
" Number of Points in stencil = " << numPoints << endl << endl;
211 if (summary && comm.
NumProc()>1)
212 cout << endl << endl << endl << endl << endl << endl << endl << endl<< endl << endl;
214 if (numProcsX*numProcsY!=comm.
NumProc()) {
215 cerr <<
"Number of processors = " << comm.
NumProc() << endl
216 <<
" is not the product of " << numProcsX <<
" and " << numProcsY << endl << endl;
220 if (numPoints!=5 && numPoints!=9 && numPoints!=25) {
221 cerr <<
"Number of points specified = " << numPoints << endl
222 <<
" is not 5, 9, 25" << endl << endl;
226 if (numNodesX*numNodesY<=0) {
227 cerr <<
"Product of number of nodes is <= zero" << endl << endl;
238 Xoff[0] = -1; Xoff[1] = 1; Xoff[2] = 0; Xoff[3] = 0; Xoff[4] = 0;
239 Yoff[0] = 0; Yoff[1] = 0; Yoff[2] = 0; Yoff[3] = -1; Yoff[4] = 1;
244 XLoff[0] = -1; XLoff[1] = 0;
245 YLoff[0] = 0; YLoff[1] = -1;
250 XUoff[0] = 0; XUoff[1] = 1; XUoff[2] = 0;
251 YUoff[0] = 0; YUoff[1] = 0; YUoff[2] = 1;
253 else if (numPoints==9) {
257 Xoff[0] = -1; Xoff[1] = 0; Xoff[2] = 1;
258 Yoff[0] = -1; Yoff[1] = -1; Yoff[2] = -1;
259 Xoff[3] = -1; Xoff[4] = 0; Xoff[5] = 1;
260 Yoff[3] = 0; Yoff[4] = 0; Yoff[5] = 0;
261 Xoff[6] = -1; Xoff[7] = 0; Xoff[8] = 1;
262 Yoff[6] = 1; Yoff[7] = 1; Yoff[8] = 1;
267 XLoff[0] = -1; XLoff[1] = 0; Xoff[2] = 1;
268 YLoff[0] = -1; YLoff[1] = -1; Yoff[2] = -1;
269 XLoff[3] = -1; XLoff[4] = 0;
270 YLoff[3] = 0; YLoff[4] = 0;
277 XUoff[1] = -1; XUoff[2] = 0; XUoff[3] = 1;
278 YUoff[1] = 1; YUoff[2] = 1; YUoff[3] = 1;
286 int xo = -2, yo = -2;
287 Xoff[xi++] = xo++; Xoff[xi++] = xo++; Xoff[xi++] = xo++; Xoff[xi++] = xo++; Xoff[xi++] = xo++;
288 Yoff[yi++] = yo ; Yoff[yi++] = yo ; Yoff[yi++] = yo ; Yoff[yi++] = yo ; Yoff[yi++] = yo ;
290 Xoff[xi++] = xo++; Xoff[xi++] = xo++; Xoff[xi++] = xo++; Xoff[xi++] = xo++; Xoff[xi++] = xo++;
291 Yoff[yi++] = yo ; Yoff[yi++] = yo ; Yoff[yi++] = yo ; Yoff[yi++] = yo ; Yoff[yi++] = yo ;
293 Xoff[xi++] = xo++; Xoff[xi++] = xo++; Xoff[xi++] = xo++; Xoff[xi++] = xo++; Xoff[xi++] = xo++;
294 Yoff[yi++] = yo ; Yoff[yi++] = yo ; Yoff[yi++] = yo ; Yoff[yi++] = yo ; Yoff[yi++] = yo ;
296 Xoff[xi++] = xo++; Xoff[xi++] = xo++; Xoff[xi++] = xo++; Xoff[xi++] = xo++; Xoff[xi++] = xo++;
297 Yoff[yi++] = yo ; Yoff[yi++] = yo ; Yoff[yi++] = yo ; Yoff[yi++] = yo ; Yoff[yi++] = yo ;
299 Xoff[xi++] = xo++; Xoff[xi++] = xo++; Xoff[xi++] = xo++; Xoff[xi++] = xo++; Xoff[xi++] = xo++;
300 Yoff[yi++] = yo ; Yoff[yi++] = yo ; Yoff[yi++] = yo ; Yoff[yi++] = yo ; Yoff[yi++] = yo ;
307 XLoff[xi++] = xo++; XLoff[xi++] = xo++; XLoff[xi++] = xo++; XLoff[xi++] = xo++; XLoff[xi++] = xo++;
308 YLoff[yi++] = yo ; YLoff[yi++] = yo ; YLoff[yi++] = yo ; YLoff[yi++] = yo ; YLoff[yi++] = yo ;
310 XLoff[xi++] = xo++; XLoff[xi++] = xo++; XLoff[xi++] = xo++; XLoff[xi++] = xo++; XLoff[xi++] = xo++;
311 YLoff[yi++] = yo ; YLoff[yi++] = yo ; YLoff[yi++] = yo ; YLoff[yi++] = yo ; YLoff[yi++] = yo ;
313 XLoff[xi++] = xo++; XLoff[xi++] = xo++; XLoff[xi++] = xo++;
314 YLoff[yi++] = yo ; YLoff[yi++] = yo ; YLoff[yi++] = yo ;
321 XUoff[xi++] = xo++; XUoff[xi++] = xo++; XUoff[xi++] = xo++;
322 YUoff[yi++] = yo ; YUoff[yi++] = yo ; YUoff[yi++] = yo ;
324 XUoff[xi++] = xo++; XUoff[xi++] = xo++; XUoff[xi++] = xo++; XUoff[xi++] = xo++; XUoff[xi++] = xo++;
325 YUoff[yi++] = yo ; YUoff[yi++] = yo ; YUoff[yi++] = yo ; YUoff[yi++] = yo ; YUoff[yi++] = yo ;
327 XUoff[xi++] = xo++; XUoff[xi++] = xo++; XUoff[xi++] = xo++; XUoff[xi++] = xo++; XUoff[xi++] = xo++;
328 YUoff[yi++] = yo ; YUoff[yi++] = yo ; YUoff[yi++] = yo ; YUoff[yi++] = yo ; YUoff[yi++] = yo ;
353#ifdef EPETRA_VERY_SHORT_PERFTEST
355#elif EPETRA_SHORT_PERFTEST
360 for (
int j=0; j<jstop; j++) {
361 for (
int k=1; k<17; k++) {
362#ifdef EPETRA_VERY_SHORT_PERFTEST
363 if (k<3 || (k%4==0 && k<9)) {
364#elif EPETRA_SHORT_PERFTEST
370 if (verbose) cout <<
"\n*************** Results for " << nrhs <<
" RHS with ";
372 bool StaticProfile = (j!=0);
374 if (StaticProfile) cout <<
" static profile\n";
375 else cout <<
" dynamic profile\n";
379 Xoff.
Values(), Yoff.
Values(), nrhs, comm, verbose, summary,
380 map, A, b, bt, xexact, StaticProfile,
false);
383#ifdef EPETRA_HAVE_JADMATRIX
388 if (verbose) cout <<
"Time to create Jagged diagonal matrix = " << elapsed_time << endl;
396 runMatrixTests(A, b, bt, xexact, StaticProfile, verbose, summary);
404 XLoff.
Values(), YLoff.
Values(), nrhs, comm, verbose, summary,
405 mapL, L, bL, btL, xexactL, StaticProfile,
true);
409 XUoff.
Values(), YUoff.
Values(), nrhs, comm, verbose, summary,
410 mapU, U, bU, btU, xexactU, StaticProfile,
true);
413 runLUMatrixTests(L, bL, btL, xexactL, U, bU, btU, xexactU, StaticProfile, verbose, summary);
443 for(
int i = 0; i < 10; ++i )
447 total_flops = q.
Flops();
448 MFLOPs = total_flops/elapsed_time/1000000.0;
449 if (verbose) cout <<
"\nTotal MFLOPs for 10 Norm2's= " << MFLOPs << endl;
452 if (comm.
NumProc()==1) cout <<
"Norm2" <<
'\t';
453 cout << MFLOPs << endl;
460 for(
int i = 0; i < 10; ++i )
464 total_flops = q.
Flops();
465 MFLOPs = total_flops/elapsed_time/1000000.0;
466 if (verbose) cout <<
"Total MFLOPs for 10 Dot's = " << MFLOPs << endl;
469 if (comm.
NumProc()==1) cout <<
"DotProd" <<
'\t';
470 cout << MFLOPs << endl;
477 for(
int i = 0; i < 10; ++i )
478 q.
Update(1.0, z, 1.0, r, 0.0);
481 total_flops = q.
Flops();
482 MFLOPs = total_flops/elapsed_time/1000000.0;
483 if (verbose) cout <<
"Total MFLOPs for 10 Updates= " << MFLOPs << endl;
486 if (comm.
NumProc()==1) cout <<
"Update" <<
'\t';
487 cout << MFLOPs << endl;
533 int * xoff,
int * yoff,
534 const Epetra_Comm &comm,
bool verbose,
bool summary,
539 Epetra_Vector *&xexact,
bool StaticProfile,
bool MakeLocalOnly) {
544 xoff, yoff, 1, comm, verbose, summary,
545 map, A, b1, bt1, xexact1, StaticProfile, MakeLocalOnly);
555 int * xoff,
int * yoff,
int nrhs,
556 const Epetra_Comm &comm,
bool verbose,
bool summary,
565 int * myGlobalElements;
568 int numMyEquations = numNodesX*numNodesY;
570 map =
new Epetra_Map(-1, numMyEquations, myGlobalElements, 0, comm);
571 delete [] myGlobalElements;
575 int profile = 0;
if (StaticProfile) profile = numPoints;
577#ifdef EPETRA_HAVE_STATICPROFILE
593 int * indices =
new int[numPoints];
594 double * values =
new double[numPoints];
596 double dnumPoints = (double) numPoints;
597 int nx = numNodesX*numProcsX;
599 for (
int i=0; i<numMyEquations; i++) {
601 int rowID = map->
GID(i);
604 for (
int j=0; j<numPoints; j++) {
605 int colID = rowID + xoff[j] + nx*yoff[j];
606 if (colID>-1 && colID<numGlobalEquations) {
607 indices[numIndices] = colID;
608 double value = - ((double) rand())/ ((
double) RAND_MAX);
610 values[numIndices++] = dnumPoints - value;
612 values[numIndices++] = value;
627 cout <<
"Time to insert matrix values = " << insertTime << endl
628 <<
"Time to complete fill = " << fillCompleteTime << endl;
630 if (comm.
NumProc()==1) cout <<
"InsertTime" <<
'\t';
631 cout << insertTime << endl;
632 if (comm.
NumProc()==1) cout <<
"FillCompleteTime" <<
'\t';
633 cout << fillCompleteTime << endl;
696 int * xoff,
int * yoff,
697 int nsizes,
int * sizes,
698 const Epetra_Comm &comm,
bool verbose,
bool summary,
703 Epetra_Vector *&xexact,
bool StaticProfile,
bool MakeLocalOnly) {
708 xoff, yoff, nsizes, sizes,
709 1, comm, verbose, summary, map, A, b1, bt1, xexact1, StaticProfile, MakeLocalOnly);
719 int * xoff,
int * yoff,
720 int nsizes,
int * sizes,
int nrhs,
721 const Epetra_Comm &comm,
bool verbose,
bool summary,
731 int * myGlobalElements;
734 int numMyElements = numNodesX*numNodesY;
736 Epetra_Map ptMap(-1, numMyElements, myGlobalElements, 0, comm);
737 delete [] myGlobalElements;
742 for (i=0; i<numMyElements; i++)
743 elementSizes[i] = sizes[ptMap.
GID(i)%nsizes];
748 int profile = 0;
if (StaticProfile) profile = numPoints;
755 int * indices =
new int[numPoints];
760 int maxElementSize = 0;
761 for (i=0; i< nsizes; i++) maxElementSize =
EPETRA_MAX(maxElementSize, sizes[i]);
767 int nx = numNodesX*numProcsX;
770 for (i=0; i<numMyElements; i++) {
771 int rowID = map->
GID(i);
773 int rowDim = sizes[rowID%nsizes];
774 for (j=0; j<numPoints; j++) {
775 int colID = rowID + xoff[j] + nx*yoff[j];
776 if (colID>-1 && colID<numGlobalEquations)
777 indices[numIndices++] = colID;
782 for (j=0; j < numIndices; j++) {
783 int colDim = sizes[indices[j]%nsizes];
800 int numBlockDiagonalEntries;
804 for (i=0; i< numBlockDiagonalEntries; i++) {
809 for (j=0; j<rowDim; j++) diagVals[j+j*diagLDA] = rowSums[diagoffsets[i]+j];
832 int myPID,
int * & myGlobalElements) {
834 myGlobalElements =
new int[numNodesX*numNodesY];
835 int myProcX = myPID%numProcsX;
836 int myProcY = myPID/numProcsX;
837 int curGID = myProcY*(numProcsX*numNodesX)*numNodesY+myProcX*numNodesX;
838 for (
int j=0; j<numNodesY; j++) {
839 for (
int i=0; i<numNodesX; i++) {
840 myGlobalElements[j*numNodesX+i] = curGID+i;
842 curGID+=numNodesX*numProcsX;
860 std::string statdyn =
"dynamic";
861 if (StaticProfile) statdyn =
"static ";
863 for (
int j=0; j<4; j++) {
865 bool TransA = (j==1 || j==3);
866 std::string contig =
"without";
867 if (j>1) contig =
"with ";
869#ifdef EPETRA_SHORT_PERFTEST
874 for (
int k=kstart; k<2; k++) {
876 std::string oldnew =
"old";
877 if (k>0) oldnew =
"new";
886#ifndef EPETRA_SHORT_PERFTEST
887 for(
int i = 0; i < 10; ++i )
893 for(
int i = 0; i < 10; ++i )
898 double total_flops = A->
Flops();
902 r.
Update(-1.0, z, 1.0, *bt, 0.0);
904 r.
Update(-1.0, z, 1.0, *b, 0.0);
908 if (verbose) cout <<
"ResNorm = " << resvec.
NormInf() <<
": ";
909 double MFLOPs = total_flops/elapsed_time/1000000.0;
910 if (verbose) cout <<
"Total MFLOPs for 10 " << oldnew <<
" MatVec's with " << statdyn <<
" Profile (Trans = " << TransA
911 <<
") and " << contig <<
" optimized storage = " << MFLOPs <<
" (" << elapsed_time <<
" s)" <<endl;
914 if (TransA) cout <<
"TransMv" << statdyn<<
"Prof" << contig <<
"OptStor" <<
'\t';
915 else cout <<
"NoTransMv" << statdyn <<
"Prof" << contig <<
"OptStor" <<
'\t';
917 cout << MFLOPs << endl;
923#ifdef EPETRA_HAVE_JADMATRIX
936 for (
int j=0; j<2; j++) {
938 bool TransA = (j==1);
944 for(
int i = 0; i < 10; ++i )
945 A->
Apply(*xexact, z);
948 double total_flops = A->
Flops();
952 r.
Update(-1.0, z, 1.0, *bt, 0.0);
954 r.
Update(-1.0, z, 1.0, *b, 0.0);
958 if (verbose) cout <<
"ResNorm = " << resvec.
NormInf() <<
": ";
959 double MFLOPs = total_flops/elapsed_time/1000000.0;
960 if (verbose) cout <<
"Total MFLOPs for 10 " <<
" Jagged Diagonal MatVec's with (Trans = " << TransA
961 <<
") " << MFLOPs <<
" (" << elapsed_time <<
" s)" <<endl;
964 if (TransA) cout <<
"TransMv" <<
'\t';
965 else cout <<
"NoTransMv" <<
'\t';
967 cout << MFLOPs << endl;
976 bool StaticProfile,
bool verbose,
bool summary) {
979 bL->
Update(1.0, *xexactL, 1.0);
980 btL->
Update(1.0, *xexactL, 1.0);
983 bU->
Update(1.0, *xexactU, 1.0);
984 btU->
Update(1.0, *xexactU, 1.0);
996 std::string statdyn =
"dynamic";
997 if (StaticProfile) statdyn =
"static ";
999 for (
int j=0; j<4; j++) {
1001 bool TransA = (j==1 || j==3);
1002 std::string contig =
"without";
1003 if (j>1) contig =
"with ";
1017 for(
int i = 0; i < 10; ++i )
1018 L->
Solve(Upper, TransA, UnitDiagonal, *b, z);
1021 double total_flops = L->
Flops();
1024 r.
Update(-1.0, z, 1.0, *xexactL, 0.0);
1027 if (resvec.
NormInf()>0.000001) {
1028 cout <<
"resvec = " << resvec << endl;
1029 cout <<
"z = " << z << endl;
1030 cout <<
"xexactL = " << *xexactL << endl;
1031 cout <<
"r = " << r << endl;
1034 if (verbose) cout <<
"ResNorm = " << resvec.
NormInf() <<
": ";
1035 double MFLOPs = total_flops/elapsed_time/1000000.0;
1036 if (verbose) cout <<
"Total MFLOPs for 10 " <<
" Lower solves " << statdyn <<
" Profile (Trans = " << TransA
1037 <<
") and " << contig <<
" opt storage = " << MFLOPs <<
" (" << elapsed_time <<
" s)" <<endl;
1040 if (TransA) cout <<
"TransLSv" << statdyn<<
"Prof" << contig <<
"OptStor" <<
'\t';
1041 else cout <<
"NoTransLSv" << statdyn <<
"Prof" << contig <<
"OptStor" <<
'\t';
1043 cout << MFLOPs << endl;
1051 b = TransA ? btU : bU;
1052 for(
int i = 0; i < 10; ++i )
1053 U->
Solve(Upper, TransA, UnitDiagonal, *b, z);
1056 total_flops = U->
Flops();
1059 r.
Update(-1.0, z, 1.0, *xexactU, 0.0);
1063 cout <<
"U = " << *U << endl;
1065 cout <<
"z = " << z << endl;
1066 cout <<
"xexactU = " << *xexactU << endl;
1068 cout <<
"b = " << *b << endl;
1072 if (verbose) cout <<
"ResNorm = " << resvec.
NormInf() <<
": ";
1073 MFLOPs = total_flops/elapsed_time/1000000.0;
1074 if (verbose) cout <<
"Total MFLOPs for 10 " <<
" Upper solves " << statdyn <<
" Profile (Trans = " << TransA
1075 <<
") and " << contig <<
" opt storage = " << MFLOPs <<endl;
1078 if (TransA) cout <<
"TransUSv" << statdyn<<
"Prof" << contig <<
"OptStor" <<
'\t';
1079 else cout <<
"NoTransUSv" << statdyn <<
"Prof" << contig <<
"OptStor" <<
'\t';
1081 cout << MFLOPs << endl;
std::string Epetra_Version()
virtual int Apply(const Epetra_MultiVector &X, Epetra_MultiVector &Y) const
Returns the result of a Epetra_RowMatrix applied to a Epetra_MultiVector X in Y.
virtual const Epetra_Comm & Comm() const
Returns a pointer to the Epetra_Comm communicator associated with this matrix.
virtual int SetUseTranspose(bool use_transpose)
If set true, transpose of this operator will be applied.
Epetra_BlockMap: A class for partitioning block element vectors and matrices.
int MyGlobalElements(int *MyGlobalElementList) const
Puts list of global elements on this processor into the user-provided array.
int GID(int LID) const
Returns global ID of local ID, return IndexBase-1 if not found on this processor.
int IndexBase() const
Index base for this map.
int ElementSize() const
Returns the size of elements in the map; only valid if map has constant element size.
int * FirstPointInElementList() const
Pointer to internal array containing a mapping between the local elements and the first local point n...
int NumGlobalElements() const
Number of elements across all processors.
const Epetra_Comm & Comm() const
Access function for Epetra_Comm communicator.
Epetra_Comm: The Epetra Communication Abstract Base Class.
virtual int NumProc() const =0
Returns total number of processes.
virtual int MyPID() const =0
Return my process ID.
void SetFlopCounter(const Epetra_Flops &FlopCounter_in)
Set the internal Epetra_Flops() pointer.
double Flops() const
Returns the number of floating point operations with this multi-vector.
Epetra_CrsMatrix: A class for constructing and using real-valued double-precision sparse compressed r...
int FillComplete(bool OptimizeDataStorage=true)
Signal that data entry is complete. Perform transformations to local index space.
int Solve(bool Upper, bool Trans, bool UnitDiagonal, const Epetra_Vector &x, Epetra_Vector &y) const
Returns the result of a local solve using the Epetra_CrsMatrix on a Epetra_Vector x in y.
int Multiply1(bool TransA, const Epetra_Vector &x, Epetra_Vector &y) const
const Epetra_Comm & Comm() const
Returns a pointer to the Epetra_Comm communicator associated with this matrix.
int OptimizeStorage()
Make consecutive row index sections contiguous, minimize internal storage used for constructing graph...
int Multiply(bool TransA, const Epetra_Vector &x, Epetra_Vector &y) const
Returns the result of a Epetra_CrsMatrix multiplied by a Epetra_Vector x in y.
virtual int InsertGlobalValues(int GlobalRow, int NumEntries, const double *Values, const int *Indices)
Insert a list of elements in a given global row of the matrix.
bool NoDiagonal() const
If matrix has no diagonal entries in global index space, this query returns true, otherwise it return...
Epetra_Flops: The Epetra Floating Point Operations Class.
void ResetFlops()
Resets the number of floating point operations to zero for this multi-vector.
Epetra_IntSerialDenseVector: A class for constructing and using dense vectors.
int Size(int Length_in)
Set length of a Epetra_IntSerialDenseVector object; init values to zero.
int Length() const
Returns length of vector.
int * Values()
Returns pointer to the values in vector.
Epetra_IntVector: A class for constructing and using dense integer vectors on a parallel computer.
int * Values() const
Returns a pointer to an array containing the values of this vector.
Epetra_JadMatrix: A class for constructing matrix objects optimized for common kernels.
Epetra_LocalMap: A class for replicating vectors and matrices across multiple processors.
Epetra_Map: A class for partitioning vectors and matrices.
Epetra_MpiComm: The Epetra MPI Communication Class.
int NumProc() const
Returns total number of processes.
int MyPID() const
Return my process ID.
Epetra_MultiVector: A class for constructing and using dense multi-vectors, vectors and matrices in p...
int Scale(double ScalarValue)
Scale the current values of a multi-vector, this = ScalarValue*this.
int NumVectors() const
Returns the number of vectors in the multi-vector.
int Reciprocal(const Epetra_MultiVector &A)
Puts element-wise reciprocal values of input Multi-vector in target.
int Dot(const Epetra_MultiVector &A, double *Result) const
Computes dot product of each corresponding pair of vectors.
int Update(double ScalarA, const Epetra_MultiVector &A, double ScalarThis)
Update multi-vector values with scaled values of A, this = ScalarThis*this + ScalarA*A.
int Random()
Set multi-vector values to random numbers.
int Norm2(double *Result) const
Compute 2-norm of each vector in multi-vector.
static void SetTracebackMode(int TracebackModeValue)
Set the value of the Epetra_Object error traceback report mode.
Epetra_SerialComm: The Epetra Serial Communication Class.
Epetra_SerialDenseVector: A class for constructing and using dense vectors.
int Resize(int Length_in)
Resize a Epetra_SerialDenseVector object.
double NormInf() const
Compute Inf-norm of each vector in multi-vector.
double * Values() const
Returns pointer to the values in vector.
Epetra_Time: The Epetra Timing Class.
void ResetStartTime(void)
Epetra_Time function to reset the start time for a timer object.
double ElapsedTime(void) const
Epetra_Time elapsed time function.
Epetra_VbrMatrix: A class for the construction and use of real-valued double-precision variable block...
int InvRowSums(Epetra_Vector &x) const
Computes the sum of absolute values of the rows of the Epetra_VbrMatrix, results returned in x.
int EndSubmitEntries()
Completes processing of all data passed in for the current block row.
int SubmitBlockEntry(double *Values, int LDA, int NumRows, int NumCols)
Submit a block entry to the indicated block row and column specified in the Begin routine.
int BeginExtractBlockDiagonalView(int &NumBlockDiagonalEntries, int *&RowColDims) const
Initiates a view of the block diagonal entries.
int BeginInsertGlobalValues(int BlockRow, int NumBlockEntries, int *BlockIndices)
Initiate insertion of a list of elements in a given global row of the matrix, values are inserted via...
int FillComplete()
Signal that data entry is complete, perform transformations to local index space.
int Multiply(bool TransA, const Epetra_MultiVector &X, Epetra_MultiVector &Y) const
Returns the result of a Epetra_VbrMatrix multiplied by a Epetra_MultiVector X in Y.
int ExtractBlockDiagonalEntryView(double *&Values, int &LDA) const
Extract a view of a block diagonal entry from the matrix.
const Epetra_BlockMap & RowMap() const
Returns the RowMap object as an Epetra_BlockMap (the Epetra_Map base class) needed for implementing E...
Epetra_Vector: A class for constructing and using dense vectors on a parallel computer.
int main(int argc, char *argv[])
void GenerateVbrProblem(int numNodesX, int numNodesY, int numProcsX, int numProcsY, int numPoints, int *xoff, int *yoff, int nsizes, int *sizes, const Epetra_Comm &comm, bool verbose, bool summary, Epetra_BlockMap *&map, Epetra_VbrMatrix *&A, Epetra_Vector *&b, Epetra_Vector *&bt, Epetra_Vector *&xexact, bool StaticProfile, bool MakeLocalOnly)
void runLUMatrixTests(Epetra_CrsMatrix *L, Epetra_MultiVector *bL, Epetra_MultiVector *btL, Epetra_MultiVector *xexactL, Epetra_CrsMatrix *U, Epetra_MultiVector *bU, Epetra_MultiVector *btU, Epetra_MultiVector *xexactU, bool StaticProfile, bool verbose, bool summary)
void GenerateCrsProblem(int numNodesX, int numNodesY, int numProcsX, int numProcsY, int numPoints, int *xoff, int *yoff, const Epetra_Comm &comm, bool verbose, bool summary, Epetra_Map *&map, Epetra_CrsMatrix *&A, Epetra_Vector *&b, Epetra_Vector *&bt, Epetra_Vector *&xexact, bool StaticProfile, bool MakeLocalOnly)
void runMatrixTests(Epetra_CrsMatrix *A, Epetra_MultiVector *b, Epetra_MultiVector *bt, Epetra_MultiVector *xexact, bool StaticProfile, bool verbose, bool summary)
void runJadMatrixTests(Epetra_JadMatrix *A, Epetra_MultiVector *b, Epetra_MultiVector *bt, Epetra_MultiVector *xexact, bool StaticProfile, bool verbose, bool summary)
void GenerateMyGlobalElements(int numNodesX, int numNodesY, int numProcsX, int numProcs, int myPID, int *&myGlobalElements)