Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Организация и исследование параллельно-последовательных вычислений на кластере МЭИ при решении класса матричных задач большой разм.docx
Скачиваний:
101
Добавлен:
28.06.2014
Размер:
1.26 Mб
Скачать

3.5. Выводы по главе 3

В главе предложена и реализована параллельно-последовательная модификация алгоритма матричного умножения. Проведено исследование временных характеристик решений от видов используемых обменных взаимодействий и от зернистости разбиений. Экспериментально подтверждено, что в модели передачи сообщений следует предпочесть крупнозернистую декомпозицию. Построены графики зависимостей времени решения задачи от влияющих на него параметров и объяснены их наиболее интересные точки.

Приложение 1. Классы, используемые в модификации метода Якоби

class Vector

{

private:

int size;

double *v;

public:

explicit Vector(int n = 0);

Vector(const Vector& vector);

Vector(int Size, double *V);

~Vector();

int GetSize() const {return size; }

int SetSize(int n);

Vector operator = (const Vector& vector);

double& operator [] (int n);

double operator [] (int n) const;

Vector operator - () const;

int operator == (const Vector& vector) const;

Vector operator + (const Vector& vector) const;

Vector operator += (const Vector& vector);

Vector operator - (const Vector& vector) const;

Vector operator -= (const Vector& vector);

Vector operator + (double value) const;

Vector operator += (double value);

Vector operator - (double value) const;

Vector operator -= (double value);

double operator * (const Vector& vector) const;

double Normi();

Vector SubVector(int X, int Y);

double* Destroy();

void Show();

};

class Matrix

{

private:

int n, m;

double *A;

public:

int isnull;

explicit Matrix(int n = 0, int m = 0);

Matrix(const Matrix& matrix);

Matrix(int N, int M, double *a);

~Matrix();

int GetN() const {return n; }

int GetM() const {return m; }

int SetSize(int N, int M);

Matrix operator = (const Matrix& matrix);

double& elem (int N, int M);

double elem (int N, int M) const;

void SetElem(int N, int M, double X);

Matrix operator - () const;

int operator == (const Matrix& matrix) const;

Matrix operator + (const Matrix& matrix) const;

Matrix operator - (const Matrix& matrix) const;

Matrix operator + (double value) const;

Matrix operator - (double value) const;

Matrix operator * (const Matrix& matrix) const;

int IsNull();

Matrix SubMatrix(int X1, int Y1, int X2, int Y2);

friend Vector operator * (const Matrix& Matr, const Vector& Vect);

friend Vector GetSolve(const Matrix& Matr, const Vector& Vectb, const Vector& Vectx);

void Show();

double* Destroy();

};

class MySystem

{

private:

Matrix A;

Vector b;

Vector x;

double eps;

int Size;

public:

MySystem() {Matrix A; Vector b; Vector x; };

MySystem(char* addr);

~MySystem() {};

int GetSize() {return Size; };

Vector GetPtrV() {return b;};

Matrix GetPtrA() {return A;};

double GetEps() {return eps; };

};

Приложение 2. Классы, используемые в реализации матричного умножения

class TBlock

{

private:

int size;

float *allElem;

float *noZeroElem;

int *row;

int *col;

int numb;

bool nullCheck;

bool isNull;

bool effectiveStorage;

public:

TBlock();

TBlock(bool EffectiveStorage, bool CheckNull, int Size);

TBlock(const TBlock& block);

~TBlock();

void CheckTriviality();

void setElem(float Elem, int I, int J);

float getElem(int I, int J);

void Show(); int getSize(){return this->size;};

TBlock operator = (const TBlock& block);

TBlock operator + (const TBlock& block);

friend void Ssend(TBlock block, int address, int tag);

friend void Receive(TBlock *block, int address, int tag, MPI_Status *Status);

friend void Cast(TBlock *block, int root);

bool getStorage(){return this->effectiveStorage;};

bool getIsNull(){return this->isNull;};

bool getNullCheck(){return this->nullCheck;};

void getOptions(int *mes);

};

class TMatrix

{

private:

TBlock **block; int n; int m; int N; int M; int blockSize; bool nullCheck; bool effectiveStorage;

public:

TMatrix(int EffectiveStorage, int NullCheck, int BlockSize, int nn, int mm);

~TMatrix(); void setElem(float Elem, int I, int J);

void setBlock(TBlock block, int I, int J);

float getElem(int I, int J);

TBlock getBlock(int I, int J);

void Show();

friend void Cast(TMatrix *matr, int root);

};

Соседние файлы в предмете Государственный экзамен