# HG changeset patch # User Some Random Person # Date 1331792520 25200 # Node ID d0c179cdf75a2c8192a7c3ce242d44fc58fc6018 # Parent c90753be66bd8a1f110d4d03e995aecd88988871 New states for sub-repos, almost works, just bug in shutdown to fix still diff -r c90753be66bd -r d0c179cdf75a SSR_Matrix_Mult/Divide_Pr.c --- a/SSR_Matrix_Mult/Divide_Pr.c Tue Mar 13 18:31:04 2012 -0700 +++ b/SSR_Matrix_Mult/Divide_Pr.c Wed Mar 14 23:22:00 2012 -0700 @@ -359,8 +359,8 @@ int32 numLeftColIdxs, numRightColIdxs; int32 leftRowIdxOffset; SMPairParams *subMatrixPairParams; - float32 numToPutOntoEachCore, leftOverFraction; - int32 numCores, coreToAssignOnto, numVecOnCurrCore; + float32 numToPutOntoEachCore, leftOverFraction, numVecOnCurrCore; + int32 numCores, coreToAssignOnto; numLeftColIdxs = numColIdxs; numRightColIdxs = numVecIdxs; @@ -397,35 +397,26 @@ subMatrixPairParams, animatingPr, coreToAssignOnto ); - } - //Trying to distribute the subMatrix-vectors across the cores, so - // that each core gets the same number of vectors, with a max - // imbalance of 1 vector more on some cores than others - numVecOnCurrCore += 1; - if( numVecOnCurrCore + leftOverFraction >= numToPutOntoEachCore -1 ) - { - //deal with fractional part, to ensure that imbalance is 1 max - // IE, core with most has only 1 more than core with least - leftOverFraction += numToPutOntoEachCore - numVecOnCurrCore; - if( leftOverFraction >= 1 ) - { leftOverFraction -= 1; - numVecOnCurrCore = -1; - } - else - { numVecOnCurrCore = 0; - } - //Move to next core, max core-value to incr to is numCores -1 - if( coreToAssignOnto >= numCores -1 ) - { coreToAssignOnto = 0; - } - else - { coreToAssignOnto += 1; - } - } - - } - } + //Trying to distribute the subMatrix-vectors across the cores, so + // that each core gets the same number of vectors, with a max + // imbalance of 1 vector more on some cores than others + numVecOnCurrCore += 1; //incr before checking, so + if( numVecOnCurrCore > numToPutOntoEachCore ) //actual num 1 less + { + //deal with fractional part, to ensure that imbalance is 1 max + // IE, core with most has only 1 more than core with least + leftOverFraction = numToPutOntoEachCore - numVecOnCurrCore; + if( leftOverFraction > 1 ) ERROR("division alg messed up\n"); + numVecOnCurrCore = leftOverFraction; //accumulates "extra" + + //Move to next core, max core-value to incr to is numCores -1 + coreToAssignOnto += 1; + if( coreToAssignOnto >= numCores ) coreToAssignOnto = 0; + } //if + } //for( vecIdx + } //for( resColIdx + } //for( resRowIdx }