2012-04-18 343 views
1

操作系統:Ubuntu 11.10 x86_64的 CUDA:V 2.1CUDA 2.1「錯誤:未知類型名稱‘爲size_t’」

當試圖使像matrixMul一個示例程序,我得到了廣泛的誤差的大小,其中大部分是「未知類型名稱'size_t'。」我已經確保將/ usr/local/cuda/bin放在我的PATH以及/etc/ld.so.conf.d中的.conf中的/ usr/local/cuda/lib中。

任何想法,爲什麼我得到這些錯誤?

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 

謝謝!

+0

/usr/include/time.h:183:34:錯誤:'__cuda_clock'的衝突類型/usr/local/cuda//bin/../include/common_functions.h:70:16:note:previous '__cuda_clock'的定義在這裏說,你包含了一些函數兩次..你的c和cuda版本是否兼容..確保編譯所需的頭文件是可用的..例如,打開文件/ usr/local/cuda //bin/../include/driver_types.h:184:3,看到你可以找到它使用的頭文件,並且它們在路徑中..命令locate在findin難以捉摸的頭文件中非常有用 – 2012-04-18 16:23:29

+0

size_t可以在之內找到,所以也許在頭文件中包含它,看看是否能夠修復一些錯誤。至少 – 2012-04-18 16:24:35

+1

您正在使用一個帶有不受支持的編譯器的* CUDA工具包。要麼獲得更新的CUDA版本,要麼安裝gcc 4.2 – talonmies 2012-04-18 18:44:07

回答

4

升級CUDA!

CUDA 2.1在2008/9發佈,您應該升級(例如到CUDA 4.2)。官方Ubuntu 11.10尚未支持,我沒有嘗試過,主要的問題可能是你將不得不安裝GCC 4.5.2。有關受支持版本的更多信息,請參見Release Notes

8

確保您#include <stddef.h>

如果這是一個C++程序,嘗試添加行using namespace std

該問題與「bin」或$ PATH無關;它與你在編譯時選擇哪個系統頭文件和系統定義有關。