cosmomc with g95 and mpi

Use of Cobaya. camb, CLASS, cosmomc, compilers, etc.
Post Reply
Gil Holder
Posts: 27
Joined: September 25 2004
Affiliation: McGill University

cosmomc with g95 and mpi

Post by Gil Holder » July 30 2005

Has anyone ran cosmomc when compiled with g95 with MPI?

I am finding that everything works great without MPI. With MPI the first chain goes ahead with no problems, but as far as I can tell the getarg() call which is supposed to pick up the command line options is getting totally screwed up. For the second chain that is getting spawned, the GetParam(1) call in driver.F90 is returning the machine name. I noticed that getarg() in g95 was a fairly recent addition, so it is possible that it is still buggy. It seems equally plausible that I am doing something silly, though.

My current 'fix' is to just hardwire in the parameter file name and the null string that MPI wants the number of chains to be, so if this is a really stupid thing to do I would appreciate any comments.

Gil Holder
Posts: 27
Joined: September 25 2004
Affiliation: McGill University

cosmomc with g95 and mpi

Post by Gil Holder » July 30 2005

Update: after some google time, I've found that it appears to be well known that there is a mismatch between getarg in fortran and MPI. I think the -Vaxlib flag is what allows this to work for the Intel compiler. I still haven't found a g95 solution other than modifying the source (either through hard-wiring the parameter filename and numstr in driver.F90 or adding a few lines to process the full command line). A hard-wired filename is definitely not the ugliest thing I have ever done in the interest of getting something working.

On the upside, everything seems to work fine once you make these modifications, provided all the relevant libraries have been compiled with g95.

Hiranya Peiris
Posts: 54
Joined: September 28 2004
Affiliation: University College London

cosmomc with g95 and mpi

Post by Hiranya Peiris » September 20 2005

Hi Gil,

Sorry about resurrecting the ghost of an old question, but how did you get cosmomc to compile with G95 and MPI? I am trying to do the same thing with XLF90 and MPI on a pair of dual G5s linked with gigabit ethernet (as a testbed for new code before running on a proper cluster).

The MPI installation I have seems to only have a mpif77 wrapper. However, I did 'mpif77 -showme', and added all the libraries it showed manually to the link path of the f90 compiler. Unfortunately, it still does not find any of the MPI symbols at the link stage.

Did you by any chance have to recompile your LAM/MPI from source with g95 before you could link to the MPI libraries? I spent some time on google trying to figure out how to use f90 with LAM/MPI and could not find anything that helpful...

Thanks,
Hiranya

Gil Holder
Posts: 27
Joined: September 25 2004
Affiliation: McGill University

cosmomc with g95 and mpi

Post by Gil Holder » September 20 2005

Hi Hiranya,

Yes, I did end up recompiling MPI under g95, as well as LAPACK. After that, other than the getarg() call at the beginning of cosmomc everything worked fine.

Gil

Post Reply