sisi4s
Loading...
Searching...
No Matches
ScaLapackMatrix.hpp
Go to the documentation of this file.
1#ifndef SCA_LAPACK_MATRIX_DEFINED
2#define SCA_LAPACK_MATRIX_DEFINED
3
4#include <util/BlacsWorld.hpp>
5#include <util/Tensor.hpp>
6
7namespace sisi4s {
9public:
10 ScaLapackDescriptor(BlacsWorld *blacsWorld, int lens_[2], int blockSize);
11 int dataType; // 1 for dense matrices
13 int lens[2];
14 int blockSize[2];
15 int offset[2];
16 int localLens[2]; // NOTE: assumes column major format
17 // NOTE: the last element localLens[1]=number of local columns
18 // is actually not part of the scalapack descriptor
19};
20
21template <typename F = double>
23public:
33 ScaLapackMatrix(CTF::Matrix<F> &A,
35 int blockSize = 64);
44 int lens[2],
46 int blockSize = 64);
52
58 const int *getDescriptor() const { return &dataType; }
59
63 const F *getLocalValues() const { return localValues; }
64
69 F *getLocalValues() { return localValues; }
70
75 void write(CTF::Matrix<F> &A);
82 void write(Tensor<F> &A);
83
84protected:
89 int getGlobalIndex(int localIndex, int dimension);
90
101 int64_t *localIndices;
102
107};
108} // namespace sisi4s
109
110#endif
Definition BlacsWorld.hpp:5
Definition ScaLapackMatrix.hpp:8
int dataType
Definition ScaLapackMatrix.hpp:11
int blockSize[2]
Definition ScaLapackMatrix.hpp:14
int blacsContext
Definition ScaLapackMatrix.hpp:12
int offset[2]
Definition ScaLapackMatrix.hpp:15
int lens[2]
Definition ScaLapackMatrix.hpp:13
int localLens[2]
Definition ScaLapackMatrix.hpp:16
Definition ScaLapackMatrix.hpp:22
const int * getDescriptor() const
Returns a pointer to a ScaLapack matrix descriptor, i.e. the first 9 integers of the class ScaLapackD...
Definition ScaLapackMatrix.hpp:58
BlacsWorld * blacsWorld
The BlacsWorld specifying the processor grid this matrix is distributed over.
Definition ScaLapackMatrix.hpp:95
void write(CTF::Matrix< F > &A)
Writes the content of the ScaLapackMatrix to the given CTF::Matrix. The CTF::Matrix must be allocated...
Definition ScaLapackMatrix.cxx:135
const F * getLocalValues() const
Returns the pointer to the block data owned by this process.
Definition ScaLapackMatrix.hpp:63
F * getLocalValues()
Returns the pointer to the mutable block data owned by this process.
Definition ScaLapackMatrix.hpp:69
int64_t * localIndices
The global indices within the local matrix elements owned by this process. The global index of an ele...
Definition ScaLapackMatrix.hpp:101
int getGlobalIndex(int localIndex, int dimension)
Retrieves the global row or column index within the full matrix from the given row or column index wi...
Definition ScaLapackMatrix.cxx:156
F * localValues
The block data owned by this process.
Definition ScaLapackMatrix.hpp:106
~ScaLapackMatrix()
Frees all resources associated with the ScaLapack matrix on all processes.
Definition ScaLapackMatrix.cxx:125
Definition Algorithm.hpp:10
CTF::Tensor< F > Tensor
Definition Tensor.hpp:9