【发布时间】:2021-07-14 13:59:17
【问题描述】:
我正在编写大整数加法、减法、乘法和除法的代码。但是在编译代码时,我收到了这个错误,以及另一个错误error: a __global__ function must have a void return type。
代码长 700 行,错误多行。因此,为了方便起见,我附上了我的 Google Colab 笔记本的链接。请查收here
这是我遇到的错误
/content/src/omp_cuda80.cu(94): error: a __global__ function must have a void return type
/content/src/omp_cuda80.cu(139): warning: missing return statement at end of non-void function "addition"
/content/src/omp_cuda80.cu(265): warning: variable "n" was declared but never referenced
/content/src/omp_cuda80.cu(367): error: a __global__ function call must be configured
/content/src/omp_cuda80.cu(381): error: a __global__ function call must be configured
/content/src/omp_cuda80.cu(390): error: a __global__ function call must be configured
/content/src/omp_cuda80.cu(442): error: a __global__ function call must be configured
/content/src/omp_cuda80.cu(456): error: a __global__ function call must be configured
/content/src/omp_cuda80.cu(465): error: a __global__ function call must be configured
/content/src/omp_cuda80.cu(533): error: a __global__ function call must be configured
/content/src/omp_cuda80.cu(538): error: a __global__ function call must be configured
/content/src/omp_cuda80.cu(548): error: a __global__ function call must be configured
/content/src/omp_cuda80.cu(553): error: a __global__ function call must be configured
11 errors detected in the compilation of "/content/src/omp_cuda80.cu".
/bin/bash: /content/src/omp_cuda80: No such file or directory
【问题讨论】:
-
我认为你需要最基本的 CUDA 教程,因为现在,你只是“猜测”了 CUDA 是如何编写的,不出所料,猜测是错误的。