You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: source/module_pw/pw_basis.h
+34-23Lines changed: 34 additions & 23 deletions
Original file line number
Diff line number
Diff line change
@@ -93,13 +93,12 @@ class PW_Basis
93
93
//distribute real-space grids to different processors
94
94
voiddistribute_r();
95
95
96
+
//prepare for MPI_Alltoall
96
97
voidgetstartgr();
97
98
98
-
//distribute plane waves to different processors
99
-
voiddistribution_method1(); // x varies fast
100
-
voiddistribution_method2(); // sticks sorted according to ixy
101
-
// void distribution_method3(); // y varies fast
102
99
100
+
101
+
//prepare for transforms between real and reciprocal spaces
103
102
voidcollect_local_pw();
104
103
105
104
// void collect_tot_pw(
@@ -120,38 +119,52 @@ class PW_Basis
120
119
int distribution_type;
121
120
int poolnproc;
122
121
int poolrank;
123
-
122
+
//distribute plane waves to different processors
123
+
124
+
//method 1: first consider number of plane waves
125
+
voiddistribution_method1();
126
+
// Distribute sticks to cores in method 1.
127
+
voiddivide_sticks_1(
128
+
int* st_i, // x or x + nx (if x < 0) of stick.
129
+
int* st_j, // y or y + ny (if y < 0) of stick.
130
+
int* st_length, // the stick on (ix, iy) consists of st_length[ix*ny+iy] planewaves.
131
+
int* npw_per // number of planewaves on each core.
132
+
);
124
133
125
-
// for both distributeg_method1 and distributeg_method2
134
+
//method 2: first consider number of sticks
135
+
voiddistribution_method2();
136
+
// Distribute sticks to cores in method 2.
137
+
voiddivide_sticks_2();
138
+
139
+
//Count the total number of planewaves (tot_npw) and sticks (this->nstot) (in distributeg method1 and method2)
126
140
voidcount_pw_st(
127
141
int &tot_npw, // total number of planewaves.
128
142
int* st_length2D, // the number of planewaves that belong to the stick located on (x, y).
129
143
int* st_bottom2D // the z-coordinate of the bottom of stick on (x, y).
130
144
);
145
+
146
+
//get ig2isz and is2ixy
131
147
voidget_ig2isz_is2ixy(
132
148
int* st_bottom, // minimum z of stick, stored in 1d array with tot_nst elements.
133
149
int* st_length // the stick on (x, y) consists of st_length[x*ny+y] planewaves.
134
150
);
135
-
// for distributeg_method1
151
+
152
+
//Collect the x, y indexs, length of the sticks (in distributeg method1)
136
153
voidcollect_st(
137
154
int* st_length2D, // the number of planewaves that belong to the stick located on (x, y), stored in 2d x-y plane.
138
155
int* st_bottom2D, // the z-coordinate of the bottom of stick on (x, y), stored in 2d x-y plane.
139
156
int* st_i, // x or x + nx (if x < 0) of stick.
140
157
int* st_j, // y or y + ny (if y < 0) of stick.
141
158
int* st_length // number of planewaves in stick, stored in 1d array with tot_nst elements.
142
159
);
143
-
voiddivide_sticks(
144
-
int* st_i, // x or x + nx (if x < 0) of stick.
145
-
int* st_j, // y or y + ny (if y < 0) of stick.
146
-
int* st_length, // the stick on (x, y) consists of st_length[x*ny+y] planewaves.
147
-
int* npw_per // number of planewaves on each core.
148
-
);
160
+
161
+
//get istot2bigixy
149
162
voidget_istot2bigixy(
150
163
int* st_i, // x or x + nx (if x < 0) of stick.
151
164
int* st_j // y or y + ny (if y < 0) of stick.
152
165
);
153
-
// for distributeg_method2
154
-
voiddivide_sticks2();
166
+
167
+
//Create the maps from ixy to (in method 2)
155
168
voidcreate_maps(
156
169
int* st_length2D, // the number of planewaves that belong to the stick located on (x, y), stored in 2d x-y plane.
157
170
int* npw_per // number of planewaves on each core.
@@ -179,16 +192,14 @@ class PW_Basis
179
192
voidrecip2real(std::complex<float> * in, float *out); //in:(nz, ns) ; out(nplane,nx*ny)
180
193
voidrecip2real(std::complex<float> * in, std::complex<float> * out); //in:(nz, ns) ; out(nplane,nx*ny)
181
194
#endif
195
+
//gather planes and scatter sticks of all processors
182
196
template<typename T>
183
-
voidgatherp_scatters(std::complex<T> *in, std::complex<T> *out); //gather planes and scatter sticks of all processors
184
-
template<typename T>
185
-
voidgathers_scatterp(std::complex<T> *in, std::complex<T> *out); //gather sticks of and scatter planes of all processors
186
-
// void gathers_scatterp2(std::complex<double> *in, std::complex<double> *out); //gather sticks of and scatter planes of all processors
187
-
// void gatherp_scatters2(std::complex<double> *in, std::complex<double> *out); //gather sticks of and scatter planes of all processors
188
-
// void gatherp_scatters_gamma(std::complex<double> *in, std::complex<double> *out); //gather planes and scatter sticks of all processors, used when gamma_only
189
-
// void gathers_scatterp_gamma(std::complex<double> *in, std::complex<double> *out); //gather sticks of and scatter planes of all processors, used when gamma only
0 commit comments