Zoltan2
Loading...
Searching...
No Matches
Zoltan2_PartitionMapping.hpp
Go to the documentation of this file.
1// @HEADER
2// *****************************************************************************
3// Zoltan2: A package of combinatorial algorithms for scientific computing
4//
5// Copyright 2012 NTESS and the Zoltan2 contributors.
6// SPDX-License-Identifier: BSD-3-Clause
7// *****************************************************************************
8// @HEADER
9
14#ifndef _ZOLTAN2_PARTITIONMAPPING_HPP_
15#define _ZOLTAN2_PARTITIONMAPPING_HPP_
16#include "Zoltan2_Model.hpp"
18#include "Teuchos_Comm.hpp"
21#include "Zoltan2_Algorithm.hpp"
22
23namespace Zoltan2 {
24
28template <typename Adapter>
29 class PartitionMapping :public Algorithm<Adapter>
30{
31public:
32
33#ifndef DOXYGEN_SHOULD_SKIP_THIS
34 typedef typename Adapter::gno_t gno_t;
35 typedef typename Adapter::scalar_t scalar_t;
36 typedef typename Adapter::scalar_t pcoord_t;
37 typedef typename Adapter::lno_t lno_t;
38 typedef typename Adapter::part_t part_t;
39 typedef typename Adapter::user_t user_t;
40#endif
41
42 const Teuchos::RCP <const Teuchos::Comm<int> >comm;
43 const Teuchos::RCP <const Zoltan2::MachineRepresentation <pcoord_t,part_t> > machine;
44 const Teuchos::RCP <const Adapter > input_adapter;
45 const Teuchos::RCP <const Zoltan2::PartitioningSolution<Adapter> >soln;
46 const Teuchos::RCP <const Environment >env;
49
50
58 const Teuchos::RCP <const Teuchos::Comm<int> >comm_,
59 const Teuchos::RCP <const Zoltan2::MachineRepresentation<pcoord_t,part_t> >machine_, // If NULL, assume homogeneous
60 // Make optional
61 const Teuchos::RCP <const Adapter> input_adapter_, // Needed to get information about
62 // the application data (coords, graph)
63 const Teuchos::RCP <const Zoltan2::PartitioningSolution<Adapter> >soln_, // Needed for mapping a partition
64 const Teuchos::RCP <const Environment > envConst_ // Perhaps envConst should be optional
65 // so applications can create a mapping
66 // directly
67 ):comm(comm_),
68 machine(machine_),
69 input_adapter(input_adapter_),
70 soln(soln_),
71 env(envConst_),num_parts(soln_->getActualGlobalNumberOfParts()),
73 {} ;
74
76 const Teuchos::RCP <const Teuchos::Comm<int> >comm_,
77 const Teuchos::RCP <const Zoltan2::MachineRepresentation<pcoord_t,part_t> >machine_, // If NULL, assume homogeneous
78 // Make optional
79 const Teuchos::RCP <const Adapter> input_adapter_, // Needed to get information about
80 // the application data (coords, graph)
81 const part_t num_parts_,
82 const part_t *result_parts,
83 const Teuchos::RCP <const Environment > envConst_ // Perhaps envConst should be optional
84 // so applications can create a mapping
85 // directly
86 ):comm(comm_),
87 machine(machine_),
88 input_adapter(input_adapter_),
89 soln(),
90 env(envConst_),num_parts(num_parts_),
91 solution_parts(result_parts)
92 {} ;
93
95 const Teuchos::RCP <const Teuchos::Comm<int> >comm_,
96 const Teuchos::RCP <const Environment > envConst_ // Perhaps envConst should be optional
97 // so applications can create a mapping
98 // directly
99 ):comm(comm_),
100 machine(),
102 soln(),
103 env(envConst_),num_parts(0),
104 solution_parts(NULL)
105 {} ;
106
108 comm(0),
109 machine(0),
110 input_adapter(0),
111 soln(0),
112 env(0),
113 solution_parts(NULL){};
114
115 PartitionMapping(const Teuchos::RCP <const Environment >envConst_):
116 comm(0),
117 machine(0),
118 input_adapter(0),
119 soln(0),
120 env(envConst_),num_parts(0),
121 solution_parts(NULL){};
122
124 const Teuchos::RCP <const Environment > envConst_,
125 const Teuchos::RCP <const Teuchos::Comm<int> >comm_,
126 const Teuchos::RCP <const MachineRepresentation<pcoord_t,part_t> >machine_
127 ):
128 comm(comm_),
129 machine(machine_),
130 input_adapter(0),
131 soln(0),
132 env(envConst_),num_parts(0),
133 solution_parts(NULL){};
134
135
137
140 virtual size_t getLocalNumberOfParts() const = 0;
141
149 // TODO: KDDKDD Decide whether information should be avail for any process
150 // TODO: KDDKDD (requiring more storage or a directory) or only for the
151 // TODO: KDDKDD local process.
152 // TODO: KDDKDD Could require O(nprocs) storage
153 virtual void getPartsForProc(int procId, part_t &numParts, part_t *&parts)
154 const = 0;
155
162 // TODO: KDDKDD Arguments should be count and array, not min and max.
163 // TODO: KDDKDD Could require O(nGlobalParts) storage
164 virtual void getProcsForPart(part_t partId, part_t &numProcs, part_t *&procs) const = 0;
165
166private:
167};
168
169} // namespace Zoltan2
170
171#endif
Zoltan2::BasicUserTypes< zscalar_t, zlno_t, zgno_t > user_t
Definition Metric.cpp:39
Defines the Environment class.
Defines the Model interface.
Defines the PartitioningSolution class.
Algorithm defines the base class for all algorithms.
Adapter::scalar_t scalar_t
MachineRepresentation Class Base class for representing machine coordinates, networks,...
PartitionMapping maps a solution or an input distribution to ranks.
PartitionMapping(const Teuchos::RCP< const Environment >envConst_)
PartitionMapping(const Teuchos::RCP< const Teuchos::Comm< int > >comm_, const Teuchos::RCP< const Environment > envConst_)
const Teuchos::RCP< const Environment > env
const Teuchos::RCP< const Zoltan2::PartitioningSolution< Adapter > > soln
const Teuchos::RCP< const Teuchos::Comm< int > > comm
const Teuchos::RCP< const Zoltan2::MachineRepresentation< pcoord_t, part_t > > machine
PartitionMapping(const Teuchos::RCP< const Environment > envConst_, const Teuchos::RCP< const Teuchos::Comm< int > >comm_, const Teuchos::RCP< const MachineRepresentation< pcoord_t, part_t > >machine_)
virtual void getProcsForPart(part_t partId, part_t &numProcs, part_t *&procs) const =0
Get the processes containing a part.
virtual void getPartsForProc(int procId, part_t &numParts, part_t *&parts) const =0
Get the parts belonging to a process.
virtual size_t getLocalNumberOfParts() const =0
Returns the number of parts to be assigned to this process.
PartitionMapping(const Teuchos::RCP< const Teuchos::Comm< int > >comm_, const Teuchos::RCP< const Zoltan2::MachineRepresentation< pcoord_t, part_t > >machine_, const Teuchos::RCP< const Adapter > input_adapter_, const part_t num_parts_, const part_t *result_parts, const Teuchos::RCP< const Environment > envConst_)
PartitionMapping(const Teuchos::RCP< const Teuchos::Comm< int > >comm_, const Teuchos::RCP< const Zoltan2::MachineRepresentation< pcoord_t, part_t > >machine_, const Teuchos::RCP< const Adapter > input_adapter_, const Teuchos::RCP< const Zoltan2::PartitioningSolution< Adapter > >soln_, const Teuchos::RCP< const Environment > envConst_)
Constructor Constructor builds the map from parts to ranks. KDDKDD WILL NEED THE SOLUTION FOR INTELLI...
const Teuchos::RCP< const Adapter > input_adapter
A PartitioningSolution is a solution to a partitioning problem.
Created by mbenlioglu on Aug 31, 2020.
SparseMatrixAdapter_t::part_t part_t
const zpart_t * getPartListView(RCP< ProblemFactory > problemFactory)