PyCUDA mem_get_ipc_handle gives LogicError: cuIpcGetMemHandle failed: operation not supported

PyCUDA mem_get_ipc_handle gives LogicError: cuIpcGetMemHandle failed: operation not supported

我正在尝试执行代码 here。我收到以下错误:

orig:  [0.36975162 0.08511397 0.16306844 0.4015488  0.25104857 0.30606773 0.24524205 0.13792656]
Process Process-1:
Traceback (most recent call last):
  File "C:\Program Files\Python27\lib\multiprocessing\process.py", line 267, in _bootstrap
    self.run()
  File "C:\Program Files\Python27\lib\multiprocessing\process.py", line 114, in run
    self._target(*self._args, **self._kwargs)
  File "C:\Users\My\Desktop\test_codes\pycuda4.py", line 28, in func1
    h = drv.mem_get_ipc_handle(x_gpu.ptr)
LogicError: cuIpcGetMemHandle failed: operation not supported

我在 Windows 7 x64 环境中使用 Python 3.7、CUDA 9.2。 Windows 不支持 CUDA IPCMemoryHandle 吗?或者,我错过了什么吗?

记录的内容 here 是 CUDA IPC 功能仅在 Linux 上受支持。

但是,驱动程序 API(PyCUDA 基于该驱动程序)docs 表明:

IPC functionality is restricted to devices with support for unified addressing on Linux and Windows operating systems. IPC functionality on Windows is restricted to GPUs in TCC mode

因此,如果您可以将 windows GPU 放入 TCC mode(通过 nvidia-smi 工具),那么我认为它应该 work/be 受支持。 GeForce GPU 不能置于 TCC 模式。大多数 Titan 和 Quadro GPU 都可以置于 TCC 模式。 windows 上的大多数 Tesla GPU 应该自动处于 TCC 模式。请注意,将您的 GPU 置于 TCC 模式意味着它无法再承载显示。

在最近的 CUDA 工具包中,已为 windows 中的 WDDM 和 TCC 使用添加了 IPC 支持(底层机制不同)。 CUDA IPC 示例代码演示了所有风格(linux、windows TCC、windows WDDM)。