我试图在拥有Cuda 8.0的Ubuntu 16.04上分析cuda代码,但它正在返回"无法分析应用程序。统一内存分析失败"。我尝试从终端和Nisght Eclipe进行分析。代码正在编译并运行,但无法进行分析。
代码 -
cusparseHandle_t handle;
cusparseCreate(&handle);
cusparseSafeCall(cusparseCreate(&handle));
//set the parameters
const int n_i = 10;
const int d = 18;
const int n_t = 40;
const int n_tau = 2;
const int n_k = 10;
float *data = generate_matrix3_1(d, n_i, n_t);
//float* data = get_data1(d, n_i,n_t);
float* a = generate_matrix3_1(n_i,n_k,n_tau);
float* b = sparse_generate_matrix1(n_k,d,0.5);
float* c = sparse_generate_matrix1(n_k,d,0.5);
float* previous_a = generate_matrix3_1(n_i,n_k,n_tau);
float* previous_b = sparse_generate_matrix1(n_k,d,0.1);
float* previous_c = sparse_generate_matrix1(n_k,d,0.1);
// calculate norm of data
float norm_data = 0;
for (int i = 0; i < n_i; i++)
{
for (int t = n_tau; t < n_t; t++)
{
for (int p = 0; p < d; p++)
{
norm_data = norm_data + ((data[p*n_i*n_t + i*n_t + t])*(data[p*n_i*n_t + i*n_t + t]));
}
}
}
// set lambda and gamma parameter
float lambda = 0.0001;
float gamma_a = 2;
float gamma_b = 3;
float gamma_c = 4;
float updated_t = 1;
float updated_t1 = 0;
float rel_error = 0;
int loop = 1;
float objective = 0;
// create sparse format for the data
float **h_data = new float*[1];
int **h_data_RowIndices = new int*[1];
int **h_data_ColIndices = new int*[1];
int nnz_data = create_sparse_MY(data,d,n_i*n_t,h_data,h_data_RowIndices,h_data_ColIndices);
// transfer sparse data to device memory
int *d_data_RowIndices; (cudaMalloc(&d_data_RowIndices, (d+1) * sizeof(int)));
(cudaMemcpy(d_data_RowIndices, h_data_RowIndices[0], (d+1) * sizeof(int), cudaMemcpyHostToDevice));
int *d_data_ColIndices; (cudaMalloc(&d_data_ColIndices, nnz_data * sizeof(int)));
(cudaMemcpy(d_data_ColIndices, h_data_ColIndices[0], (nnz_data) * sizeof(int), cudaMemcpyHostToDevice));
编译代码的命令 -
nvcc -lcusparse main.cu -o hello.out
仿形 -
nvprof -o prof ./hello.out
错误 -
== 13621 == NVPROF正在分析过程13621,命令:./ hello.out ========错误:统一内存分析失败。
有人可以帮我吗?
答案 0 :(得分:25)
具有相同的误导性错误,只需运行具有root权限的探查器,例如sudo nvprof
或sudo nvvp
。
答案 1 :(得分:9)
我遇到了同样的错误。但即使我添加sudo
权限,错误依然存在。终端返回sudo: nvprof: command not found
。
尝试此命令,它适用于我。 nvprof --unified-memory-profiling off /hello.out
答案 2 :(得分:-1)
您无需root权限即可解决此问题。由于您使用的是Cuda 8.0,因此应该可以使用。问题在于iBUS&#39;配置。您所要做的就是删除文件夹/home/[user]/.config/ibus/bus,问题就会消失。