Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Scholle__Pascoe
Beginner
140 Views

Undefned symbol linking own shared lib with intel mkl libs in tensorflow custom op

Hello everyone,

I am wanting to implement the extended eigensolver routine -  mkl_sparse_?_ev - in a custom op for tensorflow. I have run the examples for this routine, so the libraries are installed correctly, also, the compiling and linking stages dont spit out any errors. However during run time where I call the custom method from python, mkl_sparse_?_ev is undefined as well as mkl_sparse_init  and mkl_sparse_ee.

My LD_LIBRARYPATH contains the path to the mkl lib, so I am completely stumped.

I have tried to create a small example which is attached, the problem is that it requires that the user has tensorflow installed from source.

For those who want to take a quick glance, this is my command line procedure.

1) The terminal sources compilervars.sh on start up

2) I set the tensorflow cflags and lflags

TF_CFLAGS=( $(python -c 'import tensorflow as tf; print(" ".join(tf.sysconfig.get_compile_flags()))') )
TF_LFLAGS=( $(python -c 'import tensorflow as tf; print(" ".join(tf.sysconfig.get_link_flags()))') )

3) Compile and link the shared lib as per link line advisor

g++ -std=c++17 -shared -o tf_custom_ops.so -fPIC -DMKL_ILP64 -m64 -I${MKLROOT}/include -L${MKLROOT}/lib/intel64l_in -Wl,--no-as-needed -lmkl_intel_ilp64 -lmkl_sequential -lmkl_core -lpthread -lm -ldl ${TF_CFLAGS[@]} ${TF_LFLAGS[@]} -ltensorflow_framework -I/home/pas/software/tensorflow -O3 ml_ops.cc

Using ldd shows that all libraries are found. 

Thanks in advance for those who can take the time to help with this issue.

 

OS: Linux - Ubuntu 16.04 LTS

GCC version: 5.4

Kind regards,

Pascoe

 

0 Kudos
0 Replies
Reply