python 库中的 Cuda cuLaunchHostFunc 等价物

Cuda cuLaunchHostFunc equivalent in python libs

使用 Python 驱动 CUDA,我想在内核和内存复制发生后运行的流中安排一个异步的 Python 主机函数。

在 Python 库之一(PyCudaNumba、...)中是否有与 CUDA C++ 函数 CUresult cuLaunchHostFunc(CUstream hStream, CUhostFn fn, void* userData) 等效的函数?

Driver API 函数在 CUDA docs

Is there an equivalent to the CUDA C++ function CUresult cuLaunchHostFunc(CUstream hStream, CUhostFn fn, void* userData) in one of the Python libs (PyCuda, Numba, ...)?

这两个都没有。 None 基于驱动程序 API 的 CUDA 框架我知道公开了 cuLaunchHostFunc(PyCUDA、Numba、JCUDA)。

I want to schedule a Python host function asynchronous in a stream that runs after a kernel and memory copy has been taken place

原生 CUDA 驱动程序 API 中的任何内容都无法支持这一点。 Tensorflow 和 Pytorch 都具有 Python 级别的精细执行流水线和回调机制, 可能 为您提供功能上与您设想的类似的东西。但它不会在CUDA级别上完成,它会在更高的抽象级别上完成。