Mercurial > cgi-bin > hgwebdir.cgi > PR > Applications > SSR > SSR__Blocked_Matrix_Mult__Bench
changeset 17:d0c179cdf75a
New states for sub-repos, almost works, just bug in shutdown to fix still
| author | Some Random Person <seanhalle@yahoo.com> |
|---|---|
| date | Wed, 14 Mar 2012 23:22:00 -0700 |
| parents | c90753be66bd |
| children | 5671f96e0b5f |
| files | SSR_Matrix_Mult/Divide_Pr.c |
| diffstat | 1 files changed, 21 insertions(+), 30 deletions(-) [+] |
line diff
1.1 --- a/SSR_Matrix_Mult/Divide_Pr.c Tue Mar 13 18:31:04 2012 -0700 1.2 +++ b/SSR_Matrix_Mult/Divide_Pr.c Wed Mar 14 23:22:00 2012 -0700 1.3 @@ -359,8 +359,8 @@ 1.4 int32 numLeftColIdxs, numRightColIdxs; 1.5 int32 leftRowIdxOffset; 1.6 SMPairParams *subMatrixPairParams; 1.7 - float32 numToPutOntoEachCore, leftOverFraction; 1.8 - int32 numCores, coreToAssignOnto, numVecOnCurrCore; 1.9 + float32 numToPutOntoEachCore, leftOverFraction, numVecOnCurrCore; 1.10 + int32 numCores, coreToAssignOnto; 1.11 1.12 numLeftColIdxs = numColIdxs; 1.13 numRightColIdxs = numVecIdxs; 1.14 @@ -397,35 +397,26 @@ 1.15 subMatrixPairParams, 1.16 animatingPr, 1.17 coreToAssignOnto ); 1.18 - } 1.19 1.20 - //Trying to distribute the subMatrix-vectors across the cores, so 1.21 - // that each core gets the same number of vectors, with a max 1.22 - // imbalance of 1 vector more on some cores than others 1.23 - numVecOnCurrCore += 1; 1.24 - if( numVecOnCurrCore + leftOverFraction >= numToPutOntoEachCore -1 ) 1.25 - { 1.26 - //deal with fractional part, to ensure that imbalance is 1 max 1.27 - // IE, core with most has only 1 more than core with least 1.28 - leftOverFraction += numToPutOntoEachCore - numVecOnCurrCore; 1.29 - if( leftOverFraction >= 1 ) 1.30 - { leftOverFraction -= 1; 1.31 - numVecOnCurrCore = -1; 1.32 - } 1.33 - else 1.34 - { numVecOnCurrCore = 0; 1.35 - } 1.36 - //Move to next core, max core-value to incr to is numCores -1 1.37 - if( coreToAssignOnto >= numCores -1 ) 1.38 - { coreToAssignOnto = 0; 1.39 - } 1.40 - else 1.41 - { coreToAssignOnto += 1; 1.42 - } 1.43 - } 1.44 - 1.45 - } 1.46 - } 1.47 + //Trying to distribute the subMatrix-vectors across the cores, so 1.48 + // that each core gets the same number of vectors, with a max 1.49 + // imbalance of 1 vector more on some cores than others 1.50 + numVecOnCurrCore += 1; //incr before checking, so 1.51 + if( numVecOnCurrCore > numToPutOntoEachCore ) //actual num 1 less 1.52 + { 1.53 + //deal with fractional part, to ensure that imbalance is 1 max 1.54 + // IE, core with most has only 1 more than core with least 1.55 + leftOverFraction = numToPutOntoEachCore - numVecOnCurrCore; 1.56 + if( leftOverFraction > 1 ) ERROR("division alg messed up\n"); 1.57 + numVecOnCurrCore = leftOverFraction; //accumulates "extra" 1.58 + 1.59 + //Move to next core, max core-value to incr to is numCores -1 1.60 + coreToAssignOnto += 1; 1.61 + if( coreToAssignOnto >= numCores ) coreToAssignOnto = 0; 1.62 + } //if 1.63 + } //for( vecIdx 1.64 + } //for( resColIdx 1.65 + } //for( resRowIdx 1.66 1.67 } 1.68
