Now we’ve got a Conda environment setup, it’s time to install the software we need. This is the directory we’re going to be storing our environment. And inside the environment will be the software tools we need to run PyTorch, especially PyTorch on the Apple Silicon GPU.
If you’re using an M1 variant Mac, it’s “Miniforge3-MacOSX-arm64” Clicking the link above will download a shell file called Miniforge3-MacOSX-arm64.sh to your Downloads folder . Install PyTorch 1.12.0+ default version for Mac with pip from the PyTorch getting started page. Open Terminal and run these commands to install Miniforge3 into home directory. MacOS 12.3+ (PyTorch will work on previous versions but the GPU on your Mac won’t get used, this means slower code). Try to always opt for the arm64 builds when working on an M1 Mac. If that doesn’t work, you can fall back to the x64 build and use the Rosetta emulation.
The main change in the source code is the addition of a Dockerfile that, as described above, can create Docker images with natively compiled microservices. To check the hardware architecture for an application in macOS, we can use the Activity Monitor. First, ensure that the Kind la beer fest 2016 column is selected. The Kind value will be Apple for ARM64-based applications and Intel for x86_64-based applications. For example, in the screenshot below, we can see that Whatsapp is an x86_64 application, while the other applications execute as native ARM64 applications.
Our goal is not just to make Linux run on these machines but to polish it to the point where it can be used as a daily OS. Doing this requires a tremendous amount of work, as Apple Silicon is an entirely undocumented platform. In particular, we will be reverse engineering the Apple GPU architecture and developing an open-source driver for it.
Well, I suppose Apple kinda did by just cutting Intel out of the picture altogether but Intel sure hasn’t done anything and now they’re floundering. Along similar lines XQuartz had it’s first release in ~5 years very recently and now supports the M1 in the beta’s for v2.8. OK, so I don’t like FInk that much but personally I can use Macports or Homebrew just about interchangeably. The new HOMEBREW_BOOTSNAP environment variable allows the use of the Bootsnap gem to speed up repeated brew calls. This does not work on Apple Silicon or using Homebrew’s portable Ruby.
After making this change, the Spring Boot application should start again with a clean bootstrap log. While our application should still function as expected, this log is noisy and may confuse developers. As long as we don’t run our Spring Boot application on an Apple M1 in production, it’s also less critical if we don’t fix it. Based on the system property os.arch we decided which image to use for our BrowserWebDriverContainer. With Apple’s Rosetta 2 emulation, we can also try to work with an x64 JDK build.