Skip to content

Commit 2bd2d49

Browse files
committed
Deploy TensorFlow on Google Cloud C4A (Arm-based Axion VMs)
Signed-off-by: odidev <[email protected]>
1 parent 4edd700 commit 2bd2d49

File tree

8 files changed

+614
-0
lines changed

8 files changed

+614
-0
lines changed
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
---
2+
title: Deploy TensorFlow on Google Cloud C4A (Arm-based Axion VMs)
3+
4+
minutes_to_complete: 30
5+
6+
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.
7+
8+
learning_objectives:
9+
- Provision an Arm-based SUSE SLES virtual machine on Google Cloud (C4A with Axion processors)
10+
- Install TensorFlow on a SUSE Arm64 (C4A) instance
11+
- Verify TensorFlow by running basic computation and model training tests on Arm64
12+
- Benchmark TensorFlow using the Phoronix Test Suite (PTS) to measure inference performance, model execution speed, and system efficiency on Arm64
13+
14+
prerequisites:
15+
- A [Google Cloud Platform (GCP)](https://cloud.google.com/free) account with billing enabled
16+
- Basic familiarity with [TensorFlow](https://www.tensorflow.org/)
17+
18+
author: Pareena Verma
19+
20+
##### Tags
21+
skilllevels: Introductory
22+
subjects: ML
23+
cloud_service_providers: Google Cloud
24+
25+
armips:
26+
- Neoverse
27+
28+
tools_software_languages:
29+
- TensorFlow
30+
- Python
31+
- Phoronix Test Suite (PTS)
32+
33+
operatingsystems:
34+
- Linux
35+
36+
# ================================================================================
37+
# FIXED, DO NOT MODIFY
38+
# ================================================================================
39+
further_reading:
40+
- resource:
41+
title: Google Cloud documentation
42+
link: https://cloud.google.com/docs
43+
type: documentation
44+
45+
- resource:
46+
title: TensorFlow documentation
47+
link: https://www.tensorflow.org/learn
48+
type: documentation
49+
50+
- resource:
51+
title: Phoronix Test Suite (PTS) documentation
52+
link: https://www.phoronix-test-suite.com/
53+
type: documentation
54+
55+
weight: 1
56+
layout: "learningpathall"
57+
learning_path_main_page: "yes"
58+
---
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
# ================================================================================
3+
# FIXED, DO NOT MODIFY THIS FILE
4+
# ================================================================================
5+
weight: 21 # Set to always be larger than the content in this path to be at the end of the navigation.
6+
title: "Next Steps" # Always the same, html page title.
7+
layout: "learningpathall" # All files under learning paths have this same wrapper for Hugo processing.
8+
---
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
---
2+
title: Getting started with TensorFlow on Google Axion C4A (Arm Neoverse-V2)
3+
4+
weight: 2
5+
6+
layout: "learningpathall"
7+
---
8+
9+
## Google Axion C4A Arm instances in Google Cloud
10+
11+
Google Axion C4A is a family of Arm-based virtual machines built on Google’s custom Axion CPU, which is based on Arm Neoverse-V2 cores. Designed for high-performance and energy-efficient computing, these virtual machines offer strong performance for modern cloud workloads such as CI/CD pipelines, microservices, media processing, and general-purpose applications.
12+
13+
The C4A series provides a cost-effective alternative to x86 virtual machines while leveraging the scalability and performance benefits of the Arm architecture in Google Cloud.
14+
15+
To learn more about Google Axion, refer to the [Introducing Google Axion Processors, our new Arm-based CPUs](https://cloud.google.com/blog/products/compute/introducing-googles-new-arm-based-cpu) blog.
16+
17+
## TensorFlow
18+
19+
[TensorFlow](https://www.tensorflow.org/) is an **open-source machine learning and deep learning framework** developed by **Google**. It helps developers and researchers **build, train, and deploy AI models** efficiently across **CPUs, GPUs, and TPUs**.
20+
21+
With support for **neural networks**, **natural language processing (NLP)**, and **computer vision**, TensorFlow is widely used for **AI research and production**.
22+
Its **flexibility** and **scalability** make it ideal for both **cloud** and **edge environments**.
23+
24+
To learn more, visit the [official TensorFlow website](https://www.tensorflow.org/).
Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
---
2+
title: TensorFlow Baseline Testing on Google Axion C4A Arm Virtual Machine
3+
weight: 5
4+
5+
### FIXED, DO NOT MODIFY
6+
layout: learningpathall
7+
---
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.
11+
12+
13+
### Verify Installation
14+
This command checks if TensorFlow is installed correctly and prints its version number.
15+
16+
```console
17+
python -c "import tensorflow as tf; print(tf.__version__)"
18+
```
19+
### List Available Devices
20+
This command shows which hardware devices TensorFlow can use — like CPU or GPU. On most VMs, you’ll see only CPU listed.
21+
22+
```console
23+
python -c "import tensorflow as tf; print(tf.config.list_physical_devices())"
24+
```
25+
26+
You should see an output similar to:
27+
```output
28+
[PhysicalDevice(name='/physical_device:CPU:0', device_type='CPU')]
29+
```
30+
31+
### Run a Simple Computation
32+
This test multiplies two large matrices to check that TensorFlow computations work correctly on your CPU and measures how long it takes.
33+
34+
```python
35+
python -c "import tensorflow as tf; import time;
36+
a = tf.random.uniform((1000,1000)); b = tf.random.uniform((1000,1000));
37+
start = time.time(); c = tf.matmul(a,b); end = time.time();
38+
print('Computation time:', end - start, 'seconds')"
39+
```
40+
- This checks **CPU speed** and the correctness of basic operations.
41+
- Note the **computation time** as your baseline.
42+
43+
You should see an output similar to:
44+
```output
45+
Computation time: 0.008263111114501953 seconds
46+
```
47+
### Test Neural Network Execution
48+
Create a new file for testing a simple neural network:
49+
50+
```console
51+
vi test_nn.py
52+
```
53+
This opens a new Python file where you’ll write a short TensorFlow test program.
54+
Paste the code below into the `test_nn.py` file:
55+
56+
```python
57+
import tensorflow as tf
58+
from tensorflow.keras.models import Sequential
59+
from tensorflow.keras.layers import Dense
60+
import numpy as np
61+
62+
# Dummy data
63+
x = np.random.rand(1000, 20)
64+
y = np.random.rand(1000, 1)
65+
66+
# Define the model
67+
model = Sequential([
68+
Dense(64, activation='relu', input_shape=(20,)),
69+
Dense(1)
70+
])
71+
72+
# Compile the model
73+
model.compile(optimizer='adam', loss='mse')
74+
75+
# Train for 1 epoch
76+
model.fit(x, y, epochs=1, batch_size=32)
77+
```
78+
This script creates and trains a simple neural network using random data — just to make sure TensorFlow’s deep learning functions work properly.
79+
80+
**Run the Script**
81+
82+
Execute the script with Python:
83+
84+
```console
85+
python test_nn.py
86+
```
87+
88+
**Output**
89+
90+
TensorFlow will print training progress, like:
91+
```output
92+
32/32 ━━━━━━━━━━━━━━━━━━━━ 0s 1ms/step - loss: 0.1024
93+
```
94+
95+
This confirms that TensorFlow is working properly on your Arm64 VM.

0 commit comments

Comments
 (0)