sjperkins / tfopgen

Generate C++ and CUDA boilerplate for tensorflow custom operators
MIT License
20 stars 4 forks source link

test_custom.py errors #3

Open lixinfan opened 7 years ago

lixinfan commented 7 years ago

After compiling the "simple" example, custom.so is properly created: Makefile custom_op.h custom_op_cpu.h custom_op_gpu.cu custom_op_gpu.o custom.so custom_op_cpu.cpp custom_op_cpu.o custom_op_gpu.cuh test_custom.py

But running test_custom.py resulted in a "./custom.so: undefined symbol" error as follows. Any ideas about how to fix it? I am testing with tfopgen (0.2.4) and tensorflow (1.1.0-rc2), in case it matters.

python test_custom.py E

ERROR: test_custom (main.TestCustom) Test the Custom operator

Traceback (most recent call last): File "test_custom.py", line 12, in setUp self.custom = tf.load_op_library('./custom.so') File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/load_library.py", line 64, in load_op_library None, None, error_msg, error_code) NotFoundError: ./custom.so: undefined symbol: _ZN10tensorflow8internal21CheckOpMessageBuilder9NewStringEv


Ran 1 test in 0.015s

FAILED (errors=1)

lixinfan commented 7 years ago

I managed to solve the problem, by commenting out following flag in the generated Makefile # -D_GLIBCXX_USE_CXX11_ABI=0

I am not sure about causes of the problem and the solution, but the idea came from this tensforflow issue disucssion: https://github.com/tensorflow/tensorflow/issues/4118