Commit Graph

244 Commits

Author SHA1 Message Date
Austin Anderson
0a2db3d354 Provide NVIDIA CUDA build data in metadata and API
This change is a second attempt at , which was rolled back because it was fragile.

First, cuda_configure.bzl templates a file with data it already pulled from get_cuda_config. gen_build_info loads that file to provide package
build information within TensorFlow:

    from tensorflow.python.platform import build_info
    print(build_info.build_info)
    {'cuda_version': '10.2', 'cudnn_version': '7', ... }

Also is exposed through tf.sysconfig.get_build_info(), a public API change.

setup.py pulls build_info into package metadata. The wheel's
long description ends with:

    TensorFlow 2.2.0 for NVIDIA GPUs was built with these platform
    and library versions:

      - NVIDIA CUDA 10.2
      - NVIDIA cuDNN 7
      - NVIDIA CUDA Compute Capabilities compute_30, compute_70 (etc.)

I set one of the new CUDA Classifiers, and add metadata to the "platform" tag:

    >>> import pkginfo
    >>> a = pkginfo.Wheel('./tf_nightly_gpu-2.1.0-cp36-cp36m-linux_x86_64.whl')
    >>> a.platforms
    ['cuda_version:10.2', 'cudnn_version:7', ...]

I'm not 100% confident this is the best way to accomplish this. It
still seems odd to import like this setup.py, even though it works, even in
an environment with TensorFlow installed. This method is much better than the old method as it uses data that was already gathered. It could be extended to gather tensorrt, nccl, etc. from other .bzl files, but I wanted to get feedback (and ensure this lands in 2.3) before designing something like that.

Currently tested only on Linux GPU (Remote Build) for Python 3.6. I'd
like to see more tests before merging.

The API is the same as the earlier change.

Resolves https://github.com/tensorflow/tensorflow/issues/38351.

PiperOrigin-RevId: 315018663
Change-Id: Idf68a8fe4d1585164d22b5870894c879537c280d
2020-06-05 16:44:24 -07:00
A. Unique TensorFlower
2ffde8a339 This breaks multi-python:
The local gen_build_info rule calls into find_cuda_config, which only works in the remote image.

This is additionally brittle: relying on TF_CUDA_VERSION being an action_env is poisoning our caches, and running find_cuda_conifg multiple times is bugprone.

I think the better way to do this is to put the information from the repo_rule into a file template as part of the repo rule configuration (cuda_configure.bzl). Then we can just include that file, instead of trying to do that as part of the action.

PiperOrigin-RevId: 311148754
Change-Id: I80daa8652a85b2a1897c15117e6422bfd21cee6a
2020-05-12 10:12:04 -07:00
TensorFlower Gardener
94c821c0ef Merge pull request from angerson:master
PiperOrigin-RevId: 311025598
Change-Id: Ib47f014000e9183bd25b413ebeb43a4adf543d82
2020-05-11 17:21:17 -07:00
Austin Anderson
df1ee5d551 Convert build_info to dict format and expose it.
Since this module now generates a dictionary to expose in tf.config, it
doesn't make much sense to store only certain values in the build_info
dictionary and others as module variables. This obsoletes a lot of code
in gen_build_info.py and I've removed it.

I also updated all the in-code references I've found to the build_info
module. I think this may break whomever used to be using the build_info
library, but since it wasn't part of the API, there was no guarantee
that it would continue to be available.
2020-04-29 16:17:38 -07:00
Jason Zaman
dc86bb5296 systemlibs: unbundle pybind11
If pybind11 is installed on the system its headers are already captured
by @local_config_python//:python_headers, so the system lib only needs
to depend on that.

When installed correctly, includes should be #include "pybind11/...",
the bundled pybind11 is based off the source repo which does not match
the install paths. Use bazels strip_include_prefix to align the bundled
headers correctly.

Signed-off-by: Jason Zaman <jason@perfinion.com>
2020-04-08 03:38:38 +08:00
A. Unique TensorFlower
e4f82e501e tf.Benchmark: add mean and stdev of the wall time to unreported extras.
PiperOrigin-RevId: 296316355
Change-Id: I2e2de5de0b92c06c6b3d677ca5ea57046e0209b0
2020-02-20 15:54:30 -08:00
Mark Daoust
13cca52d62 Remove useless self-link and python version note.
Fixes 

PiperOrigin-RevId: 296086404
Change-Id: Ice56c6032290939e89fd752d584baab3d320c689
2020-02-19 16:52:48 -08:00
Gunhan Gulsoy
1dfd8dc2c4 Avoid using hardcoded path in benchmark_test
/tmp does not exist on windows.

PiperOrigin-RevId: 295988695
Change-Id: Ie45e6311df617462f4ba10354fabbeaf2eb05127
2020-02-19 09:42:08 -08:00
Eugene Brevdo
9211d97305 Now that tensorflow_core is gone, point includes and sysconfig at tensorflow pkg.
As of pypi nightly 20200215, the includes/ directory in the tensorflow{,_core}
site-packages is missing/incomplete.

This is due to the removal of the virtual tensorflow pointing to tensorflow_core
package but without updating sysconfig.py or the seutp.py/MANIFEST.in.

This CL fixes that.

PiperOrigin-RevId: 295761153
Change-Id: I51e21dbf40f4c9b54a98978cfa3e0b5fbcb4bc61
2020-02-18 11:35:19 -08:00
Gunhan Gulsoy
029c732c9a Automated rollback of commit 2af37fc088
PiperOrigin-RevId: 294270240
Change-Id: Ica2bb12e39eb53ee9604f6a5e7c05177cde2025e
2020-02-10 11:54:00 -08:00
Gunhan Gulsoy
2af37fc088 Automated rollback of commit b818cbe0a5
PiperOrigin-RevId: 294115842
Change-Id: I97442754c3b8a0ac6b88d211981da494c7a3b796
2020-02-09 15:29:39 -08:00
Gunhan Gulsoy
b818cbe0a5 Change resource_loader to use bazel's python tools.
PiperOrigin-RevId: 294051693
Change-Id: I8a6c618be59e9f774e6b854ca9635cfac4a81cd0
2020-02-08 23:07:57 -08:00
Gunhan Gulsoy
52a820c507 Write an actual test for resource_loader_test
Exercise the code paths it triggers.

Disable it on windows and pip packages for now.

PiperOrigin-RevId: 293910406
Change-Id: Ie84a3a85ff1f471e3d7ed4b192701667481e8324
2020-02-07 15:44:13 -08:00
A. Unique TensorFlower
925be1049d tf.gfile is now tf.io.gfile.
PiperOrigin-RevId: 293818901
Change-Id: I51746a055ca608a2a8b0cfb8696f7f33ca84fd53
2020-02-07 08:33:29 -08:00
Amit Patankar
00befcdeb8 Removing the remaining tensorflow.i and base.i SWIG files. 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 and JAX are using the pybind11 macros already. Please refer to https://github.com/tensorflow/community/blob/master/rfcs/20190208-pybind11.md for more information.
PiperOrigin-RevId: 293723717
Change-Id: I696e8a42ef651588d4830ff778fcb3f477c821a1
2020-02-06 18:31:20 -08:00
Amit Patankar
e1f998edab Remove an unused SWIG file that was previously deprecated in an older change.
PiperOrigin-RevId: 292007811
Change-Id: I98eecc8cccee17414c10cec74fd0bae43e04f419
2020-01-28 14:02:18 -08:00
Eugene Brevdo
9959c04433 [TF XLA] Add ability to convert SavedModel subgraphs to compiled [XLA CPU] objects via saved_model_cli.
You can now run, e.g.:

saved_model_cli aot_compile_cpu \
  --dir /path/to/saved_model \
  --tag_set serve \
  --signature_def_key action \
  --output_prefix /tmp/out \
  --cpp_class Serving::Action

Which will create the files:
  /tmp/{out.h, out.o, out_metadata.o, out_makefile.inc}

where out.h defines something like:

namespace Serving {
  class Action {
    ...
  }
}

and out_makefile.inc provides the additional flags required to include the header
and object files into your build.

You can optionally also point aot_compile_cpu to a newer set of checkpoints (weight values) by using the optional argument --checkpoint_path.

Also added `tf.test.is_built_with_xla()`.

TESTED:
* bazel test -c opt :saved_model_cli_test passes
* built and installed the pip wheel and tested in the bazel directory via:
  TEST_SRCDIR=/tmp/tfcompile/bazel-bin/tensorflow/python/tools/saved_model_cli_test.runfiles/ python saved_model_cli_test.py

and checking the output files to ensure the proper includes and header directories are
set in out_makefile.inc and out.h.

PiperOrigin-RevId: 290144104
Change-Id: If8eb6c3334b3042c4b9c24813b1b52c06d8fbc06
2020-01-16 14:26:12 -08:00
A. Unique TensorFlower
7bdc3ebe89 Remove obsolete macro HAS_GLOBAL_STRING from TensorFlow SWIG bindings.
PiperOrigin-RevId: 289154257
Change-Id: I47cfadeb83d11b8f56c21989ac8d1a487f725450
2020-01-10 13:32:08 -08:00
Sergei Lebedev
9d82907882 Converted file_io.i to pybind11
This is part of a larger effort to deprecate swig and eventually with
modularization break pywrap_tensorflow into smaller components.
Please refer to https://github.com/tensorflow/community/blob/master/rfcs/20190208-pybind11.md
for more information.

PiperOrigin-RevId: 286474536
Change-Id: Ic942a4480b1c1a19bdc3d6b65d3272221e47537b
2019-12-19 15:31:00 -08:00
Brian Atkinson
66c48046f1 Small adjustments on import spacing.
This is mostly the result of an internal cleanup and formatting pass.

PiperOrigin-RevId: 286318018
Change-Id: I8f9e2f7519070035da73f9f24d2fc90864abc51b
2019-12-18 20:32:12 -08:00
A. Unique TensorFlower
262213d0e4 Converted file_io.i to pybind11
This is part of a larger effort to deprecate swig and eventually with
modularization break pywrap_tensorflow into smaller components.
Please refer to https://github.com/tensorflow/community/blob/master/rfcs/20190208-pybind11.md
for more information.

PiperOrigin-RevId: 286302183
Change-Id: I4baf4a2628d46d7bdf3aa2916fb6f980a3c99abe
2019-12-18 17:57:45 -08:00
Sergei Lebedev
04941233e9 Converted file_io.i to pybind11
This is part of a larger effort to deprecate swig and eventually with
modularization break pywrap_tensorflow into smaller components.
Please refer to https://github.com/tensorflow/community/blob/master/rfcs/20190208-pybind11.md
for more information.

PiperOrigin-RevId: 286181704
Change-Id: I06e92ec7bc945c4efd69de85ef8b9e4de8007bf4
2019-12-18 06:49:37 -08:00
Amit Patankar
7bd345bcbb Export the Eager 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: 286110711
Change-Id: I7bf6f6f4ce1d6bf3e8a3e40ef4a83f82333800f6
2019-12-17 19:40:40 -08:00
Austin Anderson
78ddcded18 Add msvcp140_1.dll to list of import-time-check Windows DLLs
Resolves https://github.com/tensorflow/tensorflow/issues/35036

For TensorFlow 2.1.0rc1, the TensorFlow team built Windows packages with Microsoft Visual Studio 2019 16.4, upgraded from Visual Studio 2017. As discovered in the issue linked above, this caused an import error for Windows TF Python whls, because the build upgrade pulled in an additional Visual C++ DLL dependency, `msvcp140_1.dll`, which can be found in the latest Visual C++ package for all Visual Studio releases since 2015 (https://support.microsoft.com/en-us/help/2977003/the-latest-supported-visual-c-downloads).

I discovered the missing DLL by unpacking the two wheels for rc0 and rc1 and separately running `dumpbin /DEPENDENTS tensorflow_core/python/_pywrap_tensorflow_internal.pyd` (thanks to @yifeif for help with this!).

In this change, I've updated the import-time checker to look for both `msvcp140_1.dll` and `msvcp140.dll` in a way that supports simple future additions to the list.

PiperOrigin-RevId: 285476568
Change-Id: Ia9727e50801a4ddad1ea30653a74478fb7aee4e8
2019-12-13 17:53:13 -08:00
A. Unique TensorFlower
c733a2c1cd Expanded the description of tf.gfile.
PiperOrigin-RevId: 284775354
Change-Id: I3e6c8e785823251d2123613d9063c371ead329ad
2019-12-10 08:35:55 -08:00
A. Unique TensorFlower
722fc02b3f Minor change to depthwise convolution with dilation.
PiperOrigin-RevId: 284217866
Change-Id: Icd5419e62cef5870745182f8120b937ed791212f
2019-12-06 11:07:32 -08:00
TensorFlower Gardener
6977b8f742 Merge pull request from yongtang:33799-_logger_find_caller-3.8
PiperOrigin-RevId: 279049116
Change-Id: Ie1e6ecaf358c16bc4b80077b735239c17aecaed4
2019-11-07 03:23:19 -08:00
Yong Tang
507d188815 Update comment explaining python 3.8 change for findCaller
Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2019-11-03 19:54:20 +00:00
Yong Tang
ea3063c929 Fix TensorFlow on Python 3.8 logger issue
This fix tries to address the issue raised in 33799
where running tensorflow on python 3.8 (Ubuntu 18.04)
raised the following error:
```
TypeError: _logger_find_caller() takes from 0 to 1 positional arguments but 2 were given
```

The issue was that findCaller changed in Python 3.8

This PR fixes the issue.

This PR fixes 33799

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2019-11-03 19:53:18 +00:00
Amit Patankar
0250bfdb8c Export the stacktrace_handler 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: 277377958
Change-Id: Iea419c53a3a795e062eb2e8d9ae4b6d5c81ce80f
2019-10-29 16:08:48 -07:00
A. Unique TensorFlower
b3422c3b59 minor changes in tensor tracer.
PiperOrigin-RevId: 274900258
Change-Id: If6f5485139e61c1448054741051118467e8f4e79
2019-10-15 15:26:10 -07:00
Hye Soo Yang
fbf528fb00 Export the py_exception_registry 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: 273797800
2019-10-09 16:29:09 -07:00
Kibeom Kim
39fa4d4c52 Add basic Tensorflow eager micro benchmark.
In addition, implemented ParameterizedBenchmark class so that we no longer have
to write benchamrk functions for all the configuration matrix.  For example,
tensorflow/python/eager/benchmarks_test.py is very bloated due to this.

PiperOrigin-RevId: 268315479
2019-09-10 15:31:05 -07:00
Revan Sopher
8d52e1c646 Move default protocol parameter to a platforms library.
PiperOrigin-RevId: 260998356
2019-07-31 15:11:49 -07:00
TensorFlower Gardener
d1ac56a552 Merge pull request from frreiss:issue-linter-warning
PiperOrigin-RevId: 259445266
2019-07-22 18:30:25 -07:00
Yong Tang
7efc61175c Fix incorrect get_link_flags on Mac
This fix tries to address the issue raised in 30633 where
`tf.sysconfig.get_link_flags` on mac returned
'-l:libtensorflow_framework.1.dylib' which is not valid
for ld on macOS.

This fix changes to `-ltensorflow_framework.1`

This fix fixes 30633.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2019-07-12 10:10:05 -07:00
Duncan Riach
62ce1e98bd Fix URL in docstring [skip ci] 2019-07-09 13:43:26 -07:00
TensorFlower Gardener
d0814e19f8 Merge pull request from ROCmSoftwarePlatform:google_upstream_is_built_with_rocm
PiperOrigin-RevId: 256505080
2019-07-04 01:08:35 -07:00
Billy Lamberta
6715d8f18e Remove link to old guide.
PiperOrigin-RevId: 256016578
2019-07-01 14:20:32 -07:00
Deven Desai
9a74324a66 enhancing the build_info_test to check for test.is_built_with_rocm() functionality 2019-06-27 13:45:35 +00:00
Deven Desai
c9e11b03d1 This commit adds a test.is_built_with_rocm python utility routine, which will return true/false based on whether TF was built with ROCm support enables (i.e. with --config=rocm )
This routine will be used in subsequent PRs to make ROCm specific changes to certain unit tests. The nature of these changes will be to primarily disable certain subtests, which test features that are not yet supported on the ROCm platform (for e.g. complex datatypes, 3D pooling, etc)

A `test.is_built_with_gpu_support` routine is also being added, which is essentially "is_built_with_cuda() or is_built_with_rocm()".
2019-06-26 21:20:23 +00:00
Yifei Feng
19628668a5 Remove cuda related dll precheck so that GPU pip package can run on CPU.
We have wrapped all cuda calls with dlopen and our shared library no longer explicitly depends on cuda libraries. This is in preparation for consolidating our two pip packages into one.

PiperOrigin-RevId: 252697407
2019-06-11 15:04:17 -07:00
Mihai Maruseac
a7bcf5fdc8 Fix include and lib path from virtual pip. Fix
When making the virtual pip changes, by moving code to new directory, required headers and shared object are no longer vizible where they should. This should fix that.

PiperOrigin-RevId: 252100366
2019-06-07 13:18:10 -07:00
James Ring
f341636ee4 Split TF_Status into its own header.
This change allows users to depend on TF_Status and its associated constants
(e.g. TF_OK, TF_INVALID_ARGUMENT, etc) without bringing in the whole C API.

The first intended user is the C op definition API, which cannot depend on the
C API, because the C API itself depends on op definitions, causing circular
dependencies.

PiperOrigin-RevId: 248816896
2019-05-17 17:42:58 -07:00
frreiss
e4378df884 Fix second linter warning 2019-05-15 15:33:42 -07:00
Dong Lin
b1c95b8ebe Enable benchmark_test in presubmit
PiperOrigin-RevId: 247090431
2019-05-07 15:41:18 -07:00
TensorFlower Gardener
fc2ea0aa51 Merge pull request from yongtang:27848-logging-warning
PiperOrigin-RevId: 245915979
2019-04-30 03:17:49 -07:00
Mark Daoust
1bde2c4ce9 Apply tf1->tf2 name replaces to doc-strings and comments in tensorflow.
No code changes, only doc-strings and comments (I checked).

PiperOrigin-RevId: 243885306
2019-04-16 16:27:28 -07:00
Yong Tang
7ae75b2cd1 Fix incorrect frame numbers in tf_logging.warn
This fix tries to address the issue raised in 27848 where
the frame numbers in tf_logging.warn is incorrect in python 3.

The reason was that in python 2, `warn = warning` but in python 3,
an additional wrapper has been added to deprecate the warn. For
that reason one additional frame has been added, thus causing
incorrect output in the log.

This fix fixes 27848.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2019-04-15 19:25:32 +00:00
Jason Zaman
e2994c09ec sysconfig: fix library name on macos
On darwin, the library is named libtensorflow_framework.2.dylib

Signed-off-by: Jason Zaman <jason@perfinion.com>
2019-04-16 01:22:23 +08:00