Skip to content

Commit

Permalink
Merge pull request #131 from xhochy/2.6.0
Browse files Browse the repository at this point in the history
tensorflow 2.6.0
  • Loading branch information
xhochy authored Sep 25, 2021
2 parents 8812111 + 932381b commit 3a1f4f0
Show file tree
Hide file tree
Showing 12 changed files with 169 additions and 468 deletions.
2 changes: 1 addition & 1 deletion .ci_support/osx_arm64_python3.8.____cpython.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ c_compiler:
c_compiler_version:
- '11'
channel_sources:
- conda-forge/label/rust_dev,conda-forge
- conda-forge
channel_targets:
- conda-forge main
cxx_compiler:
Expand Down
2 changes: 1 addition & 1 deletion .ci_support/osx_arm64_python3.9.____cpython.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ c_compiler:
c_compiler_version:
- '11'
channel_sources:
- conda-forge/label/rust_dev,conda-forge
- conda-forge
channel_targets:
- conda-forge main
cxx_compiler:
Expand Down
3 changes: 2 additions & 1 deletion .scripts/build_steps.sh

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions .scripts/run_osx_build.sh

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions README.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 25 additions & 2 deletions recipe/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ export TF_SYSTEM_LIBS="
astor_archive
astunparse_archive
boringssl
com_github_googleapis_googleapis
com_github_googlecloudplatform_google_cloud_cpp
com_github_grpc_grpc
com_google_protobuf
Expand Down Expand Up @@ -80,6 +79,7 @@ BUILD_OPTS="
--config=opt
--define=PREFIX=${PREFIX}
--define=PROTOBUF_INCLUDE_PATH=${PREFIX}/include
--config=noaws
--cpu=${TARGET_CPU}"

if [[ "${target_platform}" == "osx-arm64" ]]; then
Expand Down Expand Up @@ -111,7 +111,6 @@ sed -i -e "/PROTOBUF_INCLUDE_PATH/c\ " .bazelrc
sed -i -e "/PREFIX/c\ " .bazelrc

./configure
echo "build --config=noaws" >> .bazelrc

# build using bazel
bazel ${BAZEL_OPTS} build ${BUILD_OPTS} ${BUILD_TARGET}
Expand All @@ -120,3 +119,27 @@ bazel ${BAZEL_OPTS} build ${BUILD_OPTS} ${BUILD_TARGET}
mkdir -p $SRC_DIR/tensorflow_pkg
bash -x bazel-bin/tensorflow/tools/pip_package/build_pip_package $SRC_DIR/tensorflow_pkg

if [[ "${target_platform}" == linux-* ]]; then
cp $SRC_DIR/bazel-bin/tensorflow/tools/lib_package/libtensorflow.tar.gz $SRC_DIR
mkdir -p $SRC_DIR/libtensorflow_cc_output/lib
cp -d bazel-bin/tensorflow/libtensorflow_cc.so* $SRC_DIR/libtensorflow_cc_output/lib/
cp -d bazel-bin/tensorflow/libtensorflow_framework.so* $SRC_DIR/libtensorflow_cc_output/lib/
cp -d $SRC_DIR/libtensorflow_cc_output/lib/libtensorflow_framework.so.2 $SRC_DIR/libtensorflow_cc_output/lib/libtensorflow_framework.so
# Make writable so patchelf can do its magic
chmod u+w $SRC_DIR/libtensorflow_cc_output/lib/libtensorflow*

mkdir -p $SRC_DIR/libtensorflow_cc_output/include/tensorflow
rsync -avzh --exclude '_virtual_includes/' --exclude 'pip_package/' --exclude 'lib_package/' --include '*/' --include '*.h' --include '*.inc' --exclude '*' bazel-bin/ $SRC_DIR/libtensorflow_cc_output/include
rsync -avzh --include '*/' --include '*.h' --include '*.inc' --exclude '*' tensorflow/cc $SRC_DIR/libtensorflow_cc_output/include/tensorflow/
rsync -avzh --include '*/' --include '*.h' --include '*.inc' --exclude '*' tensorflow/core $SRC_DIR/libtensorflow_cc_output/include/tensorflow/
rsync -avzh --include '*/' --include '*' --exclude '*.cc' third_party/ $SRC_DIR/libtensorflow_cc_output/include/third_party/
rsync -avzh --include '*/' --include '*' --exclude '*.txt' bazel-work/external/eigen_archive/Eigen/ $SRC_DIR/libtensorflow_cc_output/include/Eigen/
rsync -avzh --include '*/' --include '*' --exclude '*.txt' bazel-work/external/eigen_archive/unsupported/ $SRC_DIR/libtensorflow_cc_output/include/unsupported/
pushd $SRC_DIR/libtensorflow_cc_output
tar cf ../libtensorflow_cc_output.tar .
popd
chmod -R u+rw $SRC_DIR/libtensorflow_cc_output
rm -r $SRC_DIR/libtensorflow_cc_output
fi

bazel clean
13 changes: 13 additions & 0 deletions recipe/build_estimator.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash

set -exuo pipefail

pushd tensorflow-estimator

WHEEL_DIR=${PWD}/wheel_dir
mkdir -p ${WHEEL_DIR}
bazel build tensorflow_estimator/tools/pip_package:build_pip_package
bazel-bin/tensorflow_estimator/tools/pip_package/build_pip_package ${WHEEL_DIR}
${PYTHON} -m pip install --no-deps ${WHEEL_DIR}/*.whl
bazel clean
popd
2 changes: 1 addition & 1 deletion recipe/cp_libtensorflow.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# https://github.com/tensorflow/tensorflow/blob/master/tensorflow/tools/lib_package/README.md
tar -C ${PREFIX} -xzf $SRC_DIR/bazel-bin/tensorflow/tools/lib_package/libtensorflow.tar.gz
tar -C ${PREFIX} -xzf $SRC_DIR/libtensorflow.tar.gz

# Make writable so patchelf can do its magic
chmod u+w $PREFIX/lib/libtensorflow*
20 changes: 1 addition & 19 deletions recipe/cp_libtensorflow_cc.sh
Original file line number Diff line number Diff line change
@@ -1,19 +1 @@
mkdir -p $PREFIX/lib
# copy library
cp -d bazel-bin/tensorflow/libtensorflow_cc.so* $PREFIX/lib/
cp -d bazel-bin/tensorflow/libtensorflow_framework.so* $PREFIX/lib/
cp -d $PREFIX/lib/libtensorflow_framework.so.2 $PREFIX/lib/libtensorflow_framework.so
# Make writable so patchelf can do its magic
chmod u+w $PREFIX/lib/libtensorflow*

mkdir -p $PREFIX/include
mkdir -p $PREFIX/include/tensorflow
# copy headers
rsync -avzh --exclude '_virtual_includes/' --exclude 'pip_package/' --exclude 'lib_package/' --include '*/' --include '*.h' --include '*.inc' --exclude '*' bazel-bin/ $PREFIX/include/
rsync -avzh --include '*/' --include '*.h' --include '*.inc' --exclude '*' tensorflow/cc $PREFIX/include/tensorflow/
rsync -avzh --include '*/' --include '*.h' --include '*.inc' --exclude '*' tensorflow/core $PREFIX/include/tensorflow/
rsync -avzh --include '*/' --include '*' --exclude '*.cc' third_party/ $PREFIX/include/third_party/
rsync -avzh --include '*/' --include '*' --exclude '*.txt' bazel-work/external/eigen_archive/Eigen/ $PREFIX/include/Eigen/
rsync -avzh --include '*/' --include '*' --exclude '*.txt' bazel-work/external/eigen_archive/unsupported/ $PREFIX/include/unsupported/
#rsync -avzh --include '*/' --include '*.h' --include '*.inc' --exclude '*' bazel-work/external/com_google_protobuf/src/google/ $PREFIX/include/google/
#rsync -avzh --include '*/' --include '*.h' --include '*.inc' --exclude '*' bazel-work/external/com_google_absl/absl/ $PREFIX/include/absl/
tar -C ${PREFIX} -xf $SRC_DIR/libtensorflow_cc_output.tar
171 changes: 102 additions & 69 deletions recipe/meta.yaml
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
{% set version = "2.4.3" %}
{% set version = "2.6.0" %}

package:
name: tensorflow-split
version: {{ version }}

source:
url: https://github.com/tensorflow/tensorflow/archive/v{{ version }}.tar.gz
sha256: cafd520c753f8755a9eb1262932f685dc722d8658f08373f8ec88d8acd58d7d4

patches:
- patches/0001-relax-tolerence-in-special_math_test.patch
- patches/0002-skip-read-only-debugger_cli_common-test.patch
- patches/0003-relax-precision-in-matrix_log_op_test.patch
# requires setting GRPCIO_VERSION in build script
- patches/0004-loosen-requirements.patch
- patches/0005-osx-arm64.patch # [osx and arm64]
- url: https://github.com/tensorflow/tensorflow/archive/v{{ version }}.tar.gz
sha256: 41b32eeaddcbc02b0583660bcf508469550e4cd0f86b22d2abe72dfebeacde0f
patches:
- patches/0001-relax-tolerence-in-special_math_test.patch
- patches/0002-skip-read-only-debugger_cli_common-test.patch
- patches/0003-relax-precision-in-matrix_log_op_test.patch
# requires setting GRPCIO_VERSION in build script
- patches/0004-loosen-requirements.patch
- url: https://github.com/tensorflow/estimator/archive/refs/tags/v{{ version }}.tar.gz
sha256: 947705c60c50da0b4a8ceec1bc058aaf6bf567a7efdcd50d5173ebf6bafcf30f
folder: tensorflow-estimator

build:
number: 0
Expand All @@ -27,14 +28,13 @@ requirements:
- numpy 1.19.* # [build_platform != target_platform]
- {{ compiler('c') }}
- {{ compiler('cxx') }}
# see https://github.com/tensorflow/tensorflow/blob/v{{ version }}/.bazelversion
- bazel 3.1.0 # [not osx]
# For osx-arm64 cross-compilation to work, we need bazel>=4.1
- bazel 4.0 # [osx]
- bazel
- bazel >=4.2.1 # [osx and arm64]
- grpc-cpp
- libprotobuf
- nasm
- sed
- rsync # [linux]
host:
# conda build requirements
- python
Expand Down Expand Up @@ -67,25 +67,25 @@ requirements:
- zlib
# requirements specified by the package itself, see
# github.com/tensorflow/tensorflow/blob/v{{ version }}/tensorflow/tools/pip_package/setup.py
- absl-py >=0.10.0
- astunparse >=1.6.3
- python-flatbuffers 1.12.*
- google-pasta >=0.2
- h5py >=2.10
- keras-preprocessing >=1.1.2
- absl-py >=0.10,<1
- astunparse >=1.6.3,<1.7
- python-flatbuffers >=1.12,<2
- google-pasta >=0.2,<1
- h5py >=3.1.0,<3.2
- keras-preprocessing >=1.1.2,<1.2
- numpy 1.19.*
- opt_einsum 3.3.0.*
- opt_einsum >=3.3,<3.4
- protobuf >=3.9.2
- six 1.15.0.*
- termcolor >=1.1.0
- typing_extensions 3.7.4.*
- wheel >=0.35
- wrapt >=1.11.1
- six >=1.15,<1.16
- termcolor >=1.1,<1.2
- typing_extensions >=3.7.4,<3.8
- wheel >=0.35,<1
- wrapt >=1.12.1,<1.13
# upstream wants exact pin for gast
- gast ==0.3.3
- gast ==0.4.0
# TF-API needs to move in sync
- tensorboard >=2.4.0,<2.5
- tensorflow-estimator >=2.4.0,<2.5
- tensorboard >=2.6,<3
- keras >=2.6,<3

outputs:
- name: tensorflow-base
Expand Down Expand Up @@ -128,68 +128,102 @@ outputs:
- sqlite
- zlib
# requirements specified by the package itself
- absl-py >=0.10.0
- astunparse >=1.6.3
- python-flatbuffers 1.12.*
- google-pasta >=0.2
- h5py 2.10.*
- keras-preprocessing >=1.1.2
- numpy 1.19.*
- opt_einsum 3.3.0.*
- absl-py >=0.10,<1
- astunparse >=1.6.3,<1.7
- python-flatbuffers >=1.12,<2
- google-pasta >=0.2,<1
- h5py >=3.1.0,<3.2
- keras-preprocessing >=1.1.2,<1.2
- numpy >=1.19.2,<1.20
- opt_einsum >=3.3,<3.4
- protobuf >=3.9.2
- six 1.15.0.*
- termcolor >=1.1.0
- typing_extensions 3.7.4.*
- wheel >=0.35
- wrapt >=1.11.1
- six >=1.15,<1.16
- termcolor >=1.1,<1.2
- typing_extensions >=3.7.4,<3.8
- wheel >=0.35,<1
- wrapt >=1.12.1,<1.13
# upstream wants exact pin for gast
- gast ==0.3.3
- gast ==0.4.0
# TF-API needs to move in sync
- tensorboard >=2.4.0,<2.5
- tensorflow-estimator >=2.4.0,<2.5
- tensorboard >=2.6,<3
- keras >=2.6,<3
run:
- python
- absl-py >=0.10.0
- astunparse >=1.6.3
- python-flatbuffers 1.12.*
- google-pasta >=0.2
- h5py 2.10.*
- keras-preprocessing >=1.1.2
- numpy >=1.19
- opt_einsum 3.3.0.*
- absl-py >=0.10,<1
- astunparse >=1.6.3,<1.7
- python-flatbuffers >=1.12,<2
- google-pasta >=0.2,<1
- h5py >=3.1.0,<3.2
- keras-preprocessing >=1.1.2,<1.2
- numpy >=1.19.2,<1.20
- opt_einsum >=3.3,<3.4
- protobuf >=3.9.2
- six 1.15.0.*
- termcolor >=1.1.0
- typing_extensions 3.7.4.*
- wheel >=0.35
- wrapt >=1.11.1
- grpcio {{ grpc_cpp }}.*
- six >=1.15,<1.16
- termcolor >=1.1,<1.2
- typing_extensions >=3.7.4,<3.8
- wheel >=0.35,<1
- wrapt >=1.12.1,<1.13
# upstream wants exact pin for gast
- gast ==0.3.3
- gast ==0.4.0
# TF-API needs to move in sync
- tensorboard >=2.4.0,<2.5
- tensorflow-estimator >=2.4.0,<2.5
- tensorboard >=2.6,<3
- keras >=2.6,<3
- grpcio {{ grpc_cpp }}.*
test:
requires:
- pip
imports:
- tensorflow
commands:
- pip check
- tf_upgrade_v2 --help
- saved_model_cli --help
- tflite_convert --help # [not win]
- toco_from_protos --help # [not win]
- toco --help # [not win]

- name: tensorflow-estimator
script: build_estimator.sh # [not win]
script: build_estimator.bat # [win]
requirements:
build:
- {{ compiler('c') }}
- {{ compiler('cxx') }}
- bazel
host:
- python
- pip
- setuptools
- wheel
- {{ pin_subpackage('tensorflow-base', exact=True) }}
run:
- python >=3.6
- absl-py >=0.7.0
- astor >=0.6.0
- gast >=0.2.0
- numpy >=1.19
- six >=1.10.0
- protobuf >=3.6.1
- termcolor >=1.1.0
- wrapt >=1.11.1
test:
requires:
- pip
commands:
- pip check


- name: tensorflow
requirements:
host:
- python
- {{ pin_subpackage('tensorflow-base', exact=True) }}
run:
- python
- tensorflow-estimator {{ version }}.*
- {{ pin_subpackage('tensorflow-base', exact=True) }}
test:
requires:
- pip
imports:
- tensorflow
commands:
- pip check

- name: libtensorflow
script: cp_libtensorflow.sh
Expand Down Expand Up @@ -233,7 +267,6 @@ outputs:
build:
- {{ compiler('c') }}
- {{ compiler('cxx') }}
- rsync
# host requirements to pick up run_exports
host:
- giflib
Expand Down
Loading

0 comments on commit 3a1f4f0

Please sign in to comment.