96 #ifdef HAVE_EPETRA_TEUCHOS
116 #include "EpetraExt_BlockMapIn.h"
117 #include "EpetraExt_CrsMatrixIn.h"
118 #include "EpetraExt_VectorIn.h"
119 #include "EpetraExt_MultiVectorIn.h"
122 using namespace Teuchos;
124 int main(
int argc,
char *argv[])
127 MPI_Init(&argc,&argv);
129 int mypid =
Comm.MyPID();
138 const char *datafile;
139 if (argc > 1) datafile = argv[1];
140 else datafile =
"A.dat";
149 const int lineLength = 1025;
150 char line[lineLength];
152 FILE *handle = fopen(datafile,
"r");
155 printf(
"Cannot open file \"%s\" for reading.\n",datafile);
156 printf(
"usage: cxx_main.exe <filename>, where filename defaults to \"A.dat\".\n");
166 if(fgets(line, lineLength, handle)==0) {
if (handle!=0) fclose(handle);}
167 }
while (line[0] ==
'%');
169 if(sscanf(line,
"%d %d %d", &Nrows, &Ncols, &NZ)==0) {
if (handle!=0) fclose(handle);}
178 if (mypid==0) printf(
"Reading matrix with %d rows, %d columns, %d nonzeros from file \"%s\".\n",Nrows,Ncols,NZ,datafile);
179 errCode=EpetraExt::MatrixMarketFileToCrsMatrix(datafile, *rowmap, *colmap, Amat);
197 List.
set(
"zerobased",
true);
198 List.
set(
"unique",
true);
202 OskiAmat->
Multiply(
true, y, x, 2, 1);
210 OskiAmat->
Multiply(
false, Oskix, Oskiy);
211 OskiAmat->
Multiply(
true, Oskiy, Oskix, 2, 1);
217 OskiAmat->
Multiply(
false, OskiX, OskiY);
218 OskiAmat->
Multiply(
true, OskiY, OskiX, 2.0, 1.0);
221 List2.
set(
"singleblocksize",
true);
224 List2.
set(
"alignedblocks",
true);
225 OskiAmat->
SetHintMultiply(
false, 1.0, Oskix, 0.0, Oskiy, ALWAYS_TUNE_AGGRESSIVELY, List);
230 std::cout <<
"Aggressive transforms performed are: " << trans <<
"\n";
231 OskiAmat->
Multiply(
false, Oskix, Oskiy);
239 OskiAmat->
SetHintMultiply(
true, 2.0, OskiX, 1.0, OskiY, ALWAYS_TUNE, List);
243 std::cout <<
"Moderate transforms performed are: " << trans <<
"\n";
244 OskiAmat->
Multiply(
true, OskiX, OskiY, 2, 1);
255 std::cout <<
"Moderate transforms performed are: " << trans <<
"\n";
256 OskiAmat->
Multiply(
true, OskiX, OskiY, 2, 1);
261 List.
set(
"invalidinter",
true);
292 return(EXIT_SUCCESS);
Epetra_MultiVector: A class for constructing and using dense multi-vectors, vectors and matrices in p...
int MatTransMatMultiply(bool ATA, const Epetra_Vector &x, Epetra_Vector &y, Epetra_Vector *t, double Alpha=1.0, double Beta=0.0) const
Performs two matrix vector multiplies of y = Alpha*this^TransA*this*x + Beta*y or y = Alpha*this*this...
Epetra_Map: A class for partitioning vectors and matrices.
int Random()
Set multi-vector values to random numbers.
Epetra_OskiMultiVector: A class for constructing and using dense Oski multi-vectors on a single proce...
int SetHintMatTransMatMultiply(bool ATA, double Alpha, const Epetra_OskiMultiVector &InVec, double Beta, const Epetra_OskiMultiVector &OutVec, const Epetra_OskiMultiVector &Intermediate, int NumCalls, const Teuchos::ParameterList &List)
Workload hints for computing a two matrix-vector multiplies that are composed used by OskiTuneMat to ...
Epetra_OskiVector: A class for constructing and using dense OSKI vectors on a single processor or a s...
char * GetMatrixTransforms() const
Returns a string holding the transformations performed on the matrix when it was tuned.
Epetra_Vector: A class for constructing and using dense vectors on a parallel computer.
ParameterList & set(std::string const &name, T &&value, std::string const &docString="", RCP< const ParameterEntryValidator > const &validator=null)
Epetra_MpiComm: The Epetra MPI Communication Class.
const Epetra_Map & RowMap() const
Returns the Epetra_Map object associated with the rows of this matrix.
Epetra_OskiMatrix: A class for constructing and using OSKI Matrices within Epetra. For information on known issues with OSKI see the detailed description.
int SetHintMultiply(bool TransA, double Alpha, const Epetra_OskiMultiVector &InVec, double Beta, const Epetra_OskiMultiVector &OutVec, int NumCalls, const Teuchos::ParameterList &List)
Workload hints for computing a matrix-vector multiply used by OskiTuneMat to optimize the data struct...
Epetra_OskiUtils: The Epetra OSKI Class to handle all operations that do not involve the use of a mat...
int TuneMatrix()
Tunes the matrix multiply if its deemed profitable.
int MultiplyAndMatTransMultiply(bool TransA, const Epetra_Vector &x, Epetra_Vector &y, const Epetra_Vector &w, Epetra_Vector &z, double Alpha=1.0, double Beta=0.0, double Omega=1.0, double Zeta=0.0) const
Performs the two matrix vector multiplies of y = Alpha*this*x + Beta*y and z = Omega*this^TransA*w + ...
int OptimizeStorage()
Make consecutive row index sections contiguous, minimize internal storage used for constructing graph...
int SetHint(const Teuchos::ParameterList &List)
Stores the hints in List in the matrix structure.
Epetra_SerialComm: The Epetra Serial Communication Class.
void Init()
Initializes OSKI.
Epetra_CrsMatrix: A class for constructing and using real-valued double-precision sparse compressed r...
const Epetra_Map & DomainMap() const
Returns the Epetra_Map object associated with the domain of this matrix operator. ...
int main(int argc, char *argv[])
int Multiply(bool TransA, const Epetra_Vector &x, Epetra_Vector &y) const
Performs a matrix vector multiply of y = this^TransA*x.