Who is this for?

This Learning Path is for beginner C++ developers who are looking to optimize applications on Arm-based cloud instances using compiler flags.

What will you learn?

Upon completion of this Learning Path, you will be able to:

  • Compile a C++ program for a specific Arm target.
  • Use compiler flags to manage optimizations.

Prerequisites

Before starting, you will need the following:

  • Basic understanding of C++
  • Basic understanding of compilers
  • Access to a Neoverse-based system running Ubuntu 24.04 LTS, such as an AWS Graviton-based instance or an Arm AGI CPU platform

Summary

AI-assisted

This summary was drafted with an approved AI-assisted workflow and reviewed by Arm contributors before publication. Human technical review remains part of the process so the final page reflects engineering rigor, accuracy, and Arm editorial standards.

Close
?
You’ll compile and tune a C++ application with g++ on an Arm Neoverse-based Linux system. You’ll inspect the CPU with lscpu, choose between -march for portability and -mcpu for processor-specific tuning, and consider size-sensitive container builds. You’ll build and run the example, then learn to make flag choices based on portability, binary size, and performance.

Frequently asked questions

AI-assisted

These FAQs were drafted with an approved AI-assisted workflow and reviewed by Arm contributors before publication. Human technical review remains part of the process so the final page reflects engineering rigor, accuracy, and Arm editorial standards.

Close
?
How do I confirm the Arm CPU model on the instance before choosing flags?
Run lscpu | grep -i model and look for a Model name line such as Neoverse-*. If lscpu omits the model name, use the tip in the step to read the CPU part number.
Which compiler flag should I use for portability versus CPU-specific tuning?
Use -march= with a value that matches the lowest Arm architecture across your target systems for portability. Use -mcpu= to tune for a specific processor when you plan to run only on that CPU.
Do I have to use an AWS Graviton 4-based instance?
No. Any Neoverse-based system running Ubuntu 24.04 LTS works, including the examples mentioned. The workflow assumes an Arm-native environment on such a system.
What should I do if I’m deploying in a memory-constrained container?
Optimize for size as outlined in the example step. Choose compiler options that reduce binary size and accept the trade-offs they introduce.
What result should I expect after building and running the example?
The program should compile and run on the Arm instance. A portable build using -march is intended to run on other Arm servers that meet that baseline, while a CPU-tuned build targets the specified processor.
Next