You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/learning-paths/servers-and-cloud-computing/tensorflow-gcp/_index.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,7 +7,7 @@ cascade:
7
7
8
8
minutes_to_complete: 30
9
9
10
-
who_is_this_for: This learning path is intended for software developers deploying and optimizing TensorFlow workloads on Linux/Arm64 environments, specifically using Google Cloud C4A virtual machines powered by Axion processors.
10
+
who_is_this_for: This is an introductory topic for software developers deploying and optimizing TensorFlow workloads on Arm64 Linux environments, specifically using Google Cloud C4A virtual machines powered by Axion processors.
11
11
12
12
learning_objectives:
13
13
- Provision an Arm-based SUSE SLES virtual machine on Google Cloud (C4A with Axion processors)
title: TensorFlow Baseline Testing on Google Axion C4A Arm Virtual Machine
2
+
title: Test TensorFlow baseline performance on Google Axion C4A Arm virtual machines
3
3
weight: 5
4
4
5
5
### FIXED, DO NOT MODIFY
6
6
layout: learningpathall
7
7
---
8
8
9
-
## TensorFlow Baseline Testing on GCP SUSE VMs
10
-
This section helps you check if TensorFlow is properly installed and working on your **Google Axion C4A Arm64 VM**. You will run small tests to confirm that your CPU can perform TensorFlow operations correctly.
9
+
## Perform baseline testing
11
10
11
+
This section helps you verify that TensorFlow is properly installed and working on your Google Axion C4A VM. You'll run tests to confirm that your CPU can perform TensorFlow operations correctly.
12
12
13
-
### Verify Installation
14
-
This command checks if TensorFlow is installed correctly and prints its version number.
13
+
### Check available devices
15
14
16
-
```console
17
-
python -c "import tensorflow as tf; print(tf.__version__)"
18
-
```
19
-
20
-
You should see an output similar to:
21
-
```output
22
-
2.20.0
23
-
```
24
-
25
-
### List Available Devices
26
-
This command shows which hardware devices TensorFlow can use — like CPU or GPU. On most VMs, you’ll see only CPU listed.
15
+
This command shows which hardware devices TensorFlow can use, such as CPU or GPU. On most VMs, you'll see only CPU listed:
27
16
28
17
```console
29
18
python -c "import tensorflow as tf; print(tf.config.list_physical_devices())"
title: Benchmark TensorFlow model performance using tf.keras
3
3
weight: 6
4
4
5
5
### FIXED, DO NOT MODIFY
6
6
layout: learningpathall
7
7
---
8
8
9
+
## Benchmark TensorFlow models
9
10
10
-
## TensorFlow Benchmarking with tf.keras
11
-
This guide benchmarks multiple TensorFlow models (ResNet50, MobileNetV2, and InceptionV3) using dummy input data. It measures average inference time and throughput for each model running on the CPU.
11
+
This section benchmarks multiple TensorFlow models (ResNet50, MobileNetV2, and InceptionV3) using dummy input data. You'll measure average inference time and throughput for each model running on the CPU.
12
12
13
-
`tf.keras` is **TensorFlow’s high-level API** for building, training, and benchmarking deep learning models. It provides access to **predefined architectures** such as **ResNet**, **MobileNet**, and **Inception**, making it easy to evaluate model performance on different hardware setups like **CPU**, **GPU**, or **TPU**.
13
+
tf.keras is TensorFlow's high-level API for building, training, and benchmarking deep learning models. It provides access to predefined architectures such as ResNet, MobileNet, and Inception, making it easy to evaluate model performance on different hardware setups.
14
14
15
-
### Activate your TensorFlow virtual environment
16
-
This step enables your isolated Python environment (`tf-venv`) where TensorFlow is installed. It ensures that all TensorFlow-related packages and dependencies run in a clean, controlled setup without affecting system-wide Python installations:
15
+
### Activate your virtual environment
16
+
17
+
Enable your isolated Python environment where TensorFlow is installed:
17
18
18
19
```console
19
20
source ~/tf-venv/bin/activate
20
21
python -c "import tensorflow as tf; print(tf.__version__)"
21
22
```
22
-
### Install required packages for the benchmark
23
-
Here, you install TensorFlow 2.20.0 and NumPy, the core libraries needed for model creation, computation, and benchmarking. NumPy supports efficient numerical operations, while TensorFlow handles deep learning workloads (these packages are likely already installed FYI):
23
+
24
+
This ensures that all TensorFlow-related packages run in a clean, controlled setup without affecting system-wide Python installations.
25
+
26
+
### Install required packages
27
+
28
+
Install TensorFlow and NumPy for model creation and benchmarking:
24
29
25
30
```console
26
31
pip install tensorflow==2.20.0 numpy
27
32
```
28
33
29
-
### Create a Python file named tf_cpu_benchmark.py:
30
-
This step creates a Python script (`tf_cpu_benchmark.py`) using your text editor (showing "edit" as an example below) that will run TensorFlow model benchmarking tests:
34
+
These packages are likely already installed from the previous installation steps. NumPy supports efficient numerical operations, while TensorFlow handles deep learning workloads.
31
35
32
-
```console
33
-
edit tf_cpu_benchmark.py
34
-
```
36
+
### Create the benchmark script
37
+
38
+
Use an editor to create a Python script named `tf_cpu_benchmark.py` that will run TensorFlow model benchmarking tests.
39
+
40
+
Add the following code to benchmark three different model architectures:
35
41
36
-
Paste the following code:
37
42
```python
38
43
import tensorflow as tf
39
44
import time
@@ -66,24 +71,19 @@ for name, constructor in models.items():
66
71
print(f"{name} average inference time per batch: {avg_time:.4f} seconds")
-**Import libraries** – Loads TensorFlow and `time` for model creation and timing.
70
-
-**Define models** – Lists three TensorFlow Keras models: **ResNet50**, **MobileNetV2**, and **InceptionV3**.
71
-
-**Set parameters** – Configures `batch_size = 32` and runs each model **50 times** for stable benchmarking.
72
-
-**Create model instances** – Initializes each model **without pretrained weights** for fair CPU testing.
73
-
-**Generate dummy input** – Creates random data shaped like real images **(224×224×3)** for inference.
74
-
-**Warm-up phase** – Runs one inference to **stabilize model graph and memory usage**.
75
-
-**Benchmark loop** – Measures total time for 50 runs and calculates **average inference time per batch**.
76
-
-**Compute throughput** – Calculates how many **images per second** the model can process.
77
-
-**Print results** – Displays **average inference time and throughput** for each model.
74
+
75
+
This script creates model instances without pretrained weights for fair CPU testing, generates random image data for inference, includes a warm-up phase to stabilize model performance, and measures inference time over 50 runs to calculate average performance and throughput.
78
76
79
77
### Run the benchmark
78
+
80
79
Execute the benchmarking script:
81
80
82
81
```console
83
82
python tf_cpu_benchmark.py
84
83
```
85
84
86
-
You should see an output similar to:
85
+
The output is similar to:
86
+
87
87
```output
88
88
Benchmarking ResNet50...
89
89
ResNet50 average inference time per batch: 1.2051 seconds
@@ -98,23 +98,18 @@ InceptionV3 average inference time per batch: 0.8971 seconds
98
98
InceptionV3 throughput: 35.67 images/sec
99
99
```
100
100
101
-
### Benchmark Metrics Explanation
101
+
### Understand the results
102
+
103
+
The benchmark provides key performance metrics. Average inference time per batch measures how long it takes to process one batch of input data, with lower values indicating faster performance. Throughput shows how many images the model can process per second, with higher values indicating better efficiency.
102
104
103
-
-**Average Inference Time per Batch (seconds):** Measures how long it takes to process one batch of input data. Lower values indicate faster inference performance.
104
-
-**Throughput (images/sec):** Indicates how many images the model can process per second. Higher throughput means better overall efficiency.
105
-
-**Model Type:** Refers to the neural network architecture used for testing (e.g., ResNet50, MobileNetV2, InceptionV3). Each model has different computational complexity.
105
+
### Performance summary
106
106
107
-
### Benchmark summary
108
-
Results from the earlier run on the `c4a-standard-4` (4 vCPU, 16 GB memory) Arm64 VM in GCP (SUSE):
107
+
The following table shows results from running the benchmark on a `c4a-standard-4` (4 vCPU, 16 GB memory) aarch64 VM in GCP using SUSE:
109
108
110
-
|**Model**|**Average Inference Time per Batch (seconds)**|**Throughput (images/sec)**|
-**Arm64 VMs show strong performance** for lightweight CNNs like **MobileNetV2**, achieving over **110 images/sec**, indicating excellent optimization for CPU-based inference.
117
-
-**Medium-depth models** like **InceptionV3** maintain a **balanced trade-off between accuracy and latency**, confirming consistent multi-core utilization on Arm.
118
-
-**Heavier architectures** such as **ResNet50** show expected longer inference times but still deliver **stable throughput**, reflecting good floating-point efficiency.
119
-
-**Arm64 provides energy-efficient yet competitive performance**, particularly for **mobile, quantized, or edge AI workloads**.
120
-
-**Overall**, Arm64 demonstrates that **TensorFlow workloads can run efficiently on cloud-native ARM processors**, making them a **cost-effective and power-efficient alternative** for AI inference and model prototyping.
115
+
The results demonstrate strong performance for lightweight CNNs like MobileNetV2, achieving over 110 images/sec on the aarch64 platform. Medium-depth models like InceptionV3 maintain balanced performance between accuracy and latency. Heavier architectures such as ResNet50 show longer inference times but deliver stable throughput, confirming that TensorFlow workloads run efficiently on Arm processors and provide a cost-effective alternative for AI inference tasks.
Copy file name to clipboardExpand all lines: content/learning-paths/servers-and-cloud-computing/tensorflow-gcp/installation.md
+27-19Lines changed: 27 additions & 19 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,45 +6,51 @@ weight: 4
6
6
layout: learningpathall
7
7
---
8
8
9
-
## TensorFlow Installation on GCP SUSE VM
10
-
TensorFlow is a widely used **open-source machine learning library** developed by Google, designed for building and deploying ML models efficiently. On Arm64 SUSE VMs, TensorFlow can run on CPU natively, or on GPU if available.
9
+
## Install TensorFlow on Google Axion C4A
11
10
12
-
### System Preparation
13
-
Update the system and install Python3 and pip3 to a compatible version with tensorflow (please enter "y" when prompted to confirm the install):
11
+
TensorFlow is an open-source machine learning library developed by Google for building and deploying ML models efficiently. On aarch64 SUSE VMs, TensorFlow runs natively on CPU or GPU if available.
12
+
13
+
### Update your system
14
+
15
+
Update the system and install Python 3.11 with pip and virtual environment support:
TensorFlow 2.18.0 introduced compatibility with NumPy 2.0, incorporating its updated type promotion rules and improved numerical precision.
62
-
You can view [this release note](https://blog.tensorflow.org/2024/10/whats-new-in-tensorflow-218.html)
67
+
TensorFlow 2.18.0 introduced compatibility with NumPy 2.0, incorporating its updated type promotion rules and improved numerical precision. You can review [What's new in TensorFlow 2.18](https://blog.tensorflow.org/2024/10/whats-new-in-tensorflow-218.html) for more information.
63
68
64
-
The [Arm Ecosystem Dashboard](https://developer.arm.com/ecosystem-dashboard/) recommends Tensorflow version 2.18.0, the minimum recommended on the Arm platforms.
69
+
The [Arm Ecosystem Dashboard](https://developer.arm.com/ecosystem-dashboard/) recommends TensorFlow version 2.18.0 as the minimum recommended version on Arm platforms.
65
70
{{% /notice %}}
66
71
67
-
### Verify installation:
68
-
Run a quick Python command to check that TensorFlow was installed successfully and print the installed version number for confirmation.
72
+
### Verify the installation
73
+
74
+
Check that TensorFlow installed successfully and display the version:
69
75
70
76
```console
71
77
python -c "import tensorflow as tf; print(tf.__version__)"
72
78
```
73
79
74
-
You should see an output similar to:
80
+
The output is similar to:
81
+
75
82
```output
76
83
2.20.0
77
84
```
78
-
TensorFlow installation is complete. You can now go ahead with the baseline testing of TensorFlow in the next section.
85
+
86
+
Your TensorFlow installation is now complete and ready for use.
0 commit comments