@require_context
@contextlib.contextmanager
def pinned(*arylist):
 pmlist = []
 for ary in arylist:
  pm = current_context().mempin(ary, driver.host_pointer(ary), driver.host_memory_size(ary), mapped=False)
  pmlist.append(pm)
 (yield)
 del pmlist

@ require_context @ contextlib . contextmanager def pinned ( * arylist ) : pmlist = [ ] for ary in arylist : pm = current_context ( ) . mempin ( ary , driver . host_pointer ( ary ) , driver . host_memory_size ( ary ) , mapped = False ) pmlist . append ( pm ) ( yield ) del pmlist
a context manager for temporary pinning a sequence of host ndarrays .