-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.c
47 lines (44 loc) · 956 Bytes
/
main.c
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
#include "var.h"
void parametercheck(){
//wiggle length
if(LEVYLENGTH>MAXLEVYLENGTH) {
if(!rank){
printf("MAXLEVYLENGTH too small, please redefine\n");
}
MPI_Finalize();
exit(0);
}
//path length
if(N+1>MAXN) {
if(!rank){
printf("MAXN too small, please redefine\n");
}
MPI_Finalize();
exit(0);
}
//particle number check
if(ParticleNumber>MAXPARTICLENUM) {
if(!rank){
printf("MAXN too small, please redefine\n");
}
MPI_Finalize();
exit(0);
}
}
int main(int argc, char *argv[]){
//initialize mpi
MPI_Init(&argc, &argv);
MPI_Comm_size(MPI_COMM_WORLD, &numprocs);
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
if(!rank){
printf("Total processor used:%d\n",numprocs);
}
//initialize parameters
initialize(argc,argv);
//check parameters
parametercheck();
//calculate
calc();
//finalize
MPI_Finalize();
}