@@ -273,21 +273,6 @@ Array::Array(
273
273
dimCount * sizeof (int ));
274
274
// indexflag
275
275
indexflag = indexflagArg ;
276
- // exclusiveElementCountPDe
277
- int deCount = delayout -> getDeCount ();
278
- exclusiveElementCountPDe = new int [deCount ];
279
- const int * indexCountPDimPDe = distgrid -> getIndexCountPDimPDe ();
280
- for (int i = 0 ; i < deCount ; i ++ ){
281
- exclusiveElementCountPDe [i ] = 1 ; // prime exclusiveElementCountPDe element
282
- for (int jj = 0 ; jj < rank ; jj ++ ){
283
- int j = arrayToDistGridMap [jj ];// j is dimIndex basis 1, or 0 for tensor d
284
- if (j ){
285
- // decomposed dimension
286
- -- j ; // shift to basis 0
287
- exclusiveElementCountPDe [i ] *= indexCountPDimPDe [i * dimCount + j ];
288
- }
289
- }
290
- }
291
276
// totalElementCountPLocalDe
292
277
totalElementCountPLocalDe = new int [ssiLocalDeCount ];
293
278
for (int i = 0 ; i < ssiLocalDeCount ; i ++ ){
@@ -439,8 +424,6 @@ void Array::destruct(bool followCreator, bool noGarbage){
439
424
delete [] distgridToPackedArrayMap ;
440
425
if (contiguousFlag != NULL )
441
426
delete [] contiguousFlag ;
442
- if (exclusiveElementCountPDe != NULL )
443
- delete [] exclusiveElementCountPDe ;
444
427
if (totalElementCountPLocalDe != NULL )
445
428
delete [] totalElementCountPLocalDe ;
446
429
if (sizeSuperUndist != NULL )
@@ -2412,11 +2395,6 @@ Array *Array::create(
2412
2395
arrayOut -> distgridToPackedArrayMap = new int [dimCount ];
2413
2396
memcpy (arrayOut -> distgridToPackedArrayMap ,
2414
2397
arrayIn -> distgridToPackedArrayMap , dimCount * sizeof (int ));
2415
- // exclusiveElementCountPDe
2416
- int deCount = arrayIn -> delayout -> getDeCount ();
2417
- arrayOut -> exclusiveElementCountPDe = new int [deCount ];
2418
- memcpy (arrayOut -> exclusiveElementCountPDe ,
2419
- arrayIn -> exclusiveElementCountPDe , deCount * sizeof (int ));
2420
2398
2421
2399
// Set up rim members and fill with canonical seqIndex values
2422
2400
arrayOut -> setRimMembers ();
@@ -2623,12 +2601,6 @@ Array *Array::create(
2623
2601
if (ssiLocalDeCount )
2624
2602
memcpy (arrayOut -> contiguousFlag , arrayIn -> contiguousFlag ,
2625
2603
ssiLocalDeCount * sizeof (int ));
2626
- // exclusiveElementCountPDe
2627
- int deCount = arrayIn -> delayout -> getDeCount ();
2628
- arrayOut -> exclusiveElementCountPDe = new int [deCount ];
2629
- if (deCount )
2630
- memcpy (arrayOut -> exclusiveElementCountPDe ,
2631
- arrayIn -> exclusiveElementCountPDe , deCount * sizeof (int ));
2632
2604
// totalElementCountPLocalDe
2633
2605
arrayOut -> totalElementCountPLocalDe = new int [ssiLocalDeCount ];
2634
2606
if (ssiLocalDeCount )
@@ -4233,30 +4205,6 @@ int Array::print()const{
4233
4205
int de = localDeToDeMap [i ];
4234
4206
printf ("~ local data in LocalArray for DE %d ~\n" , de );
4235
4207
larrayList [i ]-> print ();
4236
- if (exclusiveElementCountPDe [de ]){
4237
- // associated DE
4238
- int j = 0 ; // reset
4239
- int jjj = 0 ; // reset
4240
- for (int jj = 0 ; jj < rank ; jj ++ ){
4241
- if (arrayToDistGridMap [jj ]){
4242
- // distributed dimension
4243
- printf ("dim %d: [%d]: [%d [%d [%d, %d] %d] %d]\n" ,
4244
- jj + 1 , j ,
4245
- totalLBound [i * redDimCount + j ], computationalLBound [i * redDimCount + j ],
4246
- exclusiveLBound [i * redDimCount + j ], exclusiveUBound [i * redDimCount + j ],
4247
- computationalUBound [i * redDimCount + j ], totalUBound [i * redDimCount + j ]);
4248
- ++ j ;
4249
- }else {
4250
- // non-distributed dimension
4251
- printf ("dim %d: undistLBound[%d]=%d undistUBound[%d]=%d\n" ,
4252
- jj + 1 , jjj , undistLBound [jjj ], jjj , undistUBound [jjj ]);
4253
- ++ jjj ;
4254
- }
4255
- }
4256
- }else {
4257
- // unassociated DE
4258
- printf ("this DE is not associated with DistGrid points\n" );
4259
- }
4260
4208
}
4261
4209
printf ("--- ESMCI::Array::print end ---\n" );
4262
4210
@@ -4535,11 +4483,8 @@ int Array::serialize(
4535
4483
* ip ++ = distgridToPackedArrayMap [i ];
4536
4484
* ip ++ = tensorElementCount ;
4537
4485
* ip ++ = replicatedDimCount ;
4538
- for (int i = 0 ; i < delayout -> getDeCount (); i ++ )
4539
- * ip ++ = exclusiveElementCountPDe [i ];
4540
4486
} else
4541
- ip += 3 + 2 * tensorCount + 2 * distgrid -> getDimCount () +
4542
- rank + delayout -> getDeCount ();
4487
+ ip += 3 + 2 * tensorCount + 2 * distgrid -> getDimCount () + rank ;
4543
4488
4544
4489
// fix offset
4545
4490
cp = (char * )ip ;
@@ -4631,9 +4576,6 @@ int Array::deserialize(
4631
4576
distgridToPackedArrayMap [i ] = * ip ++ ;
4632
4577
tensorElementCount = * ip ++ ;
4633
4578
replicatedDimCount = * ip ++ ;
4634
- exclusiveElementCountPDe = new int [delayout -> getDeCount ()];
4635
- for (int i = 0 ; i < delayout -> getDeCount (); i ++ )
4636
- exclusiveElementCountPDe [i ] = * ip ++ ;
4637
4579
4638
4580
// fix offset
4639
4581
cp = (char * )ip ;
@@ -4791,6 +4733,20 @@ int Array::gather(
4791
4733
4792
4734
int redDimCount = rank - tensorCount ;
4793
4735
4736
+ // setup exclusiveElementCountPDe
4737
+ vector < int > exclusiveElementCountPDe (deCount );
4738
+ for (int i = 0 ; i < deCount ; i ++ ){
4739
+ exclusiveElementCountPDe [i ] = 1 ; // prime exclusiveElementCountPDe element
4740
+ for (int jj = 0 ; jj < rank ; jj ++ ){
4741
+ int j = arrayToDistGridMap [jj ];// j is dimIndex basis 1, or 0 for tensor d
4742
+ if (j ){
4743
+ // decomposed dimension
4744
+ -- j ; // shift to basis 0
4745
+ exclusiveElementCountPDe [i ] *= indexCountPDimPDe [i * dimCount + j ];
4746
+ }
4747
+ }
4748
+ }
4749
+
4794
4750
// prepare for comms
4795
4751
VMK ::commhandle * commh ; // used by all comm calls
4796
4752
vector < VMK ::commhandle * > commhList (dimCount ); // used for indexList comm
@@ -5188,6 +5144,20 @@ int Array::scatter(
5188
5144
5189
5145
int redDimCount = rank - tensorCount ;
5190
5146
5147
+ // setup exclusiveElementCountPDe
5148
+ vector < int > exclusiveElementCountPDe (deCount );
5149
+ for (int i = 0 ; i < deCount ; i ++ ){
5150
+ exclusiveElementCountPDe [i ] = 1 ; // prime exclusiveElementCountPDe element
5151
+ for (int jj = 0 ; jj < rank ; jj ++ ){
5152
+ int j = arrayToDistGridMap [jj ];// j is dimIndex basis 1, or 0 for tensor d
5153
+ if (j ){
5154
+ // decomposed dimension
5155
+ -- j ; // shift to basis 0
5156
+ exclusiveElementCountPDe [i ] *= indexCountPDimPDe [i * dimCount + j ];
5157
+ }
5158
+ }
5159
+ }
5160
+
5191
5161
// prepare for comms
5192
5162
VMK ::commhandle * commh ; // used by all comm calls
5193
5163
vector < VMK ::commhandle * > commhList (dimCount ); // used for indexList comm
@@ -9378,17 +9348,29 @@ template<typename SIT, typename DIT>
9378
9348
const int srcLocalDeCount = srcArray -> delayout -> getLocalDeCount ();
9379
9349
const int * srcLocalDeToDeMap = srcArray -> delayout -> getLocalDeToDeMap ();
9380
9350
int * srcLocalDeElementCount = new int [srcLocalDeCount ];
9351
+ const int * srcIndexCountPDimPDe = srcArray -> distgrid -> getIndexCountPDimPDe ();
9381
9352
int srcElementCount = 0 ; // initialize
9382
9353
for (int i = 0 ; i < srcLocalDeCount ; i ++ ){
9383
9354
int de = srcLocalDeToDeMap [i ]; // global DE index
9384
- srcLocalDeElementCount [i ] = srcArray -> exclusiveElementCountPDe [de ]
9385
- * srcArray -> tensorElementCount ;
9355
+ srcLocalDeElementCount [i ] = 1 ; // prime the element count
9356
+ for (int jj = 0 ; jj < srcArray -> rank ; jj ++ ){
9357
+ int j = srcArray -> arrayToDistGridMap [jj ]; // j is dimIndex basis 1,
9358
+ // or 0 for tensor dim
9359
+ if (j ){
9360
+ // decomposed dimension
9361
+ -- j ; // shift to basis 0
9362
+ srcLocalDeElementCount [i ] *=
9363
+ srcIndexCountPDimPDe [de * (srcArray -> distgrid -> getDimCount ())+ j ];
9364
+ }
9365
+ }
9366
+ srcLocalDeElementCount [i ] *= srcArray -> tensorElementCount ;
9386
9367
srcElementCount += srcLocalDeElementCount [i ];
9387
9368
}
9388
9369
// determine local dstElementCount
9389
9370
const int dstLocalDeCount = dstArray -> delayout -> getLocalDeCount ();
9390
9371
const int * dstLocalDeToDeMap = dstArray -> delayout -> getLocalDeToDeMap ();
9391
9372
int * dstLocalDeElementCount = new int [dstLocalDeCount ];
9373
+ const int * dstIndexCountPDimPDe = dstArray -> distgrid -> getIndexCountPDimPDe ();
9392
9374
int dstElementCount = 0 ; // initialize
9393
9375
for (int i = 0 ; i < dstLocalDeCount ; i ++ ){
9394
9376
if (haloFlag ){
@@ -9405,8 +9387,18 @@ template<typename SIT, typename DIT>
9405
9387
}
9406
9388
}else {
9407
9389
int de = dstLocalDeToDeMap [i ]; // global DE index
9408
- dstLocalDeElementCount [i ] = dstArray -> exclusiveElementCountPDe [de ]
9409
- * dstArray -> tensorElementCount ;
9390
+ dstLocalDeElementCount [i ] = 1 ; // prime the element count
9391
+ for (int jj = 0 ; jj < dstArray -> rank ; jj ++ ){
9392
+ int j = dstArray -> arrayToDistGridMap [jj ]; // j is dimIndex basis 1,
9393
+ // or 0 for tensor dim
9394
+ if (j ){
9395
+ // decomposed dimension
9396
+ -- j ; // shift to basis 0
9397
+ dstLocalDeElementCount [i ] *=
9398
+ dstIndexCountPDimPDe [de * (dstArray -> distgrid -> getDimCount ())+ j ];
9399
+ }
9400
+ }
9401
+ dstLocalDeElementCount [i ] *= dstArray -> tensorElementCount ;
9410
9402
}
9411
9403
dstElementCount += dstLocalDeElementCount [i ];
9412
9404
}
0 commit comments