<s> from threading import Thread <EOL> import testmod <EOL> class GPUCall ( Thread ) : <EOL> """<STR_LIT:U+0020>""" <EOL> def __init__ ( self , func , device = <NUM_LIT:0> ) : <EOL> self . func = func <EOL> self . device = device <EOL> def acquire_device ( self ) : <EOL> testmod . set_device ( self . device ) <EOL> def release_device ( self ) : <EOL> pass <EOL> def run ( self ) : <EOL> self . acquire_device ( ) <EOL> self . func ( ) <EOL> self . release_device ( ) <EOL> def make_calls ( func , data , devices = None , splits = None ) : <EOL> """<STR_LIT>""" <EOL> if splits is None : <EOL> pass <EOL> def _execute_calls ( calls ) : <EOL> """<STR_LIT:U+0020>""" <EOL> for call in calls : <EOL> call . start ( ) <EOL> for call in calls : <EOL> call . join ( ) </s>
