2016-05-07 88 views
4

當我嘗試編譯keras文檔中的示例時,出現以下錯誤。Keras未能編譯theano後端

/usr/include/string.h: In function ‘void* __mempcpy_inline(void*, const void*, size_t)’: 
/usr/include/string.h:652:42: error: ‘memcpy’ was not declared in this scope 
    return (char *) memcpy (__dest, __src, __n) + __n; 
             ^
ERROR (theano.sandbox.cuda): Failed to compile cuda_ndarray.cu: ('nvcc return status', 1, 'for cmd', 'nvcc -shared -O3 -m64 -Xcompiler -DCUDA_NDARRAY_CUH=mc72d035fdf91890f3b36710688069b2e,-DNPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION,-fPIC,-fvisibility=hidden -Xlinker -rpath,/home/chase/.theano/compiledir_Linux-4.4--generic-x86_64-with-Ubuntu-16.04-xenial-x86_64-3.5.1+-64/cuda_ndarray -I/usr/local/lib/python3.5/dist-packages/theano/sandbox/cuda -I/usr/lib/python3/dist-packages/numpy/core/include -I/usr/include/python3.5m -I/usr/local/lib/python3.5/dist-packages/theano/gof -o /home/chase/.theano/compiledir_Linux-4.4--generic-x86_64-with-Ubuntu-16.04-xenial-x86_64-3.5.1+-64/cuda_ndarray/cuda_ndarray.so mod.cu -L/usr/lib -lcublas -lpython3.5m -lcudart') 

我在Ubuntu 16.04上。我正在使用從默認存儲庫安裝的CUDA 7.5。我使用CUDA來編譯我自己的一些cuda程序以及ArrayFire程序,所以我知道CUDA正在運行。

這裏是我試圖編譯...

from keras.models import Sequential 

model = Sequential() 
from keras.layers.core import Dense, Activation 

model.add(Dense(output_dim=64, input_dim=100)) 
model.add(Activation("relu")) 
model.add(Dense(output_dim=10)) 
model.add(Activation("softmax")) 

model.compile(loss='categorical_crossentropy', optimizer='sgd', metrics=['accuracy']) 

回答