Skip to content

Commit 569b05b

Browse files
Merge pull request #1569 from madeline-underwood/Win-Arm-Perf-Lib
Win arm perf lib_AP to approve
2 parents a693b35 + e3c73b9 commit 569b05b

File tree

6 files changed

+156
-129
lines changed

6 files changed

+156
-129
lines changed
Lines changed: 33 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,29 @@
11
---
2-
title: Create your first Windows on Arm application using Microsoft Visual Studio
3-
weight: 2
2+
title: Create and Run a Windows on Arm application
3+
weight: 3
44

55
### FIXED, DO NOT MODIFY
66
layout: learningpathall
77
---
8+
## Create and configure a project
89

9-
## Install Microsoft Visual Studio
10+
You are now ready to create a Windows on Arm application. For your first project, you will create a simple console application.
1011

11-
Visual Studio 2022, Microsoft's Integrated Development Environment (IDE), empowers developers to build high-performance applications for the Arm architecture.
12+
The next steps will guide you through how to create and configure your project.
1213

13-
You can learn more about [Visual Studio on Arm-powered devices](https://learn.microsoft.com/en-us/visualstudio/install/visual-studio-on-arm-devices?view=vs-2022) from Microsoft Learn.
14+
Begin by going to the **Start** window, and selecting **Create a new project**. See Figure 1.
1415

15-
Visual Studio 2022 offers different editions tailored to various development needs:
16-
- Community: A free, fully-featured edition ideal for students, open-source contributors, and individual developers.
17-
- Professional: Offers professional developer tools, services, and subscription benefits for small teams.
18-
- Enterprise: Provides the most comprehensive set of tools and services for large teams and enterprise-level development.
16+
![vs_new_proj1.png alt-text#center](./figures/vs_new_proj1.png "Figure 1: Create a new project.")
1917

20-
To select the best edition for you, refer to [Compare Visual Studio 2022 Editions](https://visualstudio.microsoft.com/vs/compare/).
18+
Then, in **Configure your new project**, do the following:
2119

22-
{{% notice Note %}}
23-
This Learning Path uses Visual Studio Community, but you can also use other editions.
24-
{{% /notice %}}
20+
* Select **Console App**.
21+
* Provide a project name, such as `ConsoleApp1`, as Figure 2 shows.
22+
* Click **Create**.
2523

26-
Download and install Visual Studio using the [Visual Studio for Windows on Arm](/install-guides/vs-woa/) install guide. Make sure to install C and C++ support and the LLVM compiler.
24+
![img2 alt-text#center](./figures/vs_new_proj2.png "Figure 2: Configure your new project.")
2725

28-
## Create a sample project
29-
30-
You are ready to create a sample Windows on Arm application.
31-
32-
To keep the example clear and concise, you can create a simple console application.
33-
34-
On the start window, click `Create a new project`.
35-
36-
![img1](./figures/vs_new_proj1.png)
37-
38-
In the `Create a new project` window, select `Console App`, provide a project name, such as `hello-world-1`, and then click `Next`.
39-
40-
![img2](./figures/vs_new_proj2.png)
41-
42-
After the project is created, you will see a line of `Hello, world!` code in the newly created C++ file.
26+
After you have created the project, you will see a line of code that says `Hello, World!` in the newly-created C++ file.
4327

4428
```C++
4529
#include <iostream>
@@ -50,43 +34,47 @@ int main()
5034
}
5135
```
5236

53-
Microsoft Visual Studio automatically configures the build environment for the current hardware's CPU architecture. However, you can still familiarize ourselves with the relevant settings.
37+
Whilst Microsoft Visual Studio automatically configures the build environment for the hardware of the CPU architecture, you still benefit from familiarizing yourself with the relevant configuration settings. So continue to learn more about how to get set up.
5438

55-
## ARM64 Configuration Setting
39+
## ARM64 Configuration Settings
5640

57-
Click the `Debug` drop down and select `Configuration Manager...`
41+
Now click on the **Debug** drop-down menu, and select **Configuration Manager...**
5842

59-
![img4](./figures/vs_console_config1.png)
43+
![img4 alt-text#center](./figures/vs_console_config1.png "Figure 3: Select Configuration Manager.")
6044

6145

62-
In the `Project contexts` area you see the platform set to `ARM64`.
46+
In the **Project contexts** area, you will see the platform set to `ARM64`, as Figure 4 shows.
6347

64-
![img5](./figures/vs_console_config2.png)
48+
![img5 alt-text#center](./figures/vs_console_config2.png "Figure 4: Project Contexts Menu.")
6549

66-
Click `Build -> Build Solution` and your application compiles successfully.
50+
Now click **Build**, then **Build Solution**, and your application will compile.
6751

6852
## Run your first Windows on Arm application
6953

70-
Use the green arrow to run the program you just compiled, and you'll see the print statement from your code correctly executed in the console.
54+
Use the green arrow to run the program you compiled, and you will see the print statement from your code correctly executed in the console.
55+
56+
![img6 alt-text#center](./figures/vs_console_exe.png "Figure 5: The Console.")
7157

72-
![img6](./figures/vs_console_exe.png)
58+
You can also use the tools that Visual Studio provides to check the compiled executable.
7359

74-
You can also use the tools provided by Visual Studio to check the compiled executable.
60+
Visual Studio includes the command-line tool [dumpbin](https://learn.microsoft.com/en-us/cpp/build/reference/dumpbin-reference?view=msvc-170), and you can use it to analyze binary files such as:
7561

76-
The [dumpbin](https://learn.microsoft.com/en-us/cpp/build/reference/dumpbin-reference?view=msvc-170) command-line tool is included with Microsoft Visual Studio. It's used to analyze binary files like executable files (.exe), object files (.obj), and dynamic-link libraries (.dll).
62+
* Executable files (.exe).
63+
* Object files (.obj).
64+
* Dynamic-link libraries (.dll).
7765

78-
To use `dumpbin` open a Command Prompt with Visual Studio configured by opening Windows search, and looking for `Arm64 Native Tools Command Prompt for VS 2022`. Find and open this application.
66+
To use `dumpbin`, open a command prompt with Visual Studio configured by opening Windows search, and then looking for `Arm64 Native Tools Command Prompt for VS 2022`. Once you have found this application, open it.
7967

80-
A new Command Prompt opens. It's the same as the regular Windows Command Prompt with the addition that Visual Studio tools can be run from the prompt.
68+
A new command prompt opens. It is the same as the regular Windows command prompt, but with the added benefit that you can run Visual Studio tools.
8169

82-
Run the command below with the executable you crated as an argument:
70+
Run the command below, replacing the text with the details of the executable that you created as an argument:
8371

8472
```cmd
8573
dumpbin /headers <your exe path>\ConsoleApp1.exe
8674
```
8775

8876
You can see that the file format shows `AA64 machine (ARM64)` in the file header.
8977

90-
![img7](./figures/vs_checkmachine.jpeg)
78+
![img7 alt-text#center](./figures/vs_checkmachine.jpeg "Figure 6: AA64 Machine in File Header.")
9179

92-
Continue to the next page to build and run a more computation intensive application.
80+
Continue to the next page to get set up with Git before you move on to build and run a more computationally-intensive application.
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
---
2+
title: Before you begin
3+
weight: 2
4+
5+
### FIXED, DO NOT MODIFY
6+
layout: learningpathall
7+
---
8+
9+
## Get set up with Microsoft Visual Studio
10+
11+
Visual Studio 2022 is an Integrated Development Environment (IDE) developed by Microsoft that empowers developers to build high-performance applications for the Arm architecture.
12+
13+
You can learn more about [Microsoft Visual Studio on Arm-powered devices](https://learn.microsoft.com/en-us/visualstudio/install/visual-studio-on-arm-devices?view=vs-2022) from the Microsoft Learn website.
14+
15+
There are three editions of Visual Studio 2022 that are tailored to various development needs:
16+
- Community Edition is a free, fully-featured edition ideal for students, open source contributors, and individual developers.
17+
- Professional Edition offers professional developer tools, services, and subscription benefits for small teams.
18+
- Enterprise Edition provides the most comprehensive set of tools and services for large teams and enterprise-level development.
19+
20+
To establish which edition is best-suited to your needs, see [Compare Visual Studio 2022 Editions](https://visualstudio.microsoft.com/vs/compare/).
21+
22+
{{% notice Note %}}
23+
This Learning Path uses the Community Edition of Visual Studio 2022, but you can also use other editions.
24+
{{% /notice %}}
25+
26+
Download and install Visual Studio using the [Visual Studio for Windows on Arm](/install-guides/vs-woa/) install guide.
27+
28+
Make sure you install C and C++ support, and the LLVM compiler.
29+

content/learning-paths/laptops-and-desktops/windows_armpl/2-multithreading.md

Lines changed: 32 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,62 +1,46 @@
11
---
2-
title: Build a simple numerical application and profile the performance
3-
weight: 3
2+
title: Build and Profile an Application with Spin the Cube and Visual Studio
3+
weight: 5
44

55
### FIXED, DO NOT MODIFY
66
layout: learningpathall
77
---
8+
## Get started with Spin the Cube
89

9-
## Install Git for Windows on Arm
10+
In Windows File Explorer, double-click **SpinTheCubeInGDI.sln** to open the project in Visual Studio.
1011

11-
This section uses an example application from GitHub to demonstrate the use of Arm Performance Libraries.
12+
The source file **SpinTheCubeInGDI.cpp** will then implement a spinning cube.
1213

13-
Start by installing Git using the [Git install guide](/install-guides/git-woa/) for Windows on Arm.
14-
15-
## Clone the example from GitHub
16-
17-
The example application renders a rotating 3D cube to perform the calculations on different programming options.
18-
19-
First, navigate to an empty directory and clone the example repository from GitHub:
20-
21-
```cmd
22-
git clone https://github.com/odincodeshen/SpinTheCubeInGDI.git
23-
```
24-
25-
{{% notice Note %}}
26-
The example repository is forked from the [original GitHub repository](https://github.com/marcpems/SpinTheCubeInGDI) and some minor modifications have been made to aid learning.
27-
{{% /notice %}}
28-
29-
## Spin the cube introduction
30-
31-
In Windows File Explorer, double-click `SpinTheCubeInGDI.sln` to open the project in Visual Studio.
32-
33-
The source file `SpinTheCubeInGDI.cpp` implements a spinning cube.
34-
35-
The four key components are:
36-
- Shape Generation: Generates the vertices for a sphere using a golden ratio-based algorithm.
37-
- Rotation Calculation:
38-
The application uses a rotation matrix to rotate the 3D shape around the X, Y, and Z axes. The rotation angle is incremented over time, creating the animation.
39-
- Drawing: The application draws the transformed vertices of the shapes on the screen, using a Windows API.
40-
- Performance Measurement: The code measures and displays the number of transforms per second.
14+
The four key components of the application are:
15+
16+
- Shape generation: the application generates the vertices for a sphere using a golden ratio-based algorithm.
17+
18+
- Rotation calculation: the application uses a rotation matrix to rotate the 3D shape around the X, Y, and Z axes. The rotation angle is incremented over time, creating the animation.
19+
20+
- Drawing: the application draws the transformed vertices of the shapes on the screen, using a Windows API.
21+
22+
- Performance measurement: the code measures and displays the number of transforms per second.
4123

4224
The code has two options to calculate the rotation:
4325

44-
1. Multithreading: The application utilizes multithreading to improve performance by distributing the rotation calculations across multiple threads.
45-
2. Arm Performance Libraries: The application utilizes optimized math library functions for the rotation calculations.
26+
1. Multithreading: the application utilizes multithreading to improve performance by distributing the rotation calculations across multiple threads.
27+
2. Arm Performance Libraries: the application utilizes optimized math library functions for the rotation calculations.
4628

4729
Option 1 is explained below and option 2 is explained on the next page. By trying both methods you can compare and contrast the code and the performance.
4830

4931
## Option 1: Multithreading
5032

51-
One way to speed up the rotation calculations is to use multithreading.
33+
One way that you can speed up the rotation calculations is to use multithreading.
5234

5335
The multithreading implementation option involves two functions:
5436

55-
- The `CalcThreadProc()` function
37+
- The `CalcThreadProc()` function:
5638

5739
This function is the entry point for each calculation thread. Each calculation thread waits on its semaphore in `semaphoreList`.
5840

59-
When a thread receives a signal, it calls `applyRotation()` to transform its assigned vertices. The updated vertices are stored in the `drawSphereVertecies` vector. The code is shown below:
41+
When a thread receives a signal, it calls `applyRotation()` to transform its assigned vertices. The updated vertices are stored in the `drawSphereVertecies` vector.
42+
43+
The code is shown below:
6044

6145
```c++
6246
DWORD WINAPI CalcThreadProc(LPVOID data)
@@ -76,7 +60,7 @@ The multithreading implementation option involves two functions:
7660
applyRotation(UseCube ? cubeVertices : sphereVertices, rotationInX, threadNum * pointStride, pointStride);
7761
LeaveCriticalSection(&cubeDraw[threadNum]);
7862

79-
// set a semaphore to say we are done
63+
// set a semaphore to say you are done
8064
ReleaseSemaphore(doneList[threadNum], 1, NULL);
8165
}
8266

@@ -106,7 +90,7 @@ The multithreading implementation option involves two functions:
10690
{
10791
counter++;
10892

109-
// take the next three values for a 3d point
93+
// take the next three values for a 3D point
11094
refx = *point; point++;
11195
refy = *point; point++;
11296
refz = *point; point++;
@@ -129,21 +113,23 @@ The multithreading implementation option involves two functions:
129113

130114
## Build and run the application
131115

132-
After gaining a general understanding of the project, you can compile and run it.
116+
After grasping a basic understanding of the project, you can compile and run it.
133117

134-
Build the project, and run `SpinTheCubeInGDI.exe`
118+
Build the project and run `SpinTheCubeInGDI.exe`.
135119

136120
You will see a simulated 3D sphere continuously rotating.
137121

138-
The number in application represents the number of frames per second (FPS). A higher number indicates better performance.
122+
The number in the application represents the number of Frames Per Second (FPS).
123+
124+
A higher number indicates more frames per second, which indicates improved performance.
139125

140-
![gif1](./figures/multithreading.gif)
126+
![gif1 alt-text#center](./figures/multithreading.gif "Figure 7: Spin The Cube Simulated 3D Sphere.")
141127

142-
Performance varies across various Windows on Arm computers, but on the Lenovo X13s the performance generally falls between 3k and 6k FPS.
128+
Performance varies across different Windows on Arm computers, but on the Lenovo X13s specifically, the performance generally falls between 3K and 6K FPS.
143129

144130

145131
You can use the [Visual Studio profiling tools](https://learn.microsoft.com/en-us/visualstudio/profiling/profiling-feature-tour?view=vs-2022) to observe the dynamic CPU and memory usage while the program is running.
146132

147-
![img8](./figures/mt_cpumem_usage1.png)
133+
![img8 alt-text#center](./figures/mt_cpumem_usage1.png "Figure 8: Using Visual Studio Profiling Tools.")
148134

149-
Continue to the next section to learn how to improve performance using Arm Performance Libraries.
135+
Continue learning to find out how you can optimize performance using Arm Performance Libraries.
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
---
2+
title: Git setup
3+
weight: 4
4+
5+
### FIXED, DO NOT MODIFY
6+
layout: learningpathall
7+
---
8+
9+
## Install Git for Windows on Arm
10+
11+
This section uses an example application from GitHub to demonstrate the use of Arm Performance Libraries.
12+
13+
If you don't already have Git installed, start by installing Git using the [Git Install Guide](/install-guides/git-woa/) for Windows on Arm.
14+
15+
## Clone the Example from GitHub
16+
17+
The example application renders a rotating 3D cube to perform the calculations using different programming options.
18+
19+
First, navigate to an empty directory, and clone the repository containing the example from GitHub:
20+
21+
```cmd
22+
git clone https://github.com/odincodeshen/SpinTheCubeInGDI.git
23+
```
24+
25+
{{% notice Note %}}
26+
The repository containing the example is forked from the [original GitHub repository for Spin the Cube](https://github.com/marcpems/SpinTheCubeInGDI) with some modifications for demonstration purposes.
27+
{{% /notice %}}
28+

0 commit comments

Comments
 (0)