Page 1 of 1

CosmoMC: mpif90 vs (gfortran+num_threads)

Posted: April 13 2020
by Dragan Huterer
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.

Re: CosmoMC: mpif90 vs (gfortran+num_threads)

Posted: April 13 2020
by Antony Lewis
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.

Re: CosmoMC: mpif90 vs (gfortran+num_threads)

Posted: April 14 2020
by Dragan Huterer
Makes sense - thanks Antony!
Meanwhile our very fine IT people managed to install mpif90, so that works for me now.