Skip to content

Commit 6977877

Browse files
Merge pull request #1519 from odincodeshen/main
Update the C++ project screenshots and revise the content.
2 parents dd1569f + 0327a96 commit 6977877

File tree

8 files changed

+17
-22
lines changed

8 files changed

+17
-22
lines changed

content/learning-paths/laptops-and-desktops/windows_armpl/1-first-vs-project.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ A new Command Prompt opens. It's the same as the regular Windows Command Prompt
8282
Run the command below with the executable you crated as an argument:
8383

8484
```cmd
85-
dumpbin /headers <your exe path>\hello-world-1.exe
85+
dumpbin /headers <your exe path>\ConsoleApp1.exe
8686
```
8787

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

content/learning-paths/laptops-and-desktops/windows_armpl/3-apt-enhancement.md

Lines changed: 16 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ You need to configure two places in your Visual Studio project:
5050
4. Click on the dropdown menu. Select `<Edit...>`
5151
5. In the dialog that opens, click the `New Line` icon to add Arm Performance Libraries `library` path.
5252

53-
![img10](./figures/linker_lib.png)
53+
![img11](./figures/linker_lib.png)
5454

5555

5656
{{% notice Note %}}
@@ -64,7 +64,10 @@ You are now ready to use Arm Performance Libraries in your project.
6464

6565
Open the source code file `SpinTheCubeInGDI.cpp` and search for the `_USE_ARMPL_DEFINES` definition.
6666

67-
Removing the comment will enable the Arm Performance Libraries feature.
67+
You should see a commented-out definition on line 13 of the program. Removing the comment will enable the Arm Performance Libraries feature when you re-build the application.
68+
69+
![img12](./figures/apl_define.png)
70+
6871

6972
When variable useAPL is True, the application will call `applyRotationBLAS()` instead of the multithreading code to apply the rotation matrix to the 3D vertices.
7073

@@ -73,22 +76,9 @@ The code is below:
7376
```c++
7477
void RotateCube(int numCores)
7578
{
76-
rotationAngle += 0.00001;
77-
if (rotationAngle > 2 * M_PI)
78-
{
79-
rotationAngle -= 2 * M_PI;
80-
}
81-
82-
// rotate around Z and Y
83-
rotationInX[0] = cos(rotationAngle) * cos(rotationAngle);
84-
rotationInX[1] = -sin(rotationAngle);
85-
rotationInX[2] = cos(rotationAngle) * sin(rotationAngle);
86-
rotationInX[3] = sin(rotationAngle) * cos(rotationAngle);
87-
rotationInX[4] = cos(rotationAngle);
88-
rotationInX[5] = sin(rotationAngle) * sin(rotationAngle);
89-
rotationInX[6] = -sin(rotationAngle);
90-
rotationInX[7] = 0;
91-
rotationInX[8] = cos(rotationAngle);
79+
//
80+
//
81+
//
9282

9383
if (useAPL)
9484
{
@@ -116,22 +106,27 @@ Here is the code used to compute rotation with BLAS:
116106
```c++
117107
void applyRotationBLAS(std::vector<double>& shape, const std::vector<double>& rotMatrix)
118108
{
109+
119110
EnterCriticalSection(&cubeDraw[0]);
111+
120112
#if defined(_M_ARM64) && defined(_USE_ARMPL_DEFINES)
121113
// Call the BLAS matrix mult for doubles.
122114
// Multiplies each of the 3d points in shape
123115
// list with rotation matrix, and applies scale
124116
cblas_dgemm(CblasRowMajor, CblasNoTrans, CblasNoTrans, (int)shape.size() / 3, 3, 3, scale, shape.data(), 3, rotMatrix.data(), 3, 0.0, drawSphereVertecies.data(), 3);
125117
#endif
118+
126119
LeaveCriticalSection(&cubeDraw[0]);
127120
}
128121
```
129122

130123
## Build and run the application
131124

132-
Rebuild the code and run `SpinTheCubeInGDI.exe` again.
125+
Rebuild the code and run `SpinTheCubeInGDI.exe` again.
126+
127+
Click on the "Options" menu in the top left corner of the program, then select "Use APL" to utilize Option 2.
133128

134-
With option 2 you see an increased Frame Rate.
129+
![img13](./figures/use_apl.png)
135130

136131
On the Lenovo X13s, the performance is between 11k and 12k FPS.
137132

@@ -141,7 +136,7 @@ Re-run the profiling tools.
141136

142137
You see that the CPU usage has decreased significantly. There is no difference in memory usage.
143138

144-
![img11](./figures/apl_on_cpu_mem_usage.png)
139+
![img14](./figures/apl_on_cpu_mem_usage.png)
145140

146141

147142
You have learned how to improve application performance using Arm Performance Libraries.
76.1 KB
Loading
33.3 KB
Loading
59.3 KB
Loading
-15 KB
Loading
17.1 KB
Loading
-2.39 KB
Loading

0 commit comments

Comments
 (0)