#NEWLINE# def findMeatyPausedComputations( self , futuresSplitResult ) : #NEWLINE# #INDENT# submittableFutures = futuresSplitResult . indicesOfSubmittableFutures ( ) #NEWLINE# pausedComputationsWithIndicesToInspect = set ( map ( ( lambda ix : ( futuresSplitResult . pausedComputationForSlot ( ix ) , ix ) ) , submittableFutures ) ) #NEWLINE# meatyPausedComputationsAndIndices = [ ] #NEWLINE# inspectedIndices = set ( ) #NEWLINE# loopCt = 0 #NEWLINE# while ( len ( pausedComputationsWithIndicesToInspect ) > 0 ) : #NEWLINE# #INDENT# loopCt += 1 #NEWLINE# pausedComputationAndIx = pausedComputationsWithIndicesToInspect . pop ( ) #NEWLINE# slotIx = pausedComputationAndIx [ 1 ] #NEWLINE# quickContext = self . grabContext ( ) #NEWLINE# quickContext . resumePausedComputation ( pausedComputationAndIx [ 0 ] ) #NEWLINE# quickContext . resetInterruptState ( ) #NEWLINE# quickContext . interruptAfterCycleCount ( 1000 ) #NEWLINE# quickContext . resume ( ) #NEWLINE# nIter = 0 #NEWLINE# while True : #NEWLINE# #INDENT# nIter += 1 #NEWLINE# if ( quickContext . isInterrupted ( ) or quickContext . isVectorLoad ( ) or quickContext . isCacheRequest ( ) ) : #NEWLINE# #INDENT# meatyPausedComputationsAndIndices . append ( pausedComputationAndIx ) #NEWLINE# inspectedIndices . add ( futuresSplitResult ) #NEWLINE# self . checkContextBackIn ( quickContext ) #NEWLINE# break #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if quickContext . isFinished ( ) : #NEWLINE# #INDENT# result = quickContext . getFinishedResult ( ) #NEWLINE# futuresSplitResult . slotCompleted ( slotIx , result ) #NEWLINE# futuresSplitResult . continueSimulation ( ) #NEWLINE# inspectedIndices . add ( slotIx ) #NEWLINE# currentSubmittableFutures = futuresSplitResult . indicesOfSubmittableFutures ( ) #NEWLINE# for newIx in set ( currentSubmittableFutures ) . difference ( inspectedIndices ) : #NEWLINE# #INDENT# pausedComputationsWithIndicesToInspect . add ( ( futuresSplitResult . pausedComputationForSlot ( newIx ) , newIx ) ) #NEWLINE# #UNINDENT# self . checkContextBackIn ( quickContext ) #NEWLINE# break #NEWLINE# #UNINDENT# #UNINDENT# if ( nIter > 10000 ) : #NEWLINE# #INDENT# assert False , 'spun too many times!' #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# if ( len ( meatyPausedComputationsAndIndices ) > 0 ) : #NEWLINE# #INDENT# return ( False , meatyPausedComputationsAndIndices ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# return ( True , futuresSplitResult . getFinalResult ( ) )