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/aarch64 support #980

Open
2 tasks
romanzac opened this issue Nov 7, 2023 · 34 comments
Open
2 tasks

ARM64/aarch64 support #980

romanzac opened this issue Nov 7, 2023 · 34 comments
Labels
enhancement New feature or request optimization

Comments

@romanzac
Copy link
Collaborator

romanzac commented Nov 7, 2023

ARM64 is recently gaining ground on the formerly leading AMD64 architecture due to its greater efficiency, offering better performance per watt.

Adding support for ARM64 would enable operators, developers, and researchers to:

  • Run on more cost-efficient cloud instances.
  • Develop and test using the powerful Apple M series chip-based laptops.

Actual steps to resolve this issue:

  • Add CI/test coverage of selected ARM64 platforms to the existing test matrix.

Selected platforms:

  • Apple Silicon M1
  • Amazon Graviton2
@romanzac
Copy link
Collaborator Author

romanzac commented Nov 7, 2023

Issue is related to #978

@kaiserd kaiserd mentioned this issue Nov 10, 2023
21 tasks
@diegomrsantos
Copy link
Collaborator

Does Nim itself support it?

@romanzac
Copy link
Collaborator Author

Does Nim itself support it?

Yes, it is on the list of supported platforms and I myself was able to compile and run tests with Nim 2.0 on Apple M1.
https://nim-lang.org/docs/packaging.html

@diegomrsantos
Copy link
Collaborator

Not sure about Nim 2.0, but I believe Nim 1.6 runs on my Apple M1 with amd64 emulation.

@mratsim
Copy link
Contributor

mratsim commented Nov 15, 2023

How did you install Nim?

@dryajov
Copy link
Contributor

dryajov commented Nov 15, 2023

Not sure about Nim 2.0, but I believe Nim 1.6 runs on my Apple M1 with amd64 emulation.

libp2p and nim both run on native apple m series chips without a hitch and people have been running it on RasPi as part of nimbus for at least a couple of years now.

Support for an arm64 CI, is a different matter altogether, if this is what this issue is about, it should be clarified, otherwise it gives the impression that arm support is missing, which is definitely not the case.

@arnetheduck
Copy link
Contributor

Nimbus' CI indirectly covers mac/arm64: https://ci.status.im/job/nimbus-eth2/job/platforms/job/macos/job/aarch64/ - a similar job can be set up for libp2p itself trivially

@romanzac
Copy link
Collaborator Author

How did you install Nim?

brew install nim
https://formulae.brew.sh/formula/nim

This defaults to 2.0

@romanzac
Copy link
Collaborator Author

Not sure about Nim 2.0, but I believe Nim 1.6 runs on my Apple M1 with amd64 emulation.

libp2p and nim both run on native apple m series chips without a hitch and people have been running it on RasPi as part of nimbus for at least a couple of years now.

Support for an arm64 CI, is a different matter altogether, if this is what this issue is about, it should be clarified, otherwise it gives the impression that arm support is missing, which is definitely not the case.

It's great to see that Nimbus benefits from nim-libp2p and also serves as the reference application. As contributors to nim-libp2p, we develop our own tests, and we aim to provide factual evidence that it can run independently on modern platforms. When we build enough knowledge about platforms specifics, we might show case optimized use cases, perhaps with Waku?

@dryajov
Copy link
Contributor

dryajov commented Nov 15, 2023

How did you install Nim?

brew install nim https://formulae.brew.sh/formula/nim

This defaults to 2.0

It's usually not a good idea to use os level pre-build packages, neither for local development, nor for CI. For CI, you want to build from source (as we should be already doing, if not it should be fixed), for local development use one of the provided environment managers, currently I'm aware of two https://github.com/dom96/choosenim which seems to have been recently abandoned and is not shipping arm builds and a nim plugin for asdf https://github.com/asdf-community/asdf-nim, which does install/ship arm supported binaries.

I do not think we yet support nim 2.0, so we should not be using it until we deem the release 2.0 stable.

@dryajov
Copy link
Contributor

dryajov commented Nov 15, 2023

Not sure about Nim 2.0, but I believe Nim 1.6 runs on my Apple M1 with amd64 emulation.

libp2p and nim both run on native apple m series chips without a hitch and people have been running it on RasPi as part of nimbus for at least a couple of years now.
Support for an arm64 CI, is a different matter altogether, if this is what this issue is about, it should be clarified, otherwise it gives the impression that arm support is missing, which is definitely not the case.

It's great to see that Nimbus benefits from nim-libp2p and also serves as the reference application. As contributors to nim-libp2p, we develop our own tests, and we aim to provide factual evidence that it can run independently on modern platforms. When we build enough knowledge about platforms specifics, we might show case optimized use cases, perhaps with Waku?

Yes, I'm well aware, my team (and @arnetheduck ) wrote most of the initial implementation.

Nimbus' CI indirectly covers mac/arm64: https://ci.status.im/job/nimbus-eth2/job/platforms/job/macos/job/aarch64/ - a similar job can be set up for libp2p itself trivially

Seems like there is a solution that already exists as part of the Nimbuis build, we should try to use it here as well. We've been also looking into building on arm as part of Codex, perhaps @veaceslavdoina might be of assistance here as well.

@veaceslavdoina
Copy link

Seems like there is a solution that already exists as part of the Nimbuis build, we should try to use it here as well. We've been also looking into building on arm as part of Codex, perhaps @veaceslavdoina might be of assistance here as well.

Codex builds now done using GitHub Actions and we are using BuildJet for ARM, because ARM runners support will be added just in 2024, in private beta.

@diegomrsantos
Copy link
Collaborator

How did you install Nim?

I used choosenim. Installed 1.6.16 today:

Nim Compiler Version 1.6.16 [MacOSX: amd64]
Compiled at 2023-11-15
Copyright (c) 2006-2023 by Andreas Rumpf

active boot switches: -d:release

@diegomrsantos
Copy link
Collaborator

I asked cause I also didn't find arm images here https://hub.docker.com/r/nimlang/nim/tags?page=1

@romanzac
Copy link
Collaborator Author

Seems like there is a solution that already exists as part of the Nimbuis build, we should try to use it here as well. We've been also looking into building on arm as part of Codex, perhaps @veaceslavdoina might be of assistance here as well.

Codex builds now done using GitHub Actions and we are using BuildJet for ARM, because ARM runners support will be added just in 2024, in private beta.

This is valuable piece of information. Thanks a lot.

@romanzac
Copy link
Collaborator Author

How did you install Nim?

I used choosenim. Installed 1.6.16 today:

Nim Compiler Version 1.6.16 [MacOSX: amd64]
Compiled at 2023-11-15
Copyright (c) 2006-2023 by Andreas Rumpf

active boot switches: -d:release

I asked cause I also didn't find arm images here https://hub.docker.com/r/nimlang/nim/tags?page=1

Your are right. Once this issues is in full motion, we would need to figure out how to build Nim and Nimble from sources on ARM. If we follow our current CI workflow practice.

@romanzac
Copy link
Collaborator Author

How did you install Nim?

brew install nim https://formulae.brew.sh/formula/nim
This defaults to 2.0

It's usually not a good idea to use os level pre-build packages, neither for local development, nor for CI. For CI, you want to build from source (as we should be already doing, if not it should be fixed), for local development use one of the provided environment managers, currently I'm aware of two https://github.com/dom96/choosenim which seems to have been recently abandoned and is not shipping arm builds and a nim plugin for asdf https://github.com/asdf-community/asdf-nim, which does install/ship arm supported binaries.

I do not think we yet support nim 2.0, so we should not be using it until we deem the release 2.0 stable.

Thanks for sharing. What makes you think Nim 2.0 is not stable ?

@dryajov
Copy link
Contributor

dryajov commented Nov 16, 2023

How did you install Nim?

brew install nim https://formulae.brew.sh/formula/nim
This defaults to 2.0

It's usually not a good idea to use os level pre-build packages, neither for local development, nor for CI. For CI, you want to build from source (as we should be already doing, if not it should be fixed), for local development use one of the provided environment managers, currently I'm aware of two https://github.com/dom96/choosenim which seems to have been recently abandoned and is not shipping arm builds and a nim plugin for asdf https://github.com/asdf-community/asdf-nim, which does install/ship arm supported binaries.
I do not think we yet support nim 2.0, so we should not be using it until we deem the release 2.0 stable.

Thanks for sharing. What makes you think Nim 2.0 is not stable ?

Its a new release and usually things take time to stabilize, status projects tend to run on older versions that are battle tested, which isn't the case with 2.0.

That is not to say that we don't want to test it with 2.0, but instead run against different nim versions.

Btw, have you looked into how the current build system is setup? It already supports building from a compiled version of nim - https://github.com/status-im/nim-libp2p/blob/unstable/.github/actions/install_nim/action.yml

I used choosenim. Installed 1.6.16 today:

@diegomrsantos - choose nim doesn't support arm binaries and has been largely abandoned, I've since switched to https://github.com/asdf-community/asdf-nim which does support apple silicon.

@diegomrsantos
Copy link
Collaborator

@dryajov thanks! Does it install nimble too?

@diegomrsantos
Copy link
Collaborator

It's usually not a good idea to use os level pre-build packages, neither for local development, nor for CI.

@dryajov could you please elaborate more on this?

@dryajov
Copy link
Contributor

dryajov commented Nov 16, 2023

@dryajov thanks! Does it install nimble too?

yes

@dryajov
Copy link
Contributor

dryajov commented Nov 16, 2023

@dryajov thanks! Does it install nimble too?

yes

It's usually not a good idea to use os level pre-build packages, neither for local development, nor for CI.

@dryajov could you please elaborate more on this?

Its harder (if not impossible) to switch versions with os level installations. Usually if the language ecosystem provides an environment manager, it is much more practical to use with difference language versions. This is usually what you want when developing software.

@arnetheduck
Copy link
Contributor

nimble will be installing nim too, after nim-lang/nimble#1131 is merged

@diegomrsantos
Copy link
Collaborator

@dryajov ah you mean using package managers like brew and apt. Thanks.

@dryajov
Copy link
Contributor

dryajov commented Nov 16, 2023

@romanzac can we clarify this issue a bit more.

Adding support for ARM64 would enable operators, developers, and researchers to:

As mentioned previously, libp2p supports (many) arm chips out of the box, this issue gives the impression that it doesn't, which is certainly not the case.

Can you clarify in the description:

  • What is this issue for
  • What outcomes we expect from it
  • What are the steps involved in getting there

@mratsim
Copy link
Contributor

mratsim commented Nov 16, 2023

I think we can close the issue. The issue is choosenim doesn't support ARM.

@romanzac
Copy link
Collaborator Author

I welcome any proposal which positively impacts adoption of nim-libp2p. Feel free to propose your own view and steps how this issue should be resolved. There will be daily tests using CI workfows at very minimum.

@dryajov
Copy link
Contributor

dryajov commented Nov 17, 2023

I welcome any proposal which positively impacts adoption of nim-libp2p. Feel free to propose your own view and steps how this issue should be resolved. There will be daily tests using CI workfows at very minimum.

That's kind of a non answer, could you provide the details I requested?

@romanzac
Copy link
Collaborator Author

I welcome any proposal which positively impacts adoption of nim-libp2p. Feel free to propose your own view and steps how this issue should be resolved. There will be daily tests using CI workfows at very minimum.

That's kind of a non answer, could you provide the details I requested?

At this time I see my answers sufficient. Thanks for your comment.

@diegomrsantos
Copy link
Collaborator

@dryajov I believe this issue is for having arm support on CI.

@dryajov
Copy link
Contributor

dryajov commented Nov 17, 2023

@dryajov I believe this issue is for having arm support on CI.

Thanks for clarifying @diegomrsantos. It would still be great to add a bit more context, I think there's been sufficient feedback to be able to substantially improve the issue.

For clarity and consistency, I would still suggest we add something that resembles #980 (comment).

@diegomrsantos
Copy link
Collaborator

@romanzac could you please update the issue description with the points below?

What is this issue for
What outcomes we expect from it
What are the steps involved in getting there

@kaiserd
Copy link
Collaborator

kaiserd commented Nov 20, 2023

The main purpose of the issue is to add CI/test coverage of these platforms (only with that we can really claim support). @romanzac let's make this explicit in the OP.
Regarding concrete plans: The issue was mainly meant as an abstract description of the matter.
Vac P2P will be prioritize nim-libp2p issues and new features based on their necessity / urgency for Nimbus and Logos projects. So, if you are not interested in this now, we will prioritize other issues. Sorry for the confusion here.
We'd add more context and specific action items to this issue, once projects show interest, or there is no other high prio task at the moment and we can work on it in the background.

@arnetheduck
Thank you for:

Nimbus' CI indirectly covers mac/arm64: https://ci.status.im/job/nimbus-eth2/job/platforms/job/macos/job/aarch64/ - a similar job can be set up for libp2p itself trivially

We will do this as a simple solution for now.

Also thanks to @dryajov , @mratsim , @veaceslavdoina for your input on this issue 🙏 .

I'd prefer to leave this issue open, and link it on the roadmap, to track full arm64 test and CI coverage.

We will refine the OP to avoid confusion:

  • make explicit that this mainly about CI
  • we'd like to only declare arm64 support, if we also have the respective CI pipelines running.
    Still, libp2p is already usable on arm (ideally list specific arm platforms).

@romanzac
Copy link
Collaborator Author

Related to #993

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request optimization
Projects
Status: icebox
Development

No branches or pull requests

7 participants