diff --git a/src/Infrastructure/Array/include/ESMCI_Array.h b/src/Infrastructure/Array/include/ESMCI_Array.h index ec1a21adb6..197a89511d 100644 --- a/src/Infrastructure/Array/include/ESMCI_Array.h +++ b/src/Infrastructure/Array/include/ESMCI_Array.h @@ -203,13 +203,6 @@ namespace ESMCI { // entry of 0 indicates replicated dim // distr. Array dims as 1, 2, 3, .. only int *contiguousFlag; // [ssiLocalDeCount] - int *exclusiveElementCountPDe; // [deCount] number of elements in - // exclusive region only considering - // DistGrid dims that are associated with - // the Array dims. - // Multiply with tensorElementCount to get - // total number of elements in exclusive - // Array region. int *totalElementCountPLocalDe; // [ssiLocalDeCount] number of elements in // total region only considering // DistGrid dims that are associated with @@ -272,7 +265,6 @@ namespace ESMCI { distgridToPackedArrayMap = NULL; contiguousFlag = NULL; tensorElementCount = 0; - exclusiveElementCountPDe = NULL; totalElementCountPLocalDe = NULL; sizeSuperUndist = NULL; sizeDist = NULL; @@ -311,7 +303,6 @@ namespace ESMCI { distgridToPackedArrayMap = NULL; contiguousFlag = NULL; tensorElementCount = 0; - exclusiveElementCountPDe = NULL; totalElementCountPLocalDe = NULL; sizeSuperUndist = NULL; sizeDist = NULL; @@ -392,8 +383,6 @@ namespace ESMCI { int getReplicatedDimCount() const {return replicatedDimCount;} const int *getUndistLBound() const {return undistLBound;} const int *getUndistUBound() const {return undistUBound;} - const int *getExclusiveElementCountPDe()const - {return exclusiveElementCountPDe;} const int *getTotalElementCountPLocalDe()const {return totalElementCountPLocalDe;} int getTensorElementCount() const {return tensorElementCount;} diff --git a/src/Infrastructure/Array/src/ESMCI_Array.C b/src/Infrastructure/Array/src/ESMCI_Array.C index 3e35b8bc7c..ab8b24c704 100644 --- a/src/Infrastructure/Array/src/ESMCI_Array.C +++ b/src/Infrastructure/Array/src/ESMCI_Array.C @@ -273,21 +273,6 @@ Array::Array( dimCount * sizeof(int)); // indexflag indexflag = indexflagArg; - // exclusiveElementCountPDe - int deCount = delayout->getDeCount(); - exclusiveElementCountPDe = new int[deCount]; - const int *indexCountPDimPDe = distgrid->getIndexCountPDimPDe(); - for (int i=0; idistgridToPackedArrayMap = new int[dimCount]; memcpy(arrayOut->distgridToPackedArrayMap, arrayIn->distgridToPackedArrayMap, dimCount * sizeof(int)); - // exclusiveElementCountPDe - int deCount = arrayIn->delayout->getDeCount(); - arrayOut->exclusiveElementCountPDe = new int[deCount]; - memcpy(arrayOut->exclusiveElementCountPDe, - arrayIn->exclusiveElementCountPDe, deCount * sizeof(int)); // Set up rim members and fill with canonical seqIndex values arrayOut->setRimMembers(); @@ -2623,12 +2601,6 @@ Array *Array::create( if (ssiLocalDeCount) memcpy(arrayOut->contiguousFlag, arrayIn->contiguousFlag, ssiLocalDeCount * sizeof(int)); - // exclusiveElementCountPDe - int deCount = arrayIn->delayout->getDeCount(); - arrayOut->exclusiveElementCountPDe = new int[deCount]; - if (deCount) - memcpy(arrayOut->exclusiveElementCountPDe, - arrayIn->exclusiveElementCountPDe, deCount * sizeof(int)); // totalElementCountPLocalDe arrayOut->totalElementCountPLocalDe = new int[ssiLocalDeCount]; if (ssiLocalDeCount) @@ -4233,30 +4205,6 @@ int Array::print()const{ int de = localDeToDeMap[i]; printf("~ local data in LocalArray for DE %d ~\n", de); larrayList[i]->print(); - if (exclusiveElementCountPDe[de]){ - // associated DE - int j=0; // reset - int jjj=0; // reset - for (int jj=0; jjgetDeCount(); i++) - *ip++ = exclusiveElementCountPDe[i]; } else - ip += 3 + 2*tensorCount + 2*distgrid->getDimCount () + - rank + delayout->getDeCount (); + ip += 3 + 2*tensorCount + 2*distgrid->getDimCount () + rank; // fix offset cp = (char *)ip; @@ -4631,9 +4576,6 @@ int Array::deserialize( distgridToPackedArrayMap[i] = *ip++; tensorElementCount = *ip++; replicatedDimCount = *ip++; - exclusiveElementCountPDe = new int[delayout->getDeCount()]; - for (int i=0; igetDeCount(); i++) - exclusiveElementCountPDe[i] = *ip++; // fix offset cp = (char *)ip; @@ -4791,6 +4733,20 @@ int Array::gather( int redDimCount = rank - tensorCount; + // setup exclusiveElementCountPDe + vector exclusiveElementCountPDe(deCount); + for (int i=0; i commhList(dimCount); // used for indexList comm @@ -5188,6 +5144,20 @@ int Array::scatter( int redDimCount = rank - tensorCount; + // setup exclusiveElementCountPDe + vector exclusiveElementCountPDe(deCount); + for (int i=0; i commhList(dimCount); // used for indexList comm @@ -9378,17 +9348,29 @@ template const int srcLocalDeCount = srcArray->delayout->getLocalDeCount(); const int *srcLocalDeToDeMap = srcArray->delayout->getLocalDeToDeMap(); int *srcLocalDeElementCount = new int[srcLocalDeCount]; + const int *srcIndexCountPDimPDe = srcArray->distgrid->getIndexCountPDimPDe(); int srcElementCount = 0; // initialize for (int i=0; iexclusiveElementCountPDe[de] - * srcArray->tensorElementCount; + srcLocalDeElementCount[i] = 1; // prime the element count + for (int jj=0; jjrank; jj++){ + int j = srcArray->arrayToDistGridMap[jj]; // j is dimIndex basis 1, + // or 0 for tensor dim + if (j){ + // decomposed dimension + --j; // shift to basis 0 + srcLocalDeElementCount[i] *= + srcIndexCountPDimPDe[de*(srcArray->distgrid->getDimCount())+j]; + } + } + srcLocalDeElementCount[i] *= srcArray->tensorElementCount; srcElementCount += srcLocalDeElementCount[i]; } // determine local dstElementCount const int dstLocalDeCount = dstArray->delayout->getLocalDeCount(); const int *dstLocalDeToDeMap = dstArray->delayout->getLocalDeToDeMap(); int *dstLocalDeElementCount = new int[dstLocalDeCount]; + const int *dstIndexCountPDimPDe = dstArray->distgrid->getIndexCountPDimPDe(); int dstElementCount = 0; // initialize for (int i=0; i } }else{ int de = dstLocalDeToDeMap[i]; // global DE index - dstLocalDeElementCount[i] = dstArray->exclusiveElementCountPDe[de] - * dstArray->tensorElementCount; + dstLocalDeElementCount[i] = 1; // prime the element count + for (int jj=0; jjrank; jj++){ + int j = dstArray->arrayToDistGridMap[jj]; // j is dimIndex basis 1, + // or 0 for tensor dim + if (j){ + // decomposed dimension + --j; // shift to basis 0 + dstLocalDeElementCount[i] *= + dstIndexCountPDimPDe[de*(dstArray->distgrid->getDimCount())+j]; + } + } + dstLocalDeElementCount[i] *= dstArray->tensorElementCount; } dstElementCount += dstLocalDeElementCount[i]; }