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: README.md
+17-2Lines changed: 17 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,7 +6,8 @@ Additionally, this Rust library demonstrates detecting support for SIMD instruct
6
6
You can find more information in the following blog posts:
7
7
8
8
-[Compiling Rust libraries for Android apps: a deep dive](https://gendignoux.com/blog/2022/10/24/rust-library-android.html),
9
-
-[Detecting SIMD support on ARM with Android (and patching the Rust compiler for it)](https://gendignoux.com/blog/2022/11/09/rust-simd-detect-arm-android.md).
9
+
-[Detecting SIMD support on ARM with Android (and patching the Rust compiler for it)](https://gendignoux.com/blog/2022/11/09/rust-simd-detect-arm-android.md),
10
+
-[Testing SIMD instructions on ARM with Rust on Android](https://gendignoux.com/blog/2023/01/05/rust-arm-simd-android.html).
10
11
11
12
## Usage
12
13
@@ -16,6 +17,8 @@ To build a Docker container containing all the build tools and the demo applicat
16
17
$ sudo ./docker-build.sh
17
18
```
18
19
20
+
### Building and running the demo Android application
21
+
19
22
You can then launch this Docker container to build the application.
20
23
This comes in various configurations:
21
24
@@ -35,6 +38,7 @@ You can build various flavors of the Rust library.
35
38
-`script-rust-nightly-nostrip.sh`: same, but without stripping debug symbols.
36
39
-`script-rust-stage1.sh` and `script-rust-stage1-nostrip.sh`: using a locally built `stage1` Rust compiler (see below).
37
40
-`script-rust-default.sh` and `script-rust-default-nostrip.sh`: using the default Rust toolchain (stable).
41
+
-`script-relinked.sh`: more advanced library, which bundles another library linked twice (see the corresponding [blog post](https://gendignoux.com/blog/2023/01/05/rust-arm-simd-android.html#mixing-dynamic-and-static-detection-re-linking-a-dependency)).
38
42
39
43
Then, multiple ways are provided to build the Java part of the Android app.
40
44
@@ -44,7 +48,7 @@ Then, multiple ways are provided to build the Java part of the Android app.
44
48
45
49
You can then spawn an Android emulator with `emulator.sh`, and use the `launch-app-debug.sh` or `launch-app-release.sh` scripts to install+launch the application via ADB to either the emulator or a real device connected via USB.
46
50
47
-
## Building and using a patched Rust compiler
51
+
###Building and using a patched Rust compiler
48
52
49
53
This repository also shows how to patch and build the Rust compiler.
50
54
You can launch the Docker container in various scenarios:
@@ -65,3 +69,14 @@ You'll also find the following tool to generate a flame graph of the disk space
65
69
66
70
-`tools/flamedisk`: small Rust tool to generate an input suitable for `flamegraph.pl`,
67
71
-`scripts/flamedisk.sh`: driver script to generate the flame graph.
72
+
73
+
### Running unit tests and benchmarks on an Android device
74
+
75
+
This repository shows how to run Rust unit tests and benchmarks directly on an attached Android device (physical device via USB or emulator), without using a full Android application.
76
+
The `android-runner.sh` script tells Cargo how to do that.
77
+
78
+
Within the Docker container, you can run the following benchmarks:
79
+
80
+
-`bench.sh`: demo application, located in `src/android-simd`,
81
+
-`bench-haraka.sh`: my implementation of the Haraka hash function (https://github.com/gendx/haraka-rs),
82
+
-`bench-horcrux.sh`: my implementation of Shamir's Secret Sharing (https://github.com/gendx/horcrux).
0 commit comments