158 int *row_indices_forcpu = NULL;
159 int *col_indices_forcpu = NULL;
160 int *modes_forcpu = NULL;
161 doubletype *values_forcpu = NULL;
162 int *numvalues_forcpu = NULL;
163 DataSet **bucketsforcpu = NULL;
165 int **row_indices_fromcpu = NULL;
166 int **col_indices_fromcpu = NULL;
167 int **modes_fromcpu = NULL;
168 doubletype **values_fromcpu = NULL;
169 int *numvalues_fromcpu = NULL;
173 int* sendcnts = NULL;
185 bucketsforcpu=xNew<DataSet*>(num_procs);
187 for(i=0;i<num_procs;i++){
193 bucketsforcpu[i]=bucketsofcpu_i;
200 this->
BucketsBuildScatterBuffers(&numvalues_forcpu,&row_indices_forcpu,&col_indices_forcpu,&values_forcpu,&modes_forcpu,bucketsforcpu,num_procs);
205 numvalues_fromcpu = xNew<int>(num_procs);
206 for(i=0;i<num_procs;i++){
210 row_indices_fromcpu=xNew<int*>(num_procs);
211 col_indices_fromcpu=xNew<int*>(num_procs);
212 values_fromcpu=xNew<doubletype*>(num_procs);
213 modes_fromcpu=xNew<int*>(num_procs);
214 for(i=0;i<num_procs;i++){
215 int size=numvalues_fromcpu[i];
217 row_indices_fromcpu[i]=xNew<int>(size);
218 col_indices_fromcpu[i]=xNew<int>(size);
219 values_fromcpu[i]=xNew<doubletype>(size);
220 modes_fromcpu[i]=xNew<int>(size);
223 row_indices_fromcpu[i]=NULL;
224 col_indices_fromcpu[i]=NULL;
225 values_fromcpu[i]=NULL;
226 modes_fromcpu[i]=NULL;
235 sendcnts=xNew<int>(num_procs);
236 displs=xNew<int>(num_procs);
238 for(i=0;i<num_procs;i++){
239 sendcnts[i]=numvalues_forcpu[i];
241 count+=numvalues_forcpu[i];
244 for(i=0;i<num_procs;i++){
254 for(i=0;i<num_procs;i++){
255 int numvalues=numvalues_fromcpu[i];
256 int* rows=row_indices_fromcpu[i];
257 int* cols=col_indices_fromcpu[i];
258 doubletype* values=values_fromcpu[i];
259 int* mods=modes_fromcpu[i];
261 for(j=0;j<numvalues;j++){
262 if(mods[j]==
ADD_VAL) *(
matrix+
N*(rows[j]-lower_row)+cols[j])+=values[j];
263 else *(
matrix+
N*(rows[j]-lower_row)+cols[j])=values[j];
269 xDelete<int>(RowRank);
270 xDelete<int>(row_indices_forcpu);
271 xDelete<int>(col_indices_forcpu);
272 xDelete<int>(modes_forcpu);
273 xDelete<doubletype>(values_forcpu);
274 xDelete<int>(numvalues_forcpu);
276 for(i=0;i<num_procs;i++){
280 xDelete<DataSet*>(bucketsforcpu);
282 for(i=0;i<num_procs;i++){
283 int* rows=row_indices_fromcpu[i];
284 int* cols=col_indices_fromcpu[i];
285 int* modes=modes_fromcpu[i];
286 doubletype* values=values_fromcpu[i];
291 xDelete<doubletype>(values);
293 xDelete<int*>(row_indices_fromcpu);
294 xDelete<int*>(col_indices_fromcpu);
295 xDelete<int*>(modes_fromcpu);
296 xDelete<doubletype*>(values_fromcpu);
297 xDelete<int>(numvalues_fromcpu);
299 xDelete<int>(sendcnts);
300 xDelete<int>(displs);