如何设置专用 GPU 以对 CUDA 内核进行基准测试?

How to setup a dedicated GPU in order to benchmark a CUDA kernel?

我想将第二个 GPU 设备用作 linux 下的专用设备,以便对内核进行基准测试。

我正在测试的内核是没有缩减的 SIMD 计算内核,没有 X-Server 连接到 GPU,设备是 GeForge GTX-480,所以我假设计算能力是 2。因此,高级禁用动态并行性和其他功能。

使用 nvidia-smi 实用程序有多种设置 GPU 的模式

"Default" means multiple contexts are allowed per device.
"Exclusive Process" means only one context is allowed per device, usable from multiple threads at a time.
"Prohibited" means no contexts are allowed per device (no compute apps).

设置 GPU 以获得尽可能忠实的基准的最佳模式是什么?

要使此类设置永久生效,我应该使用什么命令?

我正在使用以下标志编译内核:

nvcc --ptxas-options=-v -O3   -w   -arch=sm_20 -use_fast_math -c -o

是否存在更好的标志组合以便从编译器获得更多帮助以获得更快的执行时间?

任何建议将不胜感激。

my question is related to what is more appropriated? setup the GPU to a compute-exclusive mode or not.

将 GPU 设置为独占进程或默认设置无关紧要,只要只有一个进程尝试使用该 GPU。

除特定情况外,您通常不希望使用独占线程,因为独占线程可能会阻止多线程 GPU 应用 运行 正确运行,并且还可能会干扰其他功能,例如分析器功能.

What is the command that I should use in order to make permanent such setup?

如果您参考 nvidia-smi 命令行帮助 (nvidia-smi --help) 或 nvidia-smi 手册页 (man nvidia-smi),您可以确定进行更改的命令。在再次明确更改之前,您所做的任何更改都将是永久性的。