-
Notifications
You must be signed in to change notification settings - Fork 696
feature: use Rosetta AOT Caching with CDI #3858
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
base: master
Are you sure you want to change the base?
feature: use Rosetta AOT Caching with CDI #3858
Conversation
5e53248
to
54e4f8d
Compare
I also attempted to enable CDI in the [plugins."io.containerd.grpc.v1.cri"]
enable_cdi = true
cdi_spec_dirs = ["/etc/cdi", "/var/run/cdi"] However, I haven’t been successful yet. |
207c528
to
18c16e7
Compare
Rebased |
18c16e7
to
73dfbc8
Compare
73dfbc8
to
789d4d4
Compare
By creating symlink at ➜ ~13:01:29 13:03:18~ (use-rosetta-aot-caching-with-cdi) limactl start template://ubuntu-lts --name=default --tty=false --memory 16 --rosetta --log-level warn
WARN[0000] vmType vz: ignoring [VMOpts]
3.50 GiB / 3.50 GiB [---------------------------------------] 100.00% 1.22 GiB/s
➜ ~13:04:09 13:04:12~ (use-rosetta-aot-caching-with-cdi) nerdctl.lima pull --platform linux/amd64 golang
docker.io/library/golang:latest: resolved |++++++++++++++++++++++++++++++++++++++|
index-sha256:91e2cd436f7adbfad0a0cbb7bf8502fa863ed8461414ceebe36c6304731e0fd9: done |++++++++++++++++++++++++++++++++++++++|
manifest-sha256:42a6459ee5ae70dd490c6b6164bef32b064a66b4f0a9744105969883b8b23840: done |++++++++++++++++++++++++++++++++++++++|
config-sha256:4ba81a847f6b20b63eec32f2ee16fce0385e8b06bf5789a66d4e51aae215e8cd: done |++++++++++++++++++++++++++++++++++++++|
layer-sha256:4f4fb700ef54461cfa02571ae0db9a0dc1e0cdb5577484a6d75e68dc38e8acc1: done |++++++++++++++++++++++++++++++++++++++|
layer-sha256:8ea45766c6449310ca2fc621a7e00bedb4b9b803a7fbfe2607efce6d2e07e435: done |++++++++++++++++++++++++++++++++++++++|
layer-sha256:e70dc87628705e52d31a6bee046711fe5dd4d9d73e7cfd02aaceec20b352ca48: done |++++++++++++++++++++++++++++++++++++++|
layer-sha256:80b7316254b3093eb3c7ac44bb6c34bde013f27947c1ed8d8afe456b957ebfdb: done |++++++++++++++++++++++++++++++++++++++|
layer-sha256:36e4db86de6eba33869491caa7946b80dd71c255f1940e96a9f755cc2b1f3829: done |++++++++++++++++++++++++++++++++++++++|
layer-sha256:8286cb4ece30afb97c398c2b5ac1f35e8f502f758d4ea2fc69e179efdf471ea2: done |++++++++++++++++++++++++++++++++++++++|
layer-sha256:a9463fe86d3b832fec17e98dd4dc2def946be2ce83848b242e45383fd2aba0d3: done |++++++++++++++++++++++++++++++++++++++|
elapsed: 49.7s total: 290.7 (5.8 MiB/s)
➜ ~13:05:07 13:05:09~ (use-rosetta-aot-caching-with-cdi) nerdctl.lima run --rm --platform linux/amd64 -v$PWD:$PWD -w$PWD -eCGO_ENABLED=1 golang bash -c "time go run ./cmd/limactl -v 2>/dev/null"
limactl version <unknown>
real 1m43.245s
user 4m26.421s
sys 0m24.823s
➜ ~13:06:57 13:07:00~ (use-rosetta-aot-caching-with-cdi) nerdctl.lima run --rm --platform linux/amd64 -v$PWD:$PWD -w$PWD -eCGO_ENABLED=1 --device=lima-vm.io/rosetta=cached golang bash -c "time go run ./cmd/limactl -v 2>/dev/null"
limactl version <unknown>
real 0m53.677s
user 1m47.269s
sys 0m13.958s edited: rename |
2e944d8
to
6c3aba4
Compare
Renamed |
Let's mark this as a draft until Code-Hex/vz#195 is merged |
4babbce
to
52b64c7
Compare
52b64c7
to
5247cd9
Compare
Needs rebase |
Also consider adding documentation |
This change introduces device configuration to enable Rosetta AOT Caching in Docker VMs. - Modify Rosetta Caching Options from Abstract Socket to Unix Domain Socket: Unix Domain Socket can be mounted within a container using the Container Device Interface (CDI) mechanism. This requires merging the following pull request: Code-Hex/vz#195. - Register Rosettad AOT Caching Daemon as a service: - `/etc/systemd/system/rosettad.service` on systemd - `/etc/init.d/rosettad` on OpenRC - Add "lima.io/rosetta=cached" device specification to `{~/.config,/etc}/cdi/rosetta.yaml` see: https://github.com/cncf-tags/container-device-interface/blob/main/SPEC.md - Add `{~/.config,/etc}/docker/daemon.json` to `docker{,-rootful}.yaml` - `.features.cdi = true` to enable CDI - Add `enable_cdi = true` to `{~/.config,/etc}/containerd/config.toml` To enable Rosetta AOT Caching in docker, use `--device=lima.io/rosetta=cached`. see: https://docs.docker.com/build/building/cdi/ Signed-off-by: Norio Nomura <norio.nomura@gmail.com> # Conflicts: # templates/docker-rootful.yaml
5247cd9
to
3ae277c
Compare
Description
This change introduces device configuration to enable Rosetta AOT Caching in Docker VMs.
Modify Rosetta Caching Options from Abstract Socket to Unix Domain Socket:
Unix Domain Socket can be mounted within a container using the Container Device Interface (CDI) mechanism.
This requires merging the following pull request: Rosetta AOT caching options Code-Hex/vz#195.
Register Rosettad AOT Caching Daemon as a service:
/etc/systemd/system/rosettad.service
on systemd/etc/init.d/rosettad
on OpenRCAdd "lima-vm.io/rosetta=cached" device specification to
{~/.config,/etc}/cdi/rosetta.yaml
see: https://github.com/cncf-tags/container-device-interface/blob/main/SPEC.md
Add
{~/.config,/etc}/docker/daemon.json
todocker{,-rootful}.yaml
.features.cdi = true
to enable CDIAdd
enable_cdi = true
to{~/.config,/etc}/containerd/config.toml
To enable Rosetta AOT Caching in docker, use
--device=lima-vm.io/rosetta=cached
.see: https://docs.docker.com/build/building/cdi/
Benchmark
/var/cache/rosettad/*.aotcache
are created)bash -c "time go run ./cmd/limactl -v 2>/dev/null"
in golang containeredited: rename
lima.io/rosetta=cached
tolima-vm.io/rosetta=cached