[AMBER] Compiling AmberTools on OSX-arm64

From: Istvan Kolossvary via AMBER <amber.ambermd.org>
Date: Fri, 09 Feb 2024 13:20:50 -0500

Hi,

I have seen some chatter about this on the list, so I'd just like to
post the recipe that worked for me on M2. It turned out to be very
simple, but it only looks simple after lots of iterations. :) Building
the serial version is out of the box, but for some reason moft cannot be
built with either internal or external boost. These are the CMake
settings in run_cmake. I just had to install cmake and gfortran (via
brew).

# For macOS:

   if [ -x /opt/homebrew/bin/cmake ]; then
      cmake=/opt/homebrew/bin/cmake
   else
      cmake=cmake
   fi

   $cmake $AMBER_PREFIX/amber22_src \
     -DCMAKE_INSTALL_PREFIX=$AMBER_PREFIX/amber22_install \
     -DCOMPILER=CLANG -DBLA_VENDOR=Apple \
     -DDISABLE_TOOLS="moft" \
     -DMPI=FALSE -DCUDA=FALSE -DINSTALL_TESTS=TRUE \
     -DDOWNLOAD_MINICONDA=TRUE \
     2>&1 | tee cmake.log
else

The MPI version is more challenging, and in my experience I could not
get it to work with either mpich or openmpi that I built inside
amber22_src. I always had trouble with mpi4py. For me the solution was
to install both open-mpi and mpi4py with brew. mpi4py installs open-mpi,
but I needed the extra step to get the necessary links for cmake to
work.

brew install open-mpi
brew install mpi4py
ll /opt/homebrew/bin/mpi*
lrwxr-xr-x 1 istvankolossvary admin 35 Feb 9 00:35
/opt/homebrew/bin/mpic++ -> ../Cellar/open-mpi/5.0.1/bin/mpic++
lrwxr-xr-x 1 istvankolossvary admin 34 Feb 9 00:35
/opt/homebrew/bin/mpicc -> ../Cellar/open-mpi/5.0.1/bin/mpicc
lrwxr-xr-x 1 istvankolossvary admin 35 Feb 9 00:35
/opt/homebrew/bin/mpicxx -> ../Cellar/open-mpi/5.0.1/bin/mpicxx
lrwxr-xr-x 1 istvankolossvary admin 36 Feb 9 00:35
/opt/homebrew/bin/mpiexec -> ../Cellar/open-mpi/5.0.1/bin/mpiexec
lrwxr-xr-x 1 istvankolossvary admin 35 Feb 9 00:35
/opt/homebrew/bin/mpif77 -> ../Cellar/open-mpi/5.0.1/bin/mpif77
lrwxr-xr-x 1 istvankolossvary admin 35 Feb 9 00:35
/opt/homebrew/bin/mpif90 -> ../Cellar/open-mpi/5.0.1/bin/mpif90
lrwxr-xr-x 1 istvankolossvary admin 36 Feb 9 00:35
/opt/homebrew/bin/mpifort -> ../Cellar/open-mpi/5.0.1/bin/mpifort
lrwxr-xr-x 1 istvankolossvary admin 35 Feb 9 00:35
/opt/homebrew/bin/mpirun -> ../Cellar/open-mpi/5.0.1/bin/mpirun

ll /opt/homebrew/lib/libmpi*
lrwxr-xr-x 1 istvankolossvary admin 44 Feb 9 00:35
/opt/homebrew/lib/libmpi.40.dylib ->
../Cellar/open-mpi/5.0.1/lib/libmpi.40.dylib
lrwxr-xr-x 1 istvankolossvary admin 41 Feb 9 00:35
/opt/homebrew/lib/libmpi.dylib ->
../Cellar/open-mpi/5.0.1/lib/libmpi.dylib
lrwxr-xr-x 1 istvankolossvary admin 50 Feb 9 00:35
/opt/homebrew/lib/libmpi_mpifh.40.dylib ->
../Cellar/open-mpi/5.0.1/lib/libmpi_mpifh.40.dylib
lrwxr-xr-x 1 istvankolossvary admin 47 Feb 9 00:35
/opt/homebrew/lib/libmpi_mpifh.dylib ->
../Cellar/open-mpi/5.0.1/lib/libmpi_mpifh.dylib
lrwxr-xr-x 1 istvankolossvary admin 62 Feb 9 00:35
/opt/homebrew/lib/libmpi_usempi_ignore_tkr.40.dylib ->
../Cellar/open-mpi/5.0.1/lib/libmpi_usempi_ignore_tkr.40.dylib
lrwxr-xr-x 1 istvankolossvary admin 59 Feb 9 00:35
/opt/homebrew/lib/libmpi_usempi_ignore_tkr.dylib ->
../Cellar/open-mpi/5.0.1/lib/libmpi_usempi_ignore_tkr.dylib
lrwxr-xr-x 1 istvankolossvary admin 54 Feb 9 00:35
/opt/homebrew/lib/libmpi_usempif08.40.dylib ->
../Cellar/open-mpi/5.0.1/lib/libmpi_usempif08.40.dylib
lrwxr-xr-x 1 istvankolossvary admin 51 Feb 9 00:35
/opt/homebrew/lib/libmpi_usempif08.dylib ->
../Cellar/open-mpi/5.0.1/lib/libmpi_usempif08.dylib

Then, simply setting -DMPI=TRUE worked fine, both run_cmake and 'make
install' completed without issues.

    Istvan

_______________________________________________
AMBER mailing list
AMBER.ambermd.org
http://lists.ambermd.org/mailman/listinfo/amber
Received on Fri Feb 09 2024 - 10:30:03 PST
Custom Search