Skip to content

Add easy to use configuration scripts #235

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,4 @@ gradleBuild
**/target
.tf_configure.bazelrc
.clwb/
/tensorflow-core/tensorflow-core-api/config.log
11 changes: 5 additions & 6 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,9 @@ complete build could be required to reflect the changes, otherwise `-Pdev` shoul
### Native Builds

In some cases, like when adding GPU support or re-generating op classes, you will need to re-build the native library. 99% of this is building
TensorFlow, which by default is configured for the [CI](.github/workflows/ci.yml). The build configuration can be customized using the same methods as
TensorFlow, so if you're building locally, you may need to clone the [tensorflow](https://github.com/tensorflow/tensorflow) project, run its
configuration script (`./configure`), and copy the resulting
`.tf_configure.bazelrc` to `tensorflow-core-api`. This overrides the default options, and you can add to it manually (i.e. adding `build --copt="-g"`
to build with debugging info).
TensorFlow, which by default is configured for the [CI](.github/workflows/ci.yml). The build configuration can be customized using the `configure`
scripts in `tensorflow-core-api`, which call the scripts downloaded with the tensorflow dependency. This overrides the default options, and you can
add to it manually (i.e. adding `build --copt="-g"` to build with debugging info).

### GPU Support

Expand Down Expand Up @@ -90,7 +88,8 @@ in [IntelliJ](https://github.com/google/styleguide/blob/gh-pages/intellij-java-g

### Dependencies

For dependencies, we can use anything compliant with [this list](https://opensource.google/docs/thirdparty/licenses/#notice), but we want to keep the core libraries as dependency free as possible.
For dependencies, we can use anything compliant with [this list](https://opensource.google/docs/thirdparty/licenses/#notice), but we want to keep the
core libraries as dependency free as possible.

### Code generation

Expand Down
1 change: 1 addition & 0 deletions tensorflow-core/tensorflow-core-api/.bazelversion
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.1.0
4 changes: 4 additions & 0 deletions tensorflow-core/tensorflow-core-api/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
# Script to build native TensorFlow libraries
set -eu

if [ ! -f .tf_configure.bazelrc ]; then
echo "No .tf_configure.bazelrc, using CI settings. For local builds, run the ./configure script."
fi

# Allows us to use ccache with Bazel on Mac
export BAZEL_USE_CPP_ONLY_TOOLCHAIN=1

Expand Down
25 changes: 25 additions & 0 deletions tensorflow-core/tensorflow-core-api/configure
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/usr/bin/env bash

#
# Copyright 2021 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ==============================================================================
#
set -e

bazel fetch @org_tensorflow//- || true

BASE=$(bazel info output_base)
"$BASE"/external/org_tensorflow/configure
mv "$BASE"/external/org_tensorflow/.tf_configure.bazelrc .
26 changes: 26 additions & 0 deletions tensorflow-core/tensorflow-core-api/configure.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
@echo off

::
:: Copyright 2021 The TensorFlow Authors. All Rights Reserved.
::
:: Licensed under the Apache License, Version 2.0 (the "License");
:: you may not use this file except in compliance with the License.
:: You may obtain a copy of the License at
::
:: http://www.apache.org/licenses/LICENSE-2.0
::
:: Unless required by applicable law or agreed to in writing, software
:: distributed under the License is distributed on an "AS IS" BASIS,
:: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
:: See the License for the specific language governing permissions and
:: limitations under the License.
:: ==============================================================================
::

bazel fetch @org_tensorflow//-

for /f %%i in ('bazel info output_base') do set VAR=%%i

CALL %VAR%\\external\\org_tensorflow\\configure.cmd

MOVE %VAR%\\external\\org_tensorflow\\.tf_configure.bazelrc .