Cuda “已实现的占用率”列未显示为右侧分析结果

Cuda “已实现的占用率”列未显示为右侧分析结果,cuda,nvidia,nsight,Cuda,Nvidia,Nsight,我遇到了一个对我来说很奇怪的问题。在Nsight性能分析输出中,我看不到实现的占用率列。我使用的是Geforce 920M GPU、版本425.31的NVIDIA驱动程序、版本6.0.0.18296的Nsight和visual studio 2017。Nsight的版本与驱动程序的版本兼容。 有人能帮我吗?我完全不知道为什么会这样 我使用Nsight性能分析,CUDA跟踪检查如下: 我还使用了可视剖面仪,但在那里也看不到已实现的占用率。 GPU检查显示一个错误: 注意,正如Talonmes提到

我遇到了一个对我来说很奇怪的问题。在Nsight性能分析输出中,我看不到实现的占用率列。我使用的是Geforce 920M GPU、版本425.31的NVIDIA驱动程序、版本6.0.0.18296的Nsight和visual studio 2017。Nsight的版本与驱动程序的版本兼容。 有人能帮我吗?我完全不知道为什么会这样

我使用Nsight性能分析,CUDA跟踪检查如下:

我还使用了可视剖面仪,但在那里也看不到已实现的占用率。 GPU检查显示一个错误:

注意,正如Talonmes提到的,上面的错误是由于没有在管理员模式下运行探查器造成的。已解决但已实现的占用率仍未显示。 这是我的代码:

#include "cuda_runtime.h"
#include "device_launch_parameters.h"

#include <stdio.h>
#include <stdlib.h>
#include <omp.h>
#include <math.h>
#include <iostream>
#define MAX_HISTORGRAM_NUMBER 10000
#define ARRAY_SIZE 102400000

#define CHUNK_SIZE 100
#define THREAD_COUNT 8
#define SCALER 80
cudaError_t histogramWithCuda(int *a, unsigned long long int *c);

__global__ void histogramKernelSingle(unsigned long long int *c, int *a)
{
    unsigned long long int worker =  blockIdx.x*blockDim.x + threadIdx.x;
    unsigned long long int start = worker * CHUNK_SIZE;
    unsigned long long int end = start + CHUNK_SIZE;
    for (int ex = 0; ex < SCALER; ex++)
        for (long long int i = start; i < end; i++)
        {
            if (i < ARRAY_SIZE)
                atomicAdd(&c[a[i]], 1);
            else
            {
                break;
            }
        }
}

int main()
{
        int* a = (int*)malloc(sizeof(int)*ARRAY_SIZE);
        unsigned long long int* c = (unsigned long long int*)malloc(sizeof(unsigned long long int)*MAX_HISTORGRAM_NUMBER);
        for (unsigned long long i = 0; i < ARRAY_SIZE;i++)
            a[i] = rand() % MAX_HISTORGRAM_NUMBER;
        for (unsigned long long i = 0; i < MAX_HISTORGRAM_NUMBER; i++)
            c[i] = 0;

    // Add vectors in parallel.
        double start_time = omp_get_wtime();
        cudaError_t cudaStatus=histogramWithCuda(a,c);
        double end_time = omp_get_wtime();
        std::cout << end_time - start_time;
   // = 
    if (cudaStatus != cudaSuccess) {
        fprintf(stderr, "addWithCuda failed!");
        return 1;
    }
    
    // cudaDeviceReset must be called before exiting in order for profiling and
    // tracing tools such as Nsight and Visual Profiler to show complete traces.
    cudaStatus = cudaDeviceReset();
    if (cudaStatus != cudaSuccess) {
        fprintf(stderr, "cudaDeviceReset failed!");
        return 1;
    }
    unsigned long long int R = 0;
    for (int i = 0; i < MAX_HISTORGRAM_NUMBER; i++)
    {
        R += c[i];
        //printf("%d    ", c[i]);
    }
    printf("\nCORRECT:%ld   ", R/(SCALER));
    return 0;
}

// Helper function for using CUDA to add vectors in parallel.
cudaError_t histogramWithCuda(int *a, unsigned long long int *c)
{
    int *dev_a = 0;
    unsigned long long int *dev_c = 0;
    cudaError_t cudaStatus;

    // Choose which GPU to run on, change this on a multi-GPU system.
    cudaStatus = cudaSetDevice(0);
    if (cudaStatus != cudaSuccess) {
        fprintf(stderr, "cudaSetDevice failed!  Do you have a CUDA-capable GPU installed?");
        goto Error;
    }

    // Allocate GPU buffers for three vectors (two input, one output)    .
    cudaStatus = cudaMalloc((void**)&dev_c, MAX_HISTORGRAM_NUMBER * sizeof(unsigned long long int));
    if (cudaStatus != cudaSuccess) {
        fprintf(stderr, "cudaMalloc failed!");
        goto Error;
    }

    cudaStatus = cudaMalloc((void**)&dev_a, ARRAY_SIZE * sizeof(int));
    if (cudaStatus != cudaSuccess) {
        fprintf(stderr, "cudaMalloc failed!");
        goto Error;
    }


    // Copy input vectors from host memory to GPU buffers.
    cudaStatus = cudaMemcpy(dev_a, a, ARRAY_SIZE * sizeof(int), cudaMemcpyHostToDevice);
    if (cudaStatus != cudaSuccess) {
        fprintf(stderr, "cudaMemcpy failed!");
        goto Error;
    }
    // Launch a kernel on the GPU with one thread for each element.
    //// BLOCK CALCULATOR HERE
    

    ////BLOCK CALCULATOR HERE
    
    histogramKernelSingle << < ARRAY_SIZE / (THREAD_COUNT*CHUNK_SIZE), THREAD_COUNT>> > (dev_c, dev_a);
    // Check for any errors launching the kernel
    cudaStatus = cudaGetLastError();
    if (cudaStatus != cudaSuccess) {
        fprintf(stderr, "addKernel launch failed: %s\n", cudaGetErrorString(cudaStatus));
        goto Error;
    }
    
    // cudaDeviceSynchronize waits for the kernel to finish, and returns
    // any errors encountered during the launch.
    cudaStatus = cudaDeviceSynchronize();
    if (cudaStatus != cudaSuccess) {
        fprintf(stderr, "cudaDeviceSynchronize returned error code %d after launching addKernel!\n", cudaStatus);
        goto Error;
    }

    // Copy output vector from GPU buffer to host memory.
    cudaStatus = cudaMemcpy(c, dev_c, MAX_HISTORGRAM_NUMBER * sizeof(unsigned long long int), cudaMemcpyDeviceToHost);
    if (cudaStatus != cudaSuccess) {
        fprintf(stderr, "cudaMemcpy failed!");
        goto Error;
    }
    
Error:
    cudaFree(dev_c);
    cudaFree(dev_a);
    return cudaStatus;
}

提前感谢。

已实现的入住率仅在配置文件活动中记录。跟踪活动不支持捕获GPU性能计数器。达到的占用率为sm\u活动\u扭曲度\u总和/sm\u活动\u周期\u总和/sm\u最大扭曲度*100

Nsight Visual Studio版

跟踪活动无法收集已达到的占用率。运行命令Nsight |启动性能分析。。。在活动窗口中,选择Profile CUDA Application not Trace Application。默认的配置文件CUDA应用程序包含实验数据

NVIDIA视觉分析器

在NVVP中,确保正在收集GPU性能计数器。默认活动将收集时间线,但不会收集GPU事件

运行|生成时间线不会收集已达到的占用率 运行|分析应用程序将收集已实现的占用率


如果您仍然存在问题,则可能存在系统权限问题。请尝试使用Nsight Profile CUDA应用程序或NVVP收集度量和事件收集另一组性能计数器…

仅在配置文件活动中捕获已实现占用率。跟踪活动不支持捕获GPU性能计数器。达到的占用率为sm\u活动\u扭曲度\u总和/sm\u活动\u周期\u总和/sm\u最大扭曲度*100

Nsight Visual Studio版

跟踪活动无法收集已达到的占用率。运行命令Nsight |启动性能分析。。。在活动窗口中,选择Profile CUDA Application not Trace Application。默认的配置文件CUDA应用程序包含实验数据

NVIDIA视觉分析器

在NVVP中,确保正在收集GPU性能计数器。默认活动将收集时间线,但不会收集GPU事件

运行|生成时间线不会收集已达到的占用率 运行|分析应用程序将收集已实现的占用率


如果您仍然存在问题,则可能存在系统权限问题。请尝试使用Nsight Profile CUDA应用程序或NVVP收集另一组性能计数器|收集指标和事件…

为什么我得到了一个负分?我在这个问题上花了很多时间。这不公平。我必须找到解决办法。如果你知道解决方案,请注意,如果不知道,请不要无缘无故地指出。因此,如果我的问题有一些问题,请告诉我不要以这种方式投反对票。您必须在VisualProfiler中显式运行Inspect GPU使用控制,或者在NSight中显式运行其等效程序,我不知道这是什么,在收集和显示任何已实现的占用率统计数据之前,我不使用NSight。在运行GPU检查时,我发布了中显示的错误。好的,现在我们实际取得了一些进展。您遇到了驱动程序配置文件计数器的权限问题。计算机驱动程序文档中讨论了如何处理这个问题是的,你是对的,我感谢你。我忘了以管理员身份运行配置文件。现在GPU检查已成功完成,但仍仅在占用字段下显示理论占用率。我是否在正确的地方寻找已实现的入住率。我的意思是它应该显示在我在图片上标记的地方,对吗?所以在这种情况下,问题仍然存在。为什么我得到了一个负分?我在这个问题上花了很多时间。这不公平。我必须找到解决办法。如果你知道解决方案,请注意,如果不知道,请不要无缘无故地指出。因此,如果我的问题有一些问题,请告诉我不要以这种方式投反对票。您必须在VisualProfiler中显式运行Inspect GPU使用控制,或者在NSight中显式运行其等效程序,我不知道这是什么,在收集和显示任何已实现的占用率统计数据之前,我不使用NSight。在运行GPU检查时,我发布了中显示的错误。好的,现在我们实际取得了一些进展。您遇到了驱动程序配置文件计数器的权限问题。计算机驱动程序文档中讨论了如何处理这个问题是的,你是对的,我感谢你。我忘了以管理员的身份运行配置文件
R现在GPU检查已成功完成,但仍仅在占用字段下显示理论占用率。我是否在正确的地方寻找已实现的入住率。我的意思是它应该显示在我在图片上标记的地方,对吗?因此,在这种情况下,问题仍然存在。但正如我在问题中所发布的,我无法在输出中获得实现的指标。只是像开始、持续时间和结束时间这样的东西。“已实现”列完全不显示。我衷心感谢您和所有参与者,您为我节省了数小时。我使用了您建议的第Nsigth Visual Studio Edition方法,并且效果良好。但正如我在问题中所发布的,我无法在输出中获得已实现的指标。只是像开始、持续时间和结束时间这样的东西。实现的专栏根本不显示。我衷心感谢您和所有参与的人,您为我节省了几个小时。我使用了您建议的第N个Visual Studio Edition方法,效果很好。