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

arm64アーキテクチャに対応したい #1691

Closed
inductor opened this issue Nov 24, 2022 · 7 comments
Closed

arm64アーキテクチャに対応したい #1691

inductor opened this issue Nov 24, 2022 · 7 comments
Assignees

Comments

@inductor
Copy link
Member

No description provided.

@jacopen
Copy link
Collaborator

jacopen commented Jan 15, 2023

Dk自体はARM対応済み
ActionsでのImage buildがめっちゃ時間かかる問題があるので、

  • CodeBuildを使うようにする
  • ActionsがARM対応した噂もある?

@takaishi
Copy link
Contributor

Arm Virtual Hardware というのがあるらしい https://www.hsbt.org/diary/20230106.html#p03

@ShotaKitazawa
Copy link
Member

ShotaKitazawa commented Feb 26, 2023

構築手順

  • 事前に VPC, Subnet, InternetGateway を用意する
  • この CF template を利用して、以下のリソースを作成
    • AWS::S3::Bucket
    • AWS::IAM::Role
    • AWS::IAM::InstanceProfile
    • AWS::IAM::OIDCProvider (今回は利用しない)
    • AWS::EC2::SecurityGroup
  • 以下の環境変数を export
    export AWS_ACCESS_KEY_ID='XXX'
    export AWS_SECRET_ACCESS_KEY='XXX'
    export AWS_IAM_PROFILE='Proj-AVHInstanceRole'
    export AWS_DEFAULT_REGION='ap-northeast-1'
    export AWS_S3_BUCKET_NAME='CF stack 作成時に指定した名前'
    export AWS_SECURITY_GROUP_ID='CF stack から作られた sg id を指定'
    export AWS_SUBNET_ID='事前に作成済みの subnet id'
    
    #export AWS_KEEP_EC2_INSTANCES=false
    #export AWS_INSTANCE_TYPE=t2.micro
  • avhclient のインストール (pipenv を利用する場合)
    # v0.1.9 以下でないと ACCESS_KEY/SECRET_ACCESS_KEY を利用できないらしいのでバージョン指定必須
    pipenv install git+https://github.com/ARM-software/[email protected]#egg=arm-avhclient

動作確認

  • setup 処理で 4min かかることを確認
$ time pipenv run avhclient -b aws --instance-name kanata-test-20230225 execute --specfile ./avh.yml
[INFO]  avh:aws backend selected!
[INFO]
[INFO]  Preparing instance...
[INFO]  ================================================================================
[WARNING]       aws:AWS_SESSION_TOKEN environment variable not present!
[INFO]  Found credentials in environment variables.
[INFO]  aws:Selecting AMI version 1.3.1, AMI ID ami-0204b07f382c9f9ac
[INFO]  aws:Backend successfully initialized!
[INFO]  aws:Creating EC2 instance...
[INFO]  aws:EC2 instance i-07c92ea98c539b9fb created!
[INFO]  aws:Setting up the instance...
[INFO]  aws:Setting up instance workspace...
[INFO]
[INFO]  Uploading workspace...
[INFO]  ================================================================================
avh.yml
Pipfile.lock
Pipfile
env.txt
[INFO]
[INFO]  Executing...
[INFO]  ================================================================================
[INFO]  ================================================================================
[INFO]  aws:send_remote_command:CommandId = 49ce43bf-961e-4c40-91b9-b0bc25ea016f
[INFO]  aws:send_remote_command:CommandIdStatus = Success
[INFO]  aws:send_remote_command:CommandList = runuser -l ubuntu -c 'source /home/ubuntu/vars && pushd /home/ubuntu/workspace && /home/ubuntu/script-hnrimuiy.sh'
[INFO]  aws:send_remote_command:StdOut = ==== Arm Virtual Hardware AMI ====
CMSIS packs are installed at /home/ubuntu/packs
~/workspace ~
Linux ip-172-31-3-17 5.13.0-1029-aws #32~20.04.1-Ubuntu SMP Thu Jun 9 13:03:13 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
[INFO]  aws:send_remote_command:StdErr =
[INFO]
[INFO]  Downloading workspace...
[INFO]  ================================================================================
[INFO]
[INFO]  Teardown instance...
[INFO]  ================================================================================
[INFO]  aws:Terminating EC2 instance...
pipenv run avhclient -b aws --instance-name kanata-test-20230225 execute    1.08s user 0.39s system 0% cpu 4:01.65 total
  • 立ち上がったインスタンスを見ると CPU arch が x86_64 (t2.micro で上がってるのでそれはそう)
    • ARM から提供されてる AVH 用 AMI が x86_64 用しかなさそう (link)

@ShotaKitazawa
Copy link
Member

  • arm64 AMI (not provided by ARM) と arm64 instance type でやったらどうなるか → 動かない
$ cat avh.yml
name: "AVH Demo"
workdir: ./
backend:
  aws:
    ami-id: ami-0fa715233bba2f42e  # ubuntu-2204-standard-arm64-1677105045
    #ami-version: ~=1.1
    #instance-type: t2.micro
    instance-type: a1.medium
upload: []
steps:
  - run: |
      uname -a
      cat /proc/cpuinfo
download: []

$ pipenv run avhclient -b aws --instance-name kanata-test-20230225 execute --specfile ./avh.yml
[INFO]  avh:aws backend selected!
[INFO]
[INFO]  Preparing instance...
[INFO]  ================================================================================
[WARNING]       aws:AWS_SESSION_TOKEN environment variable not present!
[INFO]  Found credentials in environment variables.
[INFO]  aws:Backend successfully initialized!
[INFO]  aws:Creating EC2 instance...
[INFO]  aws:EC2 instance i-0c9ded4def4ded1bc created!
[INFO]  aws:Setting up the instance...
[INFO]
[INFO]  Teardown instance...
[INFO]  ================================================================================
[ERROR] None
[ERROR] An error occurred (InvalidOutputFolder) when calling the SendCommand operation:

@ShotaKitazawa
Copy link
Member

もしかして: Arm Virtual Hardware = Arm が出してる、スポットで VM を立ち上げる python スクリプト (現在 x86 のみ対応)

@ShotaKitazawa
Copy link
Member

Next action

  • 案 1. AWS CodePipeline を使う
  • 案 2. arm64 instance で self-host runner を動かす
    • action-runner-controller とか興味がある人が多いかもしれない (運用知見を貯めるという意味で導入する? 要相談)
      • 懸念点: CI runner が乗る k8s は特に noisy neighbor が面倒なことになる (とはいえ全 Pod に resource limit を書くのも面倒)
      • とはいえ今の work load は dev 用の dk や prometheus 等しか乗ってないし、えいやで入れてみてもいいかも

@jacopen
Copy link
Collaborator

jacopen commented Sep 4, 2023

#1957 で対応したのでこちらは閉じ

@jacopen jacopen closed this as completed Sep 4, 2023
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

4 participants