def device_memset(dst, val, size, stream=0):
 varargs = []
 if stream:
  assert isinstance(stream, Stream)
  fn = driver.cuMemsetD8Async
  varargs.append(stream.handle)
 else:
  fn = driver.cuMemsetD8
 fn(device_pointer(dst), val, size, *varargs)

def device_memset ( dst , val , size , stream = 0 ) : varargs = [ ] if stream : assert isinstance ( stream , Stream ) fn = driver . cuMemsetD8Async varargs . append ( stream . handle ) else : fn = driver . cuMemsetD8 fn ( device_pointer ( dst ) , val , size , * varargs )
memset on the device .