example of installation of cosmomc ('how to' on Ubuntu 8.04 & intel compiler)

Use of Cobaya. camb, CLASS, cosmomc, compilers, etc.
Post Reply
ivan rodriguez-montoya
Posts: 7
Joined: March 21 2009
Affiliation: Cinvestav
Contact:

example of installation of cosmomc (''how to'' on Ubuntu 8.0

Post by ivan rodriguez-montoya »

Hi everybody,

I want to post my way to install cosmomc step by step with two aims:
1.- Looking for feedback in equivalent or more efficient ways to do it and
2.- help other dummies like me to gain time in installation process

(I write informal, hope don't bother you)

1.To avoid confusion in paths of shell, it is extremely recommended to install the intel compilers from the same release and have installed only one version. If this is done, the icc and ifort compileres and libraries will be located by default all in the same directory. e.g., /opt/intel/Compiler/11.1/072. Each of these compilers include the MKL libraries. I stress that it is not necessary to install ifort and MKL apart.

2.Follow the install instructions in the intel web page (there is an evaluation licence supplied by intel). By default it would be installed 'static' (see openMPI below) in the root folder /opt/intel. Once installed, it is only necessary to add some lines to the file /home/myuser/.bashrc in order let know the shell the paths to the compilers and MKL libraries. These lines should look more or less like

source /opt/intel/Compiler/11.1/072/bin/ifortvars.sh ia32
source /opt/intel/Compiler/11.1/072/bin/iccvars.sh ia32
source /opt/intel/Compiler/11.1/072/bin/ia32/idbvars.sh
source /opt/intel/Compiler/11.1/072/mkl/tools/environment/mklvars32.sh

3.Intel also provides MPI libraries, but the installation resulted awkward to my devian based system. (The install scripts are oriented to red hat systems, using .rpm instead of .deb; alien did not work efficiently either. If you know how to install intel MPI on Ubuntu do not doubt in show me.) On the other hand, openMPI installation is straight.

4.You can find the current version of OpenMPI in http://www.open-mpi.org/. Read the FAQ section if you want to learn useful options before installation. You can install openMPI either as static or dynamic. Static points to some directory specified by the 'prefix' option, it is usually chosen to point to some super-user location. Dynamic does not require the 'prefix' option and will be installed directlly in the untared directory. I rather prefer the former, so I use the option “prefix”. Moreover, in my case we want to use the intel compilers. Thus, after decompress the tar file I go into the created directory and type in shell as super-user (you edit the path to your intel compilers)

Code: Select all

> ./configure --prefix=/usr/local CC=/opt/intel/Compiler/11.1/072/bin/icc CXX=/opt/intel/Compiler/11.1/072/bin/icpc F77=/opt/intel/Compiler/11.1/072/bin/ifort FC=/opt/intel/Compiler/11.1/072/bin/ifort 
> make all install 
With this, I have configured the installation to be located at /usr/local/share/openmpi.

5. I create two files and save them at home. A file named mpd.hosts and write in it the name of all the host on your system. For example, my lap-top only has one host, in the shell I see this: ivan@ivan-laptop:, then in my mpd.hosts file I wrote
ivan-laptop
You can find your own hardware features with

Code: Select all

 sudo lshw -html > ~/Desktop/hardware.html 
Now, create 2nd file in your home and name it .mpd.conf. This must contain a secret word, for example
MPD_SECRETWORD=secreto-de-ivan
(change 'secreto-de-ivan' for your own secret)

6.you can now test with some test.f90 code written for MPI. Solve errors if any.

Code: Select all

 mpif90 test.f90 
7.At this stage it should be possible to do a test compilation to COSMOMC. You only need to let in blank the WMAP variable. You must to set the correct path to your mpi compiler. Sintaxis of MKL libraries varies from one release to other, for that reason the best advice is going to your own documentation located at some like /opt/intel/Compiler/11.1/072/Documentation/en_US/mkl. Read the userguide.pdf 'linking examples' (chapter 5) to learn how to link your programs with MKL libraries. Remember in our case, we have installed MKL static, so, use static linking. The COSMOMC Makefile should contain lines more or less like these

Code: Select all

 MKLPATH=/opt/intel/Compiler/11.1/072/mkl/lib/32
MKLINCLUDE=/opt/intel/Compiler/11.1/072/mkl/include
WMAP = 
CFITSIO = 
INCLUDE= -I$(MKLINCLUDE)
F90C     = /usr/local/bin/mpif90
FFLAGS = -O2 -ip -W0 -WB -openmp -fpp -DMPI -vec_report0  
                -mkl=parallel
LAPACKL = -L$(MKLPATH) $(MKLPATH)/libmkl_lapack95.a \
                  -Wl,--start-group $(MKLPATH)/libmkl_intel.a  \
                  $(MKLPATH)/libmkl_sequential.a \
                  $(MKLPATH)/libmkl_core.a -Wl,--end-group  \ 
                  -liomp5 -lpthread
With no errors, then I go the next step, WMAP, but for that it is needed CFITSIO as a prerequisite.

8.You can download cfitsio from http://heasarc.gsfc.nasa.gov/docs/software/fitsio/fitsio.html. Pick the Unix.tar file. As in the step of openMPI you can type

Code: Select all

> ./configure - -help 
to learn how to select the more adequate choices for your system. For example, I use prefix=/usr/local and CC=icc.

9.The WMAP Likelihood software can be downloaded from http://lambda.gsfc.nasa.gov/product/map/current/likelihood_get.cfm. See the Detailed Product Description and pick wmap_likelihood_full_v4p1.tar.gz if you want the full product. Create a directory named something like WMAP and place the compressed file. Uncompress it and in your terminal go to ~/likelihood_v4p1. Edit the Makefile in analogy with that of COSMOMC. You should have lines more or less like

Code: Select all

 CFITSIO=/usr/local/cfitsio 
MKLPATH=/opt/intel/Compiler/11.1/072/mkl/lib/32
MKLINCLUDE=/opt/intel/Compiler/11.1/072/mkl/include 
F90 = /opt/intel/Compiler/11.1/072/bin/ia32/ifort 
FFLAGS = -O $(WMAPFLAGS)
INCS   = -I. -I$(CFITSIO)/include -I$(MKLINCLUDE)
INCS   = -I. -I$(CFITSIO)/include -I$(MKLINCLUDE)
LIBS   = -L. -L$(CFITSIO)/lib -lcfitsio -L$(MKLPATH) \  
                      -Wl,--start-group $(MKLPATH)/libmkl_intel.a  \
                      $(MKLPATH)/libmkl_sequential.a  \
                    $(MKLPATH)/libmkl_core.a -Wl,--end-group   -lpthread
10.Edit WMAP_7yr_options.F90 to hard code the full path instead of data/, e.g. in my case WMAP_data_dir = '/home/ivan/Documentos/Cinvestav/cmb/WMAP/likelihood_v4p1/data/'

11.In your terminal run

Code: Select all

 make all 
and solve errors if any (do not make clean :D)

12.Edit again the Makefile of COSMOMC to include WMAP, by setting lines more or less like

Code: Select all

 WMAP = /home/ivan/Documentos/Cinvestav/cmb/WMAP/likelihood_v4p1 
CFITSIO=/usr/local/cfitsio
INCLUDE= -I$(WMAP) -I$(CFITSIO)/include -I$(MKLINCLUDE) 
13.In your terminal go to ~/cosmomc/source. If you run the previous test without WMAP you should clean, then

Code: Select all

 make clean 
make all 
see if life is happy or solve for errors.

14.Run the test supplied

Thanks in advance for your comments.
Michelle Knights
Posts: 4
Joined: January 11 2011
Affiliation: University of Cape Town/ AIMS/ SAAO

example of installation of cosmomc (''how to'' on Ubuntu 8.0

Post by Michelle Knights »

Dear Ivan

Thank you so much for you detailed step by step instructions. They were such a huge help for when installing CosmoMC. I'm sure if it weren't for you it would have taken me so much longer. You've done an excellent job, especially with this complex code.

Warm Regards
Michelle
Post Reply