-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.cc
executable file
·150 lines (124 loc) · 3.32 KB
/
main.cc
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
#include "mpi.h"
#include "tensor.h"
#include "contraction.h"
#include "redistribute.h"
#include "test.h"
//
//#ifdef __bgq__
//#include <mpix.h>
//#else
//#warning This test should be run on a Blue Gene.
//#endif
//
#define TEST 0
using namespace RRR;
int** generate_Addr(int dimension, int max_blocks)
{
int** t_addr = (int**)malloc(dimension * sizeof(int*));
int address_space[dimension * max_blocks];
for(int i = 0; i<dimension; i++)
{
t_addr[i] = &address_space[i * max_blocks];
}
return t_addr;
}
int main(int argc, char* argv[]) {
MPI_Init(&argc, &argv);
//cout<<"Hello"<<endl;
//cout<<"Getting MPI size and rank"<<endl;
int size,rank;
MPI_Comm_size(MPI_COMM_WORLD,&size);
MPI_Comm_rank(MPI_COMM_WORLD,&rank);
//cout<<"Setting pgrid"<<endl;
int* pgrid = new int[5];
pgrid[0] = 2;//atoi(argv[1]);
pgrid[1] = 2;//atoi(argv[1]);
pgrid[2] = 2;//atoi(argv[2]);
pgrid[3] = 2;//atoi(argv[2]);
pgrid[4] = 1;//atoi(argv[2]);
//cout<<"Initializing grid"<<endl;
Grid* grid = new Grid(4, pgrid);
//cout<<"getting parameters"<<endl;
//int ctr = atoi(argv[5]);
//int vgrid_side = atoi(argv[3]);
//int N = atoi(argv[4]);
//
//
////assert(N % vgrid_side == 0);
//if(rank == 0)
//{
// cout << "#nodes = "<<size;
// cout << " Physical grid: ";
// print_tile_addr(4,pgrid);
// cout << " Vgrid side = " << vgrid_side;
// cout << " N = " << N;
// cout << endl << endl;
//}
if(!rank)
cout<<"Calling test program : Identify Receivers"<<endl;
contraction_1(grid,8,32);
MPI_Finalize();
return 0;
}
/*
int main(int argc, char* argv[])
{
cout<<"Hello"<<endl;
MPI_Init(&argc, &argv);
int size,rank;
MPI_Comm_size(MPI_COMM_WORLD,&size);
MPI_Comm_rank(MPI_COMM_WORLD,&rank);
int* pgrid = new int[4];
pgrid[0] = atoi(argv[1]);
pgrid[1] = atoi(argv[1]);
pgrid[2] = atoi(argv[2]);
pgrid[3] = atoi(argv[2]);
Grid* grid = new Grid(4, pgrid);
int ctr = atoi(argv[5]);
int vgrid_side = atoi(argv[3]);
int N = atoi(argv[4]);
//assert(N % vgrid_side == 0);
if(rank == 0)
{
cout << "#nodes = "<<size;
cout << " Physical grid: ";
print_tile_addr(4,pgrid);
cout << " Vgrid side = " << vgrid_side;
cout << " N = " << N;
cout << endl << endl;
}
if(ctr==1)
{
cout<<"Calling test program"<<endl;
redistribute_test(grid, vgrid_side, N);
}
//contraction_1(grid, vgrid_side, N);
/*if(ctr==2)
contraction_2(pgrid, vgrid_side, N);
if(ctr==3)
contraction_3(pgrid, vgrid_side, N);
if(ctr==4)
contraction_4(pgrid, vgrid_side, N);
if(ctr==6)
contraction_6(pgrid, vgrid_side, N);
if(ctr==7)
contraction_7(pgrid, vgrid_side, N);
if(ctr==5)
{
int* ppgrid = new int[2];
ppgrid[0] = atoi(argv[1]);
ppgrid[1] = atoi(argv[2]);
contraction_5(ppgrid, vgrid_side, N);
}
if(ctr==0)
{
contraction_1(pgrid, vgrid_side, N);
contraction_2(pgrid, vgrid_side, N);
contraction_3(pgrid, vgrid_side, N);
contraction_4(pgrid, vgrid_side, N);
contraction_5(pgrid, vgrid_side, N);
}
MPI_Finalize();
return 0;
}
*/