[petsc-users] M2 macs

Samar Khatiwala samar.khatiwala at earth.ox.ac.uk
Tue Jan 9 15:55:37 CST 2024


Hi Sanjay,

I’ve done this with ifort on my M2 MacBook Air and reported on my experience in this list some months ago. I attach the message below.

Samar

Begin forwarded message:

From: Samar Khatiwala <samar.khatiwala at earth.ox.ac.uk>
Subject: Re: [petsc-users] PETSc build asks for network connections
Date: April 28, 2023 at 5:43:44 PM GMT+1
To: Pierre Jolivet <pierre at joliv.et>
Cc: petsc-users <petsc-users at mcs.anl.gov>

Hi,

I realize this is an old thread but I have some recent experience based on setting up an M2 Mac that might be relevant.

I was dreading moving to Apple Silicon Macs because of issues like these but I actually did not run into this particular problem.
While I can’t be certain I think it is because in the process of installing another piece of software I had to modify Apple’s security
restrictions to make them more permissive. Details of how to do this are in the following and it takes only a minute to implement:

https://rogueamoeba.com/support/knowledgebase/?showArticle=ACE-StepByStep&product=Audio+Hijack

Incidentally, I built mpich from source followed by PETSc in the usual way.

Something else that might be helpful for others is my experience getting ifort to work. (My needs were somewhat specific: mixed
fortran/C code, preferably ifort, and avoid package managers.) The intel OneAPI installer ran smoothly (via rosetta) but when
building mpich (or PETSc) I ran into an obvious problem: clang produces arm64 object files while ifort produces x86 ones. I couldn’t
manage to set the correct CFLAGS to tell clang to target x86. Instead, the (simpler) solution turned out to be (1) the fact that all the
executables in Apple’s toolchain are universal binaries, and (2) the ‘arch’ command can let you run programs for any of the two
architectures. Specifically, executing in the terminal:

arch -x86_64 bash

starts a bash shell and *every* program that is then run from that shell is automatically the x86 version. So I could then do:
FC=ifort
./configure --prefix=/usr/local/mpichx86 --enable-two-level-namespace
make
sudo make install

and get an x86 build of mpich which I could then use (from the same shell or a new one started as above) to build [x86] PETSc.
Except for some annoying warnings from MKL (I think because it is confused what architecture it is running on) everything runs
smoothly and - even in emulation - surprisingly fast.

Sorry if this is all well know and already documented on PETSc’s install page.

Samar




On Jan 9, 2024, at 9:46 PM, Sanjay Govindjee via petsc-users <petsc-users at mcs.anl.gov> wrote:

I was wondering if anyone has build experience with PETSc + FORTRAN on an M2-based MAC?  In particular, I am looking for compiler recommendations.

-sanjay


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20240109/9c6b9133/attachment-0001.html>


More information about the petsc-users mailing list