Page MenuHomeHEPForge

Compiling Herwig 7.3.0 on Mac OS X with Apple Silicon
Open, WishlistPublic

Description

Here are the instructions that work as of today [August 8th 2023 -- on Mac OS X Ventura 13.4.1 (c)].

This will currently exclude GoSam and VBFNLO.

  • You need the homebrew package manager installed (https://brew.sh) with gcc (currently: 13.1.0) installed as well. This gives you gfortran 13.1.0: `brew install gcc'''. You will need automake and python, if you don't have them installed already.
  • Add this version of gfortran in the herwig-boostrap:
if platform.system() == 'Darwin':
    default_cc  = os.getenv('CC',  '/usr/bin/clang')
    default_cxx = os.getenv('CXX', '/usr/bin/clang++')
    default_fc  = os.getenv('FC',  '/opt/homebrew/bin/gfortran')
brew tap davidchall/hep

and install the following:

brew install fastjet lhapdf boost hepmc3
  • Also install the LHAPDF pdfs:
lhapdf install CT14lo; lhapdf install CT14nlo
  • Then run the bootstrap with:
./herwig-bootstrap --herwig-hg --thepeg-hg --with-boost=/opt/homebrew/Cellar/boost/1.82.0_1/ --with-fastjet=/opt/homebrew/Cellar/fastjet/3.4.0_1 --with-lhapdf=/opt/homebrew/Cellar/lhapdf/6.5.3 --with-hepmc=/opt/homebrew/Cellar/hepmc3/3.2.6/ --without-gosam --without-vbfnlo Herwig-full/

[versions of dependencies will change, so they will need to be adjusted accordingly -- check the versions installed in your /opt/homebrew/Cellar directory]

  • Herwig will fail during the LoopTools compilation. I found that additional FCFLAGS are necessary, so I re-configure Herwig by finding the ./configure line in the Herwig-7.3.0/config.log and adding
FCFLAGS='-w -fno-range-check -fallow-argument-mismatch -O2 -ffixed-line-length-none -DQUAD=0 -DQUADSIZE=16 -DU77EXT=0'

i.e. in my case, this looks like:

./configure --prefix=/Users/apapaefs/Projects/Herwig/Herwig-full/ --with-thepeg=/Users/apapaefs/Projects/Herwig/Herwig-full/ --with-boost=/opt/homebrew/Cellar/boost/1.82.0_1/ --with-gsl=/Users/apapaefs/Projects/Herwig/Herwig-full/ --with-fastjet=/opt/homebrew/Cellar/fastjet/3.4.0_1 --with-madgraph=/Users/apapaefs/Projects/Herwig/Herwig-full/opt/MG5_aMC_v3_5_1 --with-openloops=/Users/apapaefs/Projects/Herwig/Herwig-full/opt/OpenLoops-2.1.2 --with-pythia=/Users/apapaefs/Projects/Herwig/Herwig-full/ --with-evtgen=/Users/apapaefs/Projects/Herwig/Herwig-full/ FCFLAGS='-w -fno-range-check -fallow-argument-mismatch -O2 -ffixed-line-length-none -DQUAD=0 -DQUADSIZE=16 -DU77EXT=0'

[Again, package versions will change!]

  • After re-reconfiguring Herwig, re-run the bootstrap as before.

Event Timeline

andreasp created this object with visibility "Public (No Login Required)".
andreasp triaged this task as Wishlist priority.Aug 8 2023, 9:09 PM
andreasp updated the task description. (Show Details)
andreasp updated the task description. (Show Details)
andreasp updated the task description. (Show Details)
aidin added a project: Restricted Project.Aug 9 2023, 10:18 AM
aidin added a subscriber: aidin.

Works on my M1 MacBook! I've edited two typos in the first bootstrap command:

  • lhbapdf -> lhapdf
  • hepmc3->hepmc (The Bootstrap doesn't differentiate between hepMC2 and hepMC3)
This comment was removed by sidsule.

Herwig Docker on Apple Silicon

I realised that many of the issues that arose when trying our bootstrap on the M1 Macs were due to the structure of the OS and not the ARM64 Chip. I am currently trying to build a docker image of Herwig and its dependencies, and if successful, we can look into making it an official docker one. You can find it here:

https://hub.docker.com/repository/docker/siddharthsule/herwig-m1

Changes so far:

  • OpenLoops, set cmodel=small in openloops.cfg (OL team confirmed it ok for the general case, but "some very complicated high-multiplicity amplitudes might not compile")
  • Herwig needs to have -fno-range-check and f-default-integer-8 for the Fortran compilation procedure