默认nvprof输出很棒,但nvprof已被弃用,转而使用ncu. 我怎样才能ncu给我一个看起来更像的输出nvprof?
最小工作示例
我有 2 个range函数,其中一个函数以一种非常不理想的方式调用(仅使用 1 个线程)。它比其他函数需要更长的时间range。
简介.cu
#include <stdio.h>
//! makes sure both range functions executed correctly
bool check_range(int N, float *x_d) {
float *x_h;
cudaMallocHost(&x_h,N*sizeof(float));
cudaMemcpy(x_h, x_d, N*sizeof(float), cudaMemcpyDeviceToHost);
bool success=true;
for( int i=0; i < N; i++)
if( x_h[i] != i ) {
printf("\33[31mERROR: x[%d]=%g\33[0m\n",i,x_h[i]);
success=false;
break;
}
cudaFreeHost(x_h);
return success;
}
//! called with many threads
__global__ void range_fast(int N, float …Run Code Online (Sandbox Code Playgroud) cuda ×1