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

`import theano` error workaround for "memcpy was not declared in this scope" #4425

Closed
rh314 opened this Issue Apr 23, 2016 · 6 comments

Comments

Projects
None yet
7 participants
@rh314

rh314 commented Apr 23, 2016

Doing an import theano for the first time with the THEANO_FLAGS environment variable containing device=gpu, theano complains that CUDA is not available.

Inspecting the nvcc stderr output revealed that it's related to the following error:
/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;

I'm not sure which systems it affects, but I'm using:
OS: Ubuntu 16.04 LTS.
GCC: version 5.3.1 20160413 (Ubuntu 5.3.1-14ubuntu2)
NVCC: Cuda compilation tools, release 7.5, V7.5.17

As a temporary workaround, I use the following hack:

  • Add cmd.append('-D_FORCE_INLINES') just before p = subprocess.Popen( in the file nvcc_compiler.py

Ideas are welcome... perhaps we can close this issue and open a "less-hackish-workaround" issue that addresses the actual problem (which I couldn't figure out just yet).

@chaosmail

This comment has been minimized.

Show comment
Hide comment
@chaosmail

chaosmail Apr 23, 2016

this fix worked for me, i am using a similar setup with gcc 4.9.3

this fix worked for me, i am using a similar setup with gcc 4.9.3

@Gnork

This comment has been minimized.

Show comment
Hide comment
@Gnork

Gnork Apr 23, 2016

I'm on Ubuntu 16.04 with nvidia-cuda-toolkit from official repos. I can confirm the bug and the fix is working for me with Theano 0.8.1

Gnork commented Apr 23, 2016

I'm on Ubuntu 16.04 with nvidia-cuda-toolkit from official repos. I can confirm the bug and the fix is working for me with Theano 0.8.1

@fsjunior

This comment has been minimized.

Show comment
Hide comment
@fsjunior

fsjunior Apr 24, 2016

Worked for me too. My config: Ubuntu 16.04 LTS, nvidia-cuda-toolkit 7.5.18-0ubuntu1 (from repository), nvidia-361 (from repository) and gcc 5.3.1 20160413.

Worked for me too. My config: Ubuntu 16.04 LTS, nvidia-cuda-toolkit 7.5.18-0ubuntu1 (from repository), nvidia-361 (from repository) and gcc 5.3.1 20160413.

@phiber1

This comment has been minimized.

Show comment
Hide comment
@phiber1

phiber1 Apr 25, 2016

I can confirm that since upgrading to Ubuntu 16.04 LTS, I've encountered this exact bug in torch, tensorflow, and now theano. It would appear the underlying cause to be in CUDA 7.5's interaction with the newer gcc updates, and insufficient compatibility testing on their part. I was previously using 16.04 beta (with slightly older version of gcc) with CUDA 7.5, and had no such problems.

phiber1 commented Apr 25, 2016

I can confirm that since upgrading to Ubuntu 16.04 LTS, I've encountered this exact bug in torch, tensorflow, and now theano. It would appear the underlying cause to be in CUDA 7.5's interaction with the newer gcc updates, and insufficient compatibility testing on their part. I was previously using 16.04 beta (with slightly older version of gcc) with CUDA 7.5, and had no such problems.

@ZiweiXU

This comment has been minimized.

Show comment
Hide comment
@ZiweiXU

ZiweiXU Apr 27, 2016

This workaround worked for me on gcc 4.8.5 with Ubuntu 16.04 LTS. I don't think this is a Theano issue but it's worthwhile being here.

ZiweiXU commented Apr 27, 2016

This workaround worked for me on gcc 4.8.5 with Ubuntu 16.04 LTS. I don't think this is a Theano issue but it's worthwhile being here.

@nouiz

This comment has been minimized.

Show comment
Hide comment
@nouiz

nouiz Apr 29, 2016

Member

Just a note that I added the instruction to work around the curren problem on ubuntu 16.04 here:

8f5bd5f

Member

nouiz commented Apr 29, 2016

Just a note that I added the instruction to work around the curren problem on ubuntu 16.04 here:

8f5bd5f

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment