nGraph integration with TensorFlow
* Added nGraph bridge as a third_party to be built with TensorFlow based on user selection. * Added a limited set of C++ unit tests to verify the correctness of the computation
This commit is contained in:
parent
80fb8679ab
commit
121e0161c5
@ -79,3 +79,4 @@ new_http_archive(
|
||||
"http://download.tensorflow.org/models/speech_commands_v0.01.zip",
|
||||
],
|
||||
)
|
||||
|
||||
|
269
configure.py
269
configure.py
@ -153,14 +153,18 @@ def get_python_path(environ_cp, python_bin_path):
|
||||
if environ_cp.get('PYTHONPATH'):
|
||||
python_paths = environ_cp.get('PYTHONPATH').split(':')
|
||||
try:
|
||||
library_paths = run_shell(
|
||||
[python_bin_path, '-c',
|
||||
'import site; print("\\n".join(site.getsitepackages()))']).split('\n')
|
||||
library_paths = run_shell([
|
||||
python_bin_path, '-c',
|
||||
'import site; print("\\n".join(site.getsitepackages()))'
|
||||
]).split('\n')
|
||||
except subprocess.CalledProcessError:
|
||||
library_paths = [run_shell(
|
||||
[python_bin_path, '-c',
|
||||
library_paths = [
|
||||
run_shell([
|
||||
python_bin_path, '-c',
|
||||
'from distutils.sysconfig import get_python_lib;'
|
||||
'print(get_python_lib())'])]
|
||||
'print(get_python_lib())'
|
||||
])
|
||||
]
|
||||
|
||||
all_paths = set(python_paths + library_paths)
|
||||
|
||||
@ -173,14 +177,16 @@ def get_python_path(environ_cp, python_bin_path):
|
||||
|
||||
def get_python_major_version(python_bin_path):
|
||||
"""Get the python major version."""
|
||||
return run_shell([python_bin_path, '-c', 'import sys; print(sys.version[0])'])
|
||||
return run_shell(
|
||||
[python_bin_path, '-c', 'import sys; print(sys.version[0])'])
|
||||
|
||||
|
||||
def setup_python(environ_cp):
|
||||
"""Setup python related env variables."""
|
||||
# Get PYTHON_BIN_PATH, default is the current running python.
|
||||
default_python_bin_path = sys.executable
|
||||
ask_python_bin_path = ('Please specify the location of python. [Default is '
|
||||
ask_python_bin_path = (
|
||||
'Please specify the location of python. [Default is '
|
||||
'%s]: ') % default_python_bin_path
|
||||
while True:
|
||||
python_bin_path = get_from_env_or_user_or_default(
|
||||
@ -193,7 +199,8 @@ def setup_python(environ_cp):
|
||||
elif not os.path.exists(python_bin_path):
|
||||
print('Invalid python path: %s cannot be found.' % python_bin_path)
|
||||
else:
|
||||
print('%s is not executable. Is it the python binary?' % python_bin_path)
|
||||
print('%s is not executable. Is it the python binary?' %
|
||||
python_bin_path)
|
||||
environ_cp['PYTHON_BIN_PATH'] = ''
|
||||
|
||||
# Convert python path to Windows style before checking lib and version
|
||||
@ -230,8 +237,9 @@ def setup_python(environ_cp):
|
||||
environ_cp['PYTHON_BIN_PATH'] = python_bin_path
|
||||
|
||||
# Write tools/python_bin_path.sh
|
||||
with open(os.path.join(
|
||||
_TF_WORKSPACE_ROOT, 'tools', 'python_bin_path.sh'), 'w') as f:
|
||||
with open(
|
||||
os.path.join(_TF_WORKSPACE_ROOT, 'tools', 'python_bin_path.sh'),
|
||||
'w') as f:
|
||||
f.write('export PYTHON_BIN_PATH="%s"' % python_bin_path)
|
||||
|
||||
|
||||
@ -261,8 +269,8 @@ def cleanup_makefile():
|
||||
|
||||
These files could interfere with Bazel parsing.
|
||||
"""
|
||||
makefile_download_dir = os.path.join(
|
||||
_TF_WORKSPACE_ROOT, 'tensorflow', 'contrib', 'makefile', 'downloads')
|
||||
makefile_download_dir = os.path.join(_TF_WORKSPACE_ROOT, 'tensorflow',
|
||||
'contrib', 'makefile', 'downloads')
|
||||
if os.path.isdir(makefile_download_dir):
|
||||
for root, _, filenames in os.walk(makefile_download_dir):
|
||||
for f in filenames:
|
||||
@ -330,9 +338,8 @@ def get_var(environ_cp,
|
||||
'Environment variable %s must be set as a boolean indicator.\n'
|
||||
'The following are accepted as TRUE : %s.\n'
|
||||
'The following are accepted as FALSE: %s.\n'
|
||||
'Current value is %s.' % (
|
||||
var_name, ', '.join(true_strings), ', '.join(false_strings),
|
||||
var))
|
||||
'Current value is %s.' % (var_name, ', '.join(true_strings),
|
||||
', '.join(false_strings), var))
|
||||
|
||||
while var is None:
|
||||
user_input_origin = get_input(question)
|
||||
@ -355,8 +362,12 @@ def get_var(environ_cp,
|
||||
return var
|
||||
|
||||
|
||||
def set_build_var(environ_cp, var_name, query_item, option_name,
|
||||
enabled_by_default, bazel_config_name=None):
|
||||
def set_build_var(environ_cp,
|
||||
var_name,
|
||||
query_item,
|
||||
option_name,
|
||||
enabled_by_default,
|
||||
bazel_config_name=None):
|
||||
"""Set if query_item will be enabled for the build.
|
||||
|
||||
Ask user if query_item will be enabled. Default is used if no input is given.
|
||||
@ -372,15 +383,16 @@ def set_build_var(environ_cp, var_name, query_item, option_name,
|
||||
bazel_config_name: Name for Bazel --config argument to enable build feature.
|
||||
"""
|
||||
|
||||
var = str(int(get_var(environ_cp, var_name, query_item, enabled_by_default)))
|
||||
var = str(
|
||||
int(get_var(environ_cp, var_name, query_item, enabled_by_default)))
|
||||
environ_cp[var_name] = var
|
||||
if var == '1':
|
||||
write_to_bazelrc('build --define %s=true' % option_name)
|
||||
elif bazel_config_name is not None:
|
||||
# TODO(mikecase): Migrate all users of configure.py to use --config Bazel
|
||||
# options and not to set build configs through environment variables.
|
||||
write_to_bazelrc('build:%s --define %s=true'
|
||||
% (bazel_config_name, option_name))
|
||||
write_to_bazelrc(
|
||||
'build:%s --define %s=true' % (bazel_config_name, option_name))
|
||||
|
||||
|
||||
def set_action_env_var(environ_cp,
|
||||
@ -447,7 +459,8 @@ def check_bazel_version(min_version):
|
||||
if which('bazel') is None:
|
||||
print('Cannot find bazel. Please install bazel.')
|
||||
sys.exit(0)
|
||||
curr_version = run_shell(['bazel', '--batch', '--bazelrc=/dev/null', 'version'])
|
||||
curr_version = run_shell(
|
||||
['bazel', '--batch', '--bazelrc=/dev/null', 'version'])
|
||||
|
||||
for line in curr_version.split('\n'):
|
||||
if 'Build label: ' in line:
|
||||
@ -466,7 +479,8 @@ def check_bazel_version(min_version):
|
||||
print('You have bazel %s installed.' % curr_version)
|
||||
|
||||
if curr_version_int < min_version_int:
|
||||
print('Please upgrade your bazel installation to version %s or higher to '
|
||||
print(
|
||||
'Please upgrade your bazel installation to version %s or higher to '
|
||||
'build TensorFlow!' % min_version)
|
||||
sys.exit(0)
|
||||
return curr_version
|
||||
@ -487,11 +501,12 @@ def set_cc_opt_flags(environ_cp):
|
||||
default_cc_opt_flags = '/arch:AVX'
|
||||
else:
|
||||
default_cc_opt_flags = '-march=native'
|
||||
question = ('Please specify optimization flags to use during compilation when'
|
||||
question = (
|
||||
'Please specify optimization flags to use during compilation when'
|
||||
' bazel option "--config=opt" is specified [Default is %s]: '
|
||||
) % default_cc_opt_flags
|
||||
cc_opt_flags = get_from_env_or_user_or_default(environ_cp, 'CC_OPT_FLAGS',
|
||||
question, default_cc_opt_flags)
|
||||
cc_opt_flags = get_from_env_or_user_or_default(
|
||||
environ_cp, 'CC_OPT_FLAGS', question, default_cc_opt_flags)
|
||||
for opt in cc_opt_flags.split():
|
||||
write_to_bazelrc('build:opt --copt=%s' % opt)
|
||||
# It should be safe on the same build host.
|
||||
@ -499,6 +514,7 @@ def set_cc_opt_flags(environ_cp):
|
||||
write_to_bazelrc('build:opt --host_copt=-march=native')
|
||||
write_to_bazelrc('build:opt --define with_default_optimizations=true')
|
||||
|
||||
|
||||
def set_tf_cuda_clang(environ_cp):
|
||||
"""set TF_CUDA_CLANG action_env.
|
||||
|
||||
@ -561,7 +577,8 @@ def get_from_env_or_user_or_default(environ_cp, var_name, ask_for_var,
|
||||
def set_clang_cuda_compiler_path(environ_cp):
|
||||
"""Set CLANG_CUDA_COMPILER_PATH."""
|
||||
default_clang_path = which('clang') or ''
|
||||
ask_clang_path = ('Please specify which clang should be used as device and '
|
||||
ask_clang_path = (
|
||||
'Please specify which clang should be used as device and '
|
||||
'host compiler. [Default is %s]: ') % default_clang_path
|
||||
|
||||
while True:
|
||||
@ -572,7 +589,8 @@ def set_clang_cuda_compiler_path(environ_cp):
|
||||
break
|
||||
|
||||
# Reset and retry
|
||||
print('Invalid clang path: %s cannot be found.' % clang_cuda_compiler_path)
|
||||
print('Invalid clang path: %s cannot be found.' %
|
||||
clang_cuda_compiler_path)
|
||||
environ_cp['CLANG_CUDA_COMPILER_PATH'] = ''
|
||||
|
||||
# Set CLANG_CUDA_COMPILER_PATH
|
||||
@ -581,16 +599,14 @@ def set_clang_cuda_compiler_path(environ_cp):
|
||||
clang_cuda_compiler_path)
|
||||
|
||||
|
||||
def prompt_loop_or_load_from_env(
|
||||
environ_cp,
|
||||
def prompt_loop_or_load_from_env(environ_cp,
|
||||
var_name,
|
||||
var_default,
|
||||
ask_for_var,
|
||||
check_success,
|
||||
error_msg,
|
||||
suppress_default_error=False,
|
||||
n_ask_attempts=_DEFAULT_PROMPT_ASK_ATTEMPTS
|
||||
):
|
||||
n_ask_attempts=_DEFAULT_PROMPT_ASK_ATTEMPTS):
|
||||
"""Loop over user prompts for an ENV param until receiving a valid response.
|
||||
|
||||
For the env param var_name, read from the environment or verify user input
|
||||
@ -629,9 +645,7 @@ def prompt_loop_or_load_from_env(
|
||||
)
|
||||
|
||||
for _ in range(n_ask_attempts):
|
||||
val = get_from_env_or_user_or_default(environ_cp,
|
||||
var_name,
|
||||
full_query,
|
||||
val = get_from_env_or_user_or_default(environ_cp, var_name, full_query,
|
||||
default)
|
||||
if check_success(val):
|
||||
break
|
||||
@ -639,9 +653,9 @@ def prompt_loop_or_load_from_env(
|
||||
print(error_msg % val)
|
||||
environ_cp[var_name] = ''
|
||||
else:
|
||||
raise UserInputError('Invalid %s setting was provided %d times in a row. '
|
||||
'Assuming to be a scripting mistake.' %
|
||||
(var_name, n_ask_attempts))
|
||||
raise UserInputError(
|
||||
'Invalid %s setting was provided %d times in a row. '
|
||||
'Assuming to be a scripting mistake.' % (var_name, n_ask_attempts))
|
||||
|
||||
environ_cp[var_name] = val
|
||||
return val
|
||||
@ -650,16 +664,16 @@ def prompt_loop_or_load_from_env(
|
||||
def create_android_ndk_rule(environ_cp):
|
||||
"""Set ANDROID_NDK_HOME and write Android NDK WORKSPACE rule."""
|
||||
if is_windows() or is_cygwin():
|
||||
default_ndk_path = cygpath('%s/Android/Sdk/ndk-bundle' %
|
||||
environ_cp['APPDATA'])
|
||||
default_ndk_path = cygpath(
|
||||
'%s/Android/Sdk/ndk-bundle' % environ_cp['APPDATA'])
|
||||
elif is_macos():
|
||||
default_ndk_path = '%s/library/Android/Sdk/ndk-bundle' % environ_cp['HOME']
|
||||
else:
|
||||
default_ndk_path = '%s/Android/Sdk/ndk-bundle' % environ_cp['HOME']
|
||||
|
||||
def valid_ndk_path(path):
|
||||
return (os.path.exists(path) and
|
||||
os.path.exists(os.path.join(path, 'source.properties')))
|
||||
return (os.path.exists(path)
|
||||
and os.path.exists(os.path.join(path, 'source.properties')))
|
||||
|
||||
android_ndk_home_path = prompt_loop_or_load_from_env(
|
||||
environ_cp,
|
||||
@ -668,8 +682,7 @@ def create_android_ndk_rule(environ_cp):
|
||||
ask_for_var='Please specify the home path of the Android NDK to use.',
|
||||
check_success=valid_ndk_path,
|
||||
error_msg=('The path %s or its child file "source.properties" '
|
||||
'does not exist.')
|
||||
)
|
||||
'does not exist.'))
|
||||
write_action_env_to_bazelrc('ANDROID_NDK_HOME', android_ndk_home_path)
|
||||
write_action_env_to_bazelrc('ANDROID_NDK_API_LEVEL',
|
||||
check_ndk_level(android_ndk_home_path))
|
||||
@ -685,9 +698,9 @@ def create_android_sdk_rule(environ_cp):
|
||||
default_sdk_path = '%s/Android/Sdk' % environ_cp['HOME']
|
||||
|
||||
def valid_sdk_path(path):
|
||||
return (os.path.exists(path) and
|
||||
os.path.exists(os.path.join(path, 'platforms')) and
|
||||
os.path.exists(os.path.join(path, 'build-tools')))
|
||||
return (os.path.exists(path)
|
||||
and os.path.exists(os.path.join(path, 'platforms'))
|
||||
and os.path.exists(os.path.join(path, 'build-tools')))
|
||||
|
||||
android_sdk_home_path = prompt_loop_or_load_from_env(
|
||||
environ_cp,
|
||||
@ -703,8 +716,8 @@ def create_android_sdk_rule(environ_cp):
|
||||
api_levels = [x.replace('android-', '') for x in api_levels]
|
||||
|
||||
def valid_api_level(api_level):
|
||||
return os.path.exists(os.path.join(android_sdk_home_path,
|
||||
'platforms',
|
||||
return os.path.exists(
|
||||
os.path.join(android_sdk_home_path, 'platforms',
|
||||
'android-' + api_level))
|
||||
|
||||
android_api_level = prompt_loop_or_load_from_env(
|
||||
@ -720,9 +733,8 @@ def create_android_sdk_rule(environ_cp):
|
||||
versions = sorted(os.listdir(build_tools))
|
||||
|
||||
def valid_build_tools(version):
|
||||
return os.path.exists(os.path.join(android_sdk_home_path,
|
||||
'build-tools',
|
||||
version))
|
||||
return os.path.exists(
|
||||
os.path.join(android_sdk_home_path, 'build-tools', version))
|
||||
|
||||
android_build_tools_version = prompt_loop_or_load_from_env(
|
||||
environ_cp,
|
||||
@ -736,10 +748,8 @@ def create_android_sdk_rule(environ_cp):
|
||||
|
||||
write_action_env_to_bazelrc('ANDROID_BUILD_TOOLS_VERSION',
|
||||
android_build_tools_version)
|
||||
write_action_env_to_bazelrc('ANDROID_SDK_API_LEVEL',
|
||||
android_api_level)
|
||||
write_action_env_to_bazelrc('ANDROID_SDK_HOME',
|
||||
android_sdk_home_path)
|
||||
write_action_env_to_bazelrc('ANDROID_SDK_API_LEVEL', android_api_level)
|
||||
write_action_env_to_bazelrc('ANDROID_SDK_HOME', android_sdk_home_path)
|
||||
|
||||
|
||||
def check_ndk_level(android_ndk_home_path):
|
||||
@ -756,7 +766,8 @@ def check_ndk_level(android_ndk_home_path):
|
||||
else:
|
||||
raise Exception('Unable to parse NDK revision.')
|
||||
if int(ndk_api_level) not in _SUPPORTED_ANDROID_NDK_VERSIONS:
|
||||
print('WARNING: The API level of the NDK in %s is %s, which is not '
|
||||
print(
|
||||
'WARNING: The API level of the NDK in %s is %s, which is not '
|
||||
'supported by Bazel (officially supported versions: %s). Please use '
|
||||
'another version. Compiling Android targets may result in confusing '
|
||||
'errors.\n' % (android_ndk_home_path, ndk_api_level,
|
||||
@ -783,7 +794,8 @@ def set_gcc_host_compiler_path(environ_cp):
|
||||
error_msg='Invalid gcc path. %s cannot be found.',
|
||||
)
|
||||
|
||||
write_action_env_to_bazelrc('GCC_HOST_COMPILER_PATH', gcc_host_compiler_path)
|
||||
write_action_env_to_bazelrc('GCC_HOST_COMPILER_PATH',
|
||||
gcc_host_compiler_path)
|
||||
|
||||
|
||||
def reformat_version_sequence(version_str, sequence_count):
|
||||
@ -817,7 +829,8 @@ def set_tf_cuda_version(environ_cp):
|
||||
for _ in range(_DEFAULT_PROMPT_ASK_ATTEMPTS):
|
||||
# Configure the Cuda SDK version to use.
|
||||
tf_cuda_version = get_from_env_or_user_or_default(
|
||||
environ_cp, 'TF_CUDA_VERSION', ask_cuda_version, _DEFAULT_CUDA_VERSION)
|
||||
environ_cp, 'TF_CUDA_VERSION', ask_cuda_version,
|
||||
_DEFAULT_CUDA_VERSION)
|
||||
tf_cuda_version = reformat_version_sequence(str(tf_cuda_version), 2)
|
||||
|
||||
# Find out where the CUDA toolkit is installed
|
||||
@ -832,7 +845,8 @@ def set_tf_cuda_version(environ_cp):
|
||||
default_cuda_path = _DEFAULT_CUDA_PATH_LINUX
|
||||
ask_cuda_path = ('Please specify the location where CUDA %s toolkit is'
|
||||
' installed. Refer to README.md for more details. '
|
||||
'[Default is %s]: ') % (tf_cuda_version, default_cuda_path)
|
||||
'[Default is %s]: ') % (tf_cuda_version,
|
||||
default_cuda_path)
|
||||
cuda_toolkit_path = get_from_env_or_user_or_default(
|
||||
environ_cp, 'CUDA_TOOLKIT_PATH', ask_cuda_path, default_cuda_path)
|
||||
if is_windows() or is_cygwin():
|
||||
@ -845,7 +859,8 @@ def set_tf_cuda_version(environ_cp):
|
||||
elif is_macos():
|
||||
cuda_rt_lib_path = 'lib/libcudart.%s.dylib' % tf_cuda_version
|
||||
|
||||
cuda_toolkit_path_full = os.path.join(cuda_toolkit_path, cuda_rt_lib_path)
|
||||
cuda_toolkit_path_full = os.path.join(cuda_toolkit_path,
|
||||
cuda_rt_lib_path)
|
||||
if os.path.exists(cuda_toolkit_path_full):
|
||||
break
|
||||
|
||||
@ -856,7 +871,8 @@ def set_tf_cuda_version(environ_cp):
|
||||
environ_cp['CUDA_TOOLKIT_PATH'] = ''
|
||||
|
||||
else:
|
||||
raise UserInputError('Invalid TF_CUDA_SETTING setting was provided %d '
|
||||
raise UserInputError(
|
||||
'Invalid TF_CUDA_SETTING setting was provided %d '
|
||||
'times in a row. Assuming to be a scripting mistake.' %
|
||||
_DEFAULT_PROMPT_ASK_ATTEMPTS)
|
||||
|
||||
@ -880,11 +896,13 @@ def set_tf_cudnn_version(environ_cp):
|
||||
tf_cudnn_version = reformat_version_sequence(str(tf_cudnn_version), 1)
|
||||
|
||||
default_cudnn_path = environ_cp.get('CUDA_TOOLKIT_PATH')
|
||||
ask_cudnn_path = (r'Please specify the location where cuDNN %s library is '
|
||||
ask_cudnn_path = (
|
||||
r'Please specify the location where cuDNN %s library is '
|
||||
'installed. Refer to README.md for more details. [Default'
|
||||
' is %s]:') % (tf_cudnn_version, default_cudnn_path)
|
||||
cudnn_install_path = get_from_env_or_user_or_default(
|
||||
environ_cp, 'CUDNN_INSTALL_PATH', ask_cudnn_path, default_cudnn_path)
|
||||
environ_cp, 'CUDNN_INSTALL_PATH', ask_cudnn_path,
|
||||
default_cudnn_path)
|
||||
|
||||
# Result returned from "read" will be used unexpanded. That make "~"
|
||||
# unusable. Going through one more level of expansion to handle that.
|
||||
@ -903,7 +921,8 @@ def set_tf_cudnn_version(environ_cp):
|
||||
cuda_dnn_lib_path = 'lib/libcudnn.%s.dylib' % tf_cudnn_version
|
||||
cuda_dnn_lib_alt_path = 'libcudnn.%s.dylib' % tf_cudnn_version
|
||||
|
||||
cuda_dnn_lib_path_full = os.path.join(cudnn_install_path, cuda_dnn_lib_path)
|
||||
cuda_dnn_lib_path_full = os.path.join(cudnn_install_path,
|
||||
cuda_dnn_lib_path)
|
||||
cuda_dnn_lib_alt_path_full = os.path.join(cudnn_install_path,
|
||||
cuda_dnn_lib_alt_path)
|
||||
if os.path.exists(cuda_dnn_lib_path_full) or os.path.exists(
|
||||
@ -920,7 +939,8 @@ def set_tf_cudnn_version(environ_cp):
|
||||
cudnn_path_from_ldconfig = cudnn_path_from_ldconfig.group(1)
|
||||
if os.path.exists('%s.%s' % (cudnn_path_from_ldconfig,
|
||||
tf_cudnn_version)):
|
||||
cudnn_install_path = os.path.dirname(cudnn_path_from_ldconfig)
|
||||
cudnn_install_path = os.path.dirname(
|
||||
cudnn_path_from_ldconfig)
|
||||
break
|
||||
|
||||
# Reset and Retry
|
||||
@ -934,7 +954,8 @@ def set_tf_cudnn_version(environ_cp):
|
||||
|
||||
environ_cp['TF_CUDNN_VERSION'] = ''
|
||||
else:
|
||||
raise UserInputError('Invalid TF_CUDNN setting was provided %d '
|
||||
raise UserInputError(
|
||||
'Invalid TF_CUDNN setting was provided %d '
|
||||
'times in a row. Assuming to be a scripting mistake.' %
|
||||
_DEFAULT_PROMPT_ASK_ATTEMPTS)
|
||||
|
||||
@ -987,7 +1008,8 @@ def set_tf_tensorrt_install_path(environ_cp):
|
||||
UserInputError: if user has provided invalid input multiple times.
|
||||
"""
|
||||
if not is_linux():
|
||||
raise ValueError('Currently TensorRT is only supported on Linux platform.')
|
||||
raise ValueError(
|
||||
'Currently TensorRT is only supported on Linux platform.')
|
||||
|
||||
# Ask user whether to add TensorRT support.
|
||||
if str(int(get_var(environ_cp, 'TF_NEED_TENSORRT', 'TensorRT',
|
||||
@ -1004,7 +1026,8 @@ def set_tf_tensorrt_install_path(environ_cp):
|
||||
|
||||
# Result returned from "read" will be used unexpanded. That make "~"
|
||||
# unusable. Going through one more level of expansion to handle that.
|
||||
trt_install_path = os.path.realpath(os.path.expanduser(trt_install_path))
|
||||
trt_install_path = os.path.realpath(
|
||||
os.path.expanduser(trt_install_path))
|
||||
|
||||
def find_libs(search_path):
|
||||
"""Search for libnvinfer.so in "search_path"."""
|
||||
@ -1012,14 +1035,14 @@ def set_tf_tensorrt_install_path(environ_cp):
|
||||
if os.path.exists(search_path) and os.path.isdir(search_path):
|
||||
fl.update([
|
||||
os.path.realpath(os.path.join(search_path, x))
|
||||
for x in os.listdir(search_path)
|
||||
if 'libnvinfer.so' in x
|
||||
for x in os.listdir(search_path) if 'libnvinfer.so' in x
|
||||
])
|
||||
return fl
|
||||
|
||||
possible_files = find_libs(trt_install_path)
|
||||
possible_files.update(find_libs(os.path.join(trt_install_path, 'lib')))
|
||||
possible_files.update(find_libs(os.path.join(trt_install_path, 'lib64')))
|
||||
possible_files.update(
|
||||
find_libs(os.path.join(trt_install_path, 'lib64')))
|
||||
cuda_ver = convert_version_to_int(environ_cp['TF_CUDA_VERSION'])
|
||||
cudnn_ver = convert_version_to_int(environ_cp['TF_CUDNN_VERSION'])
|
||||
nvinfer_pattern = re.compile('.*libnvinfer.so.?(.*)$')
|
||||
@ -1049,14 +1072,17 @@ def set_tf_tensorrt_install_path(environ_cp):
|
||||
if os.path.exists(libnvinfer_path_from_ldconfig):
|
||||
if is_cuda_compatible(libnvinfer_path_from_ldconfig, cuda_ver,
|
||||
cudnn_ver):
|
||||
trt_install_path = os.path.dirname(libnvinfer_path_from_ldconfig)
|
||||
trt_install_path = os.path.dirname(
|
||||
libnvinfer_path_from_ldconfig)
|
||||
tf_tensorrt_version = search_result.group(1)
|
||||
break
|
||||
|
||||
# Reset and Retry
|
||||
if possible_files:
|
||||
print('TensorRT libraries found in one the following directories',
|
||||
'are not compatible with selected cuda and cudnn installations')
|
||||
print(
|
||||
'TensorRT libraries found in one the following directories',
|
||||
'are not compatible with selected cuda and cudnn installations'
|
||||
)
|
||||
print(trt_install_path)
|
||||
print(os.path.join(trt_install_path, 'lib'))
|
||||
print(os.path.join(trt_install_path, 'lib64'))
|
||||
@ -1064,7 +1090,8 @@ def set_tf_tensorrt_install_path(environ_cp):
|
||||
print(libnvinfer_path_from_ldconfig)
|
||||
else:
|
||||
print(
|
||||
'Invalid path to TensorRT. None of the following files can be found:')
|
||||
'Invalid path to TensorRT. None of the following files can be found:'
|
||||
)
|
||||
print(trt_install_path)
|
||||
print(os.path.join(trt_install_path, 'lib'))
|
||||
print(os.path.join(trt_install_path, 'lib64'))
|
||||
@ -1072,7 +1099,8 @@ def set_tf_tensorrt_install_path(environ_cp):
|
||||
print(libnvinfer_path_from_ldconfig)
|
||||
|
||||
else:
|
||||
raise UserInputError('Invalid TF_TENSORRT setting was provided %d '
|
||||
raise UserInputError(
|
||||
'Invalid TF_TENSORRT setting was provided %d '
|
||||
'times in a row. Assuming to be a scripting mistake.' %
|
||||
_DEFAULT_PROMPT_ASK_ATTEMPTS)
|
||||
|
||||
@ -1094,7 +1122,8 @@ def set_tf_nccl_install_path(environ_cp):
|
||||
UserInputError: if user has provided invalid input multiple times.
|
||||
"""
|
||||
if not is_linux():
|
||||
raise ValueError('Currently NCCL is only supported on Linux platforms.')
|
||||
raise ValueError(
|
||||
'Currently NCCL is only supported on Linux platforms.')
|
||||
|
||||
ask_nccl_version = (
|
||||
'Please specify the NCCL version you want to use. '
|
||||
@ -1102,7 +1131,8 @@ def set_tf_nccl_install_path(environ_cp):
|
||||
|
||||
for _ in range(_DEFAULT_PROMPT_ASK_ATTEMPTS):
|
||||
tf_nccl_version = get_from_env_or_user_or_default(
|
||||
environ_cp, 'TF_NCCL_VERSION', ask_nccl_version, _DEFAULT_NCCL_VERSION)
|
||||
environ_cp, 'TF_NCCL_VERSION', ask_nccl_version,
|
||||
_DEFAULT_NCCL_VERSION)
|
||||
tf_nccl_version = reformat_version_sequence(str(tf_nccl_version), 1)
|
||||
|
||||
if tf_nccl_version == '1':
|
||||
@ -1115,7 +1145,8 @@ def set_tf_nccl_install_path(environ_cp):
|
||||
# NCCL_INSTALL_PATH, pass separate NCCL_LIB_PATH and NCCL_HDR_PATH to
|
||||
# nccl_configure.bzl
|
||||
default_nccl_path = environ_cp.get('CUDA_TOOLKIT_PATH')
|
||||
ask_nccl_path = (r'Please specify the location where NCCL %s library is '
|
||||
ask_nccl_path = (
|
||||
r'Please specify the location where NCCL %s library is '
|
||||
'installed. Refer to README.md for more details. [Default '
|
||||
'is %s]:') % (tf_nccl_version, default_nccl_path)
|
||||
nccl_install_path = get_from_env_or_user_or_default(
|
||||
@ -1123,7 +1154,8 @@ def set_tf_nccl_install_path(environ_cp):
|
||||
|
||||
# Result returned from "read" will be used unexpanded. That make "~"
|
||||
# unusable. Going through one more level of expansion to handle that.
|
||||
nccl_install_path = os.path.realpath(os.path.expanduser(nccl_install_path))
|
||||
nccl_install_path = os.path.realpath(
|
||||
os.path.expanduser(nccl_install_path))
|
||||
if is_windows() or is_cygwin():
|
||||
nccl_install_path = cygpath(nccl_install_path)
|
||||
|
||||
@ -1145,13 +1177,15 @@ def set_tf_nccl_install_path(environ_cp):
|
||||
break
|
||||
|
||||
# Reset and Retry
|
||||
print('Invalid path to NCCL %s toolkit, %s or %s not found. Please use the '
|
||||
print(
|
||||
'Invalid path to NCCL %s toolkit, %s or %s not found. Please use the '
|
||||
'O/S agnostic package of NCCL 2' % (tf_nccl_version, nccl_lib_path,
|
||||
nccl_hdr_path))
|
||||
|
||||
environ_cp['TF_NCCL_VERSION'] = ''
|
||||
else:
|
||||
raise UserInputError('Invalid TF_NCCL setting was provided %d '
|
||||
raise UserInputError(
|
||||
'Invalid TF_NCCL setting was provided %d '
|
||||
'times in a row. Assuming to be a scripting mistake.' %
|
||||
_DEFAULT_PROMPT_ASK_ATTEMPTS)
|
||||
|
||||
@ -1170,7 +1204,8 @@ def get_native_cuda_compute_capabilities(environ_cp):
|
||||
"""
|
||||
device_query_bin = os.path.join(
|
||||
environ_cp.get('CUDA_TOOLKIT_PATH'), 'extras/demo_suite/deviceQuery')
|
||||
if os.path.isfile(device_query_bin) and os.access(device_query_bin, os.X_OK):
|
||||
if os.path.isfile(device_query_bin) and os.access(device_query_bin,
|
||||
os.X_OK):
|
||||
try:
|
||||
output = run_shell(device_query_bin).split('\n')
|
||||
pattern = re.compile('[0-9]*\\.[0-9]*')
|
||||
@ -1210,7 +1245,8 @@ def set_tf_cuda_compute_capabilities(environ_cp):
|
||||
all_valid = True
|
||||
# Remove all whitespace characters before splitting the string
|
||||
# that users may insert by accident, as this will result in error
|
||||
tf_cuda_compute_capabilities = ''.join(tf_cuda_compute_capabilities.split())
|
||||
tf_cuda_compute_capabilities = ''.join(
|
||||
tf_cuda_compute_capabilities.split())
|
||||
for compute_capability in tf_cuda_compute_capabilities.split(','):
|
||||
m = re.match('[0-9]+.[0-9]+', compute_capability)
|
||||
if not m:
|
||||
@ -1219,7 +1255,9 @@ def set_tf_cuda_compute_capabilities(environ_cp):
|
||||
else:
|
||||
ver = int(m.group(0).split('.')[0])
|
||||
if ver < 3:
|
||||
print('Only compute capabilities 3.0 or higher are supported.')
|
||||
print(
|
||||
'Only compute capabilities 3.0 or higher are supported.'
|
||||
)
|
||||
all_valid = False
|
||||
|
||||
if all_valid:
|
||||
@ -1270,7 +1308,8 @@ def set_host_c_compiler(environ_cp):
|
||||
environ_cp,
|
||||
var_name='HOST_C_COMPILER',
|
||||
var_default=default_c_host_compiler,
|
||||
ask_for_var=('Please specify which C compiler should be used as the host '
|
||||
ask_for_var=(
|
||||
'Please specify which C compiler should be used as the host '
|
||||
'C compiler.'),
|
||||
check_success=os.path.exists,
|
||||
error_msg='Invalid C compiler path. %s cannot be found.',
|
||||
@ -1289,8 +1328,7 @@ def set_computecpp_toolkit_path(environ_cp):
|
||||
else:
|
||||
sycl_rt_lib_path = ''
|
||||
|
||||
sycl_rt_lib_path_full = os.path.join(toolkit_path,
|
||||
sycl_rt_lib_path)
|
||||
sycl_rt_lib_path_full = os.path.join(toolkit_path, sycl_rt_lib_path)
|
||||
exists = os.path.exists(sycl_rt_lib_path_full)
|
||||
if not exists:
|
||||
print('Invalid SYCL %s library path. %s cannot be found' %
|
||||
@ -1318,8 +1356,8 @@ def set_trisycl_include_dir(environ_cp):
|
||||
ask_trisycl_include_dir = ('Please specify the location of the triSYCL '
|
||||
'include directory. (Use --config=sycl_trisycl '
|
||||
'when building with Bazel) '
|
||||
'[Default is %s]: '
|
||||
) % (_DEFAULT_TRISYCL_INCLUDE_DIR)
|
||||
'[Default is %s]: ') % (
|
||||
_DEFAULT_TRISYCL_INCLUDE_DIR)
|
||||
|
||||
while True:
|
||||
trisycl_include_dir = get_from_env_or_user_or_default(
|
||||
@ -1328,13 +1366,12 @@ def set_trisycl_include_dir(environ_cp):
|
||||
if os.path.exists(trisycl_include_dir):
|
||||
break
|
||||
|
||||
print('Invalid triSYCL include directory, %s cannot be found'
|
||||
% (trisycl_include_dir))
|
||||
print('Invalid triSYCL include directory, %s cannot be found' %
|
||||
(trisycl_include_dir))
|
||||
|
||||
# Set TRISYCL_INCLUDE_DIR
|
||||
environ_cp['TRISYCL_INCLUDE_DIR'] = trisycl_include_dir
|
||||
write_action_env_to_bazelrc('TRISYCL_INCLUDE_DIR',
|
||||
trisycl_include_dir)
|
||||
write_action_env_to_bazelrc('TRISYCL_INCLUDE_DIR', trisycl_include_dir)
|
||||
|
||||
|
||||
def set_mpi_home(environ_cp):
|
||||
@ -1344,8 +1381,8 @@ def set_mpi_home(environ_cp):
|
||||
default_mpi_home = os.path.dirname(os.path.dirname(default_mpi_home))
|
||||
|
||||
def valid_mpi_path(mpi_home):
|
||||
exists = (os.path.exists(os.path.join(mpi_home, 'include')) and
|
||||
os.path.exists(os.path.join(mpi_home, 'lib')))
|
||||
exists = (os.path.exists(os.path.join(mpi_home, 'include'))
|
||||
and os.path.exists(os.path.join(mpi_home, 'lib')))
|
||||
if not exists:
|
||||
print('Invalid path to the MPI Toolkit. %s or %s cannot be found' %
|
||||
(os.path.join(mpi_home, 'include'),
|
||||
@ -1370,7 +1407,8 @@ def set_other_mpi_vars(environ_cp):
|
||||
|
||||
# Determine if we use OpenMPI or MVAPICH, these require different header files
|
||||
# to be included here to make bazel dependency checker happy
|
||||
if os.path.exists(os.path.join(mpi_home, 'include/mpi_portable_platform.h')):
|
||||
if os.path.exists(
|
||||
os.path.join(mpi_home, 'include/mpi_portable_platform.h')):
|
||||
symlink_force(
|
||||
os.path.join(mpi_home, 'include/mpi_portable_platform.h'),
|
||||
'third_party/mpi/mpi_portable_platform.h')
|
||||
@ -1382,16 +1420,19 @@ def set_other_mpi_vars(environ_cp):
|
||||
symlink_force(
|
||||
os.path.join(mpi_home, 'include/mpio.h'), 'third_party/mpi/mpio.h')
|
||||
symlink_force(
|
||||
os.path.join(mpi_home, 'include/mpicxx.h'), 'third_party/mpi/mpicxx.h')
|
||||
os.path.join(mpi_home, 'include/mpicxx.h'),
|
||||
'third_party/mpi/mpicxx.h')
|
||||
# TODO(gunan): avoid editing files in configure
|
||||
sed_in_place('third_party/mpi/mpi.bzl', 'MPI_LIB_IS_OPENMPI=True',
|
||||
'MPI_LIB_IS_OPENMPI=False')
|
||||
|
||||
if os.path.exists(os.path.join(mpi_home, 'lib/libmpi.so')):
|
||||
symlink_force(
|
||||
os.path.join(mpi_home, 'lib/libmpi.so'), 'third_party/mpi/libmpi.so')
|
||||
os.path.join(mpi_home, 'lib/libmpi.so'),
|
||||
'third_party/mpi/libmpi.so')
|
||||
else:
|
||||
raise ValueError('Cannot find the MPI library file in %s/lib' % mpi_home)
|
||||
raise ValueError(
|
||||
'Cannot find the MPI library file in %s/lib' % mpi_home)
|
||||
|
||||
|
||||
def set_grpc_build_flags():
|
||||
@ -1419,7 +1460,8 @@ def config_info_line(name, help_text):
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument("--workspace",
|
||||
parser.add_argument(
|
||||
"--workspace",
|
||||
type=str,
|
||||
default=_TF_WORKSPACE_ROOT,
|
||||
help="The absolute path to your active Bazel workspace.")
|
||||
@ -1466,24 +1508,27 @@ def main():
|
||||
'with_kafka_support', True, 'kafka')
|
||||
set_build_var(environ_cp, 'TF_ENABLE_XLA', 'XLA JIT', 'with_xla_support',
|
||||
False, 'xla')
|
||||
set_build_var(environ_cp, 'TF_NEED_GDR', 'GDR', 'with_gdr_support',
|
||||
False, 'gdr')
|
||||
set_build_var(environ_cp, 'TF_NEED_GDR', 'GDR', 'with_gdr_support', False,
|
||||
'gdr')
|
||||
set_build_var(environ_cp, 'TF_NEED_VERBS', 'VERBS', 'with_verbs_support',
|
||||
False, 'verbs')
|
||||
set_build_var(environ_cp, 'TF_NEED_NGRAPH', 'nGraph',
|
||||
'with_ngraph_support', False, 'ngraph')
|
||||
|
||||
set_action_env_var(environ_cp, 'TF_NEED_OPENCL_SYCL', 'OpenCL SYCL', False)
|
||||
if environ_cp.get('TF_NEED_OPENCL_SYCL') == '1':
|
||||
set_host_cxx_compiler(environ_cp)
|
||||
set_host_c_compiler(environ_cp)
|
||||
set_action_env_var(environ_cp, 'TF_NEED_COMPUTECPP', 'ComputeCPP', True)
|
||||
set_action_env_var(environ_cp, 'TF_NEED_COMPUTECPP', 'ComputeCPP',
|
||||
True)
|
||||
if environ_cp.get('TF_NEED_COMPUTECPP') == '1':
|
||||
set_computecpp_toolkit_path(environ_cp)
|
||||
else:
|
||||
set_trisycl_include_dir(environ_cp)
|
||||
|
||||
set_action_env_var(environ_cp, 'TF_NEED_CUDA', 'CUDA', False)
|
||||
if (environ_cp.get('TF_NEED_CUDA') == '1' and
|
||||
'TF_CUDA_CONFIG_REPO' not in environ_cp):
|
||||
if (environ_cp.get('TF_NEED_CUDA') == '1'
|
||||
and 'TF_CUDA_CONFIG_REPO' not in environ_cp):
|
||||
set_tf_cuda_version(environ_cp)
|
||||
set_tf_cudnn_version(environ_cp)
|
||||
if is_linux():
|
||||
@ -1527,12 +1572,10 @@ def main():
|
||||
set_build_strip_flag()
|
||||
set_windows_build_flags()
|
||||
|
||||
if get_var(
|
||||
environ_cp, 'TF_SET_ANDROID_WORKSPACE', 'android workspace',
|
||||
if get_var(environ_cp, 'TF_SET_ANDROID_WORKSPACE', 'android workspace',
|
||||
False,
|
||||
('Would you like to interactively configure ./WORKSPACE for '
|
||||
'Android builds?'),
|
||||
'Searching for NDK and SDK installations.',
|
||||
'Android builds?'), 'Searching for NDK and SDK installations.',
|
||||
'Not configuring the WORKSPACE for Android builds.'):
|
||||
create_android_ndk_rule(environ_cp)
|
||||
create_android_sdk_rule(environ_cp)
|
||||
@ -1541,7 +1584,9 @@ def main():
|
||||
'adding "--config=<>" to your build command. See tools/bazel.rc for '
|
||||
'more details.')
|
||||
config_info_line('mkl', 'Build with MKL support.')
|
||||
config_info_line('monolithic', 'Config for mostly static monolithic build.')
|
||||
config_info_line('monolithic',
|
||||
'Config for mostly static monolithic build.')
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
@ -24,6 +24,8 @@ load(
|
||||
"gen_api_init_files", # @unused
|
||||
)
|
||||
|
||||
load("//third_party/ngraph:build_defs.bzl", "if_ngraph")
|
||||
|
||||
# Config setting for determining if we are building for Android.
|
||||
config_setting(
|
||||
name = "android",
|
||||
@ -408,6 +410,14 @@ config_setting(
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
# This flag is set from the configure step when the user selects with nGraph option.
|
||||
# By default it should be false
|
||||
config_setting(
|
||||
name = "with_ngraph_support",
|
||||
values = {"define": "with_ngraph_support=true"},
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
package_group(
|
||||
name = "internal",
|
||||
packages = [
|
||||
@ -540,7 +550,7 @@ tf_cc_shared_object(
|
||||
"//tensorflow/c:version_script.lds",
|
||||
"//tensorflow/c/eager:c_api",
|
||||
"//tensorflow/core:tensorflow",
|
||||
],
|
||||
]
|
||||
)
|
||||
|
||||
tf_cc_shared_object(
|
||||
@ -568,7 +578,7 @@ tf_cc_shared_object(
|
||||
"//tensorflow/cc:scope",
|
||||
"//tensorflow/cc/profiler",
|
||||
"//tensorflow/core:tensorflow",
|
||||
],
|
||||
] + if_ngraph(["@ngraph_tf//:ngraph_tf"])
|
||||
)
|
||||
|
||||
exports_files(
|
||||
|
@ -2325,6 +2325,7 @@ tf_generate_proto_text_sources(
|
||||
":lib_internal",
|
||||
":protos_all_proto_cc",
|
||||
],
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
@ -2435,6 +2436,7 @@ cc_header_only_library(
|
||||
deps = [
|
||||
":core_cpu_lib",
|
||||
],
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
tf_cuda_library(
|
||||
@ -2560,6 +2562,7 @@ tf_cuda_library(
|
||||
cc_library(
|
||||
name = "protos_cc",
|
||||
deps = ["//tensorflow/core/platform/default/build_config:protos_cc"],
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
# Library containing all of the graph construction code that is
|
||||
|
@ -19,6 +19,7 @@ limitations under the License.
|
||||
#include <vector>
|
||||
#include "tensorflow/core/common_runtime/device_factory.h"
|
||||
#include "tensorflow/core/framework/allocator.h"
|
||||
#include "tensorflow/core/lib/io/path.h"
|
||||
#include "tensorflow/core/public/session_options.h"
|
||||
|
||||
namespace tensorflow {
|
||||
|
@ -44,6 +44,7 @@ load("//tensorflow/core:platform/default/build_config_root.bzl", "tf_additional_
|
||||
load("//tensorflow/core:platform/default/build_config_root.bzl", "tf_additional_mpi_deps")
|
||||
load("//tensorflow/core:platform/default/build_config_root.bzl", "tf_additional_gdr_deps")
|
||||
load("//tensorflow/core:platform/default/build_config_root.bzl", "if_static")
|
||||
load("//third_party/ngraph:build_defs.bzl","if_ngraph")
|
||||
|
||||
py_library(
|
||||
name = "python",
|
||||
@ -3669,7 +3670,8 @@ tf_py_wrap_cc(
|
||||
tf_additional_plugin_deps() +
|
||||
tf_additional_verbs_deps() +
|
||||
tf_additional_mpi_deps() +
|
||||
tf_additional_gdr_deps()),
|
||||
tf_additional_gdr_deps())+
|
||||
if_ngraph(["@ngraph_tf//:ngraph_tf"])
|
||||
)
|
||||
|
||||
# ** Targets for Windows build (start) **
|
||||
|
@ -24,6 +24,10 @@ load(
|
||||
"if_mkl",
|
||||
"if_mkl_lnx_x64"
|
||||
)
|
||||
load(
|
||||
"//third_party/ngraph:build_defs.bzl",
|
||||
"if_ngraph",
|
||||
)
|
||||
|
||||
def register_extension_info(**kwargs):
|
||||
pass
|
||||
@ -214,6 +218,7 @@ def tf_copts(android_optimization_level_override="-O2", is_external=False):
|
||||
+ if_cuda(["-DGOOGLE_CUDA=1"])
|
||||
+ if_tensorrt(["-DGOOGLE_TENSORRT=1"])
|
||||
+ if_mkl(["-DINTEL_MKL=1", "-DEIGEN_USE_VML"])
|
||||
+ if_ngraph(["-DINTEL_NGRAPH=1"])
|
||||
+ if_mkl_lnx_x64(["-fopenmp"])
|
||||
+ if_android_arm(["-mfpu=neon"])
|
||||
+ if_linux_x86_64(["-msse3"])
|
||||
|
@ -803,6 +803,39 @@ def tf_workspace(path_prefix="", tf_repo_name=""):
|
||||
strip_prefix = "rules_android-0.1.1",
|
||||
)
|
||||
|
||||
tf_http_archive(
|
||||
name = "ngraph",
|
||||
urls = [
|
||||
"https://mirror.bazel.build/github.com/NervanaSystems/ngraph/archive/v0.5.0.tar.gz",
|
||||
"https://github.com/NervanaSystems/ngraph/archive/v0.5.0.tar.gz",
|
||||
],
|
||||
sha256 = "cb35d3d98836f615408afd18371fb13e3400711247e0d822ba7f306c45e9bb2c",
|
||||
strip_prefix = "ngraph-0.5.0",
|
||||
build_file = clean_dep("//third_party/ngraph:ngraph.BUILD"),
|
||||
)
|
||||
|
||||
tf_http_archive(
|
||||
name = "nlohmann_json_lib",
|
||||
urls = [
|
||||
"https://mirror.bazel.build/github.com/nlohmann/json/archive/v3.1.1.tar.gz",
|
||||
"https://github.com/nlohmann/json/archive/v3.1.1.tar.gz",
|
||||
],
|
||||
sha256 = "9f3549824af3ca7e9707a2503959886362801fb4926b869789d6929098a79e47",
|
||||
strip_prefix = "json-3.1.1",
|
||||
build_file = clean_dep("//third_party/ngraph:nlohmann_json.BUILD"),
|
||||
)
|
||||
|
||||
tf_http_archive(
|
||||
name = "ngraph_tf",
|
||||
urls = [
|
||||
"https://mirror.bazel.build/github.com/NervanaSystems/ngraph-tf/archive/v0.3.0-rc0.tar.gz",
|
||||
"https://github.com/NervanaSystems/ngraph-tf/archive/v0.3.0-rc0.tar.gz"
|
||||
],
|
||||
sha256 = "c09a35d0a605afeeaf5aad81181a6abc7e9b9e39312e8fdfbae20cbd8eb58523",
|
||||
strip_prefix = "ngraph-tf-0.3.0-rc0",
|
||||
build_file = clean_dep("//third_party/ngraph:ngraph_tf.BUILD"),
|
||||
)
|
||||
|
||||
##############################################################################
|
||||
# BIND DEFINITIONS
|
||||
#
|
||||
|
1
third_party/ngraph/BUILD
vendored
Normal file
1
third_party/ngraph/BUILD
vendored
Normal file
@ -0,0 +1 @@
|
||||
licenses(["notice"]) # 3-Clause BSD
|
201
third_party/ngraph/LICENSE
vendored
Normal file
201
third_party/ngraph/LICENSE
vendored
Normal file
@ -0,0 +1,201 @@
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "{}"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright {yyyy} {name of copyright owner}
|
||||
|
||||
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.
|
201
third_party/ngraph/NGRAPH_LICENSE
vendored
Normal file
201
third_party/ngraph/NGRAPH_LICENSE
vendored
Normal file
@ -0,0 +1,201 @@
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "{}"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright {yyyy} {name of copyright owner}
|
||||
|
||||
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.
|
16
third_party/ngraph/build_defs.bzl
vendored
Normal file
16
third_party/ngraph/build_defs.bzl
vendored
Normal file
@ -0,0 +1,16 @@
|
||||
def clean_dep(dep):
|
||||
return str(Label(dep))
|
||||
|
||||
def if_ngraph(a):
|
||||
"""Shorthand for select()'ing on whether we're building with nGraph support.
|
||||
|
||||
Returns a select statement which evaluates to if_true if we're building
|
||||
with nGraph. Otherwise, the select statement evaluates to default.
|
||||
|
||||
"""
|
||||
ret_val = select({
|
||||
clean_dep("//tensorflow:with_ngraph_support"): a,
|
||||
"//conditions:default": []
|
||||
})
|
||||
|
||||
return ret_val
|
45
third_party/ngraph/ngraph.BUILD
vendored
Normal file
45
third_party/ngraph/ngraph.BUILD
vendored
Normal file
@ -0,0 +1,45 @@
|
||||
licenses(["notice"]) # 3-Clause BSD
|
||||
|
||||
exports_files(["license.txt"])
|
||||
|
||||
filegroup(
|
||||
name = "LICENSE",
|
||||
srcs = [
|
||||
"license.txt",
|
||||
],
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "ngraph_core",
|
||||
srcs = glob([
|
||||
"src/ngraph/*.cpp",
|
||||
"src/ngraph/autodiff/*.cpp",
|
||||
"src/ngraph/builder/*.cpp",
|
||||
"src/ngraph/descriptor/*.cpp",
|
||||
"src/ngraph/descriptor/layout/*.cpp",
|
||||
"src/ngraph/op/*.cpp",
|
||||
"src/ngraph/op/util/*.cpp",
|
||||
"src/ngraph/pattern/*.cpp",
|
||||
"src/ngraph/pattern/*.hpp",
|
||||
"src/ngraph/pass/*.cpp",
|
||||
"src/ngraph/pass/*.hpp",
|
||||
"src/ngraph/runtime/*.cpp",
|
||||
"src/ngraph/type/*.cpp",
|
||||
"src/ngraph/runtime/interpreter/*.cpp",
|
||||
"src/ngraph/runtime/interpreter/*.hpp",
|
||||
]),
|
||||
hdrs = glob(["src/ngraph/**/*.hpp"]),
|
||||
deps = [
|
||||
"@eigen_archive//:eigen",
|
||||
"@nlohmann_json_lib",
|
||||
],
|
||||
copts = [
|
||||
"-I external/ngraph/src",
|
||||
"-I external/nlohmann_json_lib/include/",
|
||||
'-D SHARED_LIB_EXT=\\".so\\"',
|
||||
'-D NGRAPH_VERSION=\\"0.5.0\\"',
|
||||
],
|
||||
visibility = ["//visibility:public"],
|
||||
alwayslink=1
|
||||
)
|
96
third_party/ngraph/ngraph_tf.BUILD
vendored
Normal file
96
third_party/ngraph/ngraph_tf.BUILD
vendored
Normal file
@ -0,0 +1,96 @@
|
||||
licenses(["notice"]) # 3-Clause BSD
|
||||
|
||||
exports_files(["license.txt"])
|
||||
|
||||
filegroup(
|
||||
name = "LICENSE",
|
||||
srcs = [
|
||||
"license.txt",
|
||||
],
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
load(
|
||||
"@org_tensorflow//tensorflow:tensorflow.bzl",
|
||||
"tf_cc_test"
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "ngraph_libs_linux",
|
||||
srcs = [
|
||||
"lib/libiomp5.so",
|
||||
"lib/libmklml_intel.so",
|
||||
],
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "ngraph_tf",
|
||||
srcs =
|
||||
[
|
||||
"src/ngraph_builder.h",
|
||||
"src/ngraph_builder.cc",
|
||||
"src/ngraph_cluster.h",
|
||||
"src/ngraph_cluster.cc",
|
||||
"src/ngraph_cluster_manager.h",
|
||||
"src/ngraph_cluster_manager.cc",
|
||||
"src/ngraph_confirm_pass.cc",
|
||||
"src/ngraph_device.cc",
|
||||
"src/ngraph_encapsulate_op.cc",
|
||||
"src/ngraph_encapsulate_pass.cc",
|
||||
"src/ngraph_freshness_tracker.h",
|
||||
"src/ngraph_freshness_tracker.cc",
|
||||
"src/ngraph_graph_rewrite_passes.cc",
|
||||
"src/ngraph_liberate_pass.cc",
|
||||
"src/ngraph_op_kernels.cc",
|
||||
"src/ngraph_stub_ops.cc",
|
||||
"src/ngraph_utils.h",
|
||||
"src/ngraph_utils.cc",
|
||||
"src/ngraph_send_recv_ops.cc",
|
||||
"src/ngraph_variable_ops.cc",
|
||||
"src/tf_graphcycles.cc",
|
||||
"logging/ngraph_log.h",
|
||||
"logging/ngraph_log.cc",
|
||||
"logging/tf_graph_writer.h",
|
||||
"logging/tf_graph_writer.cc",
|
||||
],
|
||||
hdrs = [
|
||||
"src/tf_graphcycles.h"
|
||||
],
|
||||
deps = [
|
||||
"@org_tensorflow//tensorflow/core:protos_all_proto_text",
|
||||
"@org_tensorflow//tensorflow/core:framework_headers_lib",
|
||||
"@org_tensorflow//tensorflow/core:core_cpu_headers_lib",
|
||||
"@ngraph//:ngraph_core"
|
||||
],
|
||||
copts = [
|
||||
"-I external/ngraph_tf/src",
|
||||
"-I external/ngraph_tf/logging",
|
||||
"-I external/ngraph/src",
|
||||
"-D NGRAPH_EMBEDDED_IN_TENSORFLOW=1",
|
||||
],
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
tf_cc_test(
|
||||
name = "ngraph_tf_tests",
|
||||
size = "small",
|
||||
srcs = [
|
||||
"test/tf_exec.cpp",
|
||||
"test/main.cpp",
|
||||
],
|
||||
deps = [
|
||||
":ngraph_tf",
|
||||
"@com_google_googletest//:gtest",
|
||||
"@org_tensorflow//tensorflow/cc:cc_ops",
|
||||
"@org_tensorflow//tensorflow/cc:client_session",
|
||||
"@org_tensorflow//tensorflow/core:tensorflow",
|
||||
],
|
||||
extra_copts = [
|
||||
"-fexceptions ",
|
||||
"-D NGRAPH_EMBEDDED_IN_TENSORFLOW=1",
|
||||
"-I external/ngraph_tf/src",
|
||||
"-I external/ngraph_tf/logging",
|
||||
"-I external/ngraph/src",
|
||||
],
|
||||
)
|
23
third_party/ngraph/nlohmann_json.BUILD
vendored
Normal file
23
third_party/ngraph/nlohmann_json.BUILD
vendored
Normal file
@ -0,0 +1,23 @@
|
||||
licenses(["notice"]) # 3-Clause BSD
|
||||
|
||||
exports_files(["license.txt"])
|
||||
|
||||
filegroup(
|
||||
name = "LICENSE",
|
||||
srcs = [
|
||||
"license.txt",
|
||||
],
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "nlohmann_json_lib",
|
||||
hdrs = glob([
|
||||
"include/nlohmann/**/*.hpp",
|
||||
]),
|
||||
copts = [
|
||||
"-I external/nlohmann_json_lib",
|
||||
],
|
||||
visibility = ["//visibility:public"],
|
||||
alwayslink=1
|
||||
)
|
Loading…
Reference in New Issue
Block a user