@require_context
@contextlib.contextmanager
def mapped(*arylist, **kws):
 assert ((not kws) or ('stream' in kws)), "Only accept 'stream' as keyword."
 pmlist = []
 stream = kws.get('stream', 0)
 for ary in arylist:
  pm = current_context().mempin(ary, driver.host_pointer(ary), driver.host_memory_size(ary), mapped=True)
  pmlist.append(pm)
 devarylist = []
 for (ary, pm) in zip(arylist, pmlist):
  devary = devicearray.from_array_like(ary, gpu_data=pm, stream=stream)
  devarylist.append(devary)
 if (len(devarylist) == 1):
  (yield devarylist[0])
 else:
  (yield devarylist)

@ require_context @ contextlib . contextmanager def mapped ( * arylist , ** kws ) : assert ( ( not kws ) or ( 'stream' in kws ) ) , "Only accept 'stream' as keyword." pmlist = [ ] stream = kws . get ( 'stream' , 0 ) for ary in arylist : pm = current_context ( ) . mempin ( ary , driver . host_pointer ( ary ) , driver . host_memory_size ( ary ) , mapped = True ) pmlist . append ( pm ) devarylist = [ ] for ( ary , pm ) in zip ( arylist , pmlist ) : devary = devicearray . from_array_like ( ary , gpu_data = pm , stream = stream ) devarylist . append ( devary ) if ( len ( devarylist ) == 1 ) : ( yield devarylist [ 0 ] ) else : ( yield devarylist )
a context manager for temporarily mapping a sequence of host ndarrays .