| View previous topic :: View next topic |
| Author |
Message |
Moncho R Raposo
Joined: 23 May 2011 Posts: 3 Affiliation: USC
|
Posted: June 07 2011 |
|
|
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 |
|
 |
Wessel Valkenburg
Joined: 14 Mar 2008 Posts: 6 Affiliation: RWTH Aachen
|
Posted: July 01 2011 |
|
|
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 |
|
 |
Ross O'Connell
Joined: 29 Jun 2011 Posts: 4 Affiliation: Carnegie Mellon University
|
Posted: July 01 2011 |
|
|
| 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 |
|
 |
Moncho R Raposo
Joined: 23 May 2011 Posts: 3 Affiliation: USC
|
Posted: July 03 2011 |
|
|
| 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 |
|
 |
Sheng Li
Joined: 26 May 2009 Posts: 44 Affiliation: Univ. of Sussex
|
Posted: July 04 2011 |
|
|
| 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 |
|
 |
Sheng Li
Joined: 26 May 2009 Posts: 44 Affiliation: Univ. of Sussex
|
Posted: July 04 2011 |
|
|
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 |
|
 |
Wessel Valkenburg
Joined: 14 Mar 2008 Posts: 6 Affiliation: RWTH Aachen
|
Posted: July 07 2011 |
|
|
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 |
|
 |
Michael Obranovich
Joined: 15 Jul 2011 Posts: 6 Affiliation: The Ohio State University
|
Posted: July 20 2011 |
|
|
| 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 |
|
 |
Richard Easther
Joined: 14 Apr 2005 Posts: 15 Affiliation: Yale
|
Posted: August 06 2011 |
|
|
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 |
|
 |
Antony Lewis
Joined: 23 Sep 2004 Posts: 674 Affiliation: University of Sussex
|
Posted: August 08 2011 |
|
|
| Just uploaded Aug2011 minor version update which should compile OK with gfortran 4.6. |
|
| Back to top |
|
 |
Ryan Callahan Anonymous
|
Posted: August 23 2011 |
|
|
| 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
|
Posted: August 28 2011 |
|
|
| Follow the download link on the cosmomc homepage/readme. |
|
| Back to top |
|
 |
|