-
Notifications
You must be signed in to change notification settings - Fork 1
/
MyMPI.h
65 lines (53 loc) · 2.13 KB
/
MyMPI.h
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
/* MyMPI.h
*
* Header file for a library of matrix/vector
* input/output/redistribution functions.
*
* Programmed by Michael J. Quinn
*
* Last modification: 4 September 2002
*/
/************************* MACROS **************************/
#define DATA_MSG 0
#define PROMPT_MSG 1
#define RESPONSE_MSG 2
#define OPEN_FILE_ERROR -1
#define MALLOC_ERROR -2
#define TYPE_ERROR -3
#define MIN(a,b) ((a)<(b)?(a):(b))
#define BLOCK_LOW(id,p,n) ((id)*(n)/(p))
#define BLOCK_HIGH(id,p,n) (BLOCK_LOW((id)+1,p,n)-1)
#define BLOCK_SIZE(id,p,n) \
(BLOCK_HIGH(id,p,n)-BLOCK_LOW(id,p,n)+1)
#define BLOCK_OWNER(j,p,n) (((p)*((j)+1)-1)/(n))
#define PTR_SIZE (sizeof(void*))
#define CEILING(i,j) (((i)+(j)-1)/(j))
/***************** MISCELLANEOUS FUNCTIONS *****************/
void terminate (int, char *);
/*************** DATA DISTRIBUTION FUNCTIONS ***************/
void replicate_block_vector (void *, int, void *,
MPI_Datatype, MPI_Comm);
void create_mixed_xfer_arrays (int, int, int, int**, int**);
void create_uniform_xfer_arrays (int, int, int, int**,int**);
/****************** INPUT FUNCTIONS ************************/
void read_checkerboard_matrix (char *, void ***, void **,
MPI_Datatype, int *, int *, MPI_Comm);
void read_col_striped_matrix (char *, void ***, void **,
MPI_Datatype, int *, int *, MPI_Comm);
void read_row_striped_matrix (char *, void ***, void **,
MPI_Datatype, int *, int *, MPI_Comm);
void read_block_vector (char *, void **, MPI_Datatype,
int *, MPI_Comm);
void read_replicated_vector (char *, void **, MPI_Datatype,
int *, MPI_Comm);
/****************** OUTPUT FUNCTIONS ***********************/
void print_checkerboard_matrix (void **, MPI_Datatype, int,
int, MPI_Comm);
void print_col_striped_matrix (void **, MPI_Datatype, int,
int, MPI_Comm);
void print_row_striped_matrix (void **, MPI_Datatype, int,
int, MPI_Comm);
void print_block_vector (void *, MPI_Datatype, int,
MPI_Comm);
void print_replicated_vector (void *, MPI_Datatype, int,
MPI_Comm);