CMBEASY: How to compile on OS X

Use of Healpix, camb, CLASS, cosmomc, compilers, etc.
Post Reply
Alex Conley
Posts: 11
Joined: February 08 2005

CMBEASY: How to compile on OS X

Post by Alex Conley » February 08 2005

I recently compiled CMBEASY on my Mac. Since this required
making a few changes to the source files and Makefile, I
thought it would be worth posting a record of the experience
somewhere so that other people don't have to figure this
out for themselves.

I assume that you want to install everything,
including the Markov-Chain and GUI, so some of
what I describe isn't be necessary if this is not desired.

These comments apply specifically to CMBEASY 3.0.1
and OS X 10.3.7.

First, you need to install LAM/MPI. There is a OS X
version available on the LAM/MPI website, so this
is trivial. Next you need to install qt (for the gui)
and gsl (Gnu Scientific Library). The easiest
way to install these is through fink, which most
of the people who might read this probably already
know about. If you are unfamiliar with fink,
take a look at http://fink.sourceforge.net/
If you prefer to install the GSL and QT3
some other way, good luck to you.

Specifically, the gsl and qt3 can be installed by

fink install qt3 qt3-dev gsl

If you get a complaint about not having gcc 2.95
available, that's because you used the default install
when you installed the xcode tools. Go back to your
xcode cd (or disk image, whatever) and use the
package installer. This time do a custom install,
and add gcc 2.95 to the list of packages you want.

Fink installs the qt3 headers in a slightly unusual
location, so you will have to make some changes
to the Makefile. More on that in a bit.

As indicated in the INSTALLATION file, there are
some environment variables that need to be
set. I'll leave CMBEASYDIR up to you, but assuming
that you put fink in the usual place (/sw), the
other two variables should be set via something
like:

setenv QTCMB /sw
setenv GSLCMBDIR /sw

If you don't use tcsh, modify these appropriately.

Then edit the makefile. Replace $(QTCMB)/include
with $(QTCMB)/include/qt both places that it appears.
That should take care of setting up the libraries.

Next, you need to make some changes to the source code.
There is some bug with the Apple supplied standard c libraries
that causes the isnan and isinf macros to be hidden if
#include<iostream> is used. Hopefully somebody will fix
this someday, but in the meantime there are two ways
to proceed. The first is to add the flag
-D_GLIBCPP_USE_C99 to the compile options. I wouldn't
recommend this, because it interferes with some other things.
The easier solution is to add the following two lines

extern "C" int isnan(double);
extern "C" int isinf(double);

after the #include statements in the following files:

cosmos/quintcosmos.cc
cosmos/perturbation.cc
anisotropy/analyzethis.cc
anisotropy/mc_general.cc
chain/chainshop.cc
chain/lowlevelplot.cc

Finally, one other change. The hcp command
used to make bin/mc_general has to -o 's in it.
hcp doesn't seem to like this. My solution was
to remove the first one ( -o mc_xgeneral ).
hcp only appears once in the makefile, so this
should be easy to find.

Okay, with those changes in place:

make
make bin/mc_general

and everything should compile, and, at least
as far as I can tell, work.

Luis Beça
Posts: 1
Joined: February 09 2005
Affiliation: FCUP

How to compile CMBEASY on OS X

Post by Luis Beça » February 09 2005

Just to add a minor info about installing cmbEasy on Mac OS X. If you happen to have installed LAM-MPI using Fink, the hcp wrapper mentioned in the rule for mc_binary, wont be recognized. You'll have to replace it for mpic++ (NOTE WELL, not mpiCC: this is because Panther's filesystem is case insensitive so it wont distinguish mpicc from mpiCC; this was resolved by adding mpic++ to stand for mpiCC).

Pablo Fosalba
Posts: 29
Joined: September 25 2004
Affiliation: Institut d'Estudis Espacials de Catalunya
Contact:

CMBEASY: How to compile on OS X

Post by Pablo Fosalba » March 11 2005

I followed your suggestions (thanks for those!), but I didn't manage
to compile the DESIGNER files. Any tips about that ?

thanks!

Alex Conley
Posts: 11
Joined: February 08 2005

CMBEASY: How to compile on OS X

Post by Alex Conley » March 17 2005

What version of qt do you have installed, and
by what mechanism?

I installed qt3 with fink, and that seemed to work,
although I had to edit the Makefile as described
in the instructions in the first post in this thread.

My fink list qt3 gives
i qt3 3.2.2-12 Cross-Platform GUI application framework
qt3-bin [virtual package]
i qt3-designer 3.2.2-12 Cross-Platform GUI application framework
i qt3-dev 3.2.2-12 Cross-Platform GUI application framework
i qt3-doc 3.2.2-12 Cross-Platform GUI application framework
i qt3-linguist 3.2.2-12 Cross-Platform GUI application framework
i qt3-shlibs 3.2.2-12 Cross-Platform GUI application framework

Make sure you have qt3-dev installed!

Alex

Pablo Fosalba
Posts: 29
Joined: September 25 2004
Affiliation: Institut d'Estudis Espacials de Catalunya
Contact:

CMBEASY: How to compile on OS X

Post by Pablo Fosalba » March 17 2005

Thanks a lot for the check.
Actually I have the qt3 packages properly
installed (with fink too). I found my gsl were not, so I re-installed them and now it compiles fine.
Is it possible to run the MC chains in single processor mode (like for cosmomc) ?

Michael Doran
Posts: 41
Joined: November 22 2004
Affiliation: ITP Heidelberg
Contact:

CMBEASY: How to compile on OS X

Post by Michael Doran » March 20 2005

Hi,

you can run as many chains on one machine as you like.
To test, I usually have a hostfile with only one line

localhost

On invoking "mpirun" with that hostfile, the processes
all run on your local machine. For productivity runs,
I use several machines though, cause it's faster.

Cheers, Michael

Post Reply