Commit Graph

10 Commits

Author SHA1 Message Date
Amit Patankar
0f01ee7a34 Re-add dynamic loading flags and logic in Python.
PiperOrigin-RevId: 305712320
Change-Id: Iaa25ab0397e91ffa83cba805e81a6c9e315549d8
2020-04-09 10:38:50 -07:00
Amit Patankar
5fb9558424 Removing the stale py_wrap_cc and swig compiler rules from TensorFlow.
PiperOrigin-RevId: 305535788
Change-Id: I86032bdb11c08e8a647ded3def75423bace80ca9
2020-04-08 12:56:03 -07:00
Amit Patankar
a02fe6c24a Export the TF Session classes and functions from C++ to Python with pybind11 instead of swig. This is part of a larger effort to deprecate swig and eventually with modularization break pywrap_tensorflow into smaller components. It will also make exporting C++ ops to Python significantly easier. XLA is using the pybind11 macros already. Please refer to https://github.com/tensorflow/community/blob/master/rfcs/20190208-pybind11.md for more information.
PiperOrigin-RevId: 292259851
Change-Id: If5abe93f9cf25018d185e220d4dfbc216b5f3b32
2020-01-29 18:29:05 -08:00
Billy Lamberta
684b3e02e0 Update links to install pages.
PiperOrigin-RevId: 213917946
2018-09-20 18:15:54 -07:00
Alex Sergeev
8d3bd70a54 Support --config=monolithic in tf.sysconfig.get_link_flags() ()
* Don't add -ltensorflow_framework to sysconfig LFLAGS if the build is monolithic
2017-12-15 11:59:53 -05:00
Alex Sergeev
f567ddf87d Add tf.sysconfig.get_compile_flags() & tf.sysconfig.get_link_flags() for custom operators ()
* Add flags for custom op compilation

* Move ABI logic into version_info.cc

* Add #include <string> to be able to read _GLIBCXX_USE_CXX11_ABI value.

* Make flags to be lists

* Add _flag to cxx11_abi

* Address review comment.

* Move CXX import to the top level.

* Add goldens update
2017-10-31 13:18:17 -07:00
Allen Lavoie
5c7f9e316d Remove RTLD_GLOBAL when loading pywrap_tensorflow
Splits out a shared object (//tensorflow/libtensorflow_framework.so) with core TensorFlow functionality but neither ops nor kernels. This object does include registries for ops, kernels, filesystems, etc. The expectation is that shared objects containing custom ops will have a runtime dependency on this framework shared object: TensorFlow will load the custom op shared object, and the custom op shared object will use the symbols from the framework shared object to register its ops/kernels/etc. rather than (as before this change) relying on those symbols being in the global symbol table.

In this mode, TensorFlow artifacts (_pywrap_tensorflow.so for Python, libtensorflow.so for the C API; currently excluding Android artifacts) will depend on the framework shared object, which will be packaged with the Python pip package and other language distributions. This means that custom ops targeting the framework shared object will work in any language (C++, Java, Go; previously custom ops in these languages required custom Bazel builds).

Adds a config option which reproduces the old behavior (--config=monolithic), which for Python means building a monolithic pywrap_tensorflow shared object and loading its symbols into the global symbol table (with RTLD_GLOBAL). As before, there will be no extra-Bazel custom op support for other languages when compiling in this mode.

Does not change behavior on Windows; the cmake build is still monolithic.

Requires using tf_cc_binary, tf_cc_test, and (rarely) tf_cc_shared_object rules to link in the framework shared object when adding new TensorFlow build rules.

PiperOrigin-RevId: 169572746
2017-09-21 11:33:40 -07:00
Derek Murray
ff95455262 Add a platform-dependent self-check that runs during import tensorflow.
This gives us the opportunity to raise actionable error messages (e.g. about
missing DLLs on Windows) that are more useful than the loader errors we get
from a failed SWIG import.

PiperOrigin-RevId: 169315291
2017-09-19 16:02:20 -07:00
Martin Wicke
540e8d8a7e Fix link in import error message.
Change: 149308271
2017-03-06 09:47:18 -08:00
Jonathan Hseu
718812c9e4 Fix the dlopen contrib test hack by making a pywrap_tensorflow module that imports
pywrap_tensorflow_internal with RTLD_GLOBAL.

Fixes 
Change: 148843302
2017-02-28 18:51:06 -08:00