CUDA 2.1“错误:未知类型名称‘size_t’”

时间:2022-06-27 16:04:51

System: Ubuntu 11.10 x86_64 CUDA: v 2.1

系统:ubuntu11.10 x86_64 CUDA: v2.1。

When trying to make an example program like matrixMul I get an extensive amount of errors, most of which are "unknown type name 'size_t'." I've made sure to put /usr/local/cuda/bin in my PATH as well as /usr/local/cuda/lib in a .conf in /etc/ld.so.conf.d.

当我尝试做一个像matrixMul这样的示例程序时,我得到了大量的错误,其中大多数都是“未知类型名称”size_t。我已经确保将/usr/local/cuda/bin在我的路径中,以及/usr/local/cuda/lib中的。conf在/etc/ lsd .so.conf.d。

Any ideas why I'm getting these errors?

我为什么会犯这些错误?

matrixMul$ make emu=1
In file included from /tmp/tmpxft_00004089_00000000-1_matrixMul.cudafe1.stub.c:5:0,
                 from matrixMul.cu:196:
/usr/local/cuda//bin/../include/crt/host_runtime.h:192:0: warning: "__device_fun" redefined [enabled by default]
/usr/local/cuda//bin/../include/crt/host_runtime.h:215:0: note: this is the location of the previous definition
/usr/local/cuda//bin/../include/crt/host_runtime.h:194:0: warning: "__device_var" redefined [enabled by default]
/usr/local/cuda//bin/../include/crt/host_runtime.h:217:0: note: this is the location of the previous definition
/usr/local/cuda//bin/../include/crt/host_runtime.h:196:0: warning: "__tex_var" redefined [enabled by default]
/usr/local/cuda//bin/../include/crt/host_runtime.h:219:0: note: this is the location of the previous definition
/usr/local/cuda//bin/../include/crt/host_runtime.h:198:0: warning: "__cudaFatCubin" redefined [enabled by default]
/usr/local/cuda//bin/../include/crt/host_runtime.h:221:0: note: this is the location of the previous definition
/usr/local/cuda//bin/../include/crt/host_runtime.h:208:0: warning: "__ids" redefined [enabled by default]
/usr/local/cuda//bin/../include/crt/host_runtime.h:223:0: note: this is the location of the previous definition
In file included from /usr/local/cuda//bin/../include/builtin_types.h:43:0,
                 from /usr/local/cuda//bin/../include/cuda_runtime_api.h:54,
                 from /usr/local/cuda//bin/../include/crt/host_runtime.h:80,
                 from /usr/include/c++/4.6/x86_64-linux-gnu/./bits/c++config.h:156:
/usr/local/cuda//bin/../include/driver_types.h:184:3: error: unknown type name ‘size_t’
...
/usr/local/cuda//bin/../include/driver_types.h:274:3: error: unknown type name ‘size_t’
In file included from /usr/local/cuda//bin/../include/crt/host_runtime.h:80:0,
                 from /usr/include/c++/4.6/x86_64-linux-gnu/./bits/c++config.h:156:
/usr/local/cuda//bin/../include/cuda_runtime_api.h:102:46: error: unknown type name ‘size_t’
...
/usr/local/cuda//bin/../include/cuda_runtime_api.h:105:118: error: unknown type name ‘size_t’
In file included from /usr/local/cuda//bin/../include/crt/host_runtime.h:80:0,
                 from /usr/include/c++/4.6/x86_64-linux-gnu/./bits/c++config.h:156:
/usr/local/cuda//bin/../include/cuda_runtime_api.h:110:48: error: unknown type name ‘size_t’
In file included from /usr/local/cuda//bin/../include/crt/host_runtime.h:80:0,
                 from /usr/include/c++/4.6/x86_64-linux-gnu/./bits/c++config.h:156:
/usr/local/cuda//bin/../include/cuda_runtime_api.h:120:59: error: unknown type name ‘size_t’
...
/usr/local/cuda//bin/../include/cuda_runtime_api.h:121:110: error: unknown type name ‘size_t’
In file included from /usr/local/cuda//bin/../include/crt/host_runtime.h:80:0,
                 from /usr/include/c++/4.6/x86_64-linux-gnu/./bits/c++config.h:156:
/usr/local/cuda//bin/../include/cuda_runtime_api.h:122:80: error: unknown type name ‘size_t’
...
/usr/local/cuda//bin/../include/cuda_runtime_api.h:216:68: error: unknown type name ‘size_t’
In file included from /usr/local/cuda//bin/../include/crt/host_runtime.h:226:0,
                 from /usr/lib/gcc/x86_64-linux-gnu/4.6.1/include/stddef.h:213:
/usr/local/cuda//bin/../include/common_functions.h:70:1: error: unknown type name ‘clock_t’
/usr/include/time.h:183:43: error: conflicting types for ‘clock’
/usr/local/cuda//bin/../include/common_functions.h:72:10: note: previous implicit declaration of ‘clock’ was here
../../common/inc/cutil_inline_runtime.h:41:49: warning: inline function ‘_Z23cutGetMaxGflopsDeviceIdv’ declared weak [-Wattributes]
../../common/inc/cutil_inline_runtime.h:41:43: warning: inline function ‘_Z23cutGetMaxGflopsDeviceIdv’ declared weak [-Wattributes]
In file included from /tmp/tmpxft_00004089_00000000-1_matrixMul.cudafe1.stub.c:4:0,
                 from matrixMul.cu:196:
/usr/include/time.h:183:34: error: conflicting types for ‘__cuda_clock’
/usr/local/cuda//bin/../include/common_functions.h:70:16: note: previous definition of ‘__cuda_clock’ was here
In file included from /tmp/tmpxft_00004089_00000000-1_matrixMul.cudafe1.stub.c:4:0,
                 from matrixMul.cu:196:
/usr/include/x86_64-linux-gnu/bits/mathcalls.h:193:30: error: static declaration of ‘__cuda_error_not_implememted’ follows non-static declaration
/usr/local/cuda//bin/../include/math_functions.h:864:78: note: previous declaration of ‘__cuda_error_not_implememted’ was here
In file included from /tmp/tmpxft_00004089_00000000-1_matrixMul.cudafe1.stub.c:5:0,
                 from matrixMul.cu:196:
/usr/local/cuda//bin/../include/crt/host_runtime.h:185:13: error: redefinition of ‘__cudaUnregisterBinaryUtil’
/usr/local/cuda//bin/../include/crt/host_runtime.h:185:13: note: previous definition of ‘__cudaUnregisterBinaryUtil’ was here
make: *** [obj/emurelease/matrixMul.cu.o] Error 255

Thanks!

谢谢!

2 个解决方案

#1


4  

Upgrade CUDA!

升级CUDA !

CUDA 2.1 was released in 2008/9, you should upgrade (for example to CUDA 4.2). Officially Ubuntu 11.10 is not yet supported, I haven't tried it myself, the main issue is likely to be that you will have to install GCC 4.5.2. See the Release Notes for more information on supported versions.

CUDA 2.1在2008/9年度发布,您应该升级(例如CUDA 4.2)。官方的Ubuntu 11.10还没有得到支持,我自己也没有尝试过,主要的问题可能是你必须安装GCC 4.5.2。有关支持版本的更多信息,请参见发行说明。

#2


8  

Make sure you #include <stddef.h>

确保包括

If this is a C++ program, try adding the line using namespace std.

如果这是一个c++程序,尝试使用名称空间std添加该行。

The problem has nothing to do with "bin" or your $PATH; it has everything to do with which system headers and system definitions you're picking up at compile time.

问题与“bin”或您的$PATH无关;它与您在编译时正在获取的系统标题和系统定义有关。

#1


4  

Upgrade CUDA!

升级CUDA !

CUDA 2.1 was released in 2008/9, you should upgrade (for example to CUDA 4.2). Officially Ubuntu 11.10 is not yet supported, I haven't tried it myself, the main issue is likely to be that you will have to install GCC 4.5.2. See the Release Notes for more information on supported versions.

CUDA 2.1在2008/9年度发布,您应该升级(例如CUDA 4.2)。官方的Ubuntu 11.10还没有得到支持,我自己也没有尝试过,主要的问题可能是你必须安装GCC 4.5.2。有关支持版本的更多信息,请参见发行说明。

#2


8  

Make sure you #include <stddef.h>

确保包括

If this is a C++ program, try adding the line using namespace std.

如果这是一个c++程序,尝试使用名称空间std添加该行。

The problem has nothing to do with "bin" or your $PATH; it has everything to do with which system headers and system definitions you're picking up at compile time.

问题与“bin”或您的$PATH无关;它与您在编译时正在获取的系统标题和系统定义有关。