-
Notifications
You must be signed in to change notification settings - Fork 4
Native macOS build
These are instructions for getting going with the macOS native build, and our Y3 galaxy cluster analysis software. Read the instructions carefully. Do not skip any steps.
Please report any errors in the instructions to Marc (paterno@fnal.gov).
You only have to do this once. Of course, you’ll periodically need to update your copy of the various git repositories, using git pull, etc.
You are expected to have the Homebrew packages, and pip modules, required by CosmoSIS. See https://bitbucket.org/joezuntz/cosmosis/wiki/Mac%20Installs. Use python3! That means all pip commands should actually be pip3. Make sure to always use the --user flag with all pip3 commands.
For our Y3 galaxy clusters analysis, we need some additional software. Note that we update our Homebrew installation before doing anything else -- failure to keep your Homebrew installation up-to-date is a common cause of build failures, especially of hard-to-diagnose link-time failures. If you have a Homebrew installation that hasn't been updated in weeks, this may take a while.
#!bash
brew update
brew upgrade
brew install eigen # if you are told it is already installed, that is OK
Next, you need to build libcuba.dylib. There is a Homebrew installation of cuba available; it does not build a dynamic library, and it does not use the optimization level we want. Do not use it. Do the following instead:
#!bash
pushd /tmp
wget http://www.feynarts.de/cuba/Cuba-4.2.tar.gz
tar xf Cuba-4.2.tar.gz
rm Cuba-4.2.tar.gz
cd Cuba-4.2
CFLAGS="-O3 -ffast-math -fomit-frame-pointer -march=native -fPIC" ./configure
make lib
ar x libcuba.a
clang -shared *.o -o libcuba.dylib
mv libcuba.dylib /usr/local/lib
popd
rm -r /tmp/Cuba-4.2
Now we’re on to building CosmoSIS and the CSL:
#!bash
git clone http://bitbucket.org/joezuntz/cosmosis
cd cosmosis
git checkout develop # Release v1.6.2 fails on current macOS
git clone http://bitbucket.org/joezuntz/cosmosis-standard-library
cd cosmosis-standard-library
git checkout develop # Release v1.6.2 fails on current macOS
git clone git@bitbucket.org:mpaterno/y3_cluster_cpp.git
cd y3_cluster_cpp
git checkout zsource
cd ../..
source config/setup-cosmosis-mac
make # This builds cosmosis and the CSL, but not our Y3 galaxy cluster software
Next, we need cubacpp. This is a header-only library, so all you need to do is clone the repository. We do this in the top-level cosmosis directory.
#!bash
source config/setup-cosmosis-mac # only if you haven’t already done it in this shell session
git clone git@bitbucket.org:mpaterno/cubacpp.git
Because CosmoSIS is built using hand-written Makefiles, and y3_cluster_cpp uses CMake-generated Makefiles, building is a bit more complicated than it would be with a single build system. Marc is working on getting CMake to be used by CosmoSIS; this will only happen if the CosmoSIS user community is comfortable with using CMake. Feel free to spread the word with our DES colleagues.
#!bash
source config/setup-cosmosis-mac # only if you haven’t already done it in this shell session
cd cosmosis-standard-library/y3_cluster_cpp
cmake -DCUBACPP_DIR=$COSMOSIS_SRC_DIR -DCMAKE_MODULE_PATH=$COSMOSIS_SRC_DIR/cubacpp/cmake/modules -DCUBA_DIR=/usr/local -DCMAKE_BUILD_TYPE=Release .
make -j2 # or -j4, if you have a 4-core laptop. Don’t use -j (without a number)
ctest -j2 # or -j4, if you have a 4-core laptop.
As noted several times above, every time you want to work with CosmoSIS in a new shell session, you need to source the setup script:
#!bash
source config/setup-cosmosis-mac # only if you haven’t already done it in this shell session
You should be doing most of your work (editing code, building, running cosmosis) from the y3_cluster_cpp directory, or some directory below that. Pay careful attention to what directory you are in when using git commands: different parts of the cosmosis directory tree are under version control in different repositories!