def the_work():
    with cuda.gpus[device_num]:
        this_ctx = cuda.devices.get_context()
        deviceptr = handle.open_staged(this_ctx)
        arrsize = (handle.size // np.dtype(np.intp).itemsize)
        hostarray = np.zeros(arrsize, dtype=np.intp)
        cuda.driver.device_to_host(hostarray, deviceptr, size=handle.size)
        handle.close()
    return hostarray
def the_work():
    with cuda.gpus[device_num]:
        this_ctx = cuda.devices.get_context()
        deviceptr = handle.open_staged(this_ctx)
        arrsize = (handle.size // np.dtype(np.intp).itemsize)
        hostarray = np.zeros(arrsize, dtype=np.intp)
        cuda.driver.device_to_host(hostarray, deviceptr, size=handle.size)
        handle.close()
    return hostarray