- Dec 2023
-
hyscaler.com hyscaler.com
-
“MLX” is more than just a technical solution; it is an innovative and user-friendly framework inspired by popular frameworks like PyTorch, Jax, and ArrayFire. It facilitates the training and deployment of AI models on Apple devices without sacrificing performance or compatibility.
MLX (high overview)
-
- Nov 2023
-
blog.kubeflow.org blog.kubeflow.org
-
Kubeflow 1.8 adds ARM processor support which simplifies adoption for Apple Silicon users and IoT servers.
Tags
Annotators
URL
-
-
docs.docker.com docs.docker.com
-
Rosetta is now Generally Available for all users on macOS 13 or later. It provides faster emulation of Intel-based images on Apple Silicon. To use Rosetta, see Settings. Rosetta is enabled by default on macOS 14.1 and later.
Tested it on my side, and
poetry install
of one Python project took 44 seconds instead of 2 minutes 53 seconds, so it's nearly a 4x speed increase!
Tags
Annotators
URL
-
- Jan 2023
-
pythonspeed.com pythonspeed.com
-
Solution #3: Switch to Conda-Forge
Yet another possible solution for M1 users, but you need to use conda and expect less packages than in PyPI
-
In general, the environment variable is too heavy-handed and should be avoided, since it will impact all images you build or run. Given the speed impact, you don’t for example want to run your postgres image with emulation, to no benefit.
Which options to avoid
-
The problem with this approach is that the emulation slows down your runtime. How much slower it is? Once benchmark I ran was only 6% of the speed of the host machine!
Speed is the core problem with emulation
-
The other option is to run x86_64 Docker images on your ARM64 Mac machine, using emulation. Docker is packaged with software that will translate or emulate x86_64 machine code into ARM64 machine code on the fly; it’s slow, but the code will run.
Another possible solution for M1 users (see snippets below)
-
Third, you can pre-compile wheels, store them somewhere, and install those directly instead of downloading the packages from PyPI.
Third possible solution for M1 users
-
If you have a compiler installed in your Docker image and any required native libraries and development headers, you can compile a native package from the source code. Basically, you add a RUN apt-get upgrade && apt-get install -y gcc and iterate until the package compiles successfully.
Second possible solution for M1 users
-
First, it’s possible the relevant wheels are available in newer versions of the libraries.
First possible solution for M1 users
-
When you pip install murmurhash==1.0.6 on a M1/M2 Mac inside Docker, again it looks at the available files
Other possible steps that
pip
will do when trying to install a Python package without a relevant CPU instruction set -
When you pip install filprofiler==2022.05.0 on a M1/M2 Mac inside Docker, pip will look at the available files for that version, and then
3 steps that
pip
will do when trying to install a Python package without a relevant CPU instruction set -
In either case, pure Python will Just Work, because it’s interpreted at runtime: there’s no CPU-specific machine code, it’s just text that the Python interpreter knows how to run. The problems start when we start using compiled Python extensions. These are machine code, and therefore you need a version that is specific to your particular CPU instruction set.
M1 Python issues
-
on an Intel/AMD PC or Mac, docker pull will pull the linux/amd64 image. On a newer Mac using M1/M2/Silicon chips, docker pull will the pull the linux/arm64/v8 image.
Reason of all the M1 Docker issues
-
- Jun 2022
-
blog.driftingruby.com blog.driftingruby.com
-
This is a neat Docker trick for those who have an ARM development machine (Apple M1), but sometimes need to build x86/amd64 images locally to push up to a registry.
Since Apple M1 is based on the ARM architecture, it is still possible to build images based on Linux x86/amd64 architecture using docker buildx:
docker buildx build -f Dockerfile --platform linux/amd64 .
However, building such images can be really slow, so we can create a builder profile (see the paragraphs below / my other annotation to this article).
-
So, we can create this builder on our local machine. The nice part about this creation is that it is idempotent, so you can run this command many times without changing the result. All we have to do is to create a builder profile and in this case I have named it amd64_builder.
Example of creating a Docker buildx builder profile on the Apple M1 machine. This will allow for around 10x faster builds on the amd64 architecture pushed to a registry, than on the amd64 emulation on the M1 chip.
Tags
Annotators
URL
-
- Aug 2021
-
-
flipou83 · 24dI have a M1 but all my storage is on a TrueNAS and Unraid server. Doesn't trust external drive storage for the problems you listed on your post. I have a share for it's TimeMachine backups and big Photos library and iMovie Library which don't even fit on the internal SSD of the Mac mini.I would put the SSD you bought into an independent computer that acts as a NAS on your network. What about this solution?
See this thread on using M1 to remote mount shares from a Linux ZFS TrueNAS server.
-