szagoruyko / imagine-nn

IMAGINE torch neural network routines
Other
109 stars 35 forks source link

Problem in compiling with CUDA 7.5 on Ubuntu 16.04 #42

Open samson-wang opened 8 years ago

samson-wang commented 8 years ago

When makefile after cmake preprocessing, get this error message

/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;
                                          ^
CMake Error at inn_generated_SpatialStochasticPooling.cu.o.cmake:267 (message):
  Error generating file
  /home/samson/Repo/imagine-nn/build/CMakeFiles/inn.dir//./inn_generated_SpatialStochasticPooling.cu.o

CMakeFiles/inn.dir/build.make:70: recipe for target 'CMakeFiles/inn.dir/inn_generated_SpatialStochasticPooling.cu.o' failed
make[2]: *** [CMakeFiles/inn.dir/inn_generated_SpatialStochasticPooling.cu.o] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/inn.dir/all' failed
make[1]: *** [CMakeFiles/inn.dir/all] Error 2
Makefile:127: recipe for target 'all' failed
make: *** [all] Error 2

From this issue, BVLC/caffe/issues/4046 , it seems to be an incompatibility between g++-5.0 and CUDA 7.5.

I'm not familiar with the cmake tool chain. I just add -D_FORCE_INLINES to CUDA_NVCC_FLAGS in CMakeCache.txt to solve the compile problem. The diffs as follow.

207c207
< CUDA_NVCC_FLAGS:STRING=-D_FORCE_INLINES

---
> CUDA_NVCC_FLAGS:STRING=
arunpatala commented 8 years ago

relevant https://github.com/torch/torch7/issues/670

arunpatala commented 8 years ago

I added this to beginning of CMakeLists.txt

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_FORCE_INLINES")

Alek-dr commented 8 years ago

One simple question. I faced with the same problem, added string to CMakeLists.txt. How to install? If just type "luarocks install inn-1.0-0.rockspec" it will clone from git.

arunpatala commented 8 years ago

luarocks make inn-1.0-0.rockspec