CosmoMC multiprocessor run

Use of Healpix, camb, CLASS, cosmomc, compilers, etc.
Post Reply
chien lin
Posts: 6
Joined: July 02 2019
Affiliation: University of Oxford

CosmoMC multiprocessor run

Post by chien lin » July 09 2019

Hello,

I am trying to run the CosmoMC the first time on my personal computer ASUS UX430UN to get a propose matrix for my future work. I am thinking of running only 2 chains on my 4 CPUs.

The first command I try is

Code: Select all

mpirun -np 4 ./cosmomc test.ini
and I have

Code: Select all

num_threads=0
in the test.ini file. This gives 4 .txt files in the /chains folder. Then I try

Code: Select all

num_threads=2
, hoping that it will give (4 CPUs) / (2 per chain) = 2 chains in total, but when I check the /chains folder, I still find 4 chains are being processed, which is not what I am looking for.

Then I try only

Code: Select all

./cosmomc test.ini
and leaving

Code: Select all

num_threads=2
unchanged. It produces only 1 chain in the /chains subdirectory, which is not what I want either. More interestingly, when I check the CPU tab in the system monitor, of those 8 CPUs/threads (I think these are vCPUs?), only 2 are working on MCMC. I thought it should go as (8 vCPUs) / (2 threads) = 4 chains?

Image
https://imgur.com/a/TQEjHIz

The problem I have is, how many CPUs do I actually have? And also, which command and which line in the .ini file should I modify to achieve my initial goal of 2 chains in total? Or maybe there is something I can do that can further decrease the time needed to finish my first CosmoMC run?

Any suggestion will be very helpful!
Chien Lin

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

Re: CosmoMC multiprocessor run

Post by Antony Lewis » July 10 2019

Chains are run by MPI, so the -np parameter determines the number of chains. Then you want to set the threads to use available CPUs per chain.

chien lin
Posts: 6
Joined: July 02 2019
Affiliation: University of Oxford

Re: CosmoMC multiprocessor run

Post by chien lin » July 10 2019

Hello,

Thank you for your reply. So if I want a total of 2 chains, I use the command

Code: Select all

mpirun -np 2 ./cosmomc test.ini
and the num_threads key determines the number of CPUs per chain. Using the lscpu command, I know that I have 8 CPUs, so I use num_threads=4 to maximally utilise the computing power. But, for some reason, it only supports 2 CPUs per chain maximum. That is, on my computer,

num_threads = 0, total CPU running = 4
num_threads = 1, total CPU running = 2
num_threads = 2, total CPU running = 4
num_threads = 3, total CPU running = 4
num_threads = 4, total CPU running = 4

I am not sure if there is anything I did wrong.

Chien Lin

Post Reply