# TensorFlow Bazel configuration file. # This file tries to group and simplify build options for TensorFlow # # ----CONFIG OPTIONS---- # # Other build options: # short_logs: Only log errors during build, skip warnings. # verbose_logs: Show all compiler warnings during build. # monolithic: Build all TF C++ code into a single shared object. # dynamic_kernels: Try to link all kernels dynamically (experimental). # libc++: Link against libc++ instead of stdlibc++ ## # TF version options; # v1: Build TF V1 (without contrib) # v2: Build TF v2 # # Feature and Third party library support options: # xla: Build TF with XLA # tpu: Build TF with TPU support # using_cuda: CUDA is available to build system. # cuda: Build with full cuda support. # rocm: Build with AMD GPU support (rocm). # mkl: Enable full mkl support. # tensorrt: Enable Tensorrt support. # numa: Enable numa using hwloc. # noaws: Disable AWS S3 storage support # nogcp: Disable GCS support. # nohdfs: Disable hadoop hdfs support. # nonccl: Disable nccl support. # Sets the default Apple platform to macOS. build --apple_platform_type=macos # Flags for open source build, always set to be true. build --define open_source_build=true test --define open_source_build=true # For workaound the use_fast_cpp_protos issue in protobuf deps. build --define=use_fast_cpp_protos=false test --define=use_fast_cpp_protos=false # This config refers to building with CUDA available. It does not necessarily # mean that we build CUDA op kernels. build:using_cuda --define=using_cuda=true build:using_cuda --action_env TF_NEED_CUDA=1 build:using_cuda --crosstool_top=@local_config_cuda//crosstool:toolchain # Enable the mlir generated GPU kernels only for cuda builds. build --define=tensorflow_enable_mlir_generated_gpu_kernels=0 # This is a more specific option, so it takes precedence over the line above for cuda builds. build:using_cuda --define=tensorflow_enable_mlir_generated_gpu_kernels=1 # This config refers to building CUDA op kernels with nvcc. build:cuda --config=using_cuda build:cuda --define=using_cuda_nvcc=true # dbg config, as a shorthand for '--config=opt -c dbg' build:dbg --config=opt -c dbg # for now, disable arm_neon. see: https://github.com/tensorflow/tensorflow/issues/33360 build:dbg --cxxopt -DTF_LITE_DISABLE_X86_NEON # AWS SDK must be compiled in release mode. see: https://github.com/tensorflow/tensorflow/issues/37498 build:dbg --copt -DDEBUG_BUILD build:tensorrt --action_env TF_NEED_TENSORRT=1 build:rocm --crosstool_top=@local_config_rocm//crosstool:toolchain build:rocm --define=using_rocm=true --define=using_rocm_hipcc=true build:rocm --action_env TF_NEED_ROCM=1 # Options extracted from configure script build:numa --define=with_numa_support=true # Options to disable default on features build:noaws --define=no_aws_support=true build:nogcp --define=no_gcp_support=true build:nohdfs --define=no_hdfs_support=true build:nonccl --define=no_nccl_support=true build --define=allow_oversize_protos=true build --spawn_strategy=standalone build -c opt # Make Bazel print out all options from rc files. build --announce_rc # Other build flags. build --define=grpc_no_ares=true build:linux --copt=-w build:linux --host_copt=-w build:macos --copt=-w build:windows --copt=/W0 # Tensorflow uses M_* math constants that only get defined by MSVC headers if # _USE_MATH_DEFINES is defined. build:windows --copt=/D_USE_MATH_DEFINES build:windows --host_copt=/D_USE_MATH_DEFINES # Default paths for TF_SYSTEM_LIBS build:linux --define=PREFIX=/usr build:linux --define=LIBDIR=$(PREFIX)/lib build:linux --define=INCLUDEDIR=$(PREFIX)/include build:linux --define=PROTOBUF_INCLUDE_PATH=$(PREFIX)/include build:macos --define=PREFIX=/usr build:macos --define=LIBDIR=$(PREFIX)/lib build:macos --define=INCLUDEDIR=$(PREFIX)/include build:macos --define=PROTOBUF_INCLUDE_PATH=$(PREFIX)/include # TF_SYSTEM_LIBS do not work on windows. # On windows, we still link everything into a single DLL. build:windows --config=monolithic # On linux, we dynamically link small amount of kernels build:linux --config=dynamic_kernels # Make sure to include as little of windows.h as possible build:windows --copt=-DWIN32_LEAN_AND_MEAN build:windows --host_copt=-DWIN32_LEAN_AND_MEAN build:windows --copt=-DNOGDI build:windows --host_copt=-DNOGDI # MSVC (Windows): Standards-conformant preprocessor mode # See https://docs.microsoft.com/en-us/cpp/preprocessor/preprocessor-experimental-overview build:windows --copt=/experimental:preprocessor build:windows --host_copt=/experimental:preprocessor # Misc build options we need for windows. build:windows --linkopt=/DEBUG build:windows --host_linkopt=/DEBUG build:windows --linkopt=/OPT:REF build:windows --host_linkopt=/OPT:REF build:windows --linkopt=/OPT:ICF build:windows --host_linkopt=/OPT:ICF build:windows --experimental_strict_action_env=true # Verbose failure logs when something goes wrong build:windows --verbose_failures # On windows, we never cross compile build:windows --distinct_host_configuration=false # Suppress all warning messages. build:short_logs --output_filter=DONT_MATCH_ANYTHING build:verbose_logs --output_filter= build --config=short_logs # Options to build TensorFlow 1.x or 2.x. build:v1 --define=tf_api_version=1 build:v2 --define=tf_api_version=2 build:v1 --action_env=TF2_BEHAVIOR=0 build:v2 --action_env=TF2_BEHAVIOR=1 build --config=v2 test --config=v2 # Enable XLA build:xla --define=with_xla_support=true