()
| 1374 | |
| 1375 | |
| 1376 | def main(): |
| 1377 | global _TF_WORKSPACE_ROOT |
| 1378 | global _TF_BAZELRC |
| 1379 | global _TF_CURRENT_BAZEL_VERSION |
| 1380 | |
| 1381 | parser = argparse.ArgumentParser() |
| 1382 | parser.add_argument( |
| 1383 | '--workspace', |
| 1384 | type=str, |
| 1385 | default=os.path.abspath(os.path.dirname(__file__)), |
| 1386 | help='The absolute path to your active Bazel workspace.') |
| 1387 | args = parser.parse_args() |
| 1388 | |
| 1389 | _TF_WORKSPACE_ROOT = args.workspace |
| 1390 | _TF_BAZELRC = os.path.join(_TF_WORKSPACE_ROOT, _TF_BAZELRC_FILENAME) |
| 1391 | |
| 1392 | # Make a copy of os.environ to be clear when functions and getting and setting |
| 1393 | # environment variables. |
| 1394 | environ_cp = dict(os.environ) |
| 1395 | |
| 1396 | current_bazel_version = check_bazel_version(_TF_MIN_BAZEL_VERSION, |
| 1397 | _TF_MAX_BAZEL_VERSION) |
| 1398 | _TF_CURRENT_BAZEL_VERSION = convert_version_to_int(current_bazel_version) |
| 1399 | |
| 1400 | reset_tf_configure_bazelrc() |
| 1401 | |
| 1402 | cleanup_makefile() |
| 1403 | setup_python(environ_cp) |
| 1404 | |
| 1405 | if is_windows(): |
| 1406 | environ_cp['TF_NEED_OPENCL_SYCL'] = '0' |
| 1407 | environ_cp['TF_NEED_COMPUTECPP'] = '0' |
| 1408 | environ_cp['TF_NEED_OPENCL'] = '0' |
| 1409 | environ_cp['TF_CUDA_CLANG'] = '0' |
| 1410 | environ_cp['TF_NEED_TENSORRT'] = '0' |
| 1411 | # TODO(ibiryukov): Investigate using clang as a cpu or cuda compiler on |
| 1412 | # Windows. |
| 1413 | environ_cp['TF_DOWNLOAD_CLANG'] = '0' |
| 1414 | environ_cp['TF_NEED_MPI'] = '0' |
| 1415 | environ_cp['TF_SET_ANDROID_WORKSPACE'] = '0' |
| 1416 | |
| 1417 | if is_macos(): |
| 1418 | environ_cp['TF_NEED_TENSORRT'] = '0' |
| 1419 | else: |
| 1420 | environ_cp['TF_CONFIGURE_IOS'] = '0' |
| 1421 | |
| 1422 | # The numpy package on ppc64le uses OpenBLAS which has multi-threading |
| 1423 | # issues that lead to incorrect answers. Set OMP_NUM_THREADS=1 at |
| 1424 | # runtime to allow the Tensorflow testcases which compare numpy |
| 1425 | # results to Tensorflow results to succeed. |
| 1426 | if is_ppc64le(): |
| 1427 | write_action_env_to_bazelrc('OMP_NUM_THREADS', 1) |
| 1428 | |
| 1429 | xla_enabled_by_default = is_linux() or is_macos() |
| 1430 | set_build_var(environ_cp, 'TF_ENABLE_XLA', 'XLA JIT', 'with_xla_support', |
| 1431 | xla_enabled_by_default, 'xla') |
| 1432 | |
| 1433 | set_build_var(environ_cp, 'TF_NEED_STAR', 'STAR', 'with_star_support', |
no test coverage detected