小编use*_*078的帖子

CUDA无效的设备符号错误

下面的代码编译得很好.但是当我尝试运行它时,我得到了

GPUassert: invalid device symbol file.cu 114
Run Code Online (Sandbox Code Playgroud)

当我评论(!!!)标记的行时,错误不会出现.我的问题是导致这个错误的原因是因为它没有任何意义.

使用nvcc file.cu -arch compute_11进行编译

#include "stdio.h"
#include <algorithm>
#include <ctime>

#define gpuErrchk(ans) { gpuAssert((ans), __FILE__, __LINE__); }
#define THREADS 64
#define BLOCKS 256
#define _dif (((1ll<<32)-121)/(THREADS*BLOCKS)+1)

#define HASH_SIZE 1024
#define ROUNDS 16
#define HASH_ROW (HASH_SIZE/ROUNDS)+(HASH_SIZE%ROUNDS==0?0:1)
#define HASH_COL 1000000000/HASH_SIZE


typedef unsigned long long ull;

inline void gpuAssert(cudaError_t code, char *file, int line, bool abort=true)
{
  if (code != cudaSuccess) 
  {
  //fprintf(stderr,"GPUassert: %s %s %d\n", cudaGetErrorString(code), file, line);
  printf("GPUassert: %s %s %d\n", cudaGetErrorString(code), file, …
Run Code Online (Sandbox Code Playgroud)

cuda nvcc

5
推荐指数
1
解决办法
1万
查看次数

标签 统计

cuda ×1

nvcc ×1