-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathutils.h
More file actions
30 lines (20 loc) · 750 Bytes
/
utils.h
File metadata and controls
30 lines (20 loc) · 750 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
//
// Created by WYF on 2021/12/7.
//
#ifndef SUMMA_UTILS_H
#define SUMMA_UTILS_H
#include <mpi.h>
void matrix_scatter(MPI_Comm comm, const double M[], int n_row, int n_col, double result[], int root);
void matrix_gather(MPI_Comm comm, const double M[], int n_row, int n_col, double result[], int root);
void print_matrix(const double M[], int n_row, int n_col);
void init_matrix(double M[], int n_row, int n_col);
double validate_matrix(const double M[], const double N[], int n_row, int n_col);
void matmul(const double A[], const double B[], double C[], int row_A, int col_A, int col_B);
template<typename T>
void safe_delete_array(T *&p) {
if (p != nullptr) {
delete[] p;
p = nullptr;
}
}
#endif //SUMMA_UTILS_H