Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I[Idea/Question] Cross-compile a bench test to run on a remote target? #736

Open
RaulTrombin opened this issue Oct 25, 2023 · 2 comments
Open

Comments

@RaulTrombin
Copy link

I'm using criterion to run bench on a raspberry pi4 target, but compile it from zero there takes 21 minutes.
Someone already tryed to cross compile the required stuff and then execute from the target?

@stexa
Copy link

stexa commented Apr 25, 2024

Hey!
Yes I just did it, so I will explain you how:

  1. I use cross to cross compile the project.
  2. For Raspberry Pi I compile the benchmark with
cross bench --target aarch64-unknown-linux-gnu
  1. The benchmark will run now in the docker container, so ignore the printed results. But the benchmark will print which binary it runs, for me it looks like this
/target/aarch64-unknown-linux-gnu/release/deps/my_bench-7dfs8993ds789 --bench
  1. now copy the binary on your raspberry pi eg. with scp
scp /target/aarch64-unknown-linux-gnu/release/deps/my_bench-7dfs8993ds789 pi@<ip_address>:/home/pi/my_bench
  1. ssh onto the pi and run the benchmark
./my_bench --bench

(You could also specify the target CPU to eventually speed things up, just put before cross bench ...: RUSTFLAGS='-C target-cpu=cortex-a72')

@RaulTrombin
Copy link
Author

@stexa thks! Will try this on my runners,
I also found a --no-run option for cargo bench docs, will try mix both and see if it works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants