Skip to content

Native linux build

jamesannis edited this page Dec 3, 2019 · 6 revisions

These are instructions for getting going with the linux cosmosis 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).

To obtain the software

Follow the main cosmosis install by bootstrap directions.

I use

pwd
  /data/des91.a/data/annis/sing_cos/Native
cd cosmosis
source config/setup-cosmosis-linux

For our Y3 galaxy clusters analysis, we need some additional software.

pwd
  /data/des91.a/data/annis/sing_cos/Native
cd cosmosis/ups
wget https://scisoft.fnal.gov/scisoft/packages/eigen/v3_3_4a/eigen-3.3.4a-noarch.tar.bz2
tar -xf eigen-3.3.4a-noarch.tar.bz2
ups list -aK+ eigen
  "eigen" "v3_3_4a" "NULL" "" "" 
setup -B eigen v3_3_4a
printenv | grep EIGEN
  EIGEN_VERSION=v3_3_4a
  EIGEN_DIR=/data/des91.a/data/annis/sing_cos/Native/cosmosis/ups/eigen/v3_3_4a
  SETUP_EIGEN=eigen v3_3_4a -f NULL -z /data/des91.a/data/annis/sing_cos/Native/cosmosis/ups
  EIGEN_INC=/data/des91.a/data/annis/sing_cos/Native/cosmosis/ups/eigen/v3_3_4a/include/eigen3

Now we need to make some helper software. I'm working in

pwd
  /data/des91.a/data/annis/sing_cos/Native
ls
  cosmosis  cosmosis-bootstrap-linux 
mkdir local
mkdir local/include
mkdir local/lib
cd local

Make Cuba

pwd
  /data/des91.a/data/annis/sing_cos/Native/local
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
cp cuba.h ../local/include/cuba.h
make lib
ar x libcuba.a
cp libcuba.a ../lib/

If your cmake version is less than 3.10:

pwd
  /data/des91.a/data/annis/sing_cos/Native/local
wget https://github.com/Kitware/CMake/releases/download/v3.16.0/cmake-3.16.0.tar.gz
tar xf cmake-3.16.0.tar.gz
rm cmake-3.16.0.tar.gz
cd cmake-3.16.0
./bootstrap --prefix=/data/des91.a/data/annis/sing_cos/Native/local
make
make install

We'll need cluster_toolkit, as some Y3 galaxy cluster pipelines use the Python module 'cluster_toolkit'. Note that there is a quirk in the python installation script that requires an unusual syntax. Make sure you do not put a space after the final = for this command.

pwd
  /data/des91.a/data/annis/sing_cos/Native/local
git clone https://github.com/tmcclintock/cluster_toolkit.git
cd cluster_toolkit
python setup.py install --user --prefix=

The --prefix= flag, in our case, installs the cluster_toolkit in the standard python location in the cosmosis directory tree.

Now we’re on to getting the cosmosis-standard-library and y3_cluster_cpp codes.

pwd
  /data/des91.a/data/annis/sing_cos/Native/
cd cosmosis
git checkout develop # Release v1.6.2 fails on current macOS
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 ../../
pip install --user -r config/requirements.txt

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.

pwd
  /data/des91.a/data/annis/sing_cos/Native/cosmosis
source config/setup-cosmosis-linux # only if you haven’t already done it in this shell session
git clone git@bitbucket.org:mpaterno/cubacpp.git

To build and use our Y3 galaxy cluster software

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.

pwd
  /data/des91.a/data/annis/sing_cos/Native/cosmosis
source config/setup-cosmosis-linux # only if you haven’t already done it in this shell session
cd cosmosis-standard-library/y3_cluster_cpp
/data/des91.a/data/annis/sing_cos/Native/local/bin/cmake -DCMAKE_MODULE_PATH="${COSMOSIS_SRC_DIR}/cosmosis-standard-library/y3_cluster_cpp/CMake;${COSMOSIS_SRC_DIR}/cubacpp/cmake/modules" -DCUBACPP_DIR=${COSMOSIS_SRC_DIR}/cubacpp -DCUBA_DIR=/data/des91.a/data/annis/sing_cos/Native/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. 

For day-to-day work

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:

source config/setup-cosmosis-linux # only if you haven’t already done it in this shell session; also, only this path, otherwise the setup doesnt work!
cosmosis #  to run any cosmosis job

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!

Clone this wiki locally