Commit 8b3c5cc0 authored by Björn Fischer's avatar Björn Fischer

create mpi util

parent b890728b
......@@ -11,57 +11,57 @@
1.0000000000
0.1428571429
0.1571330166
0.1926800492
0.2544795945
0.3424186881
0.4656438772
0.6390629773
0.0000182857
0.0000182857
0.0000274286
0.0000365714
0.0000457143
0.0001097143
0.8571428571
0.2857142857
0.1926800492
0.1411981312
0.1397585075
0.1844451573
0.2859846957
0.4656438772
0.0000182857
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000457143
0.7142857143
0.4285714286
0.2544795945
0.1397585075
0.0946683354
0.1080432823
0.1844451573
0.3424186881
0.0000274286
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000365714
0.5714285714
0.5714285714
0.3424186881
0.1844451573
0.1080432823
0.0946683354
0.1397585075
0.2544795945
0.0000365714
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000274286
0.4285714286
0.7142857143
0.4656438772
0.2859846957
0.1844451573
0.1397585075
0.1411981312
0.1926800492
0.0000457143
0.0000000000
0.0000000000
0.0000000000
0.0000000000
0.0000182857
0.2857142857
0.8571428571
0.6390629773
0.4656438772
0.3424186881
0.2544795945
0.1926800492
0.1571330166
0.0001097143
0.0000457143
0.0000365714
0.0000274286
0.0000182857
0.0000182857
0.1428571429
1.0000000000
......
8
8
0.0000000000
0.1428571429
0.2857142857
0.4285714286
0.5714285714
0.7142857143
0.8571428571
1.0000000000
0.1428571429
0.1571330166
0.1926800492
0.2544795945
0.3424186881
0.4656438772
0.6390629773
0.8571428571
0.2857142857
0.1926800492
0.1411981312
0.1397585075
0.1844451573
0.2859846957
0.4656438772
0.7142857143
0.4285714286
0.2544795945
0.1397585075
0.0946683354
0.1080432823
0.1844451573
0.3424186881
0.5714285714
0.5714285714
0.3424186881
0.1844451573
0.1080432823
0.0946683354
0.1397585075
0.2544795945
0.4285714286
0.7142857143
0.4656438772
0.2859846957
0.1844451573
0.1397585075
0.1411981312
0.1926800492
0.2857142857
0.8571428571
0.6390629773
0.4656438772
0.3424186881
0.2544795945
0.1926800492
0.1571330166
0.1428571429
1.0000000000
0.8571428571
0.7142857143
0.5714285714
0.4285714286
0.2857142857
0.1428571429
0.0000000000
#include <mpi.h>
#include "project.h"
void Create_MPI_Type_t_process_info(MPI_Datatype *datatype) {
t_process_info mock;
MPI_Datatype type[7] = {MPI_INT, MPI_INT, MPI_INT, MPI_INT, MPI_INT, MPI_INT, MPI_INT};
int blocklen[7] = {1, 1, 1, 1, 1, 1, 1};
MPI_Aint disp[7];
disp[0] = (void*)&(mock.rank) - (void*)&mock;
disp[1] = (void*)&(mock.coord0) - (void*)&mock;
disp[2] = (void*)&(mock.coord1) - (void*)&mock;
disp[3] = (void*)&(mock.start_m) - (void*)&mock;
disp[4] = (void*)&(mock.start_n) - (void*)&mock;
disp[5] = (void*)&(mock.end_m) - (void*)&mock;
disp[6] = (void*)&(mock.end_n) - (void*)&mock;
MPI_Type_create_struct(7, blocklen, disp, type, datatype);
MPI_Type_commit(datatype);
}
\ No newline at end of file
No preview for this file type
......@@ -13,22 +13,6 @@ double delta_t = 0.000001;
double alpha = 1;
MPI_Datatype MPI_process_info;
void Create_MPI_Type_t_process_info() {
t_process_info mock;
MPI_Datatype type[7] = {MPI_INT, MPI_INT, MPI_INT, MPI_INT, MPI_INT, MPI_INT, MPI_INT};
int blocklen[7] = {1, 1, 1, 1, 1, 1, 1};
MPI_Aint disp[7];
disp[0] = (int)&(mock.rank) - (int)&mock;
disp[1] = (int)&(mock.coord0) - (int)&mock;
disp[2] = (int)&(mock.coord1) - (int)&mock;
disp[3] = (int)&(mock.start_m) - (int)&mock;
disp[4] = (int)&(mock.start_n) - (int)&mock;
disp[5] = (int)&(mock.end_m) - (int)&mock;
disp[6] = (int)&(mock.end_n) - (int)&mock;
MPI_Type_create_struct(7, blocklen, disp, type, &MPI_process_info);
MPI_Type_commit(&MPI_process_info);
}
int main(int argc, char **argv)
{
MPI_Init(&argc, &argv);
......@@ -39,7 +23,7 @@ int main(int argc, char **argv)
t_process_info pi;
t_process_info *infos;
Create_MPI_Type_t_process_info();
Create_MPI_Type_t_process_info(&MPI_process_info);
process_args(argc, argv, &m, &n, &eps, &delta_t);
......
#include <mpi.h>
// matrix.c
double ** New_Matrix(int m, int n);
void Delete_Matrix(double **matrix);
void Write_Matrix(double **a, int m, int n);
void Init_Matrix(double **a, int m, int n, int init_value);
void Insert_Matrix(double **a, int a_dim0, int a_dim1, int pos_dim0, int pos_dim1, double **b, int b_dim0, int b_dim1, int offset_top, int offset_right, int offset_bottom, int offset_left);
void Insert_Array_In_Matrix(double **a, int a_dim0, int a_dim1, int pos_dim0, int pos_dim1, double *b, int b_dim0, int b_dim1, int offset_top, int offset_right, int offset_bottom, int offset_left);
// args.c
void process_args(int argc, char **argv, int *m, int *n, double *eps, double *delta_t);
// mpi_util.c
void Create_MPI_Type_t_process_info(MPI_Datatype *datatype);
//
typedef struct {
int rank;
int coord0;
......
simple 100755 → 100644
File mode changed from 100755 to 100644
test 100755 → 100644
File mode changed from 100755 to 100644
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment