Question: How to run MrBayes on a Linux cluster
gravatar for friist
10 weeks ago by
Bodø, Norway
friist10 wrote:

I have set up a little prototype Linux cluster consisting of two laptops using mpich_3.3-a2 and after a couple of dud installs and some trouble shooting managed to get it to run the test programs cpi and hellow that are included in the examples folder in mpich.

That's all well and good but really wanted to apply it to some bioinformatics packages and there's nowhere better to start than with MrBayes.

I first created a mrbayes environment using conda:

conda create -n mrbayes_env mrbayes

Then navigated into the mrbayes_env folder and executed this command:

(base) fusc@hp-ubuntu:~/miniconda3/envs/mrbayes_env/bin$
>> mpiexec -n 6 -f /home/fusc/mpich/hosts ./mb

That certainly fired up mrbayes, but instead of it running across 6 CPUs I ended up with six instances of mrbayes, which kind of defeats the purpose.

Is there a Dummies set of instructions for running MrBayes on a Linux cluster out there somewhere that I can dip into for some hints? Any help will be greatly appreciated.


linux cluster mpiexec mrbayes • 212 views
ADD COMMENTlink modified 10 weeks ago by h.mon26k • written 10 weeks ago by friist10

Should you not instead of navigate to the env folder activate the environment? Like:

conda activate mrbayes_env
ADD REPLYlink written 10 weeks ago by gb800

Yes, you're right about that, silly mistake. I did try that but it didn't make any difference as to getting MrBayes to run on multiple CPUs, even when I tried mb-mpi.

For that I needed to compile the MrBayes source code and enable mpi in the configure step. I've posted what I did below.

ADD REPLYlink written 10 weeks ago by friist10
gravatar for h.mon
10 weeks ago by
h.mon26k wrote:

This is how the MPI version of MrBayes is supposed to work, check the documentation:

Compiling and Running the Parallel Version of MrBayes

ADD COMMENTlink written 10 weeks ago by h.mon26k

That worked rather well. Here's what I did:

First cloned the latest MrBayes repository using git:

$ git clone

Navigated into the MrBayes folder created by git, then eneabled parallelization:

$ env MPICC="/home/fusc/mpich/bin/mpicc" ./configure --with-mpi

Followed by:

$ make && sudo make install

Fired up MrBayes inside the folder containing my nexus sequence alignment:

(base) fusc@hp-ubuntu:~/MrBayes_analysis/Linux_cluster_test_run$
>> mpiexec -np 6 mb

At the moment I've got a newish 4xCPU HP laptop and an old 2xCPU HP laptop that I've strung together on this cluster, hence the np=6. Not an ideal configuration but it'll do for now. Nevertheless resulted in the desired outcome:

                      MrBayes 3.2.7a x86_64

                  (Bayesian Analysis of Phylogeny)

                         (Parallel version)
                     (6 processors available)

          Distributed under the GNU General Public License

           Type "help" or "help <command>" for information
                 on the commands that are available.

               Type "about" for authorship and general
                   information about the program.

MrBayes >

Test run a 209 species protein nexus file:

MrBayes > exe 209_C12_6-5-19.nex

....and we're off to the races... The nexus file is available on request.

ADD REPLYlink modified 10 weeks ago • written 10 weeks ago by friist10

Sweet. I suspected I'd have to compile it from source to work with mpi. I'll give that a go. Thanks!

ADD REPLYlink modified 10 weeks ago • written 10 weeks ago by friist10
Please log in to add an answer.


Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1573 users visited in the last hour