<math.h> fails on Intel Centos 6.6 cluster

1

I'm on a university cluster, no su for me. I am trying to get Keras working, with either tensorflow or theano. Tensorflow fails because the system only has CUDA 7.5. It has an Intel chipset, but it's giving me problems with math.h.

Edit: After some hacking around, I decided to compile Python 3.5 from source. Lo and behold:

gcc -pthread -c -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes    -Werror=declaration-after-statement   -I. -I./Include    -DPy_BUILD_CORE -o Programs/python.o ./Programs/python.c
In file included from ./Include/pyport.h:328:0,
                 from ./Include/Python.h:50,
                 from ./Programs/python.c:3:
/cm/shared/apps/intel/compilers_and_libraries/2016.2.181/compiler/include/math.h:29:3: error: #error "This Intel <math.h> is for use with only the Intel compilers!"
 # error "This Intel <math.h> is for use with only the Intel compilers!"
   ^
make: *** [Programs/python.o] Error 1

Same issue with math.h!

So it seems like this is the underlying issue to the bug with installing Theano.

VV --- This was my original post --- VV

Theano, gives this error on import theano:

full pastebin traceback here

[dump of entirety of lazylinker_c.c]

followed by

Problem occurred during compilation with the command line below:
/gpfs/software/gcc-4.9.2/bin/g++ -shared -g -march=haswell -mmmx -mno-3dnow -msse -msse2 -msse3 -mssse3 -mno-sse4a -mcx16 -msahf -mmovbe -maes -mno-sha -mpclmul -mpopcnt -mabm -mno-lwp -mfma -mno-fma4 -mno-xop -mbmi -mbmi2 -mno-tbm -mavx -mavx2 -msse4.2 -msse4.1 -mlzcnt -mno-rtm -mno-hle -mrdrnd -mf16c -mfsgsbase -mno-rdseed -mno-prfchw -mno-adx -mfxsr -mxsave -mxsaveopt -mno-avx512f -mno-avx512er -mno-avx512cd -mno-avx512pf -mno-prefetchwt1 --param l1-cache-size=32 --param l1-cache-line-size=64 --param l2-cache-size=15360 -mtune=generic -DNPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION -m64 -fPIC -I/gpfs/home/USERNAME/anaconda3/lib/python3.5/site-packages/numpy/core/include -I/gpfs/home/USERNAME/anaconda3/include/python3.5m -I/gpfs/home/USERNAME/anaconda3/lib/python3.5/site-packages/theano/gof -fvisibility=hidden -o /gpfs/home/USERNAME/.theano/compiledir_Linux-2.6-el6.x86_64-x86_64-with-centos-6.6-Final-x86_64-3.5.2-64/lazylinker_ext/lazylinker_ext.so /gpfs/home/USERNAME/.theano/compiledir_Linux-2.6-el6.x86_64-x86_64-with-centos-6.6-Final-x86_64-3.5.2-64/lazylinker_ext/mod.cpp -L/gpfs/home/USERNAME/anaconda3/lib -lpython3.5m
In file included from /gpfs/home/USERNAME/anaconda3/include/python3.5m/pyport.h:13:0,
                 from /gpfs/home/USERNAME/anaconda3/include/python3.5m/Python.h:50,
                 from /gpfs/home/USERNAME/.theano/compiledir_Linux-2.6-el6.x86_64-x86_64-with-centos-6.6-Final-x86_64-3.5.2-64/lazylinker_ext/mod.cpp:1:
/cm/shared/apps/intel/compilers_and_libraries/2016.2.181/compiler/include/stdint.h:79:10: warning: undefining "__STDC_LIMIT_MACROS_DEFINED_BY_CLANG"
 #  undef __STDC_LIMIT_MACROS_DEFINED_BY_CLANG
          ^
/cm/shared/apps/intel/compilers_and_libraries/2016.2.181/compiler/include/stdint.h:83:10: warning: undefining "__STDC_CONSTANT_MACROS_DEFINED_BY_CLANG"
 #  undef __STDC_CONSTANT_MACROS_DEFINED_BY_CLANG
          ^
In file included from /gpfs/home/USERNAME/anaconda3/include/python3.5m/pyport.h:328:0,
                 from /gpfs/home/USERNAME/anaconda3/include/python3.5m/Python.h:50,
                 from /gpfs/home/USERNAME/.theano/compiledir_Linux-2.6-el6.x86_64-x86_64-with-centos-6.6-Final-x86_64-3.5.2-64/lazylinker_ext/mod.cpp:1:
/cm/shared/apps/intel/compilers_and_libraries/2016.2.181/compiler/include/math.h:29:3: error: #error "This Intel <math.h> is for use with only the Intel compilers!"
 # error "This Intel <math.h> is for use with only the Intel compilers!"
   ^

Traceback (most recent call last):
  File "/gpfs/home/USERNAME/anaconda3/lib/python3.5/site-packages/theano/gof/lazylinker_c.py", line 74, in <module>
    raise ImportError()
ImportError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/gpfs/home/USERNAME/anaconda3/lib/python3.5/site-packages/theano/gof/lazylinker_c.py", line 91, in <module>
    raise ImportError()
ImportError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/gpfs/home/USERNAME/anaconda3/lib/python3.5/site-packages/theano/__init__.py", line 63, in <module>
    from theano.compile import (
  File "/gpfs/home/USERNAME/anaconda3/lib/python3.5/site-packages/theano/compile/__init__.py", line 9, in <module>
    from theano.compile.function_module import *
  File "/gpfs/home/USERNAME/anaconda3/lib/python3.5/site-packages/theano/compile/function_module.py", line 22, in <module>
    import theano.compile.mode
  File "/gpfs/home/USERNAME/anaconda3/lib/python3.5/site-packages/theano/compile/mode.py", line 12, in <module>
    import theano.gof.vm
  File "/gpfs/home/USERNAME/anaconda3/lib/python3.5/site-packages/theano/gof/vm.py", line 638, in <module>
    from . import lazylinker_c
  File "/gpfs/home/USERNAME/anaconda3/lib/python3.5/site-packages/theano/gof/lazylinker_c.py", line 126, in <module>
    preargs=args)
  File "/gpfs/home/USERNAME/anaconda3/lib/python3.5/site-packages/theano/gof/cmodule.py", line 2204, in compile_str
    (status, compile_stderr.replace('\n', '. ')))
Exception: Compilation failed (return status=1): In file included from /gpfs/home/USERNAME/anaconda3/include/python3.5m/pyport.h:13:0,.                  from /gpfs/home/USERNAME/anaconda3/include/python3.5m/Python.h:50,.                  from /gpfs/home/USERNAME/.theano/compiledir_Linux-2.6-el6.x86_64-x86_64-with-centos-6.6-Final-x86_64-3.5.2-64/lazylinker_ext/mod.cpp:1:. /cm/shared/apps/intel/compilers_and_libraries/2016.2.181/compiler/include/stdint.h:79:10: warning: undefining "__STDC_LIMIT_MACROS_DEFINED_BY_CLANG".  #  undef __STDC_LIMIT_MACROS_DEFINED_BY_CLANG.           ^. /cm/shared/apps/intel/compilers_and_libraries/2016.2.181/compiler/include/stdint.h:83:10: warning: undefining "__STDC_CONSTANT_MACROS_DEFINED_BY_CLANG".  #  undef __STDC_CONSTANT_MACROS_DEFINED_BY_CLANG.           ^. In file included from /gpfs/home/USERNAME/anaconda3/include/python3.5m/pyport.h:328:0,.                  from /gpfs/home/USERNAME/anaconda3/include/python3.5m/Python.h:50,.                  from /gpfs/home/USERNAME/.theano/compiledir_Linux-2.6-el6.x86_64-x86_64-with-centos-6.6-Final-x86_64-3.5.2-64/lazylinker_ext/mod.cpp:1:. /cm/shared/apps/intel/compilers_and_libraries/2016.2.181/compiler/include/math.h:29:3: error: #error "This Intel <math.h> is for use with only the Intel compilers!".  # error "This Intel <math.h> is for use with only the Intel compilers!".    ^.

Theano was installed with conda install theano.

I'm not sure quite what is goofing, but I suspect a lack of python-dev may be at play.

System info:

conda 4.3.13

Python 3.5.2 |Continuum Analytics, Inc.| (default, Jul 2 2016, 17:53:06) [GCC 4.4.7 20120313 (Red Hat 4.4.7-1)] on linux Type "help", "copyright", "credits" or "license" for more information.

lsb_release -a:

LSB Version: :base-4.0-amd64:base-4.0-noarch:core-4.0-amd64:core-4.0-noarch:graphics-4.0-amd64:graphics-4.0-noarch:printing-4.0-amd64:printing-4.0-noarch
Distributor ID: CentOS
Description: CentOS release 6.6 (Final)
Release: 6.6
Codename: Final

uname -r: 2.6.32-504.16.2.el6.x86_64

Edit: List of things I've tried:

  • Upgrade to 0.9: deeplearning.net/software/theano/install.html#bleeding-edge-install-instructions (stupid link reputation restriction!)- same error
  • Added ~/anaconda3 to LD_LIBRARY_PATH

My intuition is it isn't finding something that it needs to link to, but I can't pinpoint what, or how to fix it.

DeusXMachina

Posted 2017-02-23T22:15:09.337

Reputation: 113

Answers

0

Aha! Figured it out. There were some Intel libraries which were running that were preempting GCC's math library.

I tried removing all Intel paths from PATH but to no avail. However after a bit more digging, I realized that there were some Intel compiler modules that were running on the cluster.

The winning magic words were module unload intel/compiler/64/16.0.2/2016.2.181

DeusXMachina

Posted 2017-02-23T22:15:09.337

Reputation: 113