cupyx.profiler.profile#

cupyx.profiler.profile()[源码]#

在 with 语句期间启用 CUDA 分析。

此函数在进入 with 语句时启用分析,在离开语句时禁用分析。

>>> with cupyx.profiler.profile():
...    # do something you want to measure
...    pass

注意

从命令行启动 nvprof 时,可能需要手动设置 --profile-from-start off 以获得期望的行为。同样,使用 nsys profile 时,可能需要设置 -c cudaProfilerApi