CosmoCoffee Forum Index CosmoCoffee

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

Compiling Error using gfortran on MacOS
 
Post new topic   Reply to topic    CosmoCoffee Forum Index -> Computers and software
View previous topic :: View next topic  
Author Message
Moncho R Raposo



Joined: 23 May 2011
Posts: 3
Affiliation: USC

PostPosted: June 07 2011  Reply with quote

When I try to compile the code using gfortran on MacOS everything goes fine till it reaches the params_CMB.f90, where I have the following error:



Quote:
fortran -DMATRIX_SINGLE -O2 -ffree-form -x f95-cpp-input -I../camb -I../cfitsio/include -I../likelihood_v4p1 -c params_CMB.f90
params_CMB.f90:146.19:

call SetForH(Params,CMB,LastH0, .true.)
1
Error: El argumento dummy 'firsttime' del procedimiento 'setforh' en (1) tiene un atributo que requiere una interfaz explícita para este procedimiento
params_CMB.f90:146.19:



Which can be translated as: Error: The dummy argument 'firsttime' of the procedure 'setforh' in (1) has an attribute that requires an explicit interface for the procedure

Do you have any idea of what is happening? I already downloaded the latest version of gfortran.
Back to top
View user's profile  
Wessel Valkenburg



Joined: 14 Mar 2008
Posts: 6
Affiliation: RWTH Aachen

PostPosted: July 01 2011  Reply with quote

Hi,

I had the same problem, and I resolved it by adding an interface in each module that calls setforh. For example:


Code:
 
subroutine ParamsToCMBParams(Params, CMB)
     use settings
     use cmbtypes
     use CMB_Cls

     implicit none
     real Params(num_params)
     real, save :: LastParams(num_params) = 0.
     real, save :: LastH0, Lastzre

     Type(CMBParams) CMB
     real DA
     real  D_b,D_t,D_try,try_b,try_t, CMBToTheta, lasttry,tau
     external CMBToTheta
    interface
        subroutine SetForH(Params,CMB,H0, firsttime)
            use settings
            use cmbtypes
            use CMB_Cls
            implicit none
            real Params(num_Params)
            logical, intent(in), optional :: firsttime
            Type(CMBParams) CMB
            real H0
        end subroutine SetForH
    end interface



The reason is that (at least, Google told me) in Fortran officially you need to use an explicit interface to a procedure, if it uses "advanced features such as optional parameters". And since these particular routines are all external and not all together inside one module, you need to put this interface declaration in the subroutine. But apparently only gfortran bothers about this rule.
Back to top
View user's profile  
Ross O'Connell



Joined: 29 Jun 2011
Posts: 4
Affiliation: Carnegie Mellon University

PostPosted: July 01 2011  Reply with quote

After a couple days of trying to get CosmoMC and everything it depends on to compile on my Macbook, I wound up installing Virtualbox (a free virtualization thing) and a Ubuntu 10.04 VM. Working with ifort (free on linux) has been much easier than working with gfortran. I don't know if the same thing would work for you, but I thought it was worth passing along.
Back to top
View user's profile  
Moncho R Raposo



Joined: 23 May 2011
Posts: 3
Affiliation: USC

PostPosted: July 03 2011  Reply with quote

Thanks very much for the help Ross.I was so frustrated that I have installed ubuntu 11.04 on my other machines and I was able to compile it using gfortran. I think I will leave the macbook for checking the email and travelling. By the way, I didn't know that the ifort was free for linux. Good to know anyway!
Back to top
View user's profile  
Sheng Li



Joined: 26 May 2009
Posts: 44
Affiliation: Univ. of Sussex

PostPosted: July 04 2011  Reply with quote

Moncho R Raposo wrote:
Thanks very much for the help Ross.I was so frustrated that I have installed ubuntu 11.04 on my other machines and I was able to compile it using gfortran. I think I will leave the macbook for checking the email and travelling. By the way, I didn't know that the ifort was free for linux. Good to know anyway!


of course it is free, though it will be authorized by a serial number per machine/installation.
Back to top
View user's profile [ Hidden ]
Sheng Li



Joined: 26 May 2009
Posts: 44
Affiliation: Univ. of Sussex

PostPosted: July 04 2011  Reply with quote

I think you guys will be disappointed again due to the intensive computing for MCMC or MPI in Macbook (or any notebook).

but if you just use camb, that is ok.
Back to top
View user's profile [ Hidden ]
Wessel Valkenburg



Joined: 14 Mar 2008
Posts: 6
Affiliation: RWTH Aachen

PostPosted: July 07 2011  Reply with quote

I'm a bit confused about this still: if I pull the current master branch of cosmomc from Codaset, it compiles with gfortran with the settings as already present in the default makefile, without any complaint...

The edit I proposed above in this thread, wasn't even necessary (although it was necessary on my own older / custom cosmomc branch).

Using OS X 10.6.8 and gfortran 4.5.1.
Back to top
View user's profile  
Michael Obranovich



Joined: 15 Jul 2011
Posts: 6
Affiliation: The Ohio State University

PostPosted: July 20 2011  Reply with quote

I was having this problem on a linux machine using gfortran 4.6.1 i downgraded to 4.4.5 and it fixed the issue for me.
Back to top
View user's profile  
Richard Easther



Joined: 14 Apr 2005
Posts: 15
Affiliation: Yale

PostPosted: August 06 2011  Reply with quote

I just ran into this as well, using gfortran 4.6.1 on MacOS Lion, and a freshy downloaded CosmoMC.

Will be trying Wessel's fix.
Back to top
View user's profile  
Antony Lewis



Joined: 23 Sep 2004
Posts: 674
Affiliation: University of Sussex

PostPosted: August 08 2011  Reply with quote

Just uploaded Aug2011 minor version update which should compile OK with gfortran 4.6.
Back to top
View user's profile [ Hidden ] Visit poster's website
Ryan Callahan
Anonymous





PostPosted: August 23 2011  Reply with quote

Antony Lewis wrote:
Just uploaded Aug2011 minor version update which should compile OK with gfortran 4.6.

where can i find it?
Back to top
Antony Lewis



Joined: 23 Sep 2004
Posts: 674
Affiliation: University of Sussex

PostPosted: August 28 2011  Reply with quote

Follow the download link on the cosmomc homepage/readme.
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
Page 1 of 1

 
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.