您的位置:首页 > 大数据 > 人工智能

Cuda kernel failed. Error: invalid device function

2015-06-17 10:07 489 查看


Cuda kernel failed. Error: invalid device function

出现这种错误是由于makefile.config中的问题,cuda计算能力设置错误(即-arch=sm_35)。
#-gencode=arch=compute_35,code=sm_35
#-gencode=arch=compute_52,code=sm_52 -gencode=arch=compute_52,code=compute_52

all:
nvcc -O3 -m64 -arch=sm_35 -c bhsparse_cuda.cu -o bhsparse_cuda.o $(INCLUDES)
nvcc -O3 -m64 -arch=sm_35 -c ref.cu -o ref.o $(INCLUDES)
$(CC) -m64 -O3 main.cpp bhsparse.cpp bhsparse_cuda.o ref.o -o spgemm $(INCLUDES) $(LIBS)


需要根据GPU的计算能力设置其参数,不同GPU对应的计算能力如下图所示。

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: