Compiling WMAP under cygwin

Use of Cobaya. camb, CLASS, cosmomc, compilers, etc.
Mario Acero
Posts: 28
Joined: November 15 2006
Affiliation: Universidad del Atlantico
Contact:

Compiling WMAP under cygwin

Post by Mario Acero » December 04 2006

Hello,

I am trying to install CosmoMC and the WMAP-likelihood code in Windows, using cygwin.
I have the following commands in the Makefile of WMAP-likelihood:

Code: Select all

F90	= gfc
FFLAGS = -O $(WMAPFLAGS) -g
INCS   = -I. -I$(CFITSIO)/include
LIBS   = -L. -L$(CFITSIO)/ -lcfitsio -L/lib/lapack -llapack 
Then, the following errors appear:

WMAP_3yr_tt_pixlike.o: In function '__tlike__compute_tt_pixlike':
/home/Administrator/wmap_likelihood_v2p2p2/WMAP_3yr_tt_pixlike.F90:369: undefined reference to '_dgemv_'

WMAP_3yr_teeebb_pixlike.o: In function '__wmap_eebb_lowl__eebb_lowl_likelihood':
/home/Administrator/wmap_likelihood_v2p2p2/WMAP_3yr_teeebb_pixlike.F90:438: undefined reference to '_sgemv_'
collect2: ld returned 1 exit status

I think (I hope) I have installed all the required packages.
Could you tell me what could be wrong?

Thanks a lot,

MarioA.

Savvas Nesseris
Posts: 77
Joined: April 05 2005
Affiliation: UAM/IFT
Contact:

Compiling WMAP under cygwin

Post by Savvas Nesseris » December 04 2006

Hi,
I believe the problem is that you didn't link to the BLAS library (a google search : blas dgemv will persuade you). You can find BLAS all ready compiled under cygwin (as I think you did with LAPACK) but if you want an optimised version of those two (which is much faster) you can download a minimal lapack&blas set that contains just the necessary routines (not the whole~50Mb set) from:

http://leandros.physics.uoi.gr/pdl-cross/mathfiles.zip

You will find everything (both LAPACK and BLAS) in the zip file: mathfiles/min_lapack.zip that comes ready with a makefile! After you compile it (change the compiler to gfc) place it in C:\cygwin\lib. The library will be called liblapack1.a and you can call it from your programs just as any other lib!

Cheers,
Savas

Mario Acero
Posts: 28
Joined: November 15 2006
Affiliation: Universidad del Atlantico
Contact:

Compiling WMAP under cygwin

Post by Mario Acero » December 05 2006

Well, thank you very much, Savas.

Now I think that I could make some mistake, because there is a new error message:

Code: Select all

gfc -O -DFASTERTT -DOPTIMIZE -g -o test read_archive_map.o read_fits.o WMAP_3yr_options.o WMAP_3yr_util.o WMAP_3yr_tt_pixlike.o WMAP_3yr_tt_beam_and_ptsrc_corr.o WMAP_3yr_teeeb_pixlike.o WMAP_3yr_likelihood.o test.o -L. -LC:/cygwin/usr/local/cfitsio/ -lcfitsio -LC:/cygwin/lib -llapcak1

/usr/bin/ld: crt0.o : No such file : No such file or directory

collect2: ld returned 1 exit status
I have been looking for the file crt0.o, but I do not find it.

Could you tell me what could be the problem here?

Thank you,

MarioA.

Savvas Nesseris
Posts: 77
Joined: April 05 2005
Affiliation: UAM/IFT
Contact:

Compiling WMAP under cygwin

Post by Savvas Nesseris » December 05 2006

Hi,
I think, by looking at the error message, that you should link to -llapack1 and not -llapcak1. If this doesn't work please tell me which version of the likelihood code you are using:

1)The old (requires Healpix)?

2)The new (does not require Healpix)?

Cheers,
Savas

Mario Acero
Posts: 28
Joined: November 15 2006
Affiliation: Universidad del Atlantico
Contact:

Compiling WMAP under cygwin

Post by Mario Acero » December 05 2006

Sorry, that was a mistake writing the error message. It actually appears -llapack1, so that is not the problem.

On the other hand, I am using wmap_likelihoodcode_v2v2p2, which I got from the web page recommended in the CosmoMC Readme.
Then, I think I don't need Healpix.

Thank you.

Regards,

MarioA

Savvas Nesseris
Posts: 77
Joined: April 05 2005
Affiliation: UAM/IFT
Contact:

Compiling WMAP under cygwin

Post by Savvas Nesseris » December 05 2006

Hi,
I managed to compile the WMAP likelihood with gfc. The relevant part in my makefile was:
## PC+Cygwin
F90 = gfc
FFLAGS =
INCS = -I.
LIBS = -L. -LC:/cygwin/lib -L$(CFITSIO)/lib -lcfitsio -llapack1
By the way, which version of gfc are you using? Write gfc --version. Some old or experimental versions had bugs so try the latest. If all fails then try the g95 compiler. The latter is the one I use as it's one of the best out there (it's true and no I'm not in their payroll!). You can find it at:

http://ftp.g95.org/#V0.9

the Self-extracting Cygwin x86 is the one you want.

Cheers,
Savas

Mario Acero
Posts: 28
Joined: November 15 2006
Affiliation: Universidad del Atlantico
Contact:

Compiling WMAP under cygwin

Post by Mario Acero » December 05 2006

Hello,

Dear Savas, thank you very much for your help.

Well, fist of all, I noted I was using an experimental version of the gfc compiler, so I changed for the one you suggested.
Then, I am now using g95. However, it is not working yet.
This is the error now:

Code: Select all

g95 -o test read_archive_map.o read_fits.o WMAP_3yr_options.o WMAP_3yr_util.o WMAP_3yr_tt_pixlike.o WMAP_3yr_tt_beam_and_ptsrc_corr.o WMAP_3yr_teeeb_pixlike.o WMAP_3yr_likelihood.o test.o -L. -LC:/cygwin/usr/local/cfitsio/ -lcfitsio -LC:/cygwin/lib -llapack1

/bin///ld: crt0.o : No such file : No such file or directory

make: *** [test] Error 1
There is something with the file crt0.o, I think. In fact, I don't find it in the Cygwin directory.

So, what do you think?

Best,

MarioA.

Savvas Nesseris
Posts: 77
Joined: April 05 2005
Affiliation: UAM/IFT
Contact:

Compiling WMAP under cygwin

Post by Savvas Nesseris » December 05 2006

Hi,
I checked my Cygwin directory and the file crt0.o was under C:\cygwin\lib. I believe it is related to the Mingw32. Try downloading, through the Cygwin setup, all libraries related to Mingw32. I think that there should be the following (at least they are in my installation!):

mingw-runtime
gcc-mingw-core
gcc-mingw-g77
gcc-mingw-objc

Everything is under D-Level. Now try again! Remember to recompile the minimal Lapack & Blas library with g95.

Also, I am not sure right now that it matters, but try to place all your link paths together (-LC:/... command) and the libraries to be linked with together (-llapack1... etc) so you will have something like (no slash "/" is needed at the end of the path):

-L. -LC:/cygwin/usr/local/cfitsio -LC:/cygwin/lib -lcfitsio -llapack1

Finally, check that the include path is in the current directory: -I.

Cheers,
Savas

Mario Acero
Posts: 28
Joined: November 15 2006
Affiliation: Universidad del Atlantico
Contact:

Compiling WMAP under cygwin

Post by Mario Acero » December 06 2006

Thank you Savas,

Actually, the file was not there. I am now trying to reinstall all Cygwin to see if I can solve all the previous problems.

I will make more questions later.

Best,

MarioA

Mario Acero
Posts: 28
Joined: November 15 2006
Affiliation: Universidad del Atlantico
Contact:

Compiling WMAP under cygwin

Post by Mario Acero » December 07 2006

Hello all,

Finally I have managed to make work WMAP under Cygwin. I think it is working well. Now, I have another problem. I'm trying to run the Makefile in the source subdirectory, but I am not sure about what option of compiler I should use.
I have installed the g95 command as suggested by Savas, so I think I have to use it also in this case, however I would like to know if any of the options written in the Makefile could work, just writing

Code: Select all

 F90C = g95 
.

So, could you help me about this?

Thanks a lot,

MarioA

Savvas Nesseris
Posts: 77
Joined: April 05 2005
Affiliation: UAM/IFT
Contact:

Compiling WMAP under cygwin

Post by Savvas Nesseris » December 07 2006

Hi,
I'm glad that everything is working! Now,

1) Recompile the minimal lapack and blas library with g95 to build the library, as using libraries built by another compiler creates fatal errors, and replace the old liblapack1.a lib with the new one.

2)Edit the makefile of the WMAP likelihood code to include the following lines (put them where the other compilers are and remember to check if all other compilers are commented out (use a #) ):


## PC+Cygwin
F90 = g95
FFLAGS = -O2
INCS = -I.
LIBS = -L. -LC:/cygwin/lib -L(path to the cfitsio lib) -lcfitsio -llapack1

Save and exit the makefile.

3)Remember to edit the WMAP_3yr_options.F90 file. If necessary change the parameter :: WMAP_data_dir to where the data are (eg I keep the data in a different folder as I have multiple copies of the code: 'C:/CMB_programs/CMB_exe/wmap_likelihood_3yr/data/' )
Save and exit the file.

4)Run make and enjoy the ride!

Cheers,
Savas

Mario Acero
Posts: 28
Joined: November 15 2006
Affiliation: Universidad del Atlantico
Contact:

Compiling WMAP under cygwin

Post by Mario Acero » December 07 2006

Hello again,

Here are the options I am using to compile the Makefile or the source directory:
cfitsio = /cygdrive/c/cygwin/cfitsio
WMAP3 = /cygdrive/c/cygwin/wmap_likelihoodcode_v2p2p2

IFLAG = -I

#G95; make sure LAPACK and MPI libs also compiled with g95
F90C = g95
FFLAGS = -O2 #-DMPI
LAPACKL = /cygdrive/c/cygwin/lib/liblapack1.a /cygdrive/c/cygwin/lib/libblas.a

cosmomc: [tex](OBJFILES)
[/tex](F90C) -o ../cosmomc [tex](OBJFILES) [/tex](CLSLIB) $(F90FLAGS)
After reading all the files from the camb directory, it starts to read the WMAP files, arriving to the following point:
g95 -o ../cosmomc /cygdrive/c/cygwin/wmap_likelihoodcode_v2p2p2/...
... -O2 -I/cygdrive/c/cygwin/cfitsio -I/cygdrive/c/cygwin/wmap_likelihoodcode_v2p2p2 -I../camb

setting.o:setting.f90:(.text+0xa4): undefined reference to 'ssyev_'

make: *** [cosmomc} Error 1
Could someone tell me the meaning of this Error?

Thank you very much,

MarioA.

Savvas Nesseris
Posts: 77
Joined: April 05 2005
Affiliation: UAM/IFT
Contact:

Compiling WMAP under cygwin

Post by Savvas Nesseris » December 07 2006

Hi,
the error
undefined reference to 'ssyev_'
that you get comes from lapack. It obiously needs some routines that are not found in the minimal version of the lapack and blas I gave you...

To cure this (I tried it myself) just switch back to cygwin's lapack lib (I believe that by now you must have it? If not, use the update setup)

I will try and gather just the necessary routines and update the minimal lib if I manage to find some free time tomorrow ...

Cheers,
Savas

Mario Acero
Posts: 28
Joined: November 15 2006
Affiliation: Universidad del Atlantico
Contact:

Compiling WMAP under cygwin

Post by Mario Acero » December 07 2006

Hello,

Thank a lot. Each time things are going better.
Now I could compile everything almost in order. The I have tried to run an individual chain, following the steps given in http://cosmologist.info/cosmomc/readme.html, having changed the necessary paths in the params.ini file.
Unfortunately, I can not use a cluster right now, so I am running the program without the MPI option (by the way, is it possible to implement MPI under Cygwin?). So, using

Code: Select all

./cosmomc params.ini
there is a new error appearing:

Code: Select all

At line 151 of file paramdef.F90
Traceback: not available, compile with -ftrace=frame or -ftrace=full
Fortran runtime error: End of file
What should I do now?

Thanks for your help!

Best,

MarioA.

Savvas Nesseris
Posts: 77
Joined: April 05 2005
Affiliation: UAM/IFT
Contact:

Compiling WMAP under cygwin

Post by Savvas Nesseris » December 08 2006

Hi,
What paths did you change? Try running the default params.ini file (of course you should change the maximum number of chain steps to something like samples = 5 to quickly check if cosmomc produces anything).

About MPI of course it is possible to implement it under Cygwin. However, I haven't tried yet, so it would be interesting to explore this option...

Cheers,
Savas

Post Reply