Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ubuntu 16.04 - torch installation failure #141

Open
shriphani opened this issue Aug 25, 2016 · 4 comments
Open

Ubuntu 16.04 - torch installation failure #141

shriphani opened this issue Aug 25, 2016 · 4 comments

Comments

@shriphani
Copy link

Hi,

I am following these instructions: http://torch.ch/docs/getting-started.html and I get this on the final command:

/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 THC_generated_THCBlas.cu.o.cmake:267 (message):
  Error generating file
  /home/shriphani/torch/extra/cutorch/build/lib/THC/CMakeFiles/THC.dir//./THC_generated_THCBlas.cu.o


lib/THC/CMakeFiles/THC.dir/build.make:70: recipe for target 'lib/THC/CMakeFiles/THC.dir/THC_generated_THCBlas.cu.o' failed
make[2]: *** [lib/THC/CMakeFiles/THC.dir/THC_generated_THCBlas.cu.o] Error 1
make[2]: *** Waiting for unfinished jobs....
/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;
                                          ^

Is there a simple workaround?

Thanks,
S.

@shriphani
Copy link
Author

More info, I made an issue on this repo since this is what git remote show origin points to.

@soumith
Copy link
Member

soumith commented Aug 27, 2016

hi @shriphani

This is a bug in CUDA 7.5 + gcc > 4.9

This was reported before here: torch/torch7#670

The easiest way to fix it is to upgrade to CUDA 8.0

If you cant, we fixed it via some workaround flags here: https://github.com/torch/cutorch/blob/master/lib/THC/CMakeLists.txt#L13-L20

I am not sure why they are not being considered in your case.
I tested with a 16.04 machine just now, and it seems to compile fine for me.

@FabbyD
Copy link

FabbyD commented Oct 7, 2016

In case people can't upgrade to 8.0, I was able to make it work with the changes proposed in: tensorflow/tensorflow#1066

I'm using Ubuntu 16.04 LTS, gcc 5, Cuda 7.5.

~/torch/extra/cutorch/lib/THC$ git diff CMakeLists.txt
diff --git a/lib/THC/CMakeLists.txt b/lib/THC/CMakeLists.txt
index 31184af..19639bd 100644
--- a/lib/THC/CMakeLists.txt
+++ b/lib/THC/CMakeLists.txt
@@ -17,7 +17,7 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
   if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER "4.9.3")
     if(CUDA_VERSION VERSION_LESS "8.0")
       MESSAGE(STATUS "Found gcc >=5 and CUDA <= 7.5, adding workaround C++ flags")
-      set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_FORCE_INLINES")
+      set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_FORCE_INLINES -D_MWAITXINTRIN_H_INCLUDED -D__STRICT_ANSI__")
     endif(CUDA_VERSION VERSION_LESS "8.0")
   endif(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER "4.9.3")
 endif(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")

Hope it helps other.

@soumith
Copy link
Member

soumith commented Oct 17, 2016

@FabbyD thanks for that. i pushed the additional fixes into cutorch and cunn

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants