1

我想使用 Nsight Compute for Pascal GPU 来分析使用 CUDA 内存池的程序。我正在使用 Linux,CUDA 11.5,驱动程序 495.46。Nsight Compute 是 2019.5.0 版本,是最后一个支持 Pascal 的版本。

考虑以下示例程序

// nvcc -std=c++17 -arch=sm_61 -O3 main.cu -o main

#include <vector>
#include <memory>
#include <cassert>
#include <iostream>

__global__
void kernel(int* data){ data[0] = 1; };

int main(){

    cudaMemPool_t pool{};
    cudaMemPoolProps pool_props{};
    pool_props.allocType     = cudaMemAllocationTypePinned;
    pool_props.handleTypes   = cudaMemHandleTypePosixFileDescriptor;
    pool_props.location.type = cudaMemLocationTypeDevice;
    pool_props.location.id   = 0;
    auto status = cudaMemPoolCreate(&pool, &pool_props);
    printf("%s\n", cudaGetErrorName(status));

    auto stream = cudaStreamPerThread;

    int data = 0;
    int* d_data;
    status = cudaMallocFromPoolAsync(&d_data, sizeof(int), pool, stream);
    printf("%s\n", cudaGetErrorName(status));

    kernel<<<1,1,0,stream>>>(d_data);
    status = cudaGetLastError();
    printf("%s\n", cudaGetErrorName(status));

    status = cudaMemcpyAsync(&data, d_data, sizeof(int), cudaMemcpyDeviceToHost, stream);
    printf("%s\n", cudaGetErrorName(status));    

    status = cudaFreeAsync(d_data, stream);
    printf("%s\n", cudaGetErrorName(status));

    status = cudaDeviceSynchronize();
    printf("%s\n", cudaGetErrorName(status));
}

没有分析器它运行良好。

compute-sanitizer ./main
========= COMPUTE-SANITIZER
cudaSuccess
cudaSuccess
cudaSuccess
cudaSuccess
cudaSuccess
cudaSuccess
========= ERROR SUMMARY: 0 errors

使用分析器运行时,使用池 API 会返回错误cudaErrorCallRequiresNewerDriver

/opt/nvidia/nsight-compute-2019.5/nv-nsight-cu-cli ./main
==PROF== Connected to process 155966 (main)
cudaErrorCallRequiresNewerDriver
cudaErrorCallRequiresNewerDriver
==PROF== Profiling "kernel" - 1: 0%....50%....100% - 1 pass

==ERROR== Error 0: UnknownError
cudaErrorCallRequiresNewerDriver
cudaErrorIllegalAddress
cudaErrorCallRequiresNewerDriver
cudaErrorIllegalAddress
==PROF== Disconnected from process 155966
==ERROR== An error occurred while trying to profile

是否可以使用 nsight 计算在 Pascal 上分析该程序?

4

0 回答 0