“不知道该怎么办” nvcc致命错误 [英] "don't know what to do with' nvcc fatal error

查看:347
本文介绍了“不知道该怎么办” nvcc致命错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Ubuntu终端中使用命令行。

I use the command lines in Ubuntu's terminal.

我正在尝试编译CUDA_Compiler_Driver_NVCC.pdf中显示的三个文件

And I am trying to compile the three files presented in CUDA_Compiler_Driver_NVCC.pdf

当我使用命令时在这3个文件的文档给出的代码行中,确实出现以下错误:

When I do use the command line given by the documentation on these 3 files, I do get the following errors:

nvcc fatal:不知道如何处理'-dc'

nvcc fatal : don't know what to do with'-dc'

如果我在命令行中删除-dc,也会收到以下错误:
nvcc fatal:不知道如何处理'-arch = sm = 20'

If I erase -dc in the command line, I do get the following error too: nvcc fatal : don't know what to do with'-arch=sm=20'

有人知道我该如何解决这个问题?

Do anyone know how I could fix this issue ?

非常感谢您的帮助

Gibo

在下面,您会找到我在终端中输入的命令行以及文件。

Below, you will find the command line I entered in the terminal, and the files.

使用的命令行:
nvcc –arch = sm_20 –dc a.cu b.cu
nvcc –arch = sm_20 ao bo

Command line used: nvcc –arch=sm_20 –dc a.cu b.cu nvcc –arch=sm_20 a.o b.o

文件代码(只是文档的复制粘贴):
(似乎代码警察在粘贴时会发生变化,对此小问题深表歉意)。

Files code (just a copy paste of the documentation): (it seems the code police changes when pasted, sorry for this small issue)

******* b.h ***********
#define N 8

extern __device__ int g[N];
extern __device__ void bar(void);

******* b.cu***********
#include "b.h"
__device__ int g[N];
__device__ void bar (void)
{
g[threadIdx.x]++;
}

******* a.cu ***********
#include <stdio.h>

#include "b.h"

__global__ void foo (void) {
__shared__ int a[N];
a[threadIdx.x] = threadIdx.x;
__syncthreads();
g[threadIdx.x] = a[blockDim.x - threadIdx.x - 1];
}

bar();

int main (void) {
unsigned int i;
int *dg, hg[N];

int sum = 0;

foo<<<1, N>>>();

if(cudaGetSymbolAddress((void**)&dg, g)){
printf("couldn't get the symbol addr\n");
return 1;
}

if(cudaMemcpy(hg, dg, N * sizeof(int), cudaMemcpyDeviceToHost)){
printf("couldn't memcpy\n");
return 1;
}

for (i = 0; i < N; i++) {
sum += hg[i];
}

if (sum == 36) {
printf("PASSED\n");
} else {
printf("FAILED (%d)\n", sum);
}

return 0;
}


推荐答案

请确保您使用的是正确版本的nvcc。我遇到了这样的问题,这是因为我使用的是NVCC 5.5而不是6.0。

Make sure you are using the right version of nvcc. I had a problem like that and it was because I was using NVCC 5.5 instead of 6.0.

还要确保破折号具有正确的符号:use-(0x2D)and不是–(0xD0)。

Also make sure the dashes have the right symbol: use - (0x2D) and not – (0xD0).

这篇关于“不知道该怎么办” nvcc致命错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆