STT-tensorflow/tensorflow/contrib/makefile/compile_nsync.sh
Shanqing Cai e2e3a943c0 Merge changes from github.
END_PUBLIC

---
Commit 1e1b3d902 authored by Pete Warden<pete@petewarden.com>
Committed by gunan<gunan@google.com>:
Changed output directory for Pi CI build to fix permissions problem with nightlies ()

* Fix for RTLD_GLOBAL breakage of Pi builds, and removed Eigen version change for Pi that's no longer needed

* Fixed Pi Zero OpenBLAS build problems and tidied up directories used

* More robust checks in Pi build script

* Changed output directory for Pi CI build to fix permissions problem

---
Commit fe3a2e65c authored by Yan Facai (???)<facai.yan@gmail.com>
Committed by drpngx<drpngx@users.noreply.github.com>:
check invalid string type for dest_nodes in extract_sub_graph ()

* BUG: check str type

* TST: add unit test

* CLN: remove list check

* CLN: use warning

* CLN: 2 indent

* CLN: raise TypeError if not list

* CLN: check string only

---
Commit 225ab7629 authored by Jean Wanka<jm.wanka@gmail.com>
Committed by Jean Wanka<jm.wanka@gmail.com>:
Fix polynomial decay with cycle for global step=0

For polynomial decay with cycle=True the learning rate at
step 0 becomes NaN, because in the process of calculating it we
devide by 0. This change should fix it, by setting the multiplier
for the decay steps to one for global_step=0.

---
Commit 286f57061 authored by Bjarke Hammersholt Roune<broune@google.com>
Committed by TensorFlower Gardener<gardener@tensorflow.org>:
Make Service::TransferToClient not attempt to manipulate the literal when the transfer failed, preventing a crash and allowing the caller to see the reason for the failed transfer.

PiperOrigin-RevId: 169770126

---
Commit e0501bc4d authored by Yong Tang<yong.tang.github@outlook.com>
Committed by Shanqing Cai<cais@google.com>:
Fix GRUBlockCell parameter naming inconsistency ()

* Fix GRUBlockCell parameter naming inconsistency

This fix tries to fix the issue in 13137 where
parameter `cell_size` is used instead of `num_units`.
This is inconsistent with other RNN cells.

This fix adds support of `num_units` while at the same
time maintains backward compatiblility for `cell_size`.

This fix fixes 13137.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>

* Add `@deprecated_args` for 'cell_size' in `GRUBlockCell`

This commit adds `@deprecated_args` for 'cell_size' in `GRUBlockCell`

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>

* Address review comment

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>

---
Commit 02a2eba05 authored by Pete Warden<pete@petewarden.com>
Committed by gunan<gunan@google.com>:
Fix for RTLD_GLOBAL breakage of Pi builds, and removed Eigen version change that's no longer needed ()

* Fix for RTLD_GLOBAL breakage of Pi builds, and removed Eigen version change for Pi that's no longer needed

* Fixed Pi Zero OpenBLAS build problems and tidied up directories used

* More robust checks in Pi build script

---
Commit 8ef722253 authored by Sanjoy Das<sanjoy@google.com>
Committed by TensorFlower Gardener<gardener@tensorflow.org>:
Remove a redundant setName.

The EmitComputation should have emitted a function with the right name, so use a
CHECK instead.

PiperOrigin-RevId: 169764856

---
Commit 1b94147dc authored by Neal Wu<wun@google.com>
Committed by TensorFlower Gardener<gardener@tensorflow.org>:
Fix broken GitHub links in tensorflow and tensorflow_models resulting from The Great Models Move (a.k.a. the research subfolder)

PiperOrigin-RevId: 169763373

---
Commit b1ada5f0c authored by Justine Tunney<jart@google.com>
Committed by TensorFlower Gardener<gardener@tensorflow.org>:
Fix TensorBoard python -m invoke in docs

PiperOrigin-RevId: 169758752

---
Commit 2957cd894 authored by Mustafa Ispir<ispir@google.com>
Committed by TensorFlower Gardener<gardener@tensorflow.org>:
Local run option of estimator training.

PiperOrigin-RevId: 169756384

---
Commit 1dc2fe7ac authored by Gunhan Gulsoy<gunan@google.com>
Committed by TensorFlower Gardener<gardener@tensorflow.org>:
BEGIN_PUBLIC
Automated g4 rollback of changelist 166264198

PiperOrigin-RevId: 169998124
2017-09-25 19:39:42 -07:00

309 lines
15 KiB
Bash
Executable File

#!/usr/bin/env bash
# Copyright 2016 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.
# ==============================================================================
# Compile the nsync library for the platforms given as arguments.
set -e
prog=compile_nsync.sh
android_api_version=21
default_android_arch=armeabi-v7a
default_ios_arch="i386 x86_64 armv7 armv7s arm64"
usage="usage: $prog [-t linux|ios|android|macos|native]
[-a architecture] [-v android_api_version]
A script to build nsync for tensorflow.
This script can be run on Linux or MacOS host platforms, and can target
Linux, MacOS, iOS, or Android.
Options:
-t target_platform
The default target platform is the native host platform.
-a architecture
For Android and iOS target platforms, specify which architecture
to target.
For iOS, the default is: $default_ios_arch.
For Android, the default is: $default_android_arch.
-v android_api_version
Specify the Android API version; the default is $android_api_version."
# Deduce host platform.
host_platform=
nsync_path=
case `uname -s` in
Linux) host_platform=linux android_host=linux;;
Darwin) host_platform=macos android_host=darwin;;
*) echo "$prog: can't deduce host platform" >&2; exit 2;;
esac
host_arch=`uname -m`
case "$host_arch" in i[345678]86) host_arch=x86_32;; esac
# Parse command line.
target_platform=native # Default is to build for the host.
target_arch=default
while
arg="${1-}"
case "$arg" in
-*) case "$arg" in -*t*) target_platform="${2?"$usage"}"; shift; esac
case "$arg" in -*a*) target_arch="${2?"$usage"}"; shift; esac
case "$arg" in -*v*) android_api_version="${2?"$usage"}"; shift; esac
case "$arg" in -*[!atv]*) echo "$usage" >&2; exit 2;; esac;;
"") break;;
*) echo "$usage" >&2; exit 2;;
esac
do
shift
done
# Sanity check the target platform.
case "$target_platform" in
native) target_platform="$host_platform";;
esac
# Change directory to the root of the source tree.
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
cd "${SCRIPT_DIR}/../../.."
nsync_builds_dir=tensorflow/contrib/makefile/downloads/nsync/builds
case "$target_platform" in
ios) case "$target_arch" in
default) archs="$default_ios_arch";;
*) archs="$target_arch";;
esac
;;
android) case "$target_arch" in
default) archs="$default_android_arch";;
*) archs="$target_arch";;
esac
;;
*) archs="$target_arch";;
esac
# For ios, the library names for the CPU types accumulate in $platform_libs
platform_libs=
# Compile nsync.
for arch in $archs; do
nsync_platform_dir="$nsync_builds_dir/$arch.$target_platform.c++11"
# Get Makefile for target.
case "$target_platform" in
linux) makefile='
CC=${CC_PREFIX} g++
PLATFORM_CPPFLAGS=-DNSYNC_USE_CPP11_TIMEPOINT -DNSYNC_ATOMIC_CPP11 \
-I../../platform/c++11 -I../../platform/gcc \
-I../../platform/posix -pthread
PLATFORM_CFLAGS=-std=c++11 -Werror -Wall -Wextra -pedantic
PLATFORM_LDFLAGS=-pthread
MKDEP=${CC} -M -std=c++11
PLATFORM_C=../../platform/c++11/src/nsync_semaphore_mutex.cc \
../../platform/c++11/src/per_thread_waiter.cc \
../../platform/c++11/src/yield.cc \
../../platform/c++11/src/time_rep_timespec.cc \
../../platform/c++11/src/nsync_panic.cc
PLATFORM_OBJS=nsync_semaphore_mutex.o per_thread_waiter.o yield.o \
time_rep_timespec.o nsync_panic.o
TEST_PLATFORM_C=../../platform/c++11/src/start_thread.cc
TEST_PLATFORM_OBJS=start_thread.o
include ../../platform/posix/make.common
include dependfile
';;
ios) arch_flags=
case "$arch" in
i386|x86_64)
arch_flags="$arch_flags -mios-simulator-version-min=8.0"
arch_flags="$arch_flags -isysroot $(xcrun --sdk iphonesimulator --show-sdk-path)"
;;
*)
arch_flags="$arch_flags -miphoneos-version-min=8.0"
arch_flags="$arch_flags -isysroot $(xcrun --sdk iphoneos --show-sdk-path)"
;;
esac
makefile='
CC=${CC_PREFIX} clang++
PLATFORM_CPPFLAGS=-DNSYNC_USE_CPP11_TIMEPOINT -DNSYNC_ATOMIC_CPP11 \
-I../../platform/c++11 -I../../platform/gcc_no_tls \
-I../../platform/macos -I../../platform/posix -pthread
PLATFORM_CFLAGS=-arch '"$arch"' -fno-exceptions -stdlib=libc++ \
-fembed-bitcode '"$arch_flags"' -fPIC -x c++ \
-std=c++11 -Werror -Wall -Wextra -pedantic
PLATFORM_LDFLAGS=-pthread
MKDEP=${CC} -x c++ -M -std=c++11
PLATFORM_C=../../platform/posix/src/clock_gettime.c \
../../platform/c++11/src/nsync_semaphore_mutex.cc \
../../platform/posix/src/per_thread_waiter.c \
../../platform/c++11/src/yield.cc \
../../platform/c++11/src/time_rep_timespec.cc \
../../platform/c++11/src/nsync_panic.cc
PLATFORM_OBJS=clock_gettime.o nsync_semaphore_mutex.o per_thread_waiter.o \
yield.o time_rep_timespec.o nsync_panic.o
TEST_PLATFORM_C=../../platform/c++11/src/start_thread.cc
TEST_PLATFORM_OBJS=start_thread.o
include ../../platform/posix/make.common
include dependfile
';;
macos) makefile='
CC=${CC_PREFIX} clang++
PLATFORM_CPPFLAGS=-DNSYNC_USE_CPP11_TIMEPOINT -DNSYNC_ATOMIC_CPP11 \
-I../../platform/c++11 -I../../platform/gcc \
-I../../platform/macos -I../../platform/posix -pthread
PLATFORM_CFLAGS=-x c++ -std=c++11 -Werror -Wall -Wextra -pedantic
PLATFORM_LDFLAGS=-pthread
MKDEP=${CC} -x c++ -M -std=c++11
PLATFORM_C=../../platform/posix/src/clock_gettime.c \
../../platform/c++11/src/nsync_semaphore_mutex.cc \
../../platform/posix/src/per_thread_waiter.c \
../../platform/c++11/src/yield.cc \
../../platform/c++11/src/time_rep_timespec.cc \
../../platform/c++11/src/nsync_panic.cc
PLATFORM_OBJS=clock_gettime.o nsync_semaphore_mutex.o per_thread_waiter.o \
yield.o time_rep_timespec.o nsync_panic.o
TEST_PLATFORM_C=../../platform/c++11/src/start_thread.cc
TEST_PLATFORM_OBJS=start_thread.o
include ../../platform/posix/make.common
include dependfile
';;
android)
# The Android build uses many different names for the same
# platform in different parts of the tree, so things get messy here.
# Make $android_os_arch be the OS-arch name for the host
# binaries used in the NDK tree.
case "$host_platform" in
linux) android_os_arch=linux;;
macos) android_os_arch=darwin;;
*) android_os_arch="$host_platform";;
esac
case "$host_arch" in
x86_32) android_os_arch="$android_os_arch"-x86;;
*) android_os_arch="$android_os_arch-$host_arch";;
esac
case "$arch" in
arm64-v8a) toolchain="aarch64-linux-android-4.9"
sysroot_arch="arm64"
bin_prefix="aarch64-linux-android"
march_option=
;;
armeabi) toolchain="arm-linux-androideabi-4.9"
sysroot_arch="arm"
bin_prefix="arm-linux-androideabi"
march_option=
;;
armeabi-v7a) toolchain="arm-linux-androideabi-4.9"
sysroot_arch="arm"
bin_prefix="arm-linux-androideabi"
march_option="-march=armv7-a -mfloat-abi=softfp -mfpu=neon"
;;
armeabi-v7a-hard) toolchain="arm-linux-androideabi-4.9"
sysroot_arch="arm"
bin_prefix="arm-linux-androideabi"
march_option="-march=armv7-a -mfpu=neon"
;;
mips) toolchain="mipsel-linux-android-4.9"
sysroot_arch="mips"
bin_prefix="mipsel-linux-android"
march_option=
;;
mips64) toolchain="mips64el-linux-android-4.9"
sysroot_arch="mips64"
bin_prefix="mips64el-linux-android"
march_option=
;;
x86) toolchain="x86-4.9"
sysroot_arch="x86"
bin_prefix="i686-linux-android"
march_option=
;;
x86_64) toolchain="x86_64-4.9"
sysroot_arch="x86_64"
bin_prefix="x86_64-linux-android"
march_option=
;;
*) echo "android is not supported for $arch" >&2
echo "$usage" >&2
exit 2
;;
esac
android_target_platform=armeabi
case "$NDK_ROOT" in
"") echo "$prog: requires \$NDK_ROOT for android build" >&2
exit 2;;
esac
makefile='
CC=${CC_PREFIX} \
${NDK_ROOT}/toolchains/'"$toolchain"'/prebuilt/'"$android_os_arch"'/bin/'"$bin_prefix"'-g++
PLATFORM_CPPFLAGS=--sysroot \
$(NDK_ROOT)/platforms/android-'"$android_api_version"'/arch-'"$sysroot_arch"' \
-DNSYNC_USE_CPP11_TIMEPOINT -DNSYNC_ATOMIC_CPP11 \
-I$(NDK_ROOT)/sources/android/support/include \
-I$(NDK_ROOT)/sources/cxx-stl/gnu-libstdc++/4.9/include \
-I$(NDK_ROOT)/sources/cxx-stl/gnu-libstdc++/4.9/libs/'"$arch"'/include \
-I../../platform/c++11 -I../../platform/gcc \
-I../../platform/posix -pthread
PLATFORM_CFLAGS=-std=c++11 -Wno-narrowing '"$march_option"' -fPIE
PLATFORM_LDFLAGS=-pthread
MKDEP=${CC} -M -std=c++11
PLATFORM_C=../../platform/c++11/src/nsync_semaphore_mutex.cc \
../../platform/c++11/src/per_thread_waiter.cc \
../../platform/c++11/src/yield.cc \
../../platform/c++11/src/time_rep_timespec.cc \
../../platform/c++11/src/nsync_panic.cc
PLATFORM_OBJS=nsync_semaphore_mutex.o per_thread_waiter.o yield.o \
time_rep_timespec.o nsync_panic.o
TEST_PLATFORM_C=../../platform/c++11/src/start_thread.cc
TEST_PLATFORM_OBJS=start_thread.o
include ../../platform/posix/make.common
include dependfile
';;
*) echo "$usage" >&2; exit 2;;
esac
if [ ! -d "$nsync_platform_dir" ]; then
mkdir "$nsync_platform_dir"
echo "$makefile" | sed $'s,^[ \t]*,,' > "$nsync_platform_dir/Makefile"
touch "$nsync_platform_dir/dependfile"
fi
if (cd "$nsync_platform_dir" && make depend nsync.a >&2); then
case "$target_platform" in
ios) platform_libs="$platform_libs '$nsync_platform_dir/nsync.a'";;
*) echo "$nsync_platform_dir/nsync.a";;
esac
else
exit 2 # The if-statement suppresses the "set -e" on the "make".
fi
done
case "$target_platform" in
ios) nsync_platform_dir="$nsync_builds_dir/lipo.$target_platform.c++11"
mkdir "$nsync_platform_dir"
eval lipo $platform_libs -create -output '$nsync_platform_dir/nsync.a'
echo "$nsync_platform_dir/nsync.a"
;;
esac