Closed mathomp4 closed 2 years ago
Any thoughts on this? @climbfuji created this patch for use in Spack, so that ESMA_CMake picks up x86 on an M1 Mac when running in emulator mode. Shouldn't be necessary if you natively compile for aarch64, but we've (@climbfuji) compiling in Rosetta 2.
Any thoughts on this? @climbfuji created this patch for use in Spack, so that ESMA_CMake picks up x86 on an M1 Mac when running in emulator mode. Shouldn't be necessary if you natively compile for aarch64, but we've (@climbfuji) compiling in Rosetta 2.
@kgerheiser Huh. I only just recently got access to an M1 Mac and have been doing native tests (see https://github.com/GEOS-ESM/ESMA_cmake/pull/274 and https://github.com/GEOS-ESM/GEOSgcm/issues/417). That said, I could probably take that update into ESMA_cmake pretty easily as it's essentially a codepath I don't hit. I'll look at adding that in.
PS: How do you build on M1 as an x86? I never thought to try it out (not sure how to get compilers, etc.). Do you have to cross-compile GCC?
@mathomp4 Have a look at section 3.2.1.1 here: https://spack-stack.readthedocs.io/en/latest/Platforms.html#generating-new-site-configs, item 2. No need to cross-compile, the homebrew gcc will do. But also note that the spack developers (and nowadays myself, I was convinced) strongly advocate for using clang (the native apple clang works) on macOS.
Also note that you need to install another homebrew if inside the rosetta terminal (installs in /usr/local
). If you later want to get rid of this for your aarch64 homebrew (/opt/local
) you may have to revert all the changes in /usr/local
, therefore best to take a backup first. Or try to install the x86_64 homebrew version in a non-default path, against the developer's recommendation.
@climbfuji Ahh. Okay. You use Homebrew. I don't allow Homebrew to install any compilers or MPI stacks on my Macs. I like to control that myself. I'm always afraid that one day gcc-11
will "magically" move from 11.2 to 11.3. Not on my watch! 😄
And, of course, my laptop won't allow installs to /opt
or /usr
without admin rights, so that's another fun thing. Most packages don't care I'm in ~/.homebrew
but just enough do to make life spicy.
Of course, this means I have to bother the GCC devs at times when I have issues (as I've done with GCC 11.3 and GCC 12.1 native M1). But I suppose those updates are fed up to Homebrew so others get the help! (I started my GEOS M1 trials basing it off of the M1 GCC recipe Homebrew used at the time, but I quickly learned it wasn't up to snuff. But luckily the GCC devs were nice enough to put up with me!)
As reported by @natalie-perlin of NOAA, using ESMA_cmake on a M1 Mac throws a failure due to unsupported processor.