CosmoCoffee Forum Index CosmoCoffee

 
 FAQFAQ   SearchSearch  MemberlistSmartFeed   MemberlistMemberlist    RegisterRegister 
   ProfileProfile   Log inLog in 
Arxiv New Filter | Bookmarks & clubs | Arxiv ref/author:

Compiling WMAP under cygwin
Goto page 1, 2  Next  
Post new topic   Reply to topic    CosmoCoffee Forum Index -> Computers and software
View previous topic :: View next topic  
Author Message
Mario Acero



Joined: 15 Nov 2006
Posts: 25
Affiliation: ICN - UNAM

PostPosted: December 04 2006  Reply with quote

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:

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.
Back to top
View user's profile [ Hidden ] Visit poster's website
Savvas Nesseris



Joined: 05 Apr 2005
Posts: 50
Affiliation: UAM/IFT

PostPosted: December 04 2006  Reply with quote

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
Back to top
View user's profile [ Hidden ] Visit poster's website
Mario Acero



Joined: 15 Nov 2006
Posts: 25
Affiliation: ICN - UNAM

PostPosted: December 05 2006  Reply with quote

Well, thank you very much, Savas.

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

Code:

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.
Back to top
View user's profile [ Hidden ] Visit poster's website
Savvas Nesseris



Joined: 05 Apr 2005
Posts: 50
Affiliation: UAM/IFT

PostPosted: December 05 2006  Reply with quote

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
Back to top
View user's profile [ Hidden ] Visit poster's website
Mario Acero



Joined: 15 Nov 2006
Posts: 25
Affiliation: ICN - UNAM

PostPosted: December 05 2006  Reply with quote

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
Back to top
View user's profile [ Hidden ] Visit poster's website
Savvas Nesseris



Joined: 05 Apr 2005
Posts: 50
Affiliation: UAM/IFT

PostPosted: December 05 2006  Reply with quote

Hi,
I managed to compile the WMAP likelihood with gfc. The relevant part in my makefile was:

Quote:
## 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
Back to top
View user's profile [ Hidden ] Visit poster's website
Mario Acero



Joined: 15 Nov 2006
Posts: 25
Affiliation: ICN - UNAM

PostPosted: December 05 2006  Reply with quote

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:

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.
Back to top
View user's profile [ Hidden ] Visit poster's website
Savvas Nesseris



Joined: 05 Apr 2005
Posts: 50
Affiliation: UAM/IFT

PostPosted: December 05 2006  Reply with quote

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
Back to top
View user's profile [ Hidden ] Visit poster's website
Mario Acero



Joined: 15 Nov 2006
Posts: 25
Affiliation: ICN - UNAM

PostPosted: December 06 2006  Reply with quote

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
Back to top
View user's profile [ Hidden ] Visit poster's website
Mario Acero



Joined: 15 Nov 2006
Posts: 25
Affiliation: ICN - UNAM

PostPosted: December 07 2006  Reply with quote

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:
 F90C = g95
.

So, could you help me about this?

Thanks a lot,

MarioA
Back to top
View user's profile [ Hidden ] Visit poster's website
Savvas Nesseris



Joined: 05 Apr 2005
Posts: 50
Affiliation: UAM/IFT

PostPosted: December 07 2006  Reply with quote

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
Back to top
View user's profile [ Hidden ] Visit poster's website
Mario Acero



Joined: 15 Nov 2006
Posts: 25
Affiliation: ICN - UNAM

PostPosted: December 07 2006  Reply with quote

Hello again,

Here are the options I am using to compile the Makefile or the source directory:
Quote:

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: (OBJFILES)(F90C) -o ../cosmomc (OBJFILES)(CLSLIB) $(F90FLAGS)


After reading all the files from the camb directory, it starts to read the WMAP files, arriving to the following point:

Quote:

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.
Back to top
View user's profile [ Hidden ] Visit poster's website
Savvas Nesseris



Joined: 05 Apr 2005
Posts: 50
Affiliation: UAM/IFT

PostPosted: December 07 2006  Reply with quote

Hi,
the error
Quote:
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
Back to top
View user's profile [ Hidden ] Visit poster's website
Mario Acero



Joined: 15 Nov 2006
Posts: 25
Affiliation: ICN - UNAM

PostPosted: December 07 2006  Reply with quote

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:
./cosmomc params.ini

there is a new error appearing:

Code:

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.
Back to top
View user's profile [ Hidden ] Visit poster's website
Savvas Nesseris



Joined: 05 Apr 2005
Posts: 50
Affiliation: UAM/IFT

PostPosted: December 08 2006  Reply with quote

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
Back to top
View user's profile [ Hidden ] Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    CosmoCoffee Forum Index -> Computers and software All times are GMT + 5 Hours
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group. Sponsored by WordWeb online dictionary and dictionary software.