<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body style="overflow-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;">
<div dir="auto" style="overflow-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;">
Hi Sanjay,
<div><br>
</div>
<div>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.</div>
<div><br>
</div>
<div>Samar</div>
<div><br>
</div>
<div>
<blockquote type="cite" style="color: rgb(0, 0, 0);">
<div>Begin forwarded message:</div>
<br class="Apple-interchange-newline">
<div style="margin: 0px;"><span style="font-family: -webkit-system-font, "Helvetica Neue", Helvetica, sans-serif;"><b>From: </b></span><span style="font-family: -webkit-system-font, "Helvetica Neue", Helvetica, sans-serif;">Samar Khatiwala <samar.khatiwala@earth.ox.ac.uk><br>
</span></div>
<div style="margin: 0px;"><span style="font-family: -webkit-system-font, "Helvetica Neue", Helvetica, sans-serif;"><b>Subject: </b></span><span style="font-family: -webkit-system-font, "Helvetica Neue", Helvetica, sans-serif;"><b>Re: [petsc-users] PETSc build
asks for network connections</b><br>
</span></div>
<div style="margin: 0px;"><span style="font-family: -webkit-system-font, "Helvetica Neue", Helvetica, sans-serif;"><b>Date: </b></span><span style="font-family: -webkit-system-font, "Helvetica Neue", Helvetica, sans-serif;">April 28, 2023 at 5:43:44 PM GMT+1<br>
</span></div>
<div style="margin: 0px;"><span style="font-family: -webkit-system-font, "Helvetica Neue", Helvetica, sans-serif;"><b>To: </b></span><span style="font-family: -webkit-system-font, "Helvetica Neue", Helvetica, sans-serif;">Pierre Jolivet <pierre@joliv.et><br>
</span></div>
<div style="margin: 0px;"><span style="font-family: -webkit-system-font, "Helvetica Neue", Helvetica, sans-serif;"><b>Cc: </b></span><span style="font-family: -webkit-system-font, "Helvetica Neue", Helvetica, sans-serif;">petsc-users <petsc-users@mcs.anl.gov><br>
</span></div>
<br>
<div>
<div style="overflow-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;">
Hi,
<div><br>
</div>
<div>I realize this is an old thread but I have some recent experience based on setting up an M2 Mac that might be relevant.</div>
<div><br>
</div>
<div>I was dreading moving to Apple Silicon Macs because of issues like these but I actually did not run into this particular problem. </div>
<div>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 </div>
<div>restrictions to make them more permissive. Details of how to do this are in the following and it takes only a minute to implement: </div>
<div>
<div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo;">
<span style="font-variant-ligatures: no-common-ligatures;"><br>
</span></div>
<div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo;">
<span style="font-variant-ligatures: no-common-ligatures;"><a href="https://rogueamoeba.com/support/knowledgebase/?showArticle=ACE-StepByStep&product=Audio+Hijack">https://rogueamoeba.com/support/knowledgebase/?showArticle=ACE-StepByStep&product=Audio+Hijack</a></span></div>
</div>
<div><br>
<div>Incidentally, I built mpich from source followed by PETSc in the usual way.</div>
<div><br>
</div>
<div>Something else that might be helpful for others is my experience getting ifort to work. (My needs were somewhat specific: mixed </div>
<div>fortran/C code, preferably ifort, and avoid package managers.) The intel OneAPI installer ran smoothly (via rosetta) but when </div>
<div>building mpich (or PETSc) I ran into an obvious problem: clang produces arm64 object files while ifort produces x86 ones. I couldn’t </div>
<div>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 </div>
<div>executables in Apple’s toolchain are universal binaries, and (2) the ‘arch’ command can let you run programs for any of the two </div>
<div>architectures. Specifically, executing in the terminal:</div>
<div><br>
</div>
<div>
<div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo;">
<span style="font-variant-ligatures: no-common-ligatures;">arch -x86_64 bash</span></div>
</div>
<div><br>
</div>
<div>starts a bash shell and *every* program that is then run from that shell is automatically the x86 version. So I could then do:</div>
<div>
<div style="margin: 0px; font-stretch: normal; line-height: normal;">FC=ifort</div>
<div style="margin: 0px; font-stretch: normal; line-height: normal;">./configure --prefix=/usr/local/mpichx86 --enable-two-level-namespace</div>
<div style="margin: 0px; font-stretch: normal; line-height: normal;">make</div>
<div style="margin: 0px; font-stretch: normal; line-height: normal;">sudo make install</div>
<div><br>
</div>
<div>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. </div>
<div>Except for some annoying warnings from MKL (I think because it is confused what architecture it is running on) everything runs </div>
<div>smoothly and - even in emulation - surprisingly fast.</div>
<div><br>
</div>
<div>Sorry if this is all well know and already documented on PETSc’s install page.</div>
<div><br>
</div>
<div>Samar</div>
<div><br>
</div>
</div>
</div>
</div>
</div>
</blockquote>
<br class="Apple-interchange-newline">
<div><br>
</div>
<div><br>
<blockquote type="cite">
<div>On Jan 9, 2024, at 9:46 PM, Sanjay Govindjee via petsc-users <petsc-users@mcs.anl.gov> wrote:</div>
<br class="Apple-interchange-newline">
<div>
<div>I was wondering if anyone has build experience with PETSc + FORTRAN on an M2-based MAC? In particular, I am looking for compiler recommendations.<br>
<br>
-sanjay<br>
<br>
</div>
</div>
</blockquote>
</div>
<br>
</div>
</div>
</body>
</html>