Ginkgo  Generated from pipelines/3133041809 branch based on develop. Ginkgo version 2.0.0
A numerical linear algebra library targeting many-core architectures
Public Types | Public Member Functions | Static Public Member Functions | Friends | List of all members
gko::experimental::distributed::Vector< ValueType > Class Template Reference

Vector is a format which explicitly stores (multiple) distributed column vectors in a dense storage format. More...

#include <ginkgo/core/distributed/vector.hpp>

Inheritance diagram for gko::experimental::distributed::Vector< ValueType >:
[legend]
Collaboration diagram for gko::experimental::distributed::Vector< ValueType >:
[legend]

Public Types

using value_type = typename EnableMultiVector< Vector >::value_type
 
using absolute_type = typename EnableMultiVector< Vector >::absolute_type
 
using real_type = typename EnableMultiVector< Vector >::real_type
 
using complex_type = typename EnableMultiVector< Vector >::complex_type
 
using norm_type = typename EnableMultiVector< Vector >::norm_type
 
using device_view = typename EnableMultiVector< Vector >::device_view
 
using const_device_view = typename EnableMultiVector< Vector >::const_device_view
 
using local_vector_type = gko::matrix::MultiVector< value_type >
 
- Public Types inherited from gko::EnableMultiVector< Vector< ValueType > >
using traits = vector_traits< Vector< ValueType > >
 The traits providing the types related to ConcreteType.
 
using value_type = typename traits::value_type
 The value type of the stored elements.
 
using absolute_value_type = typename traits::absolute_value_type
 The real counterpart of value_type.
 
using absolute_type = typename traits::absolute_type
 The vector type holding absolute values of this vector.
 
using real_type = typename traits::real_type
 The vector type holding real or imaginary parts of this vector.
 
using complex_type = typename traits::complex_type
 The vector type holding a complex version of this vector.
 
using result_type = Vector< ValueType >
 The target type of the conversions provided by this mixin.
 
using norm_type = matrix::MultiVector< absolute_value_type >
 The vector type used to store the results of reductions to norms.
 
using device_view = AbstractMultiVector::device_view< value_type >
 The mutable device view type of the local data.
 
using const_device_view = AbstractMultiVector::device_view< const value_type >
 The immutable device view type of the local data.
 
- Public Types inherited from gko::AbstractMultiVector
template<typename ValueType >
using device_view = matrix::view::dense< ValueType >
 
- Public Types inherited from gko::ConvertibleTo< Vector< ValueType > >
using result_type = Vector< ValueType >
 
- Public Types inherited from gko::ConvertibleTo< Vector< next_precision< ValueType > > >
using result_type = Vector< next_precision< ValueType > >
 

Public Member Functions

void read_distributed (const device_matrix_data< ValueType, int64 > &data, ptr_param< const Partition< int64, int64 >> partition)
 Reads a vector from the device_matrix_data structure and a global row partition. More...
 
void read_distributed (const device_matrix_data< ValueType, int64 > &data, ptr_param< const Partition< int32, int64 >> partition)
 
void read_distributed (const device_matrix_data< ValueType, int32 > &data, ptr_param< const Partition< int32, int32 >> partition)
 
void read_distributed (const matrix_data< ValueType, int64 > &data, ptr_param< const Partition< int64, int64 >> partition)
 Reads a vector from the matrix_data structure and a global row partition. More...
 
void read_distributed (const matrix_data< ValueType, int64 > &data, ptr_param< const Partition< int32, int64 >> partition)
 
void read_distributed (const matrix_data< ValueType, int32 > &data, ptr_param< const Partition< int32, int32 >> partition)
 
void convert_to (Vector< next_precision< ValueType >> *result) const override
 
void move_to (Vector< next_precision< ValueType >> *result) override
 
void compute_mean (ptr_param< AbstractMultiVector > result) const
 Computes the column-wise mean of this (multi-)vector using a global reduction. More...
 
void compute_mean (ptr_param< AbstractMultiVector > result, array< char > &tmp) const
 Computes the column-wise arithmetic mean of this (multi-)vector using a global reduction. More...
 
value_type & at_local (size_type row, size_type col) noexcept
 Returns a single element of the multi-vector. More...
 
value_type at_local (size_type row, size_type col) const noexcept
 
value_type & at_local (size_type idx) noexcept
 Returns a single element of the multi-vector. More...
 
value_type at_local (size_type idx) const noexcept
 
value_type * get_local_values ()
 Returns a pointer to the array of local values of the multi-vector. More...
 
const value_type * get_const_local_values () const
 Returns a pointer to the array of local values of the multi-vector. More...
 
const local_vector_type * get_local_vector () const
 Direct (read) access to the underlying local local_vector_type vectors. More...
 
size_type get_stride () const noexcept
 
template<typename OtherValueType , typename = std::enable_if_t<is_complex<ValueType>() == is_complex<OtherValueType>()>>
temporary_conversion< Vector< OtherValueType > > as_precision ()
 Converts the vector to the target precision type. More...
 
template<typename OtherValueType , typename = std::enable_if_t<is_complex<ValueType>() == is_complex<OtherValueType>()>>
temporary_conversion< const Vector< OtherValueType > > as_precision () const
 Converts the vector to the target precision type. More...
 
- Public Member Functions inherited from gko::EnableMultiVector< Vector< ValueType > >
std::unique_ptr< Vector< ValueType > > clone (std::shared_ptr< const Executor > exec) const
 
std::unique_ptr< Vector< ValueType > > clone () const
 
Vector< ValueType > * copy_from (ptr_param< const Vector< ValueType > > other)
 
Vector< ValueType > * move_from (ptr_param< Vector< ValueType > > other)
 
std::unique_ptr< Vector< ValueType > > create_default () const
 
std::unique_ptr< Vector< ValueType > > create_default (std::shared_ptr< const Executor > exec) const
 
std::unique_ptr< Vector< ValueType > > create_subview (local_span rows, local_span columns)
 
std::unique_ptr< const Vector< ValueType > > create_subview (local_span rows, local_span columns) const
 
std::unique_ptr< Vector< ValueType > > create_subview (local_span rows, local_span columns, dim< 2 > global_size)
 
std::unique_ptr< const Vector< ValueType > > create_subview (local_span rows, local_span columns, dim< 2 > global_size) const
 
std::unique_ptr< const real_type > create_real_view () const
 
std::unique_ptr< real_type > create_real_view ()
 
std::unique_ptr< absolute_type > compute_absolute () const
 
void compute_absolute (ptr_param< absolute_type > output) const
 
std::unique_ptr< complex_type > make_complex () const
 
void make_complex (ptr_param< complex_type > output) const
 
std::unique_ptr< real_type > get_real () const
 
void get_real (ptr_param< real_type > output) const
 
std::unique_ptr< real_type > get_imag () const
 
void get_imag (ptr_param< real_type > output) const
 
void convert_to (result_type *result) const override
 
void move_to (result_type *result) override
 
device_view get_local_device_view ()
 Gets a local device view of this vector. More...
 
device_view< ValueType > get_local_device_view ()
 Gets a local device view of this vector for the specified value type. More...
 
const_device_view get_const_local_device_view () const
 Gets a local device view of this vector. More...
 
device_view< const ValueType > get_const_local_device_view () const
 Gets a local device view of this vector. More...
 
- Public Member Functions inherited from gko::AbstractMultiVector
std::unique_ptr< AbstractMultiVector > clone (std::shared_ptr< const Executor > exec) const
 Creates a copy of this vector on the given executor. More...
 
std::unique_ptr< AbstractMultiVector > clone () const
 Creates a copy of this vector on this vector's executor. More...
 
AbstractMultiVector * copy_from (ptr_param< const AbstractMultiVector > other)
 Copies the data of other into this vector. More...
 
AbstractMultiVector * move_from (ptr_param< AbstractMultiVector > other)
 Moves the data of other into this vector. More...
 
std::unique_ptr< AbstractMultiVector > create_default (std::shared_ptr< const Executor > exec) const
 Creates an empty vector with the same type as this vector on the given executor. More...
 
std::unique_ptr< AbstractMultiVector > create_default () const
 Creates an empty vector with the same type as this vector on this vector's executor. More...
 
std::unique_ptr< AbstractMultiVector > compute_absolute () const
 Creates a new vector with the element-wise absolute values of this vector. More...
 
void compute_absolute (ptr_param< AbstractMultiVector > output) const
 Writes the element-wise absolute values of this vector into output. More...
 
void compute_absolute_inplace ()
 Replaces each element of this vector with its absolute value. More...
 
std::unique_ptr< AbstractMultiVector > make_complex () const
 Creates a complex copy of this vector. More...
 
void make_complex (ptr_param< AbstractMultiVector > result) const
 Writes a complex copy of this vector into result. More...
 
std::unique_ptr< AbstractMultiVector > get_real () const
 Creates a new real vector with the real parts of this vector. More...
 
void get_real (ptr_param< AbstractMultiVector > result) const
 Writes the real parts of this vector into result. More...
 
std::unique_ptr< AbstractMultiVector > get_imag () const
 Creates a new real vector with the imaginary parts of this vector. More...
 
void get_imag (ptr_param< AbstractMultiVector > result) const
 Writes the imaginary parts of this vector into result. More...
 
void fill (any_scalar value)
 Fills this vector with a single value. More...
 
void scale (ptr_param< const AbstractMultiVector > alpha)
 Scales this multi-vector element-wise by alpha. More...
 
void inv_scale (ptr_param< const AbstractMultiVector > alpha)
 Divides this multi-vector element-wise by alpha. More...
 
void add_scaled (ptr_param< const AbstractMultiVector > alpha, ptr_param< const AbstractMultiVector > b)
 Adds b scaled by alpha to this (aka: BLAS axpy). More...
 
void sub_scaled (ptr_param< const AbstractMultiVector > alpha, ptr_param< const AbstractMultiVector > b)
 Subtracts b scaled by alpha from this (aka: BLAS axpy). More...
 
void compute_dot (ptr_param< const AbstractMultiVector > b, ptr_param< AbstractMultiVector > result) const
 Computes the column-wise dot product of this and b. More...
 
void compute_dot (ptr_param< const AbstractMultiVector > b, ptr_param< AbstractMultiVector > result, array< char > &tmp) const
 Computes the column-wise dot product of this and b. More...
 
void compute_conj_dot (ptr_param< const AbstractMultiVector > b, ptr_param< AbstractMultiVector > result) const
 Computes the column-wise dot product of conj(this) and b. More...
 
void compute_conj_dot (ptr_param< const AbstractMultiVector > b, ptr_param< AbstractMultiVector > result, array< char > &tmp) const
 Computes the column-wise dot product of conj(this) and b. More...
 
void compute_norm2 (ptr_param< AbstractMultiVector > result) const
 Computes the column-wise Euclidean (L^2) norm of this. More...
 
void compute_norm2 (ptr_param< AbstractMultiVector > result, array< char > &tmp) const
 Computes the column-wise Euclidean (L^2) norm of this. More...
 
void compute_squared_norm2 (ptr_param< AbstractMultiVector > result) const
 Computes the square of the column-wise Euclidean (L^2) norm of this. More...
 
void compute_squared_norm2 (ptr_param< AbstractMultiVector > result, array< char > &tmp) const
 Computes the square of the column-wise Euclidean (L^2) norm of this. More...
 
void compute_norm1 (ptr_param< AbstractMultiVector > result) const
 Computes the column-wise (L^1) norm of this. More...
 
void compute_norm1 (ptr_param< AbstractMultiVector > result, array< char > &tmp) const
 Computes the column-wise (L^1) norm of this. More...
 
std::unique_ptr< const AbstractMultiVector > create_real_view () const
 Create a real view of the (potentially) complex original multi-vector. More...
 
std::unique_ptr< AbstractMultiVector > create_real_view ()
 Create a real view of the (potentially) complex original multi-vector. More...
 
std::unique_ptr< AbstractMultiVector > create_subview (local_span rows, local_span columns)
 Creates a view containing the selected local rows and columns. More...
 
std::unique_ptr< const AbstractMultiVector > create_subview (local_span rows, local_span columns) const
 Creates a const view containing the selected local rows and columns. More...
 
std::unique_ptr< AbstractMultiVector > create_subview (local_span rows, local_span columns, dim< 2 > global_size)
 Creates a view with the selected rows, columns, and global size.
 
std::unique_ptr< const AbstractMultiVector > create_subview (local_span rows, local_span columns, dim< 2 > global_size) const
 Creates a const view with the selected rows, columns, and global size.
 
template<typename ValueType >
device_view< ValueType > get_local_device_view ()
 Gets a local device view of this vector for the specified value type. More...
 
template<typename ValueType >
device_view< const ValueType > get_const_local_device_view () const
 Gets a local device view of this vector for the specified value type. More...
 
temporary_conversion< AbstractMultiVector > as_precision (precision p)
 Creates a temporary conversion of this vector with another precision. More...
 
temporary_conversion< AbstractMultiVector > as_precision (ptr_param< const AbstractMultiVector > p)
 Creates a temporary conversion of this vector with another precision. More...
 
temporary_conversion< const AbstractMultiVector > as_precision (precision p) const
 Creates a temporary conversion of this vector with another precision. More...
 
temporary_conversion< const AbstractMultiVector > as_precision (ptr_param< const AbstractMultiVector > p) const
 Creates a temporary conversion of this vector with another precision. More...
 
precision get_precision () const noexcept
 Gets the precision of this vector. More...
 
dim< 2 > get_size () const noexcept
 Gets the size (number of rows and columns) of this vector. More...
 
dim< 2 > get_local_size () const noexcept
 Gets the size (number of rows and columns) locally owned by this vector. More...
 
 AbstractMultiVector (const AbstractMultiVector &other)
 
 AbstractMultiVector (AbstractMultiVector &&other) noexcept
 
AbstractMultiVector & operator= (const AbstractMultiVector &other)
 Copies the contents of another multi-vector. More...
 
AbstractMultiVector & operator= (AbstractMultiVector &&other) noexcept
 Moves the contents of another multi-vector. More...
 
- Public Member Functions inherited from gko::PolymorphicObject
virtual void validate_data () const
 Throws gko::InvalidData exception if we found the data inside the object does not fulfill certain property up to our knowledge.
 
PolymorphicObject & operator= (const PolymorphicObject &)
 
std::shared_ptr< const Executor > get_executor () const noexcept
 Returns the Executor of the object. More...
 
- Public Member Functions inherited from gko::log::EnableLogging< PolymorphicObject >
void add_logger (std::shared_ptr< const Logger > logger) override
 
void remove_logger (const Logger *logger) override
 
void remove_logger (ptr_param< const Logger > logger)
 
const std::vector< std::shared_ptr< const Logger > > & get_loggers () const override
 
void clear_loggers () override
 
- Public Member Functions inherited from gko::log::Loggable
void remove_logger (ptr_param< const Logger > logger)
 
- Public Member Functions inherited from gko::Cloneable
std::unique_ptr< Cloneable > clone (std::shared_ptr< const Executor > exec) const
 
std::unique_ptr< Cloneable > clone () const
 
Cloneable * copy_from (ptr_param< const Cloneable > other)
 
Cloneable * move_from (ptr_param< Cloneable > other)
 
std::unique_ptr< Cloneable > create_default (std::shared_ptr< const Executor > exec) const
 
std::unique_ptr< Cloneable > create_default () const
 
- Public Member Functions inherited from gko::ConvertibleTo< Vector< ValueType > >
void convert_to (ptr_param< result_type > result) const
 
void move_to (ptr_param< result_type > result)
 
- Public Member Functions inherited from gko::ConvertibleTo< Vector< next_precision< ValueType > > >
virtual void convert_to (result_type *result) const=0
 Converts the implementer to an object of type result_type. More...
 
void convert_to (ptr_param< result_type > result) const
 
virtual void move_to (result_type *result)=0
 Converts the implementer to an object of type result_type by moving data from this object. More...
 
void move_to (ptr_param< result_type > result)
 
- Public Member Functions inherited from gko::experimental::distributed::DistributedBase
 DistributedBase (const DistributedBase &other)=default
 
 DistributedBase (DistributedBase &&other)=default
 
DistributedBase & operator= (const DistributedBase &)
 Copy assignment that doesn't change the used mpi::communicator. More...
 
DistributedBase & operator= (DistributedBase &&) noexcept
 Move assignment that doesn't change the used mpi::communicator. More...
 
mpi::communicator get_communicator () const
 Access the used mpi::communicator. More...
 

Static Public Member Functions

static std::unique_ptr< Vector > create (std::shared_ptr< const Executor > exec, mpi::communicator comm, dim< 2 > global_size, dim< 2 > local_size, size_type stride)
 Creates an empty distributed vector with a specified size. More...
 
static std::unique_ptr< Vector > create (std::shared_ptr< const Executor > exec, mpi::communicator comm, dim< 2 > global_size={}, dim< 2 > local_size={})
 Creates an empty distributed vector with a specified size. More...
 
static std::unique_ptr< Vector > create (std::shared_ptr< const Executor > exec, mpi::communicator comm, dim< 2 > global_size, std::unique_ptr< local_vector_type > local_vector)
 Creates a distributed vector from local vectors with a specified size. More...
 
static std::unique_ptr< Vector > create (std::shared_ptr< const Executor > exec, mpi::communicator comm, std::unique_ptr< local_vector_type > local_vector)
 Creates a distributed vector from local vectors. More...
 
static std::unique_ptr< const Vector > create_const (std::shared_ptr< const Executor > exec, mpi::communicator comm, dim< 2 > global_size, std::unique_ptr< const local_vector_type > local_vector)
 Creates a constant (immutable) distributed Vector from a constant local vector. More...
 
static std::unique_ptr< const Vector > create_const (std::shared_ptr< const Executor > exec, mpi::communicator comm, std::unique_ptr< const local_vector_type > local_vector)
 Creates a constant (immutable) distributed Vector from a constant local vector. More...
 
- Static Public Member Functions inherited from gko::EnableMultiVector< Vector< ValueType > >
static std::unique_ptr< Vector< ValueType > > create_with_config_of (ptr_param< const Vector< ValueType > > other)
 
static std::unique_ptr< Vector< ValueType > > create_with_type_of (ptr_param< const Vector< ValueType > > other, std::shared_ptr< const Executor > exec)
 
static std::unique_ptr< Vector< ValueType > > create_with_type_of (ptr_param< const Vector< ValueType > > other, std::shared_ptr< const Executor > exec, const dim< 2 > &global_size, const dim< 2 > &local_size)
 
static std::unique_ptr< Vector< ValueType > > create_with_type_of (ptr_param< const Vector< ValueType > > other, std::shared_ptr< const Executor > exec, const dim< 2 > &global_size, const dim< 2 > &local_size, size_type stride)
 
- Static Public Member Functions inherited from gko::AbstractMultiVector
static std::unique_ptr< AbstractMultiVector > create_with_config_of (ptr_param< const AbstractMultiVector > other)
 Creates an empty multi-vector with the same type, executor, size, stride and precision as other. More...
 
static std::unique_ptr< AbstractMultiVector > create_with_type_of (ptr_param< const AbstractMultiVector > other, std::shared_ptr< const Executor > exec)
 Creates an empty multi-vector with the same type as other on exec. More...
 
static std::unique_ptr< AbstractMultiVector > create_with_type_of (ptr_param< const AbstractMultiVector > other, std::shared_ptr< const Executor > exec, const dim< 2 > &global_size, const dim< 2 > &local_size)
 Creates an empty multi-vector with the same type as other and the given size. More...
 
static std::unique_ptr< AbstractMultiVector > create_with_type_of (ptr_param< const AbstractMultiVector > other, std::shared_ptr< const Executor > exec, const dim< 2 > &global_size, const dim< 2 > &local_size, size_type stride)
 Creates an empty multi-vector with the same type as other and the given size and stride. More...
 

Friends

class EnableMultiVector< Vector >
 
class Vector< to_complex< ValueType > >
 
class Vector< remove_complex< ValueType > >
 
class Vector< previous_precision< ValueType > >
 

Detailed Description

template<typename ValueType = double>
class gko::experimental::distributed::Vector< ValueType >

Vector is a format which explicitly stores (multiple) distributed column vectors in a dense storage format.

The (multi-)vector is distributed by row, which is described by a Partition. The local vectors are stored using the matrix::MultiVector format. The vector should be filled using the read_distributed method, e.g.

auto vector = Vector<...>::create(exec, comm);
vector->read_distributed(matrix_data, part);

Using this approach the size of the global vectors, as well as the size of the local vectors, will be automatically inferred. It is possible to create a vector with specified global and local sizes and fill the local vectors using the accessor get_local_vector.

Note
Operations between two vectors (axpy, dot product, etc.) are only valid if both vectors where created using the same partition.
Template Parameters
ValueTypeThe precision of vector elements.

Member Function Documentation

◆ as_precision() [1/2]

template<typename ValueType = double>
template<typename OtherValueType , typename = std::enable_if_t<is_complex<ValueType>() == is_complex<OtherValueType>()>>
temporary_conversion<Vector<OtherValueType> > gko::experimental::distributed::Vector< ValueType >::as_precision ( )

Converts the vector to the target precision type.

Note
This overload will include a copy-back operation when the temporary conversion is destroyed, if OtherValueType != ValueType.
Template Parameters
OtherValueTypeThe target precision type. If ValueType is real, OtherValueType must be real. If ValueType is complex, OtherValueType must be complex.
Returns
Temporary conversion to the target precision type.

◆ as_precision() [2/2]

template<typename ValueType = double>
template<typename OtherValueType , typename = std::enable_if_t<is_complex<ValueType>() == is_complex<OtherValueType>()>>
temporary_conversion<const Vector<OtherValueType> > gko::experimental::distributed::Vector< ValueType >::as_precision ( ) const

Converts the vector to the target precision type.

Note
This overload will include a copy-back operation when the temporary conversion is destroyed, if OtherValueType != ValueType.
Template Parameters
OtherValueTypeThe target precision type. If ValueType is real, OtherValueType must be real. If ValueType is complex, OtherValueType must be complex.
Returns
Temporary conversion to the target precision type.

◆ at_local() [1/4]

template<typename ValueType = double>
value_type gko::experimental::distributed::Vector< ValueType >::at_local ( size_type  idx) const
noexcept

◆ at_local() [2/4]

template<typename ValueType = double>
value_type& gko::experimental::distributed::Vector< ValueType >::at_local ( size_type  idx)
noexcept

Returns a single element of the multi-vector.

Useful for iterating across all elements of the multi-vector. However, it is less efficient than the two-parameter variant of this method.

Parameters
idxa linear index of the requested element (ignoring the stride)
Note
the method has to be called on the same Executor the matrix is stored at (e.g. trying to call this method on a GPU matrix from the OMP results in a runtime error)

◆ at_local() [3/4]

template<typename ValueType = double>
value_type gko::experimental::distributed::Vector< ValueType >::at_local ( size_type  row,
size_type  col 
) const
noexcept

◆ at_local() [4/4]

template<typename ValueType = double>
value_type& gko::experimental::distributed::Vector< ValueType >::at_local ( size_type  row,
size_type  col 
)
noexcept

Returns a single element of the multi-vector.

Parameters
rowthe local row of the requested element
colthe local column of the requested element
Note
the method has to be called on the same Executor the multi-vector is stored at (e.g. trying to call this method on a GPU multi-vector from the OMP results in a runtime error)

◆ compute_mean() [1/2]

template<typename ValueType = double>
void gko::experimental::distributed::Vector< ValueType >::compute_mean ( ptr_param< AbstractMultiVector< ValueType > >  result) const

Computes the column-wise mean of this (multi-)vector using a global reduction.

Parameters
resulta row MultiVector, used to store the mean (the number of columns in result must match the number of columns of this)

◆ compute_mean() [2/2]

template<typename ValueType = double>
void gko::experimental::distributed::Vector< ValueType >::compute_mean ( ptr_param< AbstractMultiVector< ValueType > >  result,
array< char > &  tmp 
) const

Computes the column-wise arithmetic mean of this (multi-)vector using a global reduction.

Parameters
resulta row MultiVector, used to store the mean (the number of columns in result must match the number of columns of this)
tmpthe temporary storage to use for partial sums during the reduction computation. It may be resized and/or reset to the correct executor.

◆ create() [1/4]

template<typename ValueType = double>
static std::unique_ptr<Vector> gko::experimental::distributed::Vector< ValueType >::create ( std::shared_ptr< const Executor >  exec,
mpi::communicator  comm,
dim< 2 >  global_size,
dim< 2 >  local_size,
size_type  stride 
)
static

Creates an empty distributed vector with a specified size.

Parameters
execExecutor associated with vector
commCommunicator associated with vector
global_sizeGlobal size of the vector
local_sizeProcessor-local size of the vector
strideStride of the local vector.
Returns
A smart pointer to the newly created vector.

◆ create() [2/4]

template<typename ValueType = double>
static std::unique_ptr<Vector> gko::experimental::distributed::Vector< ValueType >::create ( std::shared_ptr< const Executor >  exec,
mpi::communicator  comm,
dim< 2 >  global_size,
std::unique_ptr< local_vector_type >  local_vector 
)
static

Creates a distributed vector from local vectors with a specified size.

Note
The data form the local_vector will be moved into the new distributed vector. You could either move in a std::unique_ptr directly, copy a local vector with gko::clone, or create a unique non-owning view of a given local vector with gko::make_dense_view.
Parameters
execExecutor associated with this vector
commCommunicator associated with this vector
global_sizeThe global size of the vector
local_vectorThe underlying local vector, the data will be moved into this
Returns
A smart pointer to the newly created vector.

◆ create() [3/4]

template<typename ValueType = double>
static std::unique_ptr<Vector> gko::experimental::distributed::Vector< ValueType >::create ( std::shared_ptr< const Executor >  exec,
mpi::communicator  comm,
dim< 2 >  global_size = {},
dim< 2 >  local_size = {} 
)
static

Creates an empty distributed vector with a specified size.

Parameters
execExecutor associated with vector
commCommunicator associated with vector
global_sizeGlobal size of the vector
local_sizeProcessor-local size of the vector, uses local_size[1] as the stride
Returns
A smart pointer to the newly created vector.

◆ create() [4/4]

template<typename ValueType = double>
static std::unique_ptr<Vector> gko::experimental::distributed::Vector< ValueType >::create ( std::shared_ptr< const Executor >  exec,
mpi::communicator  comm,
std::unique_ptr< local_vector_type >  local_vector 
)
static

Creates a distributed vector from local vectors.

The global size will be deduced from the local sizes, which will incur a collective communication.

Note
The data form the local_vector will be moved into the new distributed vector. You could either move in a std::unique_ptr directly, copy a local vector with gko::clone, or create a unique non-owning view of a given local vector with gko::make_dense_view.
Parameters
execExecutor associated with this vector
commCommunicator associated with this vector
local_vectorThe underlying local vector, the data will be moved into this.
Returns
A smart pointer to the newly created vector.

◆ create_const() [1/2]

template<typename ValueType = double>
static std::unique_ptr<const Vector> gko::experimental::distributed::Vector< ValueType >::create_const ( std::shared_ptr< const Executor >  exec,
mpi::communicator  comm,
dim< 2 >  global_size,
std::unique_ptr< const local_vector_type >  local_vector 
)
static

Creates a constant (immutable) distributed Vector from a constant local vector.

Parameters
execExecutor associated with this vector
commCommunicator associated with this vector
global_sizeThe global size of the vector
local_vectorThe underlying local vector, of which a view is created
Returns
A smart pointer to the newly created vector.

◆ create_const() [2/2]

template<typename ValueType = double>
static std::unique_ptr<const Vector> gko::experimental::distributed::Vector< ValueType >::create_const ( std::shared_ptr< const Executor >  exec,
mpi::communicator  comm,
std::unique_ptr< const local_vector_type >  local_vector 
)
static

Creates a constant (immutable) distributed Vector from a constant local vector.

The global size will be deduced from the local sizes, which will incur a collective communication.

Parameters
execExecutor associated with this vector
commCommunicator associated with this vector
local_vectorThe underlying local vector, of which a view is created
Returns
A smart pointer to the newly created vector.

◆ get_const_local_values()

template<typename ValueType = double>
const value_type* gko::experimental::distributed::Vector< ValueType >::get_const_local_values ( ) const

Returns a pointer to the array of local values of the multi-vector.

Returns
the pointer to the array of local values
Note
This is the constant version of the function, which can be significantly more memory efficient than the non-constant version, so always prefer this version.

◆ get_local_values()

template<typename ValueType = double>
value_type* gko::experimental::distributed::Vector< ValueType >::get_local_values ( )

Returns a pointer to the array of local values of the multi-vector.

Returns
the pointer to the array of local values

◆ get_local_vector()

template<typename ValueType = double>
const local_vector_type* gko::experimental::distributed::Vector< ValueType >::get_local_vector ( ) const

Direct (read) access to the underlying local local_vector_type vectors.

Returns
a constant pointer to the underlying local_vector_type vectors

◆ read_distributed() [1/2]

template<typename ValueType = double>
void gko::experimental::distributed::Vector< ValueType >::read_distributed ( const device_matrix_data< ValueType, int64 > &  data,
ptr_param< const Partition< int64, int64 >>  partition 
)

Reads a vector from the device_matrix_data structure and a global row partition.

The number of rows of the matrix data is ignored, only its number of columns is relevant. Both the number of local and global rows are inferred from the row partition.

Note
The matrix data can contain entries for rows other than those owned by the process. Entries for those rows are discarded.
Parameters
dataThe device_matrix_data structure
partitionThe global row partition

◆ read_distributed() [2/2]

template<typename ValueType = double>
void gko::experimental::distributed::Vector< ValueType >::read_distributed ( const matrix_data< ValueType, int64 > &  data,
ptr_param< const Partition< int64, int64 >>  partition 
)

Reads a vector from the matrix_data structure and a global row partition.

See read_distributed().

Note
For efficiency it is advised to use the device_matrix_data overload.

The documentation for this class was generated from the following files:
gko::experimental::distributed::Vector::create
static std::unique_ptr< Vector > create(std::shared_ptr< const Executor > exec, mpi::communicator comm, dim< 2 > global_size, dim< 2 > local_size, size_type stride)
Creates an empty distributed vector with a specified size.
gko::experimental::distributed::Partition::build_from_mapping
static std::unique_ptr< Partition > build_from_mapping(std::shared_ptr< const Executor > exec, const array< comm_index_type > &mapping, comm_index_type num_parts)
Builds a partition from a given mapping global_index -> part_id.