50 #ifndef _ZOLTAN2_ALGAMD_HPP_
51 #define _ZOLTAN2_ALGAMD_HPP_
56 #ifndef HAVE_ZOLTAN2_AMD
60 template <
typename Adapter>
65 const RCP<Teuchos::ParameterList> &pl,
66 const RCP<Teuchos::Comm<int> > &comm
70 throw std::runtime_error(
71 "BUILD ERROR: AMD requested but not compiled into Zoltan2.\n"
72 "Please set CMake flag Zoltan2_ENABLE_AMD:BOOL=ON.");
83 template <
typename Ordinal>
87 Ordinal order(Ordinal n,
const Ordinal *Ap,
const Ordinal *Ai,
88 Ordinal *perm,
double *control,
double *info);
95 int order(
int n,
const int *Ap,
const int *Ai,
int *perm,
96 double *control,
double *info)
98 return (amd_order(n, Ap, Ai, perm, control, info));
103 class AMDTraits<long>
106 long order(
long n,
const long *Ap,
const long *Ai,
long *perm,
107 double *control,
double *info)
109 return (amd_l_order(n, Ap, Ai, perm, control, info));
113 template <
typename Adapter>
115 const RCP<GraphModel<Adapter> > &model,
116 const RCP<OrderingSolution<
typename Adapter::gid_t,
118 const RCP<Teuchos::ParameterList> &pl,
119 const RCP<Teuchos::Comm<int> > &comm
124 typedef typename Adapter::gid_t gid_t;
129 if (comm->getSize() != 1)
131 throw std::runtime_error(
132 "ERROR: AMD requested with distributed matrix.\n"
133 "This feature is not supported yet. Please use a local matrix.");
136 const size_t nVtx = model->getLocalNumVertices();
138 cout <<
"Local num vertices" << nVtx << endl;
139 ArrayView<const gno_t> edgeIds;
140 ArrayView<const int> procIds;
141 ArrayView<const lno_t> offsets;
142 ArrayView<StridedData<lno_t, scalar_t> > wgts;
147 model->getEdgeList( edgeIds, procIds, offsets, wgts);
149 AMDTraits<lno_t> AMDobj;
150 double Control[AMD_CONTROL];
151 double Info[AMD_INFO];
153 amd_defaults(Control);
154 amd_control(Control);
157 perm = (lno_t *) (solution->getPermutationRCP().getRawPtr());
159 lno_t result = AMDobj.order(nVtx, offsets.getRawPtr(),
160 edgeIds.getRawPtr(), perm, Control, Info);
162 if (result != AMD_OK && result != AMD_OK_BUT_JUMBLED)
170 #endif // ZOLTAN2_HAVE_AMD
Defines the OrderingSolution class.
int AlgAMD(const RCP< GraphModel< Adapter > > &model, const RCP< OrderingSolution< typename Adapter::gid_t, typename Adapter::lno_t > > &solution, const RCP< Teuchos::ParameterList > &pl, const RCP< Teuchos::Comm< int > > &comm)
GraphModel defines the interface required for graph models.
Defines the GraphModel interface.
The class containing ordering solutions and metrics.