Intel® oneAPI Math Kernel Library
Ask questions and share information with other developers who use Intel® Math Kernel Library.
6956 Discussions

Cannot compile theano tests with icpc and mkl libraries

Kirk_W_
Beginner
895 Views

Hi everyone,

I've been trying to compile theano tests using icpc and linking against mkl-libraries. I've used the following link line and compiler settings.

link line:

-L${MKLROOT}/lib -lmkl_intel_ilp64 -lmkl_core -lmkl_intel_thread -lpthread -lm -ldl

compiler options:

-DMKL_ILP64 -qopenmp -I${MKLROOT}/include

I've been getting the following errors. If anyone can help me because this error is driving me crazy. I've tried many things such as changing flags or even changing the compiler. I've also used g++-6 but still couldn't run the tests. Everything has failed so far.

Problem occurred during compilation with the command line below:
icpc -dynamiclib -g -O3 -fno-math-errno -Wno-unused-label -Wno-unused-variable -Wno-write-strings -Wl,-rpath,/opt/intel/mkl/lib -DMKL_ILP64 -I/opt/intel/mkl/include -DNPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION -m64 -fPIC -undefined dynamic_lookup -I/Users/jm/anaconda2/lib/python2.7/site-packages/numpy/core/include -I/Users/jm/anaconda2/include/python2.7 -I/Users/jm/anaconda2/lib/python2.7/site-packages/theano/gof -L/opt/intel/mkl/lib -L/Users/jm/anaconda2/lib -fvisibility=hidden -o /Users/jm/.theano/compiledir_Darwin-15.6.0-x86_64-i386-64bit-i386-2.7.12-64/tmpiCtphp/8f7c39861f82e0c5784c93e52bab9c26.so /Users/jm/.theano/compiledir_Darwin-15.6.0-x86_64-i386-64bit-i386-2.7.12-64/tmpiCtphp/mod.cpp -lmkl_intel_ilp64 -lmkl_core -lmkl_tbb_thread -ltbb -lstdc++ -lpthread -lm -ldl

0 Kudos
11 Replies
Ying_H_Intel
Employee
895 Views

Hi Kirk, 

You mentioned the can't compile theano test,  not configure theano itself, right? . What is exact error message?   does the file /Users/jm/.theano/compiledir_Darwin-15.6.0-x86_64-i386-64bit-i386-2.7.12-64/tmpiCtphp/mod.cpp include any BLAS or LAPACK (or other MKL function)? 

Could you please tell us the hardware and OS you are using?   In most of cases ( for example, the mod.cpp will depend on the MKL library ) , you  can  try the MKL link advisor from https://software.intel.com/en-us/articles/intel-mkl-link-line-advisor/  to find required MKL library.  

Best Regards,

Ying

FYI, configure theano to using  BLAS library in   http://deeplearning.net/software/theano/install.html

0 Kudos
Kirk_W_
Beginner
895 Views

Hi Ying,

thanks for your answer. Just to clarify some things. My goal is to use icpc and mkl-intel library version 11.3 which I have installed to compile theano code. The problem is that it doesn't work.

I have already used the MKL link advisor. That's were I got the settings from in the first place.

My os is OS X 10.11 and the hardware cpu: intel-i5 and ram: 8Gb.

I think the problem lies in the linking process. I think that the settings for the MKL link advisor are not correct.

The way that I test it is by running the theano tests which fail. Then I simply try a minimal dot product example which also fails to compile.

If anyone could replicate this issue I would be grateful. I would really like to know how to properly link icpc and intel-mkl libraries against theano so that I can compile code properly?

Thanks!

0 Kudos
Ying_H_Intel
Employee
895 Views

Hi Kirk, 

Thanks for the details.  Could you please tell the step to reproduce the problem?

For example, 

Install theano  http://deeplearning.net/software/theano/install.html#osx

Then what operation are you doing?

and What is  exact error message when you try a minimal dot product example which also fails to compile.

Best Regards,
Ying 

0 Kudos
Kirk_W_
Beginner
895 Views

Hi Ying,

thank you for you reply. The exact steps to reproduce my environment are the following:

1. Install anaconda https://www.continuum.io/downloads for python 2.7.x

2. brew install graphviz "if you don't already have it in you system"

3. Install theano developer version, through "pip install --no-deps git+git://github.com/Theano/Theano.git" recommended by developers, said to be solving some issues

   Alternatively you could do: "pip install Theano"

                                             "pip install --upgrade --no-deps Theano"

4. conda install pydot-ng or pip install pydot

5. pip install graphviz (this is different from command 2. Simply an interface of python to command 2)

6. Configuration: need to tell theano what compiler, libraries and flags to use. "Create a .theanorc file in you home directory"

7. Put the following inside .theanorc in order to use icpc and intel-mkl

[global]

cxx = icpc

openmp = True --> you have to install this first via brew install openmp --without-multilib

[gcc]

cxxflags =  -DMKL_ILP64 -qopenmp -I${MKLROOT}/include

[blas]

ldflags = -L${MKLROOT}/lib -lmkl_intel_ilp64 -lmkl_core -lmkl_intel_thread -lpthread -lm -ldl

8. To test if everything works correctly first I run the tests and then the minimal  dot product example. To run the tests execute the following in a terminal. " python -c "import theano; theano.test()" ". Notice the inside double quotes are important! This results into errors and failure for me. Tests don't build clean

9. Another test that I do is the following simple minimal dot product.

import theano

import theano.tensor as tt

import numpy as np

x, w = tt.matrices('x', 'w')

f = theano.function([x, w], tt.dot(x, w), allow_input_downcast=True)

f(np.random.randn(5, 6), np.random.randn(6, 4))

Below is the error that I get from the minimal example above:

In [1]: import theano

 

In [2]: import theano.tensor as tt

 

In [3]: import numpy as np

 

In [4]: x, w = tt.matrices('x', 'w')

 

In [5]: f = theano.function([x,w], tt.dot(x,w), allow_input_downcast=True)

WARNING (theano.gof.cmodule): OPTIMIZATION WARNING: Theano was not able to find the g++ parameters that tune the compilation to your  specific CPU. This can slow down the execution of Theano functions. Please submit the following lines to Theano's mailing list so that we can fix this problem:

 ['# 1 "-"\n', 'icpc version 16.0.3 (gcc version 4.9.0 compatibility)\n', '/usr/local/bin/icpc-16.0-base/bin/intel64/mcpcom    --target_efi2 -_g -mP3OPT_inline_alloca -D__ICC=1600 -D__INTEL_COMPILER=1600 -D__INTEL_COMPILER_UPDATE=3 -D__BLOCKS__ -D__SIZE_WIDTH__=64 -D__PTRDIFF_TYPE__=long "-D__SIZE_TYPE__=unsigned long" -D__WCHAR_TYPE__=int -D__WINT_TYPE__=int "-D__INTMAX_TYPE__=long int" "-D__UINTMAX_TYPE__=long unsigned int" -D__LONG_MAX__=9223372036854775807L -D__QMSPP_ -D__OPTIMIZE__ -D__NO_MATH_INLINES -D__NO_STRING_INLINES -D__GNUC_GNU_INLINE__ -D__GNUC__=4 -D__GNUC_MINOR__=9 -D__GNUC_PATCHLEVEL__=0 -D__clang__=1 -D__clang_patchlevel__=0 -D__clang_minor__=3 -D__clang_major__=7 -D__clang_version__=7.3.0 -D__APPLE_CC__=5226 -D__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__=1116 -D__LITTLE_ENDIAN__ -D__DYNAMIC__ "-D__private_extern__=__attribute__((visibility("hidden")))" -D__LP64__ -D_LP64 -D__GXX_ABI_VERSION=1002 -D__USER_LABEL_PREFIX__=_ -D__REGISTER_PREFIX__= -D__INTEL_RTTI__ -D__x86_64 -D__x86_64__ -D__amd64 -D__amd64__ "-_Acpu(x86_64)" "-_Amachine(x86_64)" -D__INTEL_COMPILER_BUILD_DATE=20160415 -D__PIC__ -D__APPLE__ -D__MACH__ -D__pentium4 -D__pentium4__ -D__tune_pentium4__ -D__SSE2__ -D__SSE2_MATH__ -D__SSE3__ -D__SSSE3__ -D__SSE4_1__ -D__SSE4_2__ -D__SSE__ -D__SSE_MATH__ -D__MMX__ -D__AVX__ -D__AVX_I__ -D__AVX2__ -D__FMA__ -_k -_8 -_l --has_new_stdarg_support -_D -_a -_b -E --gnu_version=40900 -_W5 --gcc-extern-inline --clang_version=30700 --multibyte_chars --blocks --clang_lib_extensions -D_LIBCPP_HAS_NO_VARIADICS -D_LIBCPP_HAS_NO_RVALUE_REFERENCES -mGLOB_diag_suppress_sys --array_section --simd --simd_func --clang_extensions -mP1OPT_print_version=FALSE -mGLOB_em64t=TRUE -mP1OPT_version=16.0-intel64 -mGLOB_diag_use_message_catalog=FALSE -\n', '#include "..." search starts here:\n', '#include <...> search starts here:\n', ' /usr/local/bin/icpc-16.0-base/compiler/include/intel64\n', ' /usr/local/bin/icpc-16.0-base/compiler/include\n', ' /System/Library/Frameworks\n', ' /Library/Frameworks\n', ' /Library/Developer/CommandLineTools/usr/bin/../lib/clang/7.3.0/include\n', ' /usr/local/include\n', ' /usr/include/\n', ' /usr/include\n', 'End of search list.\n']

 

In [6]: f(np.random.randn(4,5), np.random.randn(5,6))

Segmentation fault: 11

 
Thanks!
0 Kudos
Kirk_W_
Beginner
895 Views

And if I try to link gcc6 against intel-mkl libraries and run the above minimal example, I get the following errors:

f = theano.function([x,w], tt.dot(x,w), allow_input_downcast=True)

Problem occurred during compilation with the command line below:

g++-6c -dynamiclib -g -O3 -fno-math-errno -Wno-unused-label -Wno-unused-variable -Wno-write-strings -Wl,--no-as-needed -Wl,-rpath,/opt/intel/mkl/lib -DMKL_ILP64 -m64 -I/opt/intel/mkl/include -DNPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION -m64 -fPIC -undefined dynamic_lookup -I/Users/jm/anaconda2/lib/python2.7/site-packages/numpy/core/include -I/Users/jm/anaconda2/include/python2.7 -I/Users/jm/anaconda2/lib/python2.7/site-packages/theano/gof -L/opt/intel/mkl/lib -L/Users/jm/anaconda2/lib -fvisibility=hidden -o /Users/jm/.theano/compiledir_Darwin-15.6.0-x86_64-i386-64bit-i386-2.7.12-64/tmpHSLq3t/20e25ec3332be5b692d497e191c73eba.so /Users/jm/.theano/compiledir_Darwin-15.6.0-x86_64-i386-64bit-i386-2.7.12-64/tmpHSLq3t/mod.cpp -lmkl_intel_ilp64 -lmkl_core -lmkl_intel_thread -liomp5 -lpthread -lm -ldl

ERROR (theano.gof.cmodule): [Errno 2] No such file or directory

---------------------------------------------------------------------------

OSError                                   Traceback (most recent call last)

<ipython-input-9-69d89bc7defb> in <module>()

----> 1 f = theano.function([x,w], tt.dot(x,w), allow_input_downcast=True)

 

/Users/jm/anaconda2/lib/python2.7/site-packages/theano/compile/function.pyc in function(inputs, outputs, mode, updates, givens, no_default_updates, accept_inplace, name, rebuild_strict, allow_input_downcast, profile, on_unused_input)

    324                    on_unused_input=on_unused_input,

    325                    profile=profile,

--> 326                    output_keys=output_keys)

    327     # We need to add the flag check_aliased inputs if we have any mutable or

    328     # borrowed used defined inputs

 

/Users/jm/anaconda2/lib/python2.7/site-packages/theano/compile/pfunc.pyc in pfunc(params, outputs, mode, updates, givens, no_default_updates, accept_inplace, name, rebuild_strict, allow_input_downcast, profile, on_unused_input, output_keys)

    482                          accept_inplace=accept_inplace, name=name,

    483                          profile=profile, on_unused_input=on_unused_input,

--> 484                          output_keys=output_keys)

    485 

    486 

 

/Users/jm/anaconda2/lib/python2.7/site-packages/theano/compile/function_module.pyc in orig_function(inputs, outputs, mode, accept_inplace, name, profile, on_unused_input, output_keys)

   1787                    on_unused_input=on_unused_input,

   1788                    output_keys=output_keys).create(

-> 1789             defaults)

   1790 

   1791     t2 = time.time()

 

/Users/jm/anaconda2/lib/python2.7/site-packages/theano/compile/function_module.pyc in create(self, input_storage, trustme, storage_map)

   1651             theano.config.traceback.limit = theano.config.traceback.compile_limit

   1652             _fn, _i, _o = self.linker.make_thunk(

-> 1653                 input_storage=input_storage_lists, storage_map=storage_map)

   1654         finally:

   1655             theano.config.traceback.limit = limit_orig

 

/Users/jm/anaconda2/lib/python2.7/site-packages/theano/gof/link.pyc in make_thunk(self, input_storage, output_storage, storage_map)

    697         return self.make_all(input_storage=input_storage,

    698                              output_storage=output_storage,

--> 699                              storage_map=storage_map)[:3]

    700 

    701     def make_all(self, input_storage, output_storage):

 

/Users/jm/anaconda2/lib/python2.7/site-packages/theano/gof/vm.pyc in make_all(self, profiler, input_storage, output_storage, storage_map)

   1049                                                  storage_map,

   1050                                                  compute_map,

-> 1051                                                  no_recycling))

   1052                 if not hasattr(thunks[-1], 'lazy'):

   1053                     # We don't want all ops maker to think about lazy Ops.

 

/Users/jm/anaconda2/lib/python2.7/site-packages/theano/gof/op.pyc in make_thunk(self, node, storage_map, compute_map, no_recycling)

    973             try:

    974                 return self.make_c_thunk(node, storage_map, compute_map,

--> 975                                          no_recycling)

    976             except (NotImplementedError, utils.MethodNotDefined):

    977                 logger.debug('Falling back on perform')

 

/Users/jm/anaconda2/lib/python2.7/site-packages/theano/gof/op.pyc in make_c_thunk(self, node, storage_map, compute_map, no_recycling)

    873         logger.debug('Trying CLinker.make_thunk')

    874         outputs = cl.make_thunk(input_storage=node_input_storage,

--> 875                                 output_storage=node_output_storage)

    876         fill_storage, node_input_filters, node_output_filters = outputs

    877 

 

/Users/jm/anaconda2/lib/python2.7/site-packages/theano/gof/cc.pyc in make_thunk(self, input_storage, output_storage, storage_map, keep_lock)

   1188         cthunk, in_storage, out_storage, error_storage = self.__compile__(

   1189             input_storage, output_storage, storage_map,

-> 1190             keep_lock=keep_lock)

   1191 

   1192         res = _CThunk(cthunk, init_tasks, tasks, error_storage)

 

/Users/jm/anaconda2/lib/python2.7/site-packages/theano/gof/cc.pyc in __compile__(self, input_storage, output_storage, storage_map, keep_lock)

   1129                                     output_storage,

   1130                                     storage_map,

-> 1131                                     keep_lock=keep_lock)

   1132         return (thunk,

   1133                 [link.Container(input, storage) for input, storage in

 

/Users/jm/anaconda2/lib/python2.7/site-packages/theano/gof/cc.pyc in cthunk_factory(self, error_storage, in_storage, out_storage, storage_map, keep_lock)

   1584         else:

   1585             module = get_module_cache().module_from_key(

-> 1586                 key=key, lnk=self, keep_lock=keep_lock)

   1587 

   1588         vars = self.inputs + self.outputs + self.orphans

 

/Users/jm/anaconda2/lib/python2.7/site-packages/theano/gof/cmodule.pyc in module_from_key(self, key, lnk, keep_lock)

   1143             try:

   1144                 location = dlimport_workdir(self.dirname)

-> 1145                 module = lnk.compile_cmodule(location)

   1146                 name = module.__file__

   1147                 assert name.startswith(location)

 

/Users/jm/anaconda2/lib/python2.7/site-packages/theano/gof/cc.pyc in compile_cmodule(self, location)

   1490                 lib_dirs=self.lib_dirs(),

   1491                 libs=libs,

-> 1492                 preargs=preargs)

   1493         except Exception as e:

   1494             e.args += (str(self.fgraph),)

 

/Users/jm/anaconda2/lib/python2.7/site-packages/theano/gof/cmodule.pyc in compile_str(module_name, src_code, location, include_dirs, lib_dirs, libs, preargs, py_module, hide_symbols)

   2277 

   2278         try:

-> 2279             p_out = output_subprocess_Popen(cmd)

   2280             compile_stderr = decode(p_out[1])

   2281         except Exception:

 

/Users/jm/anaconda2/lib/python2.7/site-packages/theano/misc/windows.pyc in output_subprocess_Popen(command, **params)

     80     params['stdout'] = subprocess.PIPE

     81     params['stderr'] = subprocess.PIPE

---> 82     p = subprocess_Popen(command, **params)

     83     # we need to use communicate to make sure we don't deadlock around

     84     # the stdour/stderr pipe.

 

/Users/jm/anaconda2/lib/python2.7/site-packages/theano/misc/windows.pyc in subprocess_Popen(command, **params)

     41 

     42     try:

---> 43         proc = subprocess.Popen(command, startupinfo=startupinfo, **params)

     44     finally:

     45         if stdin is not None:

 

/Users/jm/anaconda2/lib/python2.7/subprocess.pyc in __init__(self, args, bufsize, executable, stdin, stdout, stderr, preexec_fn, close_fds, shell, cwd, env, universal_newlines, startupinfo, creationflags)

    709                                 p2cread, p2cwrite,

    710                                 c2pread, c2pwrite,

--> 711                                 errread, errwrite)

    712         except Exception:

    713             # Preserve original exception in case os.close raises.

 

/Users/jm/anaconda2/lib/python2.7/subprocess.pyc in _execute_child(self, args, executable, preexec_fn, close_fds, cwd, env, universal_newlines, startupinfo, creationflags, shell, to_close, p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite)

   1341                         raise

   1342                 child_exception = pickle.loads(data)

-> 1343                 raise child_exception

   1344 

   1345 

 

OSError: [Errno 2] No such file or directory

 
0 Kudos
Ying_H_Intel
Employee
895 Views

Hi Kirk, 

thank for the step by step.  I try almost same 

1. Install anaconda https://www.continuum.io/downloads for python 2.7.x (command line) 

i haven't try homebrew and conda 

3. Install theano 

: "pip install Theano"

                                             "pip install --upgrade --no-deps Theano"

4. pip install pydot

5. pip install graphviz 

6. Configuration: need to tell theano what compiler, libraries and flags to use. "Create a .theanorc file in you home directory"

7. Put the following inside .theanorc in order to use icpc and intel-mkl

[global]

cxx = icpc

openmp = True --> you have to install this first via brew install openmp --without-multilib

[gcc]

cxxflags =  -DMKL_ILP64 -qopenmp -I${MKLROOT}/include

[blas]

ldflags = -L-L/opt/intel/compilers_and_libraries_2016.3.170/mac/mkl/lib/-lmkl_intel_ilp64 -lmkl_core -lmkl_intel_thread -lpthread -lm -ldl

 

->  I can't use the $MKLROOT. although i have source  /opt/intel/compilers_and_libraries_2016.3.170/mac/mkl/bin/mklvars.sh intel64

>python test.py

I got segmentation error too.  

But it is not problem to run with 

[global]
cxx = icpc
openmp = True  ( as icpc support OpenMP,  i don't install openMP from other places) 

[gcc]
cxxflags =  -DMKL_LP64 -qopenmp -I${MKLROOT}/include

[blas]
ldflags = -L/opt/intel/compilers_and_libraries_2016.3.170/mac/mkl/lib -lmkl_intel_lp64 -lmkl_core -lmkl_intel_thread -lpthread -lm -ldl

Last login: Wed Sep 21 00:25:59 2016
macmini01:~ yhu5$ icpc -v
icpc version 17.0.0 (gcc version 4.9.0 compatibility)
macmini01:~ yhu5$ source /opt/intel/compilers_and_libraries_2017.0.
compilers_and_libraries_2017.0.092/ compilers_and_libraries_2017.0.102/
macmini01:~ yhu5$ source /opt/intel/compilers_and_libraries_2016.3.170/
.version   licensing/ mac/
macmini01:~ yhu5$ source /opt/intel/compilers_and_libraries_2016.3.170/mac/
bin/             documentation/   man/             pkg_bin/
compiler/        link_install.sh  mkl/
macmini01:~ yhu5$ source /opt/intel/compilers_and_libraries_2016.3.170/mac/mkl/b             in/mklvars.sh intel64
macmini01:~ yhu5$ python test.py  ( i add me= f(np.random.randn(4,5), np.random.randn(5,6)), print me
WARNING (theano.gof.cmodule): OPTIMIZATION WARNING: your Theano flag `cxx` seems              not to be the g++ compiler. So we disable the compiler optimization specific to              g++ that tell to compile for a specific CPU. At worst, this could cause slow do             wn.
         You can add those parameters to the compiler yourself via the Theano fl             ag `gcc.cxxflags`.
[[ 1.27863428  1.28816199  2.83958232 -0.35235211]
 [ 2.46670051  2.72214105  2.85460089 -0.99719573]
 [-3.06628748  0.67908877  1.68852227 -3.37025947]
 [-1.6107379  -1.37031813 -1.47781715 -2.912304  ]
 [-4.03258646 -0.75107235 -2.93471964 -2.51097149]]
macmini01:~ yhu5$ 

So what i can suggest 

1. try  -DMKL_LP64   -lmkl_intel_lp64 .... 

2 may be try latest MKL 2017 , which can be get from  https://software.intel.com/en-us/intel-mkl/  => get This Library for free

(although i'm in icpc in 2017 and MKL using 2016) 

3. I can reproduce the error with gcc. , seems not direct MKL related.     ERROR (theano.gof.cmodule): [Errno 2] No such file or directory.  it should be wrong file or directory. 

Best Regards,

Ying 

0 Kudos
Kirk_W_
Beginner
895 Views

Hi Ying, 

thanks for the reply. Did you manage to run the tests without problems with icpc+intel-mkl? 

One question though, how can you update the intel-mkl to a newer version? I mean do I have to uninstall what I have already installed in my system and then re-install the new version?

Thanks!

0 Kudos
Ying_H_Intel
Employee
895 Views

Hi Kirk, 

I did further investigation. The  problem of segmentation error should be the ILP64, where theano use "int" type as matrix size input, which is 32bit by default. the ILP64 means int 64bit. So the correct MKL library should be  

[global]
cxx = icpc
openmp = True  ( as icpc support OpenMP,  i don't install openMP from other places) 

[gcc]
cxxflags =  -I${MKLROOT}/include

[blas]
ldflags = -L/opt/intel/compilers_and_libraries_2016.3.170/mac/mkl/lib -lmkl_intel_ilp64 -lmkl_core -lmkl_intel_thread -lpthread -lm -ldl

Last login: Wed Sep 21 00:25:59 2016

You may try it and let me know if it work for you. 

Yes, the  "-lmkl_intel_lp64 -lmkl_core -lmkl_intel_thread" should work with both clang /gcc too.  They can run without problem. 

You can upgrade to Intel MKL by any way. Usually, you don't need uninstall the old version.  Different version should be install to different folder. and the /opt/intel/mkl  will link the latest version.

Best Regards,

Ying  

0 Kudos
Kirk_W_
Beginner
895 Views

 

Hi Yiing,

thank you so much for your support. So, I've tried your settings and run the theano tests but I get a Segmentation fault:11

Here is the output from that segmentation fault:

Theano version 0.9.0dev2.dev-8e4dff3581eefcc4cd6dcfa06b99f44338c5ffec
theano is installed in /Users/jm/anaconda2/lib/python2.7/site-packages/theano
NumPy version 1.11.1
NumPy relaxed strides checking option: False
NumPy is installed in /Users/jm/anaconda2/lib/python2.7/site-packages/numpy
Python version 2.7.12 |Continuum Analytics, Inc.| (default, Jul  2 2016, 17:43:17) [GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.11.00)]
nose version 1.3.7
/Users/jm/anaconda2/lib/python2.7/site-packages/theano/misc/pycuda_init.py:35: UserWarning: PyCUDA import failed in theano.misc.pycuda_init
  warnings.warn("PyCUDA import failed in theano.misc.pycuda_init")
/Users/jm/anaconda2/lib/python2.7/site-packages/theano/sandbox/gpuarray/__init__.py:10: UserWarning: theano.sandbox.gpuarray has been moved to theano.gpuarray. Please update your code and pickles. If the warning persists, clear theano's cache ('$theano/bin/theano-cache clear').
  warnings.warn(message)
.WARNING (theano.gof.cmodule): OPTIMIZATION WARNING: Theano was not able to find the g++ parameters that tune the compilation to your  specific CPU. This can slow down the execution of Theano functions. Please submit the following lines to Theano's mailing list so that we can fix this problem:
 ['# 1 "-"\n', 'icpc version 16.0.3 (gcc version 4.9.0 compatibility)\n', '/usr/local/bin/icpc-16.0-base/bin/intel64/mcpcom    --target_efi2 -_g -mP3OPT_inline_alloca -D__ICC=1600 -D__INTEL_COMPILER=1600 -D__INTEL_COMPILER_UPDATE=3 -D__BLOCKS__ -D__SIZE_WIDTH__=64 -D__PTRDIFF_TYPE__=long "-D__SIZE_TYPE__=unsigned long" -D__WCHAR_TYPE__=int -D__WINT_TYPE__=int "-D__INTMAX_TYPE__=long int" "-D__UINTMAX_TYPE__=long unsigned int" -D__LONG_MAX__=9223372036854775807L -D__QMSPP_ -D__OPTIMIZE__ -D__NO_MATH_INLINES -D__NO_STRING_INLINES -D__GNUC_GNU_INLINE__ -D__GNUC__=4 -D__GNUC_MINOR__=9 -D__GNUC_PATCHLEVEL__=0 -D__clang__=1 -D__clang_patchlevel__=0 -D__clang_minor__=3 -D__clang_major__=7 -D__clang_version__=7.3.0 -D__APPLE_CC__=5226 -D__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__=1116 -D__LITTLE_ENDIAN__ -D__DYNAMIC__ "-D__private_extern__=__attribute__((visibility("hidden")))" -D__LP64__ -D_LP64 -D__GXX_ABI_VERSION=1002 -D__USER_LABEL_PREFIX__=_ -D__REGISTER_PREFIX__= -D__INTEL_RTTI__ -D__x86_64 -D__x86_64__ -D__amd64 -D__amd64__ "-_Acpu(x86_64)" "-_Amachine(x86_64)" -D__INTEL_COMPILER_BUILD_DATE=20160415 -D__PIC__ -D__APPLE__ -D__MACH__ -D__pentium4 -D__pentium4__ -D__tune_pentium4__ -D__SSE2__ -D__SSE2_MATH__ -D__SSE3__ -D__SSSE3__ -D__SSE4_1__ -D__SSE4_2__ -D__SSE__ -D__SSE_MATH__ -D__MMX__ -D__AVX__ -D__AVX_I__ -D__AVX2__ -D__FMA__ -_k -_8 -_l --has_new_stdarg_support -_D -_a -_b -E --gnu_version=40900 -_W5 --gcc-extern-inline --clang_version=30700 --multibyte_chars --blocks --clang_lib_extensions -D_LIBCPP_HAS_NO_VARIADICS -D_LIBCPP_HAS_NO_RVALUE_REFERENCES -mGLOB_diag_suppress_sys --array_section --simd --simd_func --clang_extensions -mP1OPT_print_version=FALSE -mGLOB_em64t=TRUE -mP1OPT_version=16.0-intel64 -mGLOB_diag_use_message_catalog=FALSE -\n', '#include "..." search starts here:\n', '#include <...> search starts here:\n', ' /usr/local/opt/openblas/include\n', ' /opt/intel/compilers_and_libraries_2016.3.170/mac/compiler/include\n', ' /usr/local/bin/icpc-16.0-base/compiler/include/intel64\n', ' /usr/local/bin/icpc-16.0-base/compiler/include\n', ' /System/Library/Frameworks\n', ' /Library/Frameworks\n', ' /Library/Developer/CommandLineTools/usr/bin/../lib/clang/7.3.0/include\n', ' /usr/local/include\n', ' /usr/include/\n', ' /usr/include\n', 'End of search list.\n']
.....Segmentation fault: 11

Best Regards,

K.W.

0 Kudos
Ying_H_Intel
Employee
895 Views

Hi K.W, 

Thanks for letting me know.  From the output, last  segmenttation fault , it seems no MKL library information, right? 

How about  just run the small test.py  with pin install theano  (no the developer version) ? 

import theano

import theano.tensor as tt

import numpy as np

x, w = tt.matrices('x', 'w')

f = theano.function([x, w], tt.dot(x, w), allow_input_downcast=True,mode='DebugMode')

me = f(np.random.randn(5, 6), np.random.randn(6, 4))
print me 

Best Regards,
Ying 

P.S as i mentioned, i can run the test fine with the below step:

1. Install anaconda https://www.continuum.io/downloads for python 2.7.x (command line)     (i haven't try homebrew and conda )

3. Install theano 

 "pip install Theano"

    "pip install --upgrade --no-deps Theano"

4. pip install pydot

5. pip install graphviz 

6. Configuration: need to tell theano what compiler, libraries and flags to use. "Create a .theanorc file in you home directory"

7. Put the following inside .theanorc in order to use icpc and intel-mkl

[global]
cxx = icpc
openmp = True  ( as icpc support OpenMP,  i don't install openMP from other places) 

[gcc]
cxxflags =  -I${MKLROOT}/include

[blas]
ldflags = -L/opt/intel/compilers_and_libraries_2016.3.170/mac/mkl/lib -lmkl_intel_lp64 -lmkl_core -lmkl_intel_thread -lpthread -lm -ldl

Last login: Wed Sep 21 00:25:59 2016
macmini01:~ yhu5$ icpc -v
icpc version 17.0.0 (gcc version 4.9.0 compatibility)
macmini01:~ yhu5$ source /opt/intel/compilers_and_libraries_2017.0.
compilers_and_libraries_2017.0.092/ compilers_and_libraries_2017.0.102/
macmini01:~ yhu5$ source /opt/intel/compilers_and_libraries_2016.3.170/
.version   licensing/ mac/
macmini01:~ yhu5$ source /opt/intel/compilers_and_libraries_2016.3.170/mac/
bin/             documentation/   man/             pkg_bin/
compiler/        link_install.sh  mkl/
macmini01:~ yhu5$ source /opt/intel/compilers_and_libraries_2016.3.170/mac/mkl/b             in/mklvars.sh intel64
macmini01:~ yhu5$ python test.py

 

0 Kudos
Kirk_W_
Beginner
895 Views

Hi Ying,

apologies for my late reply. I tried but still get a segmentation fault.

I think I'm still gonna have to do some more debugging.

But the bottom line is that I still cannot make it work.

0 Kudos
Reply