Performance Discrepancy Between pip install tensorflow and Building from Source
@vishwascm,
The difference in code execution time between a TensorFlow installation from **source** and a pre-built binary installed using **pip install tensorflow** can be influenced by several factors. 

When you are trying to build TensorFlow from source, there is an option to customize compiler flags and optimizations. If the compilation is not configured optimally for your hardware, it might result in performance. Also the speed of the storage device where TensorFlow is installed can affect the loading and execution times. If the source build is on a slower storage medium compared to the system where the pre-built binary is installed, it can contribute to differences in execution time.

To improve the execution time for TensorFlow built from source, consider the following:

```
- Use appropriate compiler flags for your CPU architecture.
- Check and customize the build configuration to match your requirements.
- Ensure that GPU support is configured correctly if applicable.
- Monitor the build logs for any errors or warnings that might indicate issues.
```

TensorFlow build from source can sometimes lead to increased code execution time compared to using pip install tensorflow. While building from source offers certain advantages like customization and access to the new features, it can also introduce performance drawbacks if not done correctly. Thank you! Hi @tilakrayal,
Is there any place where I can see the build command along with all configuration used and flags used for official tf v2.15.0 wheel file available in pypi.org for aarch64 machine (graviton) with  sve_256? Hi @tilakrayal ,
Is there any place where I can see the build command along with all configuration used and flags used for official tf v2.15.0 wheel file available in pypi.org for aarch64 machine (graviton) with sve_256? @vishwascm,
Apologies for the delay.
You can directly install the tensorflow v2.15 on aarch64 using **pip install tensorflow-aarch64** where the flags are not required. 
https://pypi.org/project/tensorflow-aarch64/

If you are trying to install the tensorflow using a build source, then we will use the flags based upon the requirement.
https://www.tensorflow.org/install/source#build_the_package

Thank you! This issue is stale because it has been open for 7 days with no activity. It will be closed if no further activity occurs. Thank you. Hi @tilakrayal,
Thanks for the reply. I am looking for some more detail about building tensorflow from source, specific to aarch64 architecture with vector length 256 (Graviton) machine, including clang version, ubuntu version, build tags to use aarch64 etc. Just like how official wheel files are built.  Are these details available in tensorflow git repository itself? If available how to use it.

Thanks,
Vishwas @vishwascm,
Could you please take a look at this official build from the source document where you can find the clang version, flags required to install the tensorflow.
https://www.tensorflow.org/install/source

`sudo apt-get update && sudo apt-get install -y llvm-16 clang-16`

You can try to specify the flags for aarch64 as per the requirement to install the tensorflow from build.

Thank you!


 This issue is stale because it has been open for 7 days with no activity. It will be closed if no further activity occurs. Thank you. This issue was closed because it has been inactive for 7 days since being marked as stale. Please reopen if you'd like to work on this further. Are you satisfied with the resolution of your issue?
<a href="https://docs.google.com/forms/d/e/1FAIpQLSfaP12TRhd9xSxjXZjcZFNXPGk4kc1-qMdv3gc6bEP90vY1ew/viewform?entry.85265664=Yes&entry.2137816233=https://github.com/tensorflow/tensorflow/issues/62642">Yes</a>
<a href="https://docs.google.com/forms/d/e/1FAIpQLSfaP12TRhd9xSxjXZjcZFNXPGk4kc1-qMdv3gc6bEP90vY1ew/viewform?entry.85265664=No&entry.2137816233=https://github.com/tensorflow/tensorflow/issues/62642">No</a>

### Issue type

Performance

### Have you reproduced the bug with TensorFlow Nightly?

No

### Source

source

### TensorFlow version

tf v2.15.0

### Custom code

No

### OS platform and distribution

ubuntu 22.04.1 on aarch64 

### Mobile device

_No response_

### Python version

Python 3.11.0

### Bazel version

6.1.0

### GCC/compiler version

clang version 16.0.6

### CUDA/cuDNN version

_No response_

### GPU model and memory

_No response_

### Current behavior?

I have observed a notable difference in the execution time between TensorFlow installed via pip install tensorflow and TensorFlow built from source. The source-built TensorFlow appears to take longer to run hugging face models like resnet50, bert etc, compared to the pip-installed version. The build commands used are given below:

bazel build -s --config=mkl_aarch64 --features=-layering_check --copt=-O3 --copt=-march=armv8-a+sve --copt=-msve-vector-bits=256 --copt=-Wno-gnu-offsetof-extensions --copt=-Wno-unused-but-set-variable  --local_cpu_resources=16 //tensorflow/tools/pip_package:build_pip_package --verbose_failures 

./bazel-bin/tensorflow/tools/pip_package/build_pip_package /home/vishwas/Graviton/tensorflow

pip install /home/vishwas/Graviton/tensorflow/tensorflow_wheelfile.whl


It will be great if people help me to provide actual build commands used for aarch64 machine with sve_256.

### Standalone code to reproduce the issue

```shell
cd tensorflow
git checkout v2.15.0
export CC="/usr/local/bin/clang"
export CXX="/usr/local/bin/clang++"
export TF_PYTHON_VERSION=3.11
pip install -U pip numpy wheel packaging requests opt_einsum

bazel build -s --config=mkl_aarch64 --features=-layering_check --copt=-O3 --copt=-march=armv8-a+sve --copt=-msve-vector-bits=256 --copt=-Wno-gnu-offsetof-extensions --copt=-Wno-unused-but-set-variable  --local_cpu_resources=16 //tensorflow/tools/pip_package:build_pip_package --verbose_failures 

./bazel-bin/tensorflow/tools/pip_package/build_pip_package /home/vishwas/Graviton/tensorflow
pip install /home/vishwas/Graviton/tensorflow/tensorflow_wheelfile.whl
```


### Relevant log output

```shell
Following are the timing differences:
Bert Model Inference: 2237.73 ms  with build from source and 349.63 ms for pip install
Resnet50: 411.6 ms with build from source and 139.4 ms for pip install

These are average run timings.
No changes made for code built from source.
```
