MyraMath


Source: tests/multifrontal/symbolic/AssemblyTree.cpp

1 // ========================================================================= //
2 // This file is part of MyraMath, copyright (c) 2014-2019 by Ryan A Chilton //
3 // and distributed by MyraCore, LLC. See LICENSE.txt for license terms. //
4 // ========================================================================= //
5 
11 // Containers.
16 
17 // Algorithms.
22 
23 // Reporting.
24 #include <myramath/utility/Timer.h>
26 #include <tests/myratest.h>
27 
28 using namespace myra;
29 using namespace myra_stlprint;
30 
31 ADD_TEST("AssemblyTree","[symbolic]")
32  {
33  // Define problem size.
34  int X = 256;
35  int Y = 256;
36  // Process command line arguments
37  if (myra::argc() == 3)
38  {
39  X = atoi( myra::argv(1) );
40  Y = atoi( myra::argv(2) );
41  }
42  int N = X*Y;
43  myra::out() << "AssemblyTree: " << X << " * " << Y << " = " << N << std::endl;
44  myra::out() << std::endl;
45  Pattern pattern = stencil2(X,Y);
46  // Some relevant reordering-related options.
47  typedef ::multifrontal::Options Options;
48  Options options = Options::create();
49  // Generate permutation using bisect2()
50  {
51  myra::out() << "Testing bisect()" << std::endl;
52  Timer timer;
53  Permutation P = bisect2(X,Y);
54  myra::out() << " Reordering time = " << timer.elapsed_time() << std::endl;
55  AssemblyTree atree(pattern, P, options);
56  myra::out() << " AssemblyTree time = " << timer.elapsed_time() << std::endl;
57  myra::out() << " #flops = " << static_cast<double> (atree.n_work_llt()) << std::endl;
58  myra::out() << " #words = " << atree.n_words() << std::endl;
59  myra::out() << std::endl;
60  }
61  // Generate permutation using mmd()
62  {
63  myra::out() << "Testing mmd()" << std::endl;
64  Timer timer;
65  Permutation perm = mmd(pattern);
66  myra::out() << " Reordering time = " << timer.elapsed_time() << std::endl;
67  AssemblyTree atree (pattern, perm, options);
68  myra::out() << " AssemblyTree time = " << timer.elapsed_time() << std::endl;
69  myra::out() << " #flops = " << static_cast<double> (atree.n_work_llt()) << std::endl;
70  myra::out() << " #words = " << atree.n_words() << std::endl;
71  myra::out() << std::endl;
72  }
73 
74  // Generate permutation using reorder()
75  {
76  myra::out() << "Testing reorder()" << std::endl;
77  Timer timer;
78  Permutation perm = reorder(pattern);
79  myra::out() << " Reordering time = " << timer.elapsed_time() << std::endl;
80  AssemblyTree atree (pattern, perm, options);
81  myra::out() << " AssemblyTree time = " << timer.elapsed_time() << std::endl;
82  myra::out() << " #flops = " << static_cast<double> (atree.n_work_llt()) << std::endl;
83  myra::out() << " #words = " << atree.n_words() << std::endl;
84  myra::out() << std::endl;
85  }
86 
87  }
Represents a Permutation matrix, used to reorder rows/columns/etc of various numeric containers...
Definition: Permutation.h:34
Symbolic analysis data structure for all multifrontal solvers.
Definition: AssemblyTree.h:38
Simplistic timing class, might dispatch to platform specific timers depending upon environment...
Definition: syntax.dox:1
Measures elapsed time.
Definition: Timer.h:19
Permutation mmd(const PatternRange &A)
Reorders A for reduced fill-in using multiple minimum degree.
Definition: stlprint.h:32
Routines for printing the contents of various std::container&#39;s to a std::ostream using operator <<...
Describes data layout and job dependencies for symmetric-pattern multifrontal solvers.
Options pack for routines in /multifrontal.
Range/Iterator types associated with Pattern.
Holds the nonzero pattern of a sparse matrix.
Definition: Pattern.h:55
Container class for a sparse nonzero pattern, used in reordering/symbolic analysis.
Aggregates a (perm, iperm, swaps) triple into a vocabulary type.
Minimum degree algorithms, for computing fill-minimizing permutations.
Computes a fill-reducing Permutation for a structurally symmetric sparse A.
Helper routines for reordering/filling 2D structured grids. Used by many unit tests.
double elapsed_time() const
Returns elapsed time in seconds since last call to reset()
Definition: Timer.cpp:18


Results: [PASS]

AssemblyTree: 256 * 256 = 65536
Testing bisect()
Reordering time = 0.026002
AssemblyTree time = 0.092005
#flops = 1.10143e+09
#words = {11123203,2481726}
Testing mmd()
Reordering time = 0.518029
AssemblyTree time = 0.607034
#flops = 7.57534e+08
#words = {8977926,2634595}
Testing reorder()
Reordering time = 0.563033
AssemblyTree time = 0.647037
#flops = 7.06218e+08
#words = {8673068,2176808}


Go back to Summary of /test programs.