CosmoMC: mpif90 vs (gfortran+num_threads)

Use of Healpix, camb, CLASS, cosmomc, compilers, etc.
Post Reply
Dragan Huterer
Posts: 26
Joined: July 18 2005
Affiliation: University of Michigan
Contact:

CosmoMC: mpif90 vs (gfortran+num_threads)

Post by Dragan Huterer » April 13 2020

People helping me with installation of CosmoMC failed to compile mpif90, but succeeded with gfortran. I checked that I can run code, and with num_threads set to e.g. 10 or 20, I get a nice-looking cpu usage of ~1000% on my (24-core) desktop.

Probably a beginner's type question: what is lost in practice in not using mpi? Given I do apparently use multiple cores (which is openmp I assume) in the current configuration without mpi.

Antony Lewis
Posts: 1618
Joined: September 23 2004
Affiliation: University of Sussex
Contact:

Re: CosmoMC: mpif90 vs (gfortran+num_threads)

Post by Antony Lewis » April 13 2020

You need mpi to use multiple chains at once. This is substantially more efficient that using lots of openmp threads since the scaling with openmp is not linear, and also allows convergence checks between the chains. I usually run four chains with 4-8 threads each. mpif90 may use gfortran or another compiler depending on options/how it is configured.

Dragan Huterer
Posts: 26
Joined: July 18 2005
Affiliation: University of Michigan
Contact:

Re: CosmoMC: mpif90 vs (gfortran+num_threads)

Post by Dragan Huterer » April 14 2020

Makes sense - thanks Antony!
Meanwhile our very fine IT people managed to install mpif90, so that works for me now.

Post Reply