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

CI: Setup self-hosted GitHub Actions runner #455

Closed
henrybear327 opened this issue Jun 10, 2024 · 6 comments
Closed

CI: Setup self-hosted GitHub Actions runner #455

henrybear327 opened this issue Jun 10, 2024 · 6 comments
Assignees

Comments

@henrybear327
Copy link
Collaborator

Recently we discovered that the benchmarking numbers dropped significantly.

To resolve the problem in the long run, we would like to set up a self-hosted Github runner [1] on node11.

The self-hosted runner will only be dedicated to running the benchmarking pipeline [2], reducing the network bandwidth requirement as there is currently a restriction on the network that node11 is hosted.

References:
[1] https://docs.github.com/en/actions/hosting-your-own-runners/managing-self-hosted-runners/about-self-hosted-runners
[2] https://docs.github.com/en/actions/hosting-your-own-runners/managing-self-hosted-runners/using-labels-with-self-hosted-runners

@henrybear327 henrybear327 self-assigned this Jun 10, 2024
@henrybear327
Copy link
Collaborator Author

@jserv I probably need temporary access to the repo setting for setting up the GitHub action runner. Or, I can set up the self-hosted runner in my private repo and send over the step-by-step guide here so you can apply it!

@jserv
Copy link
Contributor

jserv commented Jun 10, 2024

@jserv I probably need temporary access to the repo setting for setting up the GitHub action runner. Or, I can set up the self-hosted runner in my private repo and send over the step-by-step guide here so you can apply it!

Let's stick to the latter.

@jserv jserv changed the title Setup self-hosted Github action runner CI: Setup self-hosted GitHub Actions runner Jun 10, 2024
@henrybear327
Copy link
Collaborator Author

henrybear327 commented Jun 12, 2024

After investigation by bisecting the code, the issue is caused by this commit #360

henry@node11:~/rv32emu$ git bisect log
git bisect start
# good: [13a653138ddffc73f231ee92a33b0cce74423309] Merge pull request #393 from ChinYikMing/sha1
git bisect good 13a653138ddffc73f231ee92a33b0cce74423309
# bad: [dd9fccae11e7ea3d208694901456b000629deebb] Merge pull request #425 from qwe661234/Add_LLVM_T2C
git bisect bad dd9fccae11e7ea3d208694901456b000629deebb
# good: [6d459594eba7531bdb5ae6581d9ad4853b2def83] Merge pull request #424 from visitorckw/optimize-ci-efficiency
git bisect good 6d459594eba7531bdb5ae6581d9ad4853b2def83
# bad: [a8aa29eed782318f80320c242c0944e8fe624b70] Fix the microsecond-to-nanosecond conversion (#360)
git bisect bad a8aa29eed782318f80320c242c0944e8fe624b70
# good: [9fdbcec3c72161677bbce7b1fcba6ebda7c44961] Fix syscall lseek() to return correct offset
git bisect good 9fdbcec3c72161677bbce7b1fcba6ebda7c44961
# good: [da034acc6b9e5190ea0660edb9d9c9c61833bb5e] Merge pull request #436 from visitorckw/optimize-write
git bisect good da034acc6b9e5190ea0660edb9d9c9c61833bb5e
# good: [51970e7c20445c0b1ec74ec2c553189e36306592] Correctly update the information of hotspot
git bisect good 51970e7c20445c0b1ec74ec2c553189e36306592
# good: [b8e20f69788d4ad127c6fce8df3d77d57aedbe05] Fix typo (#442)
git bisect good b8e20f69788d4ad127c6fce8df3d77d57aedbe05
# first bad commit: [a8aa29eed782318f80320c242c0944e8fe624b70] Fix the microsecond-to-nanosecond conversion (#360)

a8aa29eed782318f80320c242c0944e8fe624b70 is the first bad commit
commit a8aa29eed782318f80320c242c0944e8fe624b70
Author: Alan Jian <alanjian85@outlook.com>
Date:   Wed May 22 01:58:11 2024 +0800

    Fix the microsecond-to-nanosecond conversion (#360)
    
    A microsecond is 1000 times bigger than a nanosecond (1e-6 vs 1e-9 seconds).
    This commit corrects the conversion of microseconds to nanoseconds in
    rv_clock_gettime() by multiplying tv_usec by 1000 instead of dividing it.

 src/utils.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

My current guess is that the binaries we used for benchmarking aren't recompiled, causing the time calculation to be wrong.

@jserv
Copy link
Contributor

jserv commented Jun 13, 2024

My current guess is that the binaries we used for benchmarking aren't recompiled, causing the time calculation to be wrong.

Yes, we should recompile the benchmark programs with newer GNU Toolchain, otherwise we would fail to measure.

@henrybear327
Copy link
Collaborator Author

My current guess is that the binaries we used for benchmarking aren't recompiled, causing the time calculation to be wrong.

Yes, we should recompile the benchmark programs with newer GNU Toolchain, otherwise we would fail to measure.

I will close this issue and create a new one since the action item has nothing to do with #455 anymore.

@henrybear327
Copy link
Collaborator Author

For future reference, to install GitHub runners on node11, we just need to follow the steps listed here.

Registration token

Steps for obtaining Github runner registration token

  1. Visit this link
  2. Click on Add new self-hosted runner, you can see the --token in one of the steps

Node11 setup using Dockerfile

These are just the steps I took to create containerized Github runners for quick experimentation. Maybe there is a better way.

  • create a dockerfile
FROM ghcr.io/actions/actions-runner:2.317.0

ARG GITHUB_RUNNER_REGISTRATION_TOKEN

RUN sudo apt-get update && \
    sudo apt-get install -y \
    git build-essential python3-pip libsdl2-dev libsdl2-mixer-dev && \
    sudo rm -rf /var/lib/apt/lists/*

RUN ./config.sh --url https://github.com/sysprog21/rv32emu --token $GITHUB_RUNNER_REGISTRATION_TOKEN --unattended --labels node11

ENTRYPOINT ["./run.sh"]
  • build the image docker build -t github-runner-node11:2.317 --build-arg GITHUB_RUNNER_REGISTRATION_TOKEN=xxx -f Dockerfile-Github-Runner-node11 .
    • Make sure that all the necessary packages are installed in the Dockerfile
  • run it (can't have several running instances unless you assign each of them a unique name!) docker run -d github-runner-node11:2.317

Development note

https://hackmd.io/@henrybear327/SkaBTJwSA

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