Zoltan2
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
Zoltan2::CoordinateTaskMapper< Adapter, part_t > Class Template Reference

#include <Zoltan2_TaskMapping.hpp>

Inheritance diagram for Zoltan2::CoordinateTaskMapper< Adapter, part_t >:
Inheritance graph
[legend]
Collaboration diagram for Zoltan2::CoordinateTaskMapper< Adapter, part_t >:
Collaboration graph
[legend]

Public Member Functions

void getProcTask (part_t *&proc_to_task_xadj_, part_t *&proc_to_task_adj_)
 
void map (RCP< MappingSolution< Adapter > > &mappingsoln)
 
virtual ~CoordinateTaskMapper ()
 
 CoordinateTaskMapper (const Teuchos::RCP< const Teuchos::Comm< int > > comm_, const Teuchos::RCP< const 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. When this constructor is called, in order to calculate the communication metric, the task adjacency graph is created based on the coordinate model input and partitioning of it. if the communication graph is already calculated, use the other constructors. More...
 
 CoordinateTaskMapper (const Teuchos::RCP< const Teuchos::Comm< int > > comm_, const Teuchos::RCP< const 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, bool is_input_adapter_distributed=true)
 Constructor. Instead of Solution we have two parameters, numparts When this constructor is called, in order to calculate the communication metric, the task adjacency graph is created based on the coordinate model input and partitioning of it. if the communication graph is already calculated, use the other constructors. More...
 
 CoordinateTaskMapper (const Environment *env_const_, const Teuchos::Comm< int > *problemComm, int proc_dim, int num_processors, pcoord_t **machine_coords, int task_dim, part_t num_tasks, tcoord_t **task_coords, ArrayRCP< part_t >task_comm_xadj, ArrayRCP< part_t >task_comm_adj, pcoord_t *task_communication_edge_weight_, int recursion_depth, part_t *part_no_array, const part_t *machine_dimensions)
 Constructor The mapping constructor which will also perform the mapping operation. The result mapping can be obtained by –getAssignedProcForTask function: which returns the assigned processor id for the given task –getPartsForProc: which returns the assigned tasks with the number of tasks. More...
 
virtual size_t getLocalNumberOfParts () const
 Returns the number of parts to be assigned to this process. More...
 
pcoord_t ** shiftMachineCoordinates (int machine_dim, const part_t *machine_dimensions, bool *machine_extent_wrap_around, part_t numProcs, pcoord_t **mCoords)
 Using the machine dimensions provided, create virtual machine coordinates by assigning the largest gap to be as the wrap around link. More...
 
virtual void getProcsForPart (part_t taskId, part_t &numProcs, part_t *&procs) const
 getAssignedProcForTask function, returns the assigned tasks with the number of tasks. More...
 
part_t getAssignedProcForTask (part_t taskId)
 getAssignedProcForTask function, returns the assigned processor id for the given task More...
 
virtual void getPartsForProc (int procId, part_t &numParts, part_t *&parts) const
 getAssignedProcForTask function, returns the assigned tasks with the number of tasks. More...
 
ArrayView< part_t > getAssignedTasksForProc (part_t procId)
 
- Public Member Functions inherited from Zoltan2::PartitionMapping< Adapter >
 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 INTELLIGENT MAPPING KDDKDD BUT MAY WANT TO SET PART SIZES BASED ON CAPABILITY OF A RANK. KDDKDD SO WHEN SHOULD THE MAP BE CREATED? More...
 
 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 Environment > envConst_)
 
 PartitionMapping ()
 
 PartitionMapping (const Teuchos::RCP< const Environment >envConst_)
 
 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 ~PartitionMapping ()
 

Protected Member Functions

void doMapping (int myRank)
 doMapping function, calls getMapping function of communicationModel object. More...
 
RCP< Comm< int > > create_subCommunicator ()
 creates and returns the subcommunicator for the processor group. More...
 
void getBestMapping ()
 finds the lowest cost mapping and broadcasts solution to everyone. More...
 
void writeMapping ()
 
void writeMapping2 (int myRank)
 

Protected Attributes

ArrayRCP< part_t > proc_to_task_xadj
 
ArrayRCP< part_t > proc_to_task_adj
 
ArrayRCP< part_t > task_to_proc
 
bool isOwnerofModel
 
CoordinateCommunicationModel< pcoord_t, tcoord_t, part_t > * proc_task_comm
 
part_t nprocs
 
part_t ntasks
 
ArrayRCP< part_t > task_communication_xadj
 
ArrayRCP< part_t > task_communication_adj
 
ArrayRCP< scalar_t > task_communication_edge_weight
 

Additional Inherited Members

- Public Attributes inherited from Zoltan2::PartitionMapping< Adapter >
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 Environmentenv
 
const part_t num_parts
 
const part_t * solution_parts
 

Detailed Description

template<typename Adapter, typename part_t>
class Zoltan2::CoordinateTaskMapper< Adapter, part_t >

Definition at line 1393 of file Zoltan2_TaskMapping.hpp.

Constructor & Destructor Documentation

◆ ~CoordinateTaskMapper()

template<typename Adapter, typename part_t>
virtual Zoltan2::CoordinateTaskMapper< Adapter, part_t >::~CoordinateTaskMapper ( )
inlinevirtual

Definition at line 1768 of file Zoltan2_TaskMapping.hpp.

◆ CoordinateTaskMapper() [1/3]

template<typename Adapter, typename part_t>
Zoltan2::CoordinateTaskMapper< Adapter, part_t >::CoordinateTaskMapper ( const Teuchos::RCP< const Teuchos::Comm< int > >  comm_,
const Teuchos::RCP< const 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 
)
inline

Constructor. When this constructor is called, in order to calculate the communication metric, the task adjacency graph is created based on the coordinate model input and partitioning of it. if the communication graph is already calculated, use the other constructors.

Parameters
comm_is the communication object.
machine_is the machineRepresentation object. Stores the coordinates of machines.
model_is the input adapter.
soln_is the solution object. Holds the assignment of points.
envConst_is the environment object.

Definition at line 1788 of file Zoltan2_TaskMapping.hpp.

◆ CoordinateTaskMapper() [2/3]

template<typename Adapter, typename part_t>
Zoltan2::CoordinateTaskMapper< Adapter, part_t >::CoordinateTaskMapper ( const Teuchos::RCP< const Teuchos::Comm< int > >  comm_,
const Teuchos::RCP< const 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,
bool  is_input_adapter_distributed = true 
)
inline

Constructor. Instead of Solution we have two parameters, numparts When this constructor is called, in order to calculate the communication metric, the task adjacency graph is created based on the coordinate model input and partitioning of it. if the communication graph is already calculated, use the other constructors.

Parameters
comm_is the communication object.
machine_is the machineRepresentation object. Stores the coordinates of machines.
model_is the input adapter.
soln_is the solution object. Holds the assignment of points.
envConst_is the environment object.

Definition at line 2040 of file Zoltan2_TaskMapping.hpp.

◆ CoordinateTaskMapper() [3/3]

template<typename Adapter, typename part_t>
Zoltan2::CoordinateTaskMapper< Adapter, part_t >::CoordinateTaskMapper ( const Environment env_const_,
const Teuchos::Comm< int > *  problemComm,
int  proc_dim,
int  num_processors,
pcoord_t **  machine_coords,
int  task_dim,
part_t  num_tasks,
tcoord_t **  task_coords,
ArrayRCP< part_t >  task_comm_xadj,
ArrayRCP< part_t >  task_comm_adj,
pcoord_t *  task_communication_edge_weight_,
int  recursion_depth,
part_t *  part_no_array,
const part_t *  machine_dimensions 
)
inline

Constructor The mapping constructor which will also perform the mapping operation. The result mapping can be obtained by –getAssignedProcForTask function: which returns the assigned processor id for the given task –getPartsForProc: which returns the assigned tasks with the number of tasks.

-task_comm_xadj, task_comm_adj, task_communication_edge_weight_ can be provided NULL. In this case all processors will calculate the same mapping. -If task_comm_xadj, task_comm_adj and provided, algorithm will perform rotations, and processors will calculate different mappings, and best one will be reduced. -If task_communication_edge_weight_ is provided with task_comm_xadj, task_comm_adj this will be used when cost is calculated. -recursion_depth is a mandatory argument. In the case part_no_array is not null, this parameter should represent the length of part_no_array. If part_no_array is given as NULL, then this will give the recursion depth for the algorith, Maximum number is ceil(log_2(min(num_processors, num_tasks))), and providing a higher number will be equivalant to this. Partitioning algorithm will work as RCB when maximum number is given, which performs the best mapping results. -part_no_array: The best results are obtained when this parameter is given as NULL. But if this is provided, partitioning will use this array for partitioning each dimension to the given numbers. The multiplication of these numbers should be equal to min(num_processors, num_tasks). -machine_dimensions: This can be NULL, but if provided the algorithm will perform shift of the machine coords so that the largest gap is treated as wrap-around link.

Parameters
env_const_the environment object.
problemCommis the communication object.
proc_dimdimensions of the processor coordinates.
num_processorsis the number of processors
machine_coordsis the coordinates of the processors.
task_dimis the dimension of the tasks.
num_tasksis the number of tasks.
task_coordsis the coordinates of the tasks.
task_comm_xadjis the task communication graphs xadj array. (task i adjacency is between task_comm_xadj[i] and task_comm_xadj[i+1])
task_comm_adjis task communication graphs adj array.
task_communication_edge_weight_is the weight of the communication in task graph.
recursion_depthis the recursion depth that will be applied to partitioning. If part_no_array is provided, then it is the length of this array.
part_no_arrayif part_no_array is provided, partitioning algorithm will be forced to use this array for partitioning. However, the multiplication of each entries in this array should be equal to min(num_processors, num_tasks).
*machine_dimensionsthe dimensions of the machine network. For example for hopper 17x8x24 This can be NULL, but if provided the algorithm will perform shift of the machine coords so that the largest gap is treated as wrap-around link.

Definition at line 2337 of file Zoltan2_TaskMapping.hpp.

Member Function Documentation

◆ doMapping()

template<typename Adapter, typename part_t>
void Zoltan2::CoordinateTaskMapper< Adapter, part_t >::doMapping ( int  myRank)
inlineprotected

doMapping function, calls getMapping function of communicationModel object.

Definition at line 1419 of file Zoltan2_TaskMapping.hpp.

◆ create_subCommunicator()

template<typename Adapter, typename part_t>
RCP<Comm<int> > Zoltan2::CoordinateTaskMapper< Adapter, part_t >::create_subCommunicator ( )
inlineprotected

creates and returns the subcommunicator for the processor group.

Definition at line 1439 of file Zoltan2_TaskMapping.hpp.

◆ getBestMapping()

template<typename Adapter, typename part_t>
void Zoltan2::CoordinateTaskMapper< Adapter, part_t >::getBestMapping ( )
inlineprotected

finds the lowest cost mapping and broadcasts solution to everyone.

Definition at line 1485 of file Zoltan2_TaskMapping.hpp.

◆ writeMapping()

template<typename Adapter, typename part_t>
void Zoltan2::CoordinateTaskMapper< Adapter, part_t >::writeMapping ( )
inlineprotected

Definition at line 1521 of file Zoltan2_TaskMapping.hpp.

◆ writeMapping2()

template<typename Adapter, typename part_t>
void Zoltan2::CoordinateTaskMapper< Adapter, part_t >::writeMapping2 ( int  myRank)
inlineprotected

Definition at line 1585 of file Zoltan2_TaskMapping.hpp.

◆ getProcTask()

template<typename Adapter, typename part_t>
void Zoltan2::CoordinateTaskMapper< Adapter, part_t >::getProcTask ( part_t *&  proc_to_task_xadj_,
part_t *&  proc_to_task_adj_ 
)
inline

Definition at line 1747 of file Zoltan2_TaskMapping.hpp.

◆ map()

template<typename Adapter, typename part_t>
void Zoltan2::CoordinateTaskMapper< Adapter, part_t >::map ( RCP< MappingSolution< Adapter > > &  mappingsoln)
inline

Definition at line 1752 of file Zoltan2_TaskMapping.hpp.

◆ getLocalNumberOfParts()

template<typename Adapter, typename part_t>
virtual size_t Zoltan2::CoordinateTaskMapper< Adapter, part_t >::getLocalNumberOfParts ( ) const
inlinevirtual

Returns the number of parts to be assigned to this process.

Implements Zoltan2::PartitionMapping< Adapter >.

Definition at line 2454 of file Zoltan2_TaskMapping.hpp.

◆ shiftMachineCoordinates()

template<typename Adapter, typename part_t>
pcoord_t** Zoltan2::CoordinateTaskMapper< Adapter, part_t >::shiftMachineCoordinates ( int  machine_dim,
const part_t *  machine_dimensions,
bool *  machine_extent_wrap_around,
part_t  numProcs,
pcoord_t **  mCoords 
)
inline

Using the machine dimensions provided, create virtual machine coordinates by assigning the largest gap to be as the wrap around link.

Parameters
machine_dimthe number of dimensions in the machine network.
machine_dimensionsthe dimension of the machien network. For example for hopper, 17,8,24
numProcsthe number of allocated processors.
mCoordsallocated machine coordinates.

Definition at line 2466 of file Zoltan2_TaskMapping.hpp.

◆ getProcsForPart()

template<typename Adapter, typename part_t>
virtual void Zoltan2::CoordinateTaskMapper< Adapter, part_t >::getProcsForPart ( part_t  taskId,
part_t &  numProcs,
part_t *&  procs 
) const
inlinevirtual

getAssignedProcForTask function, returns the assigned tasks with the number of tasks.

Parameters
procIdprocId being queried.
numProcs(output), the number of processor the part is assigned to.
procs(output), the list of processors assigned to given part..

Implements Zoltan2::PartitionMapping< Adapter >.

Definition at line 2562 of file Zoltan2_TaskMapping.hpp.

◆ getAssignedProcForTask()

template<typename Adapter, typename part_t>
part_t Zoltan2::CoordinateTaskMapper< Adapter, part_t >::getAssignedProcForTask ( part_t  taskId)
inline

getAssignedProcForTask function, returns the assigned processor id for the given task

Parameters
taskIdtaskId being queried.

Definition at line 2569 of file Zoltan2_TaskMapping.hpp.

◆ getPartsForProc()

template<typename Adapter, typename part_t>
virtual void Zoltan2::CoordinateTaskMapper< Adapter, part_t >::getPartsForProc ( int  procId,
part_t &  numParts,
part_t *&  parts 
) const
inlinevirtual

getAssignedProcForTask function, returns the assigned tasks with the number of tasks.

Parameters
procIdprocId being queried.
numParts(output), the number of parts the processor is assigned to.
parts(output), the list of parts assigned to given processor..

Implements Zoltan2::PartitionMapping< Adapter >.

Definition at line 2578 of file Zoltan2_TaskMapping.hpp.

◆ getAssignedTasksForProc()

template<typename Adapter, typename part_t>
ArrayView<part_t> Zoltan2::CoordinateTaskMapper< Adapter, part_t >::getAssignedTasksForProc ( part_t  procId)
inline

Definition at line 2586 of file Zoltan2_TaskMapping.hpp.

Member Data Documentation

◆ proc_to_task_xadj

template<typename Adapter, typename part_t>
ArrayRCP<part_t> Zoltan2::CoordinateTaskMapper< Adapter, part_t >::proc_to_task_xadj
protected

Definition at line 1405 of file Zoltan2_TaskMapping.hpp.

◆ proc_to_task_adj

template<typename Adapter, typename part_t>
ArrayRCP<part_t> Zoltan2::CoordinateTaskMapper< Adapter, part_t >::proc_to_task_adj
protected

Definition at line 1406 of file Zoltan2_TaskMapping.hpp.

◆ task_to_proc

template<typename Adapter, typename part_t>
ArrayRCP<part_t> Zoltan2::CoordinateTaskMapper< Adapter, part_t >::task_to_proc
protected

Definition at line 1407 of file Zoltan2_TaskMapping.hpp.

◆ isOwnerofModel

template<typename Adapter, typename part_t>
bool Zoltan2::CoordinateTaskMapper< Adapter, part_t >::isOwnerofModel
protected

Definition at line 1408 of file Zoltan2_TaskMapping.hpp.

◆ proc_task_comm

template<typename Adapter, typename part_t>
CoordinateCommunicationModel<pcoord_t,tcoord_t,part_t>* Zoltan2::CoordinateTaskMapper< Adapter, part_t >::proc_task_comm
protected

Definition at line 1409 of file Zoltan2_TaskMapping.hpp.

◆ nprocs

template<typename Adapter, typename part_t>
part_t Zoltan2::CoordinateTaskMapper< Adapter, part_t >::nprocs
protected

Definition at line 1410 of file Zoltan2_TaskMapping.hpp.

◆ ntasks

template<typename Adapter, typename part_t>
part_t Zoltan2::CoordinateTaskMapper< Adapter, part_t >::ntasks
protected

Definition at line 1411 of file Zoltan2_TaskMapping.hpp.

◆ task_communication_xadj

template<typename Adapter, typename part_t>
ArrayRCP<part_t> Zoltan2::CoordinateTaskMapper< Adapter, part_t >::task_communication_xadj
protected

Definition at line 1412 of file Zoltan2_TaskMapping.hpp.

◆ task_communication_adj

template<typename Adapter, typename part_t>
ArrayRCP<part_t> Zoltan2::CoordinateTaskMapper< Adapter, part_t >::task_communication_adj
protected

Definition at line 1413 of file Zoltan2_TaskMapping.hpp.

◆ task_communication_edge_weight

template<typename Adapter, typename part_t>
ArrayRCP<scalar_t> Zoltan2::CoordinateTaskMapper< Adapter, part_t >::task_communication_edge_weight
protected

Definition at line 1414 of file Zoltan2_TaskMapping.hpp.


The documentation for this class was generated from the following file: