def radixLoopTopDown(A, B, Tmp, BK, numBK, n, bits, f, js): if (n == 0): return if (bits <= MAX_RADIX): radixStep(A, B, Tmp, BK, numBK, n, 1 << bits, True, eBits(bits,0,f), js) elif(numBK >= BUCKETS+1): radixStep(A, B, Tmp, BK, numBK, n, BUCKETS, True, eBits(MAX_RADIX,bits-MAX_RADIX,f), js) offsets = BK[0] remain = numBK - BUCKETS - 1 y = remain / n jobs = [(i, js.submit(parallel_rLoopTopD, (n, offsets, y, i, A, B, Tmp, BK, bits, f, js), (radixStep,))) for i in range(0,BUCKETS)] for i, job in jobs: job() else: radixLoopBottomUp(A, B, Tmp, BK, numBK, n, bits, False, f, js)
def radixLoopBottomUp(A, B, Tmp, BK, numBK, n, bits, top, f, js): rounds = 1 + (bits - 1) / MAX_RADIX rbits = 1+(bits-1)/rounds bitOffset = 0 while(bitOffset < bits): if (bitOffset+rbits > bits): rbits = bits-bitOffset radixStep(A, B, Tmp, BK, numBK, n, 1 << rbits, top, eBits(rbits,bitOffset,f), js) bitOffset += rbits