Intel® Distribution for Python*
Engage in discussions with community peers related to Python* applications and core computational packages.

2018_0018: theano compilation error

sergio_r_
Novice
1,556 Views

Hello folks,

Trying the theano code:

$ python
Python 3.6.2 |Intel Corporation| (default, Aug 15 2017, 16:14:26)
[GCC 4.8.2 20140120 (Red Hat 4.8.2-15)] on linux
Type "help", "copyright", "credits" or "license" for more information.
Intel(R) Distribution for Python is brought to you by Intel Corporation.
Please check out: https://software.intel.com/en-us/python-distribution
>>> from theano import function, config, shared, sandbox
icpc version 13.0.0 (gcc version 4.7.0 compatibility)
>>> import theano.tensor as T
>>> import numpy
>>> import time
>>> vlen = 10 * 30 * 768  # 10 x #cores x # threads per core
>>> iters = 1000
>>> rng = numpy.random.RandomState(22)  
>>> x = shared(numpy.asarray(rng.rand(vlen), config.floatX))  
>>> f = function([], T.exp(x))
>>> ... ... ... icpc: command line warning #10006: ignoring unknown option
 \'-qopt-prefetch=2\'. /usr/include/c++/4.8/iostream(38): catastrophic error: cannot open 
source file "bits/c++config.h".   #include <bits/c++config.h>.                              ^. . compilation 
aborted for /home/srojas/.theano/compiledir_Linux-3.13--generic-x86_64-with-debian-jessie-sid-x86_64-3.6.2-64/tmpy7syaejc/mod.cpp (code 4). ', '[Elemwise{exp,no_inplace}(<TensorType(float32, vector)>)]')

Is there any way to overcome this "catastrophic error"?

Thanks,

Sergio

 

0 Kudos
2 Replies
Christophe_H_Intel2
1,556 Views

Hi Sergio,

Intel Theano defaults to using the Intel compiler if it finds it on your system.  In your case, the installed compiler is version 13.0, which only has gcc 4.7 compatibility. You have three options:

1. Use Intel compiler >= 16.0

2. Remove icpc from your path before importing theano

3. At runtime, you can change the config to use gcc with the following code

from theano import config
config.cxx = 'g++'
config.gcc.cxxflags = '-fopenmp -O3 -opt-prefetch=2 -funroll-loops'

Thanks,

Chris

0 Kudos
Reply