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

Installation fails on Ubuntu 16.04 (‘memcpy’ was not declared in this scope) #670

Closed
andreaskoepf opened this issue May 1, 2016 · 18 comments

Comments

@andreaskoepf
Copy link
Contributor

andreaskoepf commented May 1, 2016

Just tried to install Torch on a fresh Ubuntu 16.04 machine. Compilation of cutorch failed with the following 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;

Caffe has a similar issue: BVLC/caffe#4046
Tensorflow had this too: tensorflow/tensorflow#1346

Solution is to define _FORCE_INLINES, e.g. add set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_FORCE_INLINES") to the CMakeLists.txt files of ctorch, cunn and cunnx.

Could somebody more familiar with the CMake configurations of those projects please check what to do?

@soumith
Copy link
Member

soumith commented May 1, 2016

@andreaskoepf where'd you get a 16.04 machine? are they available on ec2?

@andreaskoepf
Copy link
Contributor Author

@soumith I installed on the premises with an iso-image downloaded from ubuntu.com.

@andreaskoepf
Copy link
Contributor Author

It seems @hughperkins is already working on it torch/cutorch#401 👍

@hughperkins
Copy link
Contributor

Well "worked" on it. I have my own distro fork, which works ok :-) https://github.com/hughperkins/distro (On the other hand, whilst my Ubuntu is cutting edge, but lts, I've decided to create my own Torch lts, so if you use my distro, you get February version of Torch :-D ).

For bleeding edge torch "sid", you'll probalby need to fix it yourself, and submit a PR :-)

@andreaskoepf
Copy link
Contributor Author

@hughperkins ok. Was this the relevant change? hughperkins/distro-cl@357ed7b Anything else?

@hughperkins
Copy link
Contributor

hughperkins commented May 2, 2016

That's how I changed it. But in hindsight I'm not sure this is the best place to control the definition. It is ok for me, since I force everyone on OpenCL to use my distro, and only my distro :-D ie, not allowed to do luarocks install cutorch.

However, to support luarocks install cutorch, probably the change should be in cutorch's CMakeLists.txt. Something like add_definitions(-D_FORCE_INLINES), or update the CMAKE_CXX_FLAGS, as you/we both did, should work.

(Edit: note that you need to update the rockspec too, if you use my current approach, torch/cutorch#402 , but this is already merged to Torch "sid", so should be ok)

@hughperkins
Copy link
Contributor

Finally, I moved my fix into CMakeLists.txt actually hughperkins/cutorch@f1f62a1 When I say 'moved', I mean, 'added', need to remove the old 'fix'.

@hughperkins
Copy link
Contributor

hughperkins commented May 2, 2016

To be fair, I'm getting:

gcc-4.9: internal compiler error: Killed (program cc1plus)
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-4.9/README.Bugs> for instructions.
CMake Error at THC_generated_THCTensorMath2.cu.o.cmake:266 (message):
  Error generating file
  /home/ubuntu/torch-cl/extra/cutorch/build/lib/THC/CMakeFiles/THC.dir//./THC_generated_THCTensorMath2.cu.o

... so I've been switching to ec2 14.04 to finish building. I assumed it's because my laptop only has 4GB memory, but it might be something more critical....

@hughperkins
Copy link
Contributor

(note: after dropping the -j threads to 1, cutorch built ok on my 16.04 laptop; tests run ok).

@hughperkins
Copy link
Contributor

(but: need to modify cmakelists for cunn too it seems :-D )

@hughperkins
Copy link
Contributor

(so, it would be tempting to add the change to https://github.com/hughperkins/FindCUDA really... if someone can see how to do that, I'll probably accept a PR )

@hughperkins
Copy link
Contributor

(relevant commit for cunn for now hughperkins/cunn@3a752e5 )

@lukeyeager
Copy link

lukeyeager commented May 2, 2016

@hughperkins FWIW I tried your distro fork and it solved all my build issues. Thanks!

EDIT - now that the CUDA 8.0 RC is available, everyone should start using that on Ubuntu 16.04

@hughperkins
Copy link
Contributor

cool :-)

@notkarol
Copy link

notkarol commented Jun 1, 2016

A workaround is to install Cuda 8 directly from the 16.04 run file and remove Ubuntu's nvidia-cuda-toolkit package.

@shrx
Copy link

shrx commented Jun 1, 2016

@notkarol can you provide a link?

@notkarol
Copy link

notkarol commented Jun 1, 2016

https://developer.nvidia.com/cuda-release-candidate-download

Log in then navigate: Linux -> x86_64 -> Ubuntu -> 16.04 -> runfile (local) and download cuda_8.0.27_linux-run

@lukeyeager
Copy link

I'd recommend you use the deb package instead.

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

6 participants