Help installing gfortran on MacBook Pro with M1pro

You just need to install brew first,

Then in the terminal, type

brew install gfortran mpich

Done.

The latest version on brew is perhaps 11.3.0. There are other more latest version of gfortran, but the brew seems very easy to have mpi installed together with gfortran.

You probably also need to install Make.

I learned from @wiremoons,

The Xcode stuff you mentioned is for Intel OneAPI, however Intel OneAPI does not optimize for M1, so the speed of Intel Fortran will be the same as gfortran with -O0 or at best -Og. Also the Python distribution in Intel OneAPI will fail when install on M1 Mac. You need to de-select the Python part if you want to install OneAPI on M1 Mac.

It your code is memory bound, you will see performance gain from M1 chip, since Apple uses HBM which is designed particularly for M1.
if your code is CPU bound, you perhaps will not see too much performance gain from M1 chip especially if your Intel chip is relatively not too old.


PS.

However I am not sure if gfortran (or gcc) is fully compatible with M1 chip now. I personally have some code run with the same 11.2.0 gfortran on Linux well and can also run on Windows, but on M1 it can give me segment 11 error. If you have things like below (procedure point to some function) you may encounter compatibility issues.

image