Welcome to BCL’s documentation!
Communication
-
template<typename T>
struct GlobalPtr Global pointer class. Provides a way to point to remote memory.
Public Functions
-
inline reference operator*() const noexcept
Dereference the global pointer, returning a global reference
GlobalRefthat can be used to read or write to the memory location.
-
inline reference operator*() const noexcept
-
template<typename T>
inline GlobalPtr<T> BCL::alloc(const size_t size) Non-collective function. Allocate a block of global memory on the local rank to hold
sizeelements of typeT. The total size of the allocation will besizeof(T) * size. Does not call any constructors.
-
template<typename T>
inline void BCL::dealloc(GlobalPtr<T> ptr) Non-collective function. Deallocate the block of memory pointed to by
ptr.ptrmust point to memory on the local rank.
-
template<typename T, typename U>
inline GlobalPtr<T> BCL::reinterpret_pointer_cast(GlobalPtr<U> ptr) noexcept Cast a
GlobalPtrto point to memory of another type.
Example
#include <bcl/bcl.hpp>
int main(int argc, char** argv) {
BCL::init();
BCL::GlobalPtr<char> cptr = BCL::alloc<char>(100);
BCL::GlobalPtr<int> iptr = BCL::reinterpret_pointer_cast<int>(cptr);
BCL::finalize();
return 0;
}
Data Structures
-
template<typename T>
class DMatrix : public BCL::DExpr<DMatrix<T>> Distributed dense matrix data structure storing elements of type
T.Public Functions
-
template<typename Blocking = BCL::BlockSquare, typename TeamType = BCL::WorldTeam>
inline DMatrix(matrix_dim dim, Blocking &&blocking = Blocking(), TeamType &&team = TeamType()) Construct a distributed dense matrix of dimension
dim[0]xdim[1]. The optional argumentblockingdescribes how the matrix should be distributed, and the optional argumentteamcontrols on which subset of processes the matrix is stored.
-
inline GlobalRef<T> operator[](matrix_dim index)
Return a reference to element
index[0],index[1]of the matrix.
-
template<typename MatrixType>
inline auto dot(MatrixType &&other) const Multiply the matrix by another matrix or symbolic matrix view, returning the result as a new matrix.
-
template<typename Fn>
inline DMatrix &apply_inplace(Fn &&fn) Apply the functor
fnin place on each element of the matrix.
-
template<typename Fn>
inline DMatrix<T> apply(Fn &&fn) const Return a new matrix equal to the current matrix with
fnapplied to each element.
-
template<typename Fn>
inline DMatrix<T> binary_op(const DMatrix<T> &other, Fn &&fn) const Create a new matrix equal to the result of the binary operation
fnapplied element-wise to the elements of the current matrix and matrixother.
-
template<typename Fn>
inline DMatrix<T> &binary_op_inplace(const DMatrix<T> &other, Fn &&fn) Apply the binary operation
fnelementwise to the current matrix andother, storing the result in the current matrix.
-
inline matrix_dim shape() const noexcept
Return the shape of the matrix.
-
inline void print() const
Print the matrix to the terminal.
-
template<typename Blocking = BCL::BlockSquare, typename TeamType = BCL::WorldTeam>
-
template<typename T, typename I = int>
class SPMatrix Distributed sparse matrix data structure storing elements of type
T. Indices are stored using integral typeI.Public Functions
-
template<typename Blocking = BCL::BlockSquare, typename TeamType = BCL::WorldTeam>
inline SPMatrix(std::string fname, Blocking &&blocking = Blocking(), TeamType &&team = BCL::WorldTeam(), FileFormat format = FileFormat::Unknown) Construct a distributed sparse matrix matching the sparse matrix stored in the file at path
fname. The optional argumentsblockingandteamdetermine the tile distribution strategy and set of processes among which the matrix is distributed, respectively. The optional argumentformatdescribes the storage format of the file.
-
template<typename Blocking = BCL::BlockSquare, typename TeamType = BCL::WorldTeam>
inline SPMatrix(matrix_dim dim, Blocking &&blocking = Blocking(), TeamType &&team = TeamType()) Constructed a distributed sparse matrix of dimension
dim[0] x dim[1]. The optional argumentsblockingandteamdetermine the tile distribution strategy and set of processes among which the matrix is distributed, respectively.
-
inline matrix_dim shape() const noexcept
Return the shape of the sparse matrix.
-
inline std::size_t nnz() const noexcept
Return the number of nonzero elements stored in the sparse matrix.
-
template<typename MatrixType>
inline auto dot(MatrixType &&other) const Multiply the matrix by another matrix or symbolic matrix view, returning the result as a new matrix.
-
inline void print() const
Print distributed sparse matrix data structure.
-
template<typename Blocking = BCL::BlockSquare, typename TeamType = BCL::WorldTeam>