def staged_ipc_handle_test(handle, device_num, result_queue):

    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
    core_ipc_handle_test(the_work, result_queue)
def staged_ipc_handle_test(handle, device_num, result_queue):

    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
    core_ipc_handle_test(the_work, result_queue)