Zoltan2
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Protected Member Functions | List of all members
Zoltan2::BaseAdapter< User > Class Template Referenceabstract

#include <Zoltan2_Adapter.hpp>

Inheritance diagram for Zoltan2::BaseAdapter< User >:
Inheritance graph
[legend]
Collaboration diagram for Zoltan2::BaseAdapter< User >:
Collaboration graph
[legend]

Public Types

typedef InputTraits< User >::lno_t lno_t
 
typedef InputTraits< User >::gno_t gno_t
 
typedef InputTraits< User >::scalar_t scalar_t
 
typedef InputTraits< User >::node_t node_t
 
typedef InputTraits< User >::part_t part_t
 
typedef InputTraits< User >::offset_t offset_t
 

Public Member Functions

virtual enum BaseAdapterType adapterType () const =0
 Returns the type of adapter.
 
virtual ~BaseAdapter ()
 Destructor.
 
virtual void getIDsView (const gno_t *&ids) const
 Provide a pointer to this process' identifiers.
 
virtual void getIDsKokkosView (Kokkos::View< const gno_t *, typename node_t::device_type > &ids) const
 Provide a Kokkos view to this process' identifiers.
 
void getPartsView (const part_t *&inputPart) const
 Provide pointer to a weight array with stride.
 
template<typename Adapter >
void applyPartitioningSolution (const User &in, User *&out, const PartitioningSolution< Adapter > &solution) const
 Apply a PartitioningSolution to an input.
 
- Public Member Functions inherited from Zoltan2::BaseAdapterRoot
virtual ~BaseAdapterRoot ()
 
virtual size_t getLocalNumIDs () const =0
 Returns the number of objects on this process.
 
virtual int getNumWeightsPerID () const
 Returns the number of weights per object. Number of weights per object should be zero or greater. If zero, then it is assumed that all objects are equally weighted. Default is zero weights per ID.
 

Protected Member Functions

void generateWeightFileOnly (const char *fileprefix, const Teuchos::Comm< int > &comm) const
 

Detailed Description

template<typename User>
class Zoltan2::BaseAdapter< User >

Definition at line 101 of file Zoltan2_Adapter.hpp.

Member Typedef Documentation

◆ lno_t

template<typename User >
typedef InputTraits<User>::lno_t Zoltan2::BaseAdapter< User >::lno_t

Definition at line 104 of file Zoltan2_Adapter.hpp.

◆ gno_t

template<typename User >
typedef InputTraits<User>::gno_t Zoltan2::BaseAdapter< User >::gno_t

Definition at line 105 of file Zoltan2_Adapter.hpp.

◆ scalar_t

template<typename User >
typedef InputTraits<User>::scalar_t Zoltan2::BaseAdapter< User >::scalar_t

Definition at line 106 of file Zoltan2_Adapter.hpp.

◆ node_t

template<typename User >
typedef InputTraits<User>::node_t Zoltan2::BaseAdapter< User >::node_t

Definition at line 107 of file Zoltan2_Adapter.hpp.

◆ part_t

template<typename User >
typedef InputTraits<User>::part_t Zoltan2::BaseAdapter< User >::part_t

Definition at line 108 of file Zoltan2_Adapter.hpp.

◆ offset_t

template<typename User >
typedef InputTraits<User>::offset_t Zoltan2::BaseAdapter< User >::offset_t

Definition at line 109 of file Zoltan2_Adapter.hpp.

Constructor & Destructor Documentation

◆ ~BaseAdapter()

template<typename User >
virtual Zoltan2::BaseAdapter< User >::~BaseAdapter ( )
inlinevirtual

Destructor.

Definition at line 117 of file Zoltan2_Adapter.hpp.

Member Function Documentation

◆ adapterType()

template<typename User >
virtual enum BaseAdapterType Zoltan2::BaseAdapter< User >::adapterType ( ) const
pure virtual

◆ getIDsView()

template<typename User >
virtual void Zoltan2::BaseAdapter< User >::getIDsView ( const gno_t *&  ids) const
inlinevirtual

Provide a pointer to this process' identifiers.

Parameters
idswill on return point to the list of the global Ids for this process.

Reimplemented in Zoltan2::BasicIdentifierAdapter< User >, Zoltan2::BasicKokkosIdentifierAdapter< User >, Zoltan2::GraphAdapter< User, UserCoord >, Zoltan2::GraphAdapter< User, User >, Zoltan2::MatrixAdapter< User, UserCoord >, Zoltan2::MatrixAdapter< User, User >, and Zoltan2::MeshAdapter< User >.

Definition at line 123 of file Zoltan2_Adapter.hpp.

◆ getIDsKokkosView()

template<typename User >
virtual void Zoltan2::BaseAdapter< User >::getIDsKokkosView ( Kokkos::View< const gno_t *, typename node_t::device_type > &  ids) const
inlinevirtual

Provide a Kokkos view to this process' identifiers.

Parameters
idswill on return point to the list of the global Ids for this process.

Reimplemented in Zoltan2::MeshAdapter< User >.

Definition at line 136 of file Zoltan2_Adapter.hpp.

◆ getPartsView()

template<typename User >
void Zoltan2::BaseAdapter< User >::getPartsView ( const part_t *&  inputPart) const
inline

Provide pointer to a weight array with stride.

Parameters
wgton return a pointer to the weights for this idx
strideon return, the value such that the \t nth weight should be found at wgt[n*stride] .
idxthe weight index, zero or greater This function or getWeightsKokkosView must be implemented in derived adapter if getNumWeightsPerID > 0. This function should not be called if getNumWeightsPerID is zero. ‍/ virtual void getWeightsView(const scalar_t *&wgt, int &stride, int idx = 0) const { If adapter does not define getWeightsView, getWeightsKokkosView is called. If adapter does not define getWeightsKokkosView, getWeightsView is called. Allows forward and backwards compatibility. Kokkos::View<scalar_t **, typename node_t::device_type> kokkos_wgts_2d; getWeightsKokkosView(kokkos_wgts_2d); Kokkos::View<scalar_t *, typename node_t::device_type> kokkos_wgts; wgt = Kokkos::subview(kokkos_wgts_2d, Kokkos::ALL, idx).data(); stride = 1; }

/*! Provide kokkos view of weights.

Parameters
wgton return a Kokkos view of the weights for this idx This function or getWeightsView must be implemented in derived adapter if getNumWeightsPerID > 0. This function should not be called if getNumWeightsPerID is zero. ‍/ virtual void getWeightsKokkosView(Kokkos::View<scalar_t **, typename node_t::device_type> & wgt) const { If adapter does not define getWeightsKokkosView, getWeightsView is called. If adapter does not define getWeightsView, getWeightsKokkosView is called. Allows forward and backwards compatibility. wgt = Kokkos::View<scalar_t **, typename node_t::device_type>( "wgts", getLocalNumIDs(), getNumWeightsPerID()); typename Kokkos::View<scalar_t **, typename node_t::device_type>::HostMirror host_wgt = Kokkos::create_mirror_view(wgt); for(int j = 0; j < this->getNumWeightsPerID(); ++j) { const scalar_t * ptr_wgts; int stride; getWeightsView(ptr_wgts, stride, j); size_t i = 0; for(size_t n = 0; n < this->getLocalNumIDs() * stride; n += stride) { host_wgt(i++,j) = ptr_wgts[n]; } } Kokkos::deep_copy(wgt, host_wgt); }

/*! Provide pointer to an array containing the input part assignment for each ID. The input part information may be used for re-partitioning to reduce data movement, or for mapping parts to processes. Adapters may return NULL for this pointer (the default behavior); if NULL is returned, algorithms will assume the rank

Parameters
inputParton return a pointer to input part numbers

Definition at line 212 of file Zoltan2_Adapter.hpp.

◆ applyPartitioningSolution()

template<typename User >
template<typename Adapter >
void Zoltan2::BaseAdapter< User >::applyPartitioningSolution ( const User &  in,
User *&  out,
const PartitioningSolution< Adapter > &  solution 
) const
inline

Apply a PartitioningSolution to an input.

This is not a required part of the InputAdapter interface. However if the Caller calls a Problem method to redistribute data, it needs this method to perform the redistribution.

Parameters
inAn input object with a structure and assignment of of global Ids to processes that matches that of the input data that instantiated this Adapter.
outOn return this should point to a newly created object with the specified partitioning.
solutionThe Solution object created by a Problem should be supplied as the third argument. It must have been templated on user data that has the same global ID distribution as this user data.
Returns
Returns the number of local Ids in the new partition.

Definition at line 236 of file Zoltan2_Adapter.hpp.

◆ generateWeightFileOnly()

template<typename User >
void Zoltan2::BaseAdapter< User >::generateWeightFileOnly ( const char *  fileprefix,
const Teuchos::Comm< int > &  comm 
) const
protected

Definition at line 275 of file Zoltan2_Adapter.hpp.


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