MKL, EIGEN, and TF

750 views
Skip to first unread message

rupflz

unread,
Jun 26, 2016, 9:24:48 PM6/26/16
to Discuss
I have downloaded the current version of Intel MKL to link with V0.8 of Tensorflow (I have the source and Bazel). To bring MKL into the build,I defined a copt -DEIGEN_USE_MKL_ALL and set up a local_repository defined within bazel to get TF to build and produce _pywrap_tensorflow.so. Note that I am statically linking. 

Here is the list of MKL libs used to link:
           ["lib/intel64_lin/libmkl_intel_lp64.a",
            "lib/intel64_lin/libmkl_intel_thread.a",
            "lib/intel64_lin/libmkl_blacs_intelmpi_lp64.a",
            "lib/intel64_lin/libmkl_core.a"],

 
When attempting to import tensorflow into python, I receive the following error:

Traceback (most recent call last):
    import tensorflow as tf
  File "/home/tf/tensorflow/_python_build/tensorflow/__init__.py", line 23, in <module>
    from tensorflow.python import *
  File "/home/tf/tensorflow/_python_build/tensorflow/python/__init__.py", line 48, in <module>
    from tensorflow.python import pywrap_tensorflow
  File "/home/tf/tensorflow/_python_build/tensorflow/python/pywrap_tensorflow.py", line 28, in <module>
    _pywrap_tensorflow = swig_import_helper()
  File "/home/tf/tensorflow/_python_build/tensorflow/python/pywrap_tensorflow.py", line 24, in swig_import_helper
    _mod = imp.load_module('_pywrap_tensorflow', fp, pathname, description)
ImportError: /home/tf/tensorflow/_python_build/tensorflow/python/_pywrap_tensorflow.so: undefined symbol: MPI_Comm_rank

Is SWIG the culprit? Does it need MKL defined as a dep? If so, where and how to specify?

Has anyone else linked MKL with TF successfully? Is there a known/documented recipe to build TF with MKL?



Pete Warden

unread,
Jun 28, 2016, 6:06:42 AM6/28/16
to rupflz, Discuss
I've been experimenting with MKL inside TensorFlow, but I'm not aware of anybody who's been able to use it wholesale. Most of my work has focused on replacing the GEMM calls, and involved makeshift code changes to do benchmarking.

--
You received this message because you are subscribed to the Google Groups "Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to discuss+u...@tensorflow.org.
To post to this group, send email to dis...@tensorflow.org.
To view this discussion on the web visit https://groups.google.com/a/tensorflow.org/d/msgid/discuss/238c8ed6-7145-4039-9240-78cf80c4c963%40tensorflow.org.

dahvid...@gmail.com

unread,
Jul 19, 2017, 1:43:42 AM7/19/17
to Discuss
Your problem is MPI in this case.  You should choose not to build with MPI.  Of course I haven't got MKL to work either.  Mainly Eigan won't compile with MKL which makes it worthless in terms of accelleration.

Toby Boyd

unread,
Jul 19, 2017, 2:18:04 AM7/19/17
to dahvid...@gmail.com, Discuss
MKL was added in 1.2 by Intel and for linux the build has been easy for me so far.  Instructions have shown up on this group along with numbers as well for some models.

We are still working to improve the build process so it may change but as of 1.2 this works.  I have been doing somewhat extensive testing.

./configure
Do you wish to build TensorFlow with MKL support? [y/N] Y
Do you wish to download MKL LIB from the web? [Y/n] Y
# Select the defaults for the rest of the options.

bazel build --config=mkl --copt="-DEIGEN_USE_VML" -c opt //tensorflow/tools/pip_package:build_pip_package

Toby

--
You received this message because you are subscribed to the Google Groups "Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to discuss+unsubscribe@tensorflow.org.

To post to this group, send email to dis...@tensorflow.org.
Reply all
Reply to author
Forward
0 new messages