Skip to Content.
Sympa Menu

aria-discuss - [aria-discuss] Running ARIA 2.3.2 with CNS 1.21 on a M1 Macintosh (macOS 11.4)

Subject: Discussion group for the ARIA software

List archive

[aria-discuss] Running ARIA 2.3.2 with CNS 1.21 on a M1 Macintosh (macOS 11.4)


Chronological Thread  
  • From: "Nikolaus Loening" <loening AT lclark.edu>
  • To: aria-discuss AT services.cnrs.fr
  • Subject: [aria-discuss] Running ARIA 2.3.2 with CNS 1.21 on a M1 Macintosh (macOS 11.4)
  • Date: Tue, 22 Jun 2021 23:57:38 +0200

For those of you who use macOS and are getting a Macintosh with the new M1
(Arm64) processor, I'm happy to report that ARIA 2.3.2 works with CNS 1.21. Of
course, the Aria Web Server (https://ariaweb.pasteur.fr) is available for
doing calculations in the cloud, but if you're like me and prefer running
calculations locally, the following instructions might come in handy. I'm not
sure if all of the following steps listed below are strictly necessary, but
this is what worked for me on a M1 Mac Mini running macOS 11.4 (Big Sur). Some
of the following might also be helpful if you're trying to get ARIA/CNS
working on an Intel Mac running Big Sur.


PERFORMANCE OPTIMIZATION

In looking at the results from the "top" command, I noticed that about half of
the time CNS wasn't actually running. Basically, the peptide in the project I
was playing with to test things is small enough that ARIA is spending a lot of
time in a sleep state waiting for CNS to finish. I reduced the times in the
"sleep" commands in src/py/aria/JobManager.py by a factor of ten (from 5
seconds to 0.5 seconds at line 234 and from 2 seconds to 0.2 seconds at line
357), as well as in src/py/aria/cns.py (from 1 second to 0.1 seconds at line
2430). This reduced the calculation time for this peptide from ~15 minutes to
~6.5 minutes. For larger proteins, the speed up from these edits will be less
dramatic as each CNS calculation will be longer, so the amount of time that
ARIA sleeps before launching the next CNS job is a smaller percentage of the
overall calculation time. But you should still be able to save 7-8 minutes by
making these changes.


PERFORMANCE COMPARISON

In terms of performance, the M1 chip is pretty fast. An ARIA calculation (with
the modifications to ARIA above) of a small peptide that took ~11 minutes to
complete on a 2019 Intel iMac (3 GHz, 6 core i5) took 6.5 minutes on a M1 Mac
Mini. The M1 processor has 4 high performance cores and 4 energy efficient
cores. I found that calculations completed a bit faster (6.5 minutes) using
all 8 cpus for ARIA than using 4 cpus (9 minutes), so the contribution of the
energy efficient cores is significant.


INSTALLATION

1) Download Aria 2.3.2 (http://aria.pasteur.fr/archives/aria2.3.2.tar.gz).
Unpack and move to whereever is convenient.

2) Download CNS 1.2 patchlevel 1 (http://cns-online.org/v1.21/). ARIA doesn't
work with CNS 1.3. Unpack and move to whereever is convenient. Edit
cns_solve_1.21/cns_solve_env to define the location of the CNSsolve directory.

3) Copy the ARIA Fortran sources from ARIA's cns/src folder to cns_solve_1.21/
source

4) You'll need a Fortran compiler. I used gfortran, which is installed with
the GNU Compiler Collection (gcc), and installed it using HomeBrew
(https://brew.sh). You can also install gcc/gfortran using MacPorts
(https://www.macports.org). The third package manager for macOS, Fink
(https://www.finkproject.org), doesn't yet support macOS 11 (Big Sur).

To install HomeBrew, just execute the following on the command line:

/bin/bash -c "$(curl -fsSL
https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

After answering some prompts, it should download and install itself. HomeBrew
will also install the Apple's XCode command line tools if those aren't already
installed. Once installed, you'll need to add the HomeBrew path to
your .zprofile (replace "loening" with your username below). Note, the
commands below for modifying .zprofile are for HomeBrew on M1 systemes, where
HomeBrew goes into the /opt/homebrew folder. On Intel macs, HomeBrew will end
up in /usr/local.

echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> /Users/
loening/.zprofile
eval "$(/opt/homebrew/bin/brew shellenv)"

You can then install gcc (or confirm that gcc has been installed). In my case,
the version of gcc with HomeBrew is 11.1.

brew install gcc

On a side note, HomeBrew is a great way to install an up-to-date (and free)
version of PyMOL

brew install brewsci/bio/pymol

5) The following commands assume you're on the command line in the folder
containing the cns_solve_1.21 folder. First, copy the gfortran Makefile from a
different supported configuration to the mac-intel-darwin machine folder

cp cns_solve_1.21/instlib/machine/supported/intel-x86_64bit-linux/
Makefile.header.2.gfortran cns_solve_1.21/instlib/machine/supported/mac-intel-
darwin/Makefile.header.5.gfortran

You'll need this additional Makefile file to use gfortran to compile CNS on
Intel Macs. For our M1 (ARM) macs, you'll want to then copy the entire Intel
Mac machine directory to a new directory for ARM macs:

cp -r cns_solve_1.21/instlib/machine/supported/mac-intel-darwin
cns_solve_1.21/instlib/machine/supported/mac-arm-darwin

6) In cns_solve_1.21/instlib/machine/supported/mac-arm-darwin/Makefile.header.
5.gfortran modify the F77STD line to match what's below.

F77STD = -fdefault-integer-8 -w -fallow-argument-mismatch

also remove the "-ffast-math" from FF77OPT. For me, this option seems to slow
down calculations by 10% rather than speeding them up and changes the results
of the calculations as well (not surprising, as this compiler option changes
how round-off errors are handled in floating point operations and makes some
other changes as well).

7) We'll now need to make some edits to the CNS source files.
a) Set MXRTP to 4000 in cns_solve_1.21/source/rtf.inc
b) Set MXFPEPS2 value to 8192 in cns_solve_1.21/source/machvar.inc
c) add the below line in cns_solve_1.21/source/machvar.f
WRITE (6,'(I6,E10.3,E10.3)') I, ONEP, ONEM
just above line 67, which looks like this:
IF (ONE .EQ. ONEP .OR. ONE .EQ. ONEM) THEN

8) In cns_solve_1.21/bin/getarch, add the following at the end of the section
for selecting machine architecture

arm64:Darwin:*:*)
echo mac-arm64-darwin
exit 0 ;;

9) Change directory to cns_solve_1.21 and compile:

make install compiler=gfortran

10) At this point, you'll hopefully compile without any errors (although a few
warnings will appear). Check to see if CNS runs:

./mac-arm64-darwin/bin/cns

11) For running Aria's graphical interface, you'll need to install X Windows
software; a good option is XQuartz, https://www.xquartz.org. You might be able
to get away with installing X11 via HomeBrew, but I haven't tested that.

12) Due to its dependence on Tix, the graphical interface of ARIA can be
tricky to get running. I haven't figured out how to successfully compile a
working version of Tix (which hasn't been updated since 2008), so instead
following the suggestion from others (presumably from Benjamin Bardiaux) to
install an older version of CCPNMR (version 2.3 worked for me), which has all
the required Tcl/Tk/Tix libraries needed. See
http://aria.pasteur.fr/faq-1/no-tix-on-mac-use-ccpnmr-analysis-as-a-python-tcl-tk-tix-surrogate
for instructions.

13) Aria needs different Python versions for running the graphical interface
(which needs Tix) versus doing calculations (which fails when old versions of
Python are used, presumably because of a race condition in the multiprocessor
code). The following should be added to your .zshrc file; CCPNMR_OLD will need
to be edited to point to whereever you installed the old version of CCPNMR,
and ARIA2 will also need to be edited to match where you put the aria2.3.2
folder.

export CCPNMR_OLD=/Users/Shared/sw/ccpnmr
export PYTHONPATH=".:${CCPNMR_OLD}/ccpnmr2.3/python"
export LD_LIBRARY_PATH="${CCPNMR_OLD}/tcl8.5/lib:${CCPNMR_OLD}/tk8.5/
lib:${CCPNMR_OLD}/tcl8.5/lib/Tix8.4.3"
export DYLD_LIBRARY_PATH="${CCPNMR_OLD}/tcl8.5/lib:${CCPNMR_OLD}/
tk8.5/lib:${CCPNMR_OLD}/tcl8.5/lib/Tix8.4.3"
export TCL_LIBRARY="${CCPNMR_OLD}/tcl8.5/lib/tcl8.5"
export TK_LIBRARY="${CCPNMR_OLD}/tk8.5/lib/tk8.5"
export TIX_LIBRARY="${CCPNMR_OLD}/tcl8.5/lib/Tix8.4.3"
export ARIA2="/Users/Shared/sw/aria2.3.2"
alias aria2g="${CCPNMR_OLD}/python2.6/bin/python2.6 -O $ARIA2/aria2.py
-g"
alias aria2="python -O $ARIA2/aria2.py"

Note that there are two different aliases for ARIA, which allows it to be run
with different versions of pythons depending on whether the graphical
interface is being used (aria2g) or not (aria2).

I think that's it. Hopefully I didn't miss anything or introduce too many
errors in transcribing my installation notes.

Niko Loening


  • [aria-discuss] Running ARIA 2.3.2 with CNS 1.21 on a M1 Macintosh (macOS 11.4), Nikolaus Loening, 06/22/2021

Archive powered by MHonArc 2.6.19.

Top of Page