为什么 Nvidia 分析器不显示统一的内存信息



我在Windows 10 64位中安装了TitanXP,带有CUDA 9.2和Nvidia驱动程序(398.82-desktop-win10-64bit-international-whql(,我有一个简单的程序,它使用统一的内存,如下所示。

// CUDA kernel to add elements of two arrays
__global__
void add(int n, float *x, float *y)
{
int index = blockIdx.x * blockDim.x + threadIdx.x;
int stride = blockDim.x * gridDim.x;
for (int i = index; i < n; i += stride)
y[i] = x[i] + y[i];
}
int main(void)
{
int N = 1 << 20;
float *x, *y;
// Allocate Unified Memory -- accessible from CPU or GPU
cudaMallocManaged(&x, N * sizeof(float));
cudaMallocManaged(&y, N * sizeof(float));
// initialize x and y arrays on the host
for (int i = 0; i < N; i++) {
x[i] = 1.0f;
y[i] = 2.0f;
}
// Launch kernel on 1M elements on the GPU
int blockSize = 256;
int numBlocks = (N + blockSize - 1) / blockSize;
add <<< numBlocks, blockSize >>>(N, x, y);
// Wait for GPU to finish before accessing on host
cudaDeviceSynchronize();
// Check for errors (all values should be 3.0f)
float maxError = 0.0f;
for (int i = 0; i < N; i++)
maxError = fmax(maxError, fabs(y[i] - 3.0f));
std::cout << "Max error: " << maxError << std::endl;
// Free memory
cudaFree(x);
cudaFree(y);
return 0;
}

我使用 Visual Studio 2017 社区编译此代码,并在命令提示符窗口中运行它,没有错误。

当我在Nvidia Profiler中分析它时,它给了我一条"警告"消息,如下所示。

"==852== Warning: Unified Memory Profiling is not supported on the
current configuration because a pair of devices without peer-to-peer
support is detected on this multi-GPU setup. When peer mappings are
not available, system falls back to using zero-copy memory. It can
cause kernels, which access unified memory, to run slower. More
details can be found at:
http://docs.nvidia.com/cuda/cuda-c-programming-guide/index.html#um-
managed-memory"

我很确定我只在计算机中安装了一个GPU,为什么我无法获得统一的内存分析信息?

顺便说一下,我在另一台具有相同软件环境和相同 GPU 的机器上做了完全相同的实验,并且分析器确实显示了统一的内存信息。那台特定的计算机有什么问题吗?为了启用统一内存功能,我需要执行任何与硬件相关的配置/设置吗?

我过去遇到过这个问题,但是将驱动程序更新到最新版本(如果我没记错的话,发布于 19/9/2018(后,问题解决了。

希望它也能解决您的问题。 让我知道它是否确实如此。

我安装了新的 cuda sdk 10,现在工作正常。