10
$\begingroup$

I'm attempting to make QEspresso's pw program on a new 2021 MacBook Air, which has an M1 processor. While ./configure does not throw any errors, running 'make pw' fails with the following output:

checking build system type... Invalid configuration `aarch64-apple-darwin20.6.0': machine `aarch64-apple' not recognized
configure: error: /bin/sh ./config/config.sub aarch64-apple-darwin20.6.0 failed
if test -d src/ ; then \
    ( cd src/ ; make ) ; fi
make[3]: *** No rule to make target `device_auxfunc_mod.o', needed by `deviceXlib_mod.o'.  Stop.
make[2]: *** [libsrc] Error 2
make[1]: *** [libcuda_devxlib] Error 2
make: *** [libcuda] Error 2

I included what I believe are the relevant lines of the make output. The output prior to this seemed normal. I believe CUDA is related to parallelization, which I don't need right now, so I tried disabling parallelization as a make option -- yet this does not work. I've also tried

sudo ./configure --disable-parallel --with-internal-FFTW --with-internal-blas --with-internal-lapack ARCH="mac686"

following the instructions of Ref [1] for Macs, however, I don't know if I need to manual set ARCH="mac686", or something different for the newer M1. Or maybe this is entirely the wrong direction.

Has anyone tried installing QEspresso on an M1 Mac yet? Or have any sense if this is currently even possible? My web search only dug up one reference to installing QEspresso on the new M1 (see Ref [2]), which was totally unhelpful, so I'm afraid I'm running into a dead end and major time sink.

Ref [1]: https://sites.google.com/a/ncsu.edu/cjobrien/tutorials-and-guides/pwscf

Ref [2]: https://lists.quantum-espresso.org/pipermail/developers/2021-July/002430.html

$\endgroup$
3
  • 3
    $\begingroup$ I don't know the definitive answer, but I was also looking around recently and found the same mailing list thread. The main blocker is probably a suitable Fortran compiler. My suggestion is to set up a development environment in Rosetta 2 mode (x86_64 emulation), such that your architecture is x86_64 instead of aarch64. $\endgroup$ Nov 26, 2021 at 20:56
  • $\begingroup$ I have similar issue, but in my case I use Makefile to write some shortcuts for myself and make doesn't work for me with the same error message. $\endgroup$
    – ryaz
    Nov 29, 2021 at 7:34
  • $\begingroup$ upgrading gcc-12 and g++-12 can solve this problem $\endgroup$
    – user6143
    Oct 14, 2022 at 15:07

3 Answers 3

11
$\begingroup$

I was able to replicate your output on a Macbook Pro M1. Therefore, at the moment running ./configure followed by make all is not an option because the script will try to compile using clang. However, I was able to compile Quantum Espresso 7.0 using cmake, gcc-11, and open-mpi with the instructions from the official QE GitLab.

Since Google does not return any other discussion (besides this thread) on how to install QE with the new M1 Apple Silicon, here are the steps I followed. Hopefully this will avoid a headache to someone else.

Compile Quantum Espresso on M1

Install gcc, cmake, and open-mpi via brew:

$ brew install gcc open-mpi cmake

Download the QE release 7.0 from here and unzip the source code. From terminal, cd into the unzipped folder that contains the downloaded QE source code and create an empty folder (e.g. /build/). cd into this folder, configure via cmake with the options mpicc and mpif90, and compile. The commands are:

$ mkdir build
$ cd build
$ cmake -DCMAKE_C_COMPILER=mpicc -DCMAKE_Fortran_COMPILER=mpif90 ..
$ make -jN all

where N is the number of processors to be used for compilation. Running make all works just fine too. When compilation is over, the executables should be located in /build/bin/, and can be run with the usual

$ mpirun -np N path/to/build/bin -in input_file.in > output_file.out

where N is again the number of processors to be used for the calculation.

$\endgroup$
3
  • 2
    $\begingroup$ Never use sudo (or the root account) to configure or compile! This can seriously mess up your system. If you install programs by hand, you shouldn't even need superuser rights; just install them in a user-accessible directory. $\endgroup$ Feb 4, 2022 at 22:26
  • $\begingroup$ Thanks for the remark! You're indeed right, answer updated. $\endgroup$
    – Disidrosi
    Feb 7, 2022 at 11:05
  • 1
    $\begingroup$ This worked for me, but I also had to brew install fftw to get it to work before the cmake step. $\endgroup$
    – J.R. Owens
    Sep 15, 2022 at 0:04
5
$\begingroup$

It looks like Quantum Espresso is available through conda-forge which will be helpful.

Conda Forge has worked to migrate many packages to osx-arm64 and will rebuild packages for you.

The easy way is to update the list of packages to migrate as a pull-request. Assuming that goes through, various scripts will update the qe package on conda-forge and you'll get an osx-arm64 build in a day or so.

If you want to build yourself, you can grab the feedstock and add changes to conda-forge.yml:

build_platform:
  osx_arm64: osx_64
test_on_native_only: true

Follow the instructions on the conda-forge blog page to finish a local build.

I can't promise it'll all work, since Quantum Espresso is trying to guess CUDA, etc. based on the configure script. If you're just building for the M1, you shouldn't need to set ARCH but it's either aarch64-apple-darwin or osx-arm for most scripts.

$\endgroup$
1
  • $\begingroup$ I don't have access to the Mac I was using currently, but I will again in the not-to-distant future. I'll give this a try, and let you know if this works. Thanks! $\endgroup$ Dec 4, 2021 at 18:10
4
$\begingroup$

I found that the highest voted answer solution works, but it is missing an important step.

Before even installing homebrew, you should setup the rosetta emulator in your terminal app.

The details are explained here, then the install proceeds as if it is on an Intel chip.

In my case, I had an anaconda installation prior to setting up rosetta, which I thought shouldn't interfere with the QE installation. However, I realized that the ld linker was getting picked up from the anaconda binaries from the older arm64 anaconda installation. The error in qe installation was saying as if my fortran executable is not able to compile as above. After erasing the anaconda installation, the method above worked perfectly (plus fftw installation through homebrew).

$\endgroup$
1
  • $\begingroup$ +1 and welcome to our new community! I see you've been around for a while, but appreciate you now contributing this answer in case it's helpful for future readers. We hope to see much more of you in the future!! $\endgroup$ Jan 27 at 21:33

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .