<p>It is not trivial getting MB to run in parallel because from my experience it required granting privileges to regular users. I used this via MPI (MPICH) on a Slurm/SGE cluster.</p>
<p>Essentially, this is coarse grain parallel processing.</p>
<p>It is certainly worth parallelizing MB because each chain can be run on a different nodes and avoids RAM bottlenecks on complex models and big data sets. For example, 8 to 10+ chains can be run, ensuring convergence quickly by running chains across nodes.</p>
<hr />
<p><strong>Update</strong> I later found it was much easier to run via EasyBuild with OpenMPI using the command <code>runmpi</code>.</p>

CC BY-SA 4.0
2018-12-17T15:05:16.633Z
Interesting, so this might be an MPI permissions issue then. I will run this by the university IT folks and see if they can help me figure this out. I'll report back.
Pascal
CC BY-SA 4.0
2019-01-17T18:42:52.647Z
This seems to most likely have been an issue with mpi on my system, rather than with MrBayes, and this now works for me, although I'm not sure what changed.
Pascal
CC BY-SA 4.0
2018-12-14T13:34:45.963Z
2023-10-28T01:03:07.463Z
2023-10-28T01:03:07.463Z
M__
<p>I compiled MrBayes v3.2.7 from github, with the configuration options <code>./configure --without-beagle --enable-mpi</code>. The program is called mb.</p>

<p>I tried one of the included example files "sceloporus.nex". I find that if I run <code>mb sceloporus.nex</code>, then it appears to make progress, and writes files to disk. </p>

<p>I used MPI with 1 core, and it behaves as before, making progress, writing files to disk.</p>

<p>But if I run with more than 1 core, using MPI, with <code>mpirun -np 2 mb sceloporus.nex</code>, then it only makes it through some of the analysis setup, doesn't write any files to disk, and just hangs. If I look at <code>top</code>, I see activity on the number of cores I specified. I finally had to manually terminate the program.</p>

<p>Is there something I should be doing differently to have MrBayes properly run in parallel?</p>

<p>Here is a copy of my terminal from these 3 attempts:</p>

<pre><code>[ptitle@iu mbTest]<span class="math-container">$ ls
sceloporus.nex
[ptitle@iu mbTest]$</span> ~/MrBayes/src/mb sceloporus.nex 


                            MrBayes pre-3.2.7 x86_64

                      (Bayesian Analysis of Phylogeny)

                             (Parallel version)
                         (1 processors available)

              Distributed under the GNU General Public License


               Type "help" or "help &lt;command&gt;" for information
                     on the commands that are available.

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



   Executing file "sceloporus.nex"
   DOS line termination
   Longest line length = 1632
   Parsing file
   Expecting NEXUS formatted file
   Reading data block
      Allocated taxon set
      Allocated matrix
      Defining new matrix with 123 taxa and 1606 characters
      Data is Dna
      Missing data coded as ?
      Gaps coded as -
      Taxon   1 -&gt; AZYuJAS289
      Taxon   2 -&gt; AZYuJAS290
      Taxon   3 -&gt; AZlaJAS294
      Taxon   4 -&gt; AZcoTBP271
      Taxon   5 -&gt; AZcoGM1054
      Taxon   6 -&gt; AZcoDGM994
      Taxon   7 -&gt; AZgiP26438
      Taxon   8 -&gt; AZgrGM1012
      Taxon   9 -&gt; AZgrGM1013
      Taxon  10 -&gt; AZgrGM1024
      Taxon  11 -&gt; AZlaDGM856
      Taxon  12 -&gt; AZmaDGM984
      Taxon  13 -&gt; AZmaDGM992
      Taxon  14 -&gt; AZmaRM4401
      Taxon  15 -&gt; AZmaRM4402
      Taxon  16 -&gt; AZmaRM4403
      Taxon  17 -&gt; AZmoGM1045
      Taxon  18 -&gt; AZmoDGM492
      Taxon  19 -&gt; AZmoDGM699
      Taxon  20 -&gt; AZmoDGM704
      Taxon  21 -&gt; AZmoRM4394
      Taxon  22 -&gt; AZpiKWS238
      Taxon  23 -&gt; AZyuDGM826
      Taxon  24 -&gt; AZyuDGM838
      Taxon  25 -&gt; AZyuDGM852
      Taxon  26 -&gt; AZyuDGM858
      Taxon  27 -&gt; AZyuDGM865
      Taxon  28 -&gt; CAfrP25750
      Taxon  29 -&gt; CAimDGM534
      Taxon  30 -&gt; CAimDGM558
      Taxon  31 -&gt; CAimDGM694
      Taxon  32 -&gt; CAimKWS170
      Taxon  33 -&gt; CAinCRF530
      Taxon  34 -&gt; CAinoDGM74
      Taxon  35 -&gt; CAinCRF529
      Taxon  36 -&gt; CAkeDS2SP7
      Taxon  37 -&gt; CAkeP26556
      Taxon  38 -&gt; CAla78323
      Taxon  39 -&gt; CAlaDAW220
      Taxon  40 -&gt; CAlaM14610
      Taxon  41 -&gt; CAlaM23289
      Taxon  42 -&gt; CAmoJQR132
      Taxon  43 -&gt; CArvJOS138
      Taxon  44 -&gt; CArvESA441
      Taxon  45 -&gt; CAsaBUR167
      Taxon  46 -&gt; CAsaMCFMAG
      Taxon  47 -&gt; CAsarnMCC
      Taxon  48 -&gt; CAsa150079
      Taxon  49 -&gt; CAsa150088
      Taxon  50 -&gt; CAsa179886
      Taxon  51 -&gt; CAsaM19838
      Taxon  52 -&gt; CAsdDGM691
      Taxon  53 -&gt; CAsdDGM748
      Taxon  54 -&gt; CAsdSWT701
      Taxon  55 -&gt; MXBCDGM474
      Taxon  56 -&gt; MXBCDGM475
      Taxon  57 -&gt; MXBCDGM486
      Taxon  58 -&gt; MXchRM4860
      Taxon  59 -&gt; MXduA83134
      Taxon  60 -&gt; MXsoM14488
      Taxon  61 -&gt; MXsoP26449
      Taxon  62 -&gt; MXso210345
      Taxon  63 -&gt; NMdoTWR230
      Taxon  64 -&gt; NMedDGM938
      Taxon  65 -&gt; NMhiU48819
      Taxon  66 -&gt; NMluGM947
      Taxon  67 -&gt; NMluDGM948
      Taxon  68 -&gt; NMsiDGM891
      Taxon  69 -&gt; NMsoDGM900
      Taxon  70 -&gt; NMsoDGM904
      Taxon  71 -&gt; NMsoDGM905
      Taxon  72 -&gt; NMvaDGM924
      Taxon  73 -&gt; NVchDGM612
      Taxon  74 -&gt; NVch162077
      Taxon  75 -&gt; NVclDGM296
      Taxon  76 -&gt; NVclDGM678
      Taxon  77 -&gt; NVesDGM210
      Taxon  78 -&gt; NVlyDGM610
      Taxon  79 -&gt; NVwaDGM608
      Taxon  80 -&gt; UTemGM1058
      Taxon  81 -&gt; UTgrDGM156
      Taxon  82 -&gt; UTgrDGM169
      Taxon  83 -&gt; UTgrDGM175
      Taxon  84 -&gt; UTkaGM1034
      Taxon  85 -&gt; UTsnDM142
      Taxon  86 -&gt; UTsnDG043
      Taxon  87 -&gt; UTsnnDGM645
      Taxon  88 -&gt; UTwsGM261
      Taxon  89 -&gt; UTwsGM263
      Taxon  90 -&gt; UTwsnDGM751
      Taxon  91 -&gt; UTwsJRM4437
      Taxon  92 -&gt; hunsiM376
      Taxon  93 -&gt; hunsiM377
      Taxon  94 -&gt; hunsiRWM619
      Taxon  95 -&gt; lickGM378
      Taxon  96 -&gt; lineatulus
      Taxon  97 -&gt; orcuOM14377
      Taxon  98 -&gt; orcuOM14453
      Taxon  99 -&gt; orcuOM14673
      Taxon 100 -&gt; orcuRWM798
      Taxon 101 -&gt; orcuS201108
      Taxon 102 -&gt; orcuS201124
      Taxon 103 -&gt; zostZ16290
      Taxon 104 -&gt; zosV161292
      Taxon 105 -&gt; zosV161293
      Taxon 106 -&gt; zosV161311
      Taxon 107 -&gt; zosWM1890
      Taxon 108 -&gt; zosGM364
      Taxon 109 -&gt; zosGM365
      Taxon 110 -&gt; zosGM387
      Taxon 111 -&gt; zosGM393
      Taxon 112 -&gt; zosRO332
      Taxon 113 -&gt; zosOM37006
      Taxon 114 -&gt; zosWM1601
      Taxon 115 -&gt; clarkii
      Taxon 116 -&gt; edwardti80
      Taxon 117 -&gt; smaragdnus
      Taxon 118 -&gt; graciosus
      Taxon 119 -&gt; grammicus
      Taxon 120 -&gt; maculosus
      Taxon 121 -&gt; bicanthlis
      Taxon 122 -&gt; torquatus
      Taxon 123 -&gt; variabilis
      Successfully read matrix
      Setting default partition (does not divide up characters)
      Setting model defaults
      Seed (for generating default start values) = 1544128156
      Setting output file names to "sceloporus.nex.run&lt;i&gt;.&lt;p|t&gt;"
   Exiting data block
   Reading mrbayes block
      Excluding character(s)
      Setting Nst to 6
      Setting Rates to Gamma
      Successfully set likelihood model parameters
      Setting Brlenspr to Unconstrained:GammaDir(1.00,1.0000,0.70,0.50)
      Successfully set prior model parameters
      Setting number of generations to 5000000
      Running Markov chain
      MCMC stamp = 9284864458
      Seed = 753696747
      Swapseed = 1544128156
      Model settings:

         Data not partitioned --
            Datatype  = DNA
            Nucmodel  = 4by4
            Nst       = 6
                        Substitution rates, expressed as proportions
                        of the rate sum, have a Dirichlet prior
                        (1.00,1.00,1.00,1.00,1.00,1.00)
            Covarion  = No
            # States  = 4
                        State frequencies have a Dirichlet prior
                        (1.00,1.00,1.00,1.00)
            Rates     = Gamma
                        The distribution is approximated using 4 categories.
                        Shape parameter is exponentially
                        distributed with parameter (1.00).

      Active parameters: 

         Parameters
         ---------------------
         Revmat              1
         Statefreq           2
         Shape               3
         Ratemultiplier      4
         Topology            5
         Brlens              6
         ---------------------

         1 --  Parameter  = Revmat
               Type       = Rates of reversible rate matrix
               Prior      = Dirichlet(1.00,1.00,1.00,1.00,1.00,1.00)

         2 --  Parameter  = Pi
               Type       = Stationary state frequencies
               Prior      = Dirichlet

         3 --  Parameter  = Alpha
               Type       = Shape of scaled gamma distribution of site rates
               Prior      = Exponential(1.00)

         4 --  Parameter  = Ratemultiplier
               Type       = Partition-specific rate multiplier
               Prior      = Fixed(1.0)

         5 --  Parameter  = Tau
               Type       = Topology
               Prior      = All topologies equally probable a priori
               Subparam.  = V

         6 --  Parameter  = V
               Type       = Branch lengths
               Prior      = Unconstrained:GammaDir(1.0,1.0000,0.7,0.5)


      Number of chains per MPI processor = 8

      The MCMC sampler will use the following moves:
         With prob.  Chain will use move
            0.94 %   Dirichlet(Revmat)
            0.94 %   Slider(Revmat)
            0.94 %   Dirichlet(Pi)
            0.94 %   Slider(Pi)
            1.89 %   Multiplier(Alpha)
            9.43 %   ExtSPR(Tau,V)
            9.43 %   ExtTBR(Tau,V)
            9.43 %   NNI(Tau,V)
            9.43 %   ParsSPR(Tau,V)
           37.74 %   Multiplier(V)
           13.21 %   Nodeslider(V)
            5.66 %   TLMultiplier(V)

      Division 1 has 624 unique site patterns
      Initializing conditional likelihoods
      Using standard FMA likelihood calculator for division 1 (single-precision)

      Initial log likelihoods and log prior probs for run 1:
         Chain 1 -- -38239.042144 -- 53.554896
         Chain 2 -- -37743.352685 -- 53.554896
         Chain 3 -- -38049.750737 -- 53.554896
         Chain 4 -- -38759.582835 -- 53.554896

      Initial log likelihoods and log prior probs for run 2:
         Chain 1 -- -38348.591921 -- 53.554896
         Chain 2 -- -39602.594468 -- 53.554896
         Chain 3 -- -38874.065643 -- 53.554896
         Chain 4 -- -39227.723762 -- 53.554896


      Using a relative burnin of 25.0 % for diagnostics

      Chain results (5000000 generations requested):

         0 -- [-38239.042] (-37743.353) (-38049.751) (-38759.583) * [-38348.592] (-39602.594) (-38874.066) (-39227.724) (...0 remote chains...) 
^C
[ptitle@iu mbTest]<span class="math-container">$ ls
sceloporus.nex  sceloporus.nex.mcmc  sceloporus.nex.run1.p  sceloporus.nex.run1.t  sceloporus.nex.run2.p  sceloporus.nex.run2.t
[ptitle@iu mbTest]$</span> mpirun -np 1 ~/MrBayes/src/mb sceloporus.nex 


                            MrBayes pre-3.2.7 x86_64

                      (Bayesian Analysis of Phylogeny)

                             (Parallel version)
                         (1 processors available)

              Distributed under the GNU General Public License


               Type "help" or "help &lt;command&gt;" for information
                     on the commands that are available.

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



   Executing file "sceloporus.nex"
   DOS line termination
   Longest line length = 1632
   Parsing file
   Expecting NEXUS formatted file
   Reading data block
      Allocated taxon set
      Allocated matrix
      Defining new matrix with 123 taxa and 1606 characters
      Data is Dna
      Missing data coded as ?
      Gaps coded as -
      Taxon   1 -&gt; AZYuJAS289
      Taxon   2 -&gt; AZYuJAS290
      Taxon   3 -&gt; AZlaJAS294
      Taxon   4 -&gt; AZcoTBP271
      Taxon   5 -&gt; AZcoGM1054
      Taxon   6 -&gt; AZcoDGM994
      Taxon   7 -&gt; AZgiP26438
      Taxon   8 -&gt; AZgrGM1012
      Taxon   9 -&gt; AZgrGM1013
      Taxon  10 -&gt; AZgrGM1024
      Taxon  11 -&gt; AZlaDGM856
      Taxon  12 -&gt; AZmaDGM984
      Taxon  13 -&gt; AZmaDGM992
      Taxon  14 -&gt; AZmaRM4401
      Taxon  15 -&gt; AZmaRM4402
      Taxon  16 -&gt; AZmaRM4403
      Taxon  17 -&gt; AZmoGM1045
      Taxon  18 -&gt; AZmoDGM492
      Taxon  19 -&gt; AZmoDGM699
      Taxon  20 -&gt; AZmoDGM704
      Taxon  21 -&gt; AZmoRM4394
      Taxon  22 -&gt; AZpiKWS238
      Taxon  23 -&gt; AZyuDGM826
      Taxon  24 -&gt; AZyuDGM838
      Taxon  25 -&gt; AZyuDGM852
      Taxon  26 -&gt; AZyuDGM858
      Taxon  27 -&gt; AZyuDGM865
      Taxon  28 -&gt; CAfrP25750
      Taxon  29 -&gt; CAimDGM534
      Taxon  30 -&gt; CAimDGM558
      Taxon  31 -&gt; CAimDGM694
      Taxon  32 -&gt; CAimKWS170
      Taxon  33 -&gt; CAinCRF530
      Taxon  34 -&gt; CAinoDGM74
      Taxon  35 -&gt; CAinCRF529
      Taxon  36 -&gt; CAkeDS2SP7
      Taxon  37 -&gt; CAkeP26556
      Taxon  38 -&gt; CAla78323
      Taxon  39 -&gt; CAlaDAW220
      Taxon  40 -&gt; CAlaM14610
      Taxon  41 -&gt; CAlaM23289
      Taxon  42 -&gt; CAmoJQR132
      Taxon  43 -&gt; CArvJOS138
      Taxon  44 -&gt; CArvESA441
      Taxon  45 -&gt; CAsaBUR167
      Taxon  46 -&gt; CAsaMCFMAG
      Taxon  47 -&gt; CAsarnMCC
      Taxon  48 -&gt; CAsa150079
      Taxon  49 -&gt; CAsa150088
      Taxon  50 -&gt; CAsa179886
      Taxon  51 -&gt; CAsaM19838
      Taxon  52 -&gt; CAsdDGM691
      Taxon  53 -&gt; CAsdDGM748
      Taxon  54 -&gt; CAsdSWT701
      Taxon  55 -&gt; MXBCDGM474
      Taxon  56 -&gt; MXBCDGM475
      Taxon  57 -&gt; MXBCDGM486
      Taxon  58 -&gt; MXchRM4860
      Taxon  59 -&gt; MXduA83134
      Taxon  60 -&gt; MXsoM14488
      Taxon  61 -&gt; MXsoP26449
      Taxon  62 -&gt; MXso210345
      Taxon  63 -&gt; NMdoTWR230
      Taxon  64 -&gt; NMedDGM938
      Taxon  65 -&gt; NMhiU48819
      Taxon  66 -&gt; NMluGM947
      Taxon  67 -&gt; NMluDGM948
      Taxon  68 -&gt; NMsiDGM891
      Taxon  69 -&gt; NMsoDGM900
      Taxon  70 -&gt; NMsoDGM904
      Taxon  71 -&gt; NMsoDGM905
      Taxon  72 -&gt; NMvaDGM924
      Taxon  73 -&gt; NVchDGM612
      Taxon  74 -&gt; NVch162077
      Taxon  75 -&gt; NVclDGM296
      Taxon  76 -&gt; NVclDGM678
      Taxon  77 -&gt; NVesDGM210
      Taxon  78 -&gt; NVlyDGM610
      Taxon  79 -&gt; NVwaDGM608
      Taxon  80 -&gt; UTemGM1058
      Taxon  81 -&gt; UTgrDGM156
      Taxon  82 -&gt; UTgrDGM169
      Taxon  83 -&gt; UTgrDGM175
      Taxon  84 -&gt; UTkaGM1034
      Taxon  85 -&gt; UTsnDM142
      Taxon  86 -&gt; UTsnDG043
      Taxon  87 -&gt; UTsnnDGM645
      Taxon  88 -&gt; UTwsGM261
      Taxon  89 -&gt; UTwsGM263
      Taxon  90 -&gt; UTwsnDGM751
      Taxon  91 -&gt; UTwsJRM4437
      Taxon  92 -&gt; hunsiM376
      Taxon  93 -&gt; hunsiM377
      Taxon  94 -&gt; hunsiRWM619
      Taxon  95 -&gt; lickGM378
      Taxon  96 -&gt; lineatulus
      Taxon  97 -&gt; orcuOM14377
      Taxon  98 -&gt; orcuOM14453
      Taxon  99 -&gt; orcuOM14673
      Taxon 100 -&gt; orcuRWM798
      Taxon 101 -&gt; orcuS201108
      Taxon 102 -&gt; orcuS201124
      Taxon 103 -&gt; zostZ16290
      Taxon 104 -&gt; zosV161292
      Taxon 105 -&gt; zosV161293
      Taxon 106 -&gt; zosV161311
      Taxon 107 -&gt; zosWM1890
      Taxon 108 -&gt; zosGM364
      Taxon 109 -&gt; zosGM365
      Taxon 110 -&gt; zosGM387
      Taxon 111 -&gt; zosGM393
      Taxon 112 -&gt; zosRO332
      Taxon 113 -&gt; zosOM37006
      Taxon 114 -&gt; zosWM1601
      Taxon 115 -&gt; clarkii
      Taxon 116 -&gt; edwardti80
      Taxon 117 -&gt; smaragdnus
      Taxon 118 -&gt; graciosus
      Taxon 119 -&gt; grammicus
      Taxon 120 -&gt; maculosus
      Taxon 121 -&gt; bicanthlis
      Taxon 122 -&gt; torquatus
      Taxon 123 -&gt; variabilis
      Successfully read matrix
      Setting default partition (does not divide up characters)
      Setting model defaults
      Seed (for generating default start values) = 1544128192
      Setting output file names to "sceloporus.nex.run&lt;i&gt;.&lt;p|t&gt;"
   Exiting data block
   Reading mrbayes block
      Excluding character(s)
      Setting Nst to 6
      Setting Rates to Gamma
      Successfully set likelihood model parameters
      Setting Brlenspr to Unconstrained:GammaDir(1.00,1.0000,0.70,0.50)
      Successfully set prior model parameters
      Setting number of generations to 5000000
      Running Markov chain
      MCMC stamp = 9909051894
      Seed = 1261289135
      Swapseed = 1544128192
      Model settings:

         Data not partitioned --
            Datatype  = DNA
            Nucmodel  = 4by4
            Nst       = 6
                        Substitution rates, expressed as proportions
                        of the rate sum, have a Dirichlet prior
                        (1.00,1.00,1.00,1.00,1.00,1.00)
            Covarion  = No
            # States  = 4
                        State frequencies have a Dirichlet prior
                        (1.00,1.00,1.00,1.00)
            Rates     = Gamma
                        The distribution is approximated using 4 categories.
                        Shape parameter is exponentially
                        distributed with parameter (1.00).

      Active parameters: 

         Parameters
         ---------------------
         Revmat              1
         Statefreq           2
         Shape               3
         Ratemultiplier      4
         Topology            5
         Brlens              6
         ---------------------

         1 --  Parameter  = Revmat
               Type       = Rates of reversible rate matrix
               Prior      = Dirichlet(1.00,1.00,1.00,1.00,1.00,1.00)

         2 --  Parameter  = Pi
               Type       = Stationary state frequencies
               Prior      = Dirichlet

         3 --  Parameter  = Alpha
               Type       = Shape of scaled gamma distribution of site rates
               Prior      = Exponential(1.00)

         4 --  Parameter  = Ratemultiplier
               Type       = Partition-specific rate multiplier
               Prior      = Fixed(1.0)

         5 --  Parameter  = Tau
               Type       = Topology
               Prior      = All topologies equally probable a priori
               Subparam.  = V

         6 --  Parameter  = V
               Type       = Branch lengths
               Prior      = Unconstrained:GammaDir(1.0,1.0000,0.7,0.5)


      Number of chains per MPI processor = 8

      The MCMC sampler will use the following moves:
         With prob.  Chain will use move
            0.94 %   Dirichlet(Revmat)
            0.94 %   Slider(Revmat)
            0.94 %   Dirichlet(Pi)
            0.94 %   Slider(Pi)
            1.89 %   Multiplier(Alpha)
            9.43 %   ExtSPR(Tau,V)
            9.43 %   ExtTBR(Tau,V)
            9.43 %   NNI(Tau,V)
            9.43 %   ParsSPR(Tau,V)
           37.74 %   Multiplier(V)
           13.21 %   Nodeslider(V)
            5.66 %   TLMultiplier(V)

      Division 1 has 624 unique site patterns
      Initializing conditional likelihoods
      Using standard FMA likelihood calculator for division 1 (single-precision)

      Initial log likelihoods and log prior probs for run 1:
         Chain 1 -- -39098.978535 -- 53.554896
         Chain 2 -- -38054.044640 -- 53.554896
         Chain 3 -- -39425.015629 -- 53.554896
         Chain 4 -- -40157.756230 -- 53.554896

      Initial log likelihoods and log prior probs for run 2:
         Chain 1 -- -40084.553712 -- 53.554896
         Chain 2 -- -39002.725314 -- 53.554896
         Chain 3 -- -38719.752582 -- 53.554896
         Chain 4 -- -39156.129424 -- 53.554896


      Using a relative burnin of 25.0 % for diagnostics

      Chain results (5000000 generations requested):

         0 -- [-39098.979] (-38054.045) (-39425.016) (-40157.756) * [-40084.554] (-39002.725) (-38719.753) (-39156.129) (...0 remote chains...) 
^C[ptitle@iu mbTest]$ mpirun -np 2 ~/MrBayes/src/mb sceloporus.nex 


                            MrBayes pre-3.2.7 x86_64

                      (Bayesian Analysis of Phylogeny)

                             (Parallel version)
                         (2 processors available)

              Distributed under the GNU General Public License


               Type "help" or "help &lt;command&gt;" for information
                     on the commands that are available.

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



   Executing file "sceloporus.nex"
   DOS line termination
   Longest line length = 1632
   Parsing file
   Expecting NEXUS formatted file
   Reading data block
      Allocated taxon set
      Allocated matrix
      Defining new matrix with 123 taxa and 1606 characters
      Data is Dna
      Missing data coded as ?
      Gaps coded as -
      Taxon   1 -&gt; AZYuJAS289
      Taxon   2 -&gt; AZYuJAS290
      Taxon   3 -&gt; AZlaJAS294
      Taxon   4 -&gt; AZcoTBP271
      Taxon   5 -&gt; AZcoGM1054
      Taxon   6 -&gt; AZcoDGM994
      Taxon   7 -&gt; AZgiP26438
      Taxon   8 -&gt; AZgrGM1012
      Taxon   9 -&gt; AZgrGM1013
      Taxon  10 -&gt; AZgrGM1024
^C[ptitle@iu mbTest]$ 
</code></pre>

<phylogenetics><phylogeny><molecular-genetics><mrbayes>
MrBayes runs as single-core, but hangs when multi-core
# MrBayes runs as single-core, but hangs when multi-core

(Asked by: username_0 on 2018-12-06)

I compiled MrBayes v3.2.7 from github, with the configuration options ./configure --without-beagle --enable-mpi. The program is called mb.
I tried one of the included example files "sceloporus.nex". I find that if I run mb sceloporus.nex, then it appears to make progress, and writes files to disk. 
I used MPI with 1 core, and it behaves as before, making progress, writing files to disk.
But if I run with more than 1 core, using MPI, with mpirun -np 2 mb sceloporus.nex, then it only makes it through some of the analysis setup, doesn't write any files to disk, and just hangs. If I look at top, I see activity on the number of cores I specified. I finally had to manually terminate the program.
Is there something I should be doing differently to have MrBayes properly run in parallel?
Here is a copy of my terminal from these 3 attempts:
[ptitle@iu mbTest]$ ls
sceloporus.nex
[ptitle@iu mbTest]$ ~/MrBayes/src/mb sceloporus.nex 


                            MrBayes pre-3.2.7 x86_64

                      (Bayesian Analysis of Phylogeny)

                             (Parallel version)
                         (1 processors available)

              Distributed under the GNU General Public License


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

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



   Executing file "sceloporus.nex"
   DOS line termination
   Longest line length = 1632
   Parsing file
   Expecting NEXUS formatted file
   Reading data block
      Allocated taxon set
      Allocated matrix
      Defining new matrix with 123 taxa and 1606 characters
      Data is Dna
      Missing data coded as ?
      Gaps coded as -
      Taxon   1 -> AZYuJAS289
      Taxon   2 -> AZYuJAS290
      Taxon   3 -> AZlaJAS294
      Taxon   4 -> AZcoTBP271
      Taxon   5 -> AZcoGM1054
      Taxon   6 -> AZcoDGM994
      Taxon   7 -> AZgiP26438
      Taxon   8 -> AZgrGM1012
      Taxon   9 -> AZgrGM1013
      Taxon  10 -> AZgrGM1024
      Taxon  11 -> AZlaDGM856
      Taxon  12 -> AZmaDGM984
      Taxon  13 -> AZmaDGM992
      Taxon  14 -> AZmaRM4401
      Taxon  15 -> AZmaRM4402
      Taxon  16 -> AZmaRM4403
      Taxon  17 -> AZmoGM1045
      Taxon  18 -> AZmoDGM492
      Taxon  19 -> AZmoDGM699
      Taxon  20 -> AZmoDGM704
      Taxon  21 -> AZmoRM4394
      Taxon  22 -> AZpiKWS238
      Taxon  23 -> AZyuDGM826
      Taxon  24 -> AZyuDGM838
      Taxon  25 -> AZyuDGM852
      Taxon  26 -> AZyuDGM858
      Taxon  27 -> AZyuDGM865
      Taxon  28 -> CAfrP25750
      Taxon  29 -> CAimDGM534
      Taxon  30 -> CAimDGM558
      Taxon  31 -> CAimDGM694
      Taxon  32 -> CAimKWS170
      Taxon  33 -> CAinCRF530
      Taxon  34 -> CAinoDGM74
      Taxon  35 -> CAinCRF529
      Taxon  36 -> CAkeDS2SP7
      Taxon  37 -> CAkeP26556
      Taxon  38 -> CAla78323
      Taxon  39 -> CAlaDAW220
      Taxon  40 -> CAlaM14610
      Taxon  41 -> CAlaM23289
      Taxon  42 -> CAmoJQR132
      Taxon  43 -> CArvJOS138
      Taxon  44 -> CArvESA441
      Taxon  45 -> CAsaBUR167
      Taxon  46 -> CAsaMCFMAG
      Taxon  47 -> CAsarnMCC
      Taxon  48 -> CAsa150079
      Taxon  49 -> CAsa150088
      Taxon  50 -> CAsa179886
      Taxon  51 -> CAsaM19838
      Taxon  52 -> CAsdDGM691
      Taxon  53 -> CAsdDGM748
      Taxon  54 -> CAsdSWT701
      Taxon  55 -> MXBCDGM474
      Taxon  56 -> MXBCDGM475
      Taxon  57 -> MXBCDGM486
      Taxon  58 -> MXchRM4860
      Taxon  59 -> MXduA83134
      Taxon  60 -> MXsoM14488
      Taxon  61 -> MXsoP26449
      Taxon  62 -> MXso210345
      Taxon  63 -> NMdoTWR230
      Taxon  64 -> NMedDGM938
      Taxon  65 -> NMhiU48819
      Taxon  66 -> NMluGM947
      Taxon  67 -> NMluDGM948
      Taxon  68 -> NMsiDGM891
      Taxon  69 -> NMsoDGM900
      Taxon  70 -> NMsoDGM904
      Taxon  71 -> NMsoDGM905
      Taxon  72 -> NMvaDGM924
      Taxon  73 -> NVchDGM612
      Taxon  74 -> NVch162077
      Taxon  75 -> NVclDGM296
      Taxon  76 -> NVclDGM678
      Taxon  77 -> NVesDGM210
      Taxon  78 -> NVlyDGM610
      Taxon  79 -> NVwaDGM608
      Taxon  80 -> UTemGM1058
      Taxon  81 -> UTgrDGM156
      Taxon  82 -> UTgrDGM169
      Taxon  83 -> UTgrDGM175
      Taxon  84 -> UTkaGM1034
      Taxon  85 -> UTsnDM142
      Taxon  86 -> UTsnDG043
      Taxon  87 -> UTsnnDGM645
      Taxon  88 -> UTwsGM261
      Taxon  89 -> UTwsGM263
      Taxon  90 -> UTwsnDGM751
      Taxon  91 -> UTwsJRM4437
      Taxon  92 -> hunsiM376
      Taxon  93 -> hunsiM377
      Taxon  94 -> hunsiRWM619
      Taxon  95 -> lickGM378
      Taxon  96 -> lineatulus
      Taxon  97 -> orcuOM14377
      Taxon  98 -> orcuOM14453
      Taxon  99 -> orcuOM14673
      Taxon 100 -> orcuRWM798
      Taxon 101 -> orcuS201108
      Taxon 102 -> orcuS201124
      Taxon 103 -> zostZ16290
      Taxon 104 -> zosV161292
      Taxon 105 -> zosV161293
      Taxon 106 -> zosV161311
      Taxon 107 -> zosWM1890
      Taxon 108 -> zosGM364
      Taxon 109 -> zosGM365
      Taxon 110 -> zosGM387
      Taxon 111 -> zosGM393
      Taxon 112 -> zosRO332
      Taxon 113 -> zosOM37006
      Taxon 114 -> zosWM1601
      Taxon 115 -> clarkii
      Taxon 116 -> edwardti80
      Taxon 117 -> smaragdnus
      Taxon 118 -> graciosus
      Taxon 119 -> grammicus
      Taxon 120 -> maculosus
      Taxon 121 -> bicanthlis
      Taxon 122 -> torquatus
      Taxon 123 -> variabilis
      Successfully read matrix
      Setting default partition (does not divide up characters)
      Setting model defaults
      Seed (for generating default start values) = 1544128156
      Setting output file names to "sceloporus.nex.run."
   Exiting data block
   Reading mrbayes block
      Excluding character(s)
      Setting Nst to 6
      Setting Rates to Gamma
      Successfully set likelihood model parameters
      Setting Brlenspr to Unconstrained:GammaDir(1.00,1.0000,0.70,0.50)
      Successfully set prior model parameters
      Setting number of generations to 5000000
      Running Markov chain
      MCMC stamp = 9284864458
      Seed = 753696747
      Swapseed = 1544128156
      Model settings:

         Data not partitioned --
            Datatype  = DNA
            Nucmodel  = 4by4
            Nst       = 6
                        Substitution rates, expressed as proportions
                        of the rate sum, have a Dirichlet prior
                        (1.00,1.00,1.00,1.00,1.00,1.00)
            Covarion  = No
            # States  = 4
                        State frequencies have a Dirichlet prior
                        (1.00,1.00,1.00,1.00)
            Rates     = Gamma
                        The distribution is approximated using 4 categories.
                        Shape parameter is exponentially
                        distributed with parameter (1.00).

      Active parameters: 

         Parameters
         ---------------------
         Revmat              1
         Statefreq           2
         Shape               3
         Ratemultiplier      4
         Topology            5
         Brlens              6
         ---------------------

         1 --  Parameter  = Revmat
               Type       = Rates of reversible rate matrix
               Prior      = Dirichlet(1.00,1.00,1.00,1.00,1.00,1.00)

         2 --  Parameter  = Pi
               Type       = Stationary state frequencies
               Prior      = Dirichlet

         3 --  Parameter  = Alpha
               Type       = Shape of scaled gamma distribution of site rates
               Prior      = Exponential(1.00)

         4 --  Parameter  = Ratemultiplier
               Type       = Partition-specific rate multiplier
               Prior      = Fixed(1.0)

         5 --  Parameter  = Tau
               Type       = Topology
               Prior      = All topologies equally probable a priori
               Subparam.  = V

         6 --  Parameter  = V
               Type       = Branch lengths
               Prior      = Unconstrained:GammaDir(1.0,1.0000,0.7,0.5)


      Number of chains per MPI processor = 8

      The MCMC sampler will use the following moves:
         With prob.  Chain will use move
            0.94 %   Dirichlet(Revmat)
            0.94 %   Slider(Revmat)
            0.94 %   Dirichlet(Pi)
            0.94 %   Slider(Pi)
            1.89 %   Multiplier(Alpha)
            9.43 %   ExtSPR(Tau,V)
            9.43 %   ExtTBR(Tau,V)
            9.43 %   NNI(Tau,V)
            9.43 %   ParsSPR(Tau,V)
           37.74 %   Multiplier(V)
           13.21 %   Nodeslider(V)
            5.66 %   TLMultiplier(V)

      Division 1 has 624 unique site patterns
      Initializing conditional likelihoods
      Using standard FMA likelihood calculator for division 1 (single-precision)

      Initial log likelihoods and log prior probs for run 1:
         Chain 1 -- -38239.042144 -- 53.554896
         Chain 2 -- -37743.352685 -- 53.554896
         Chain 3 -- -38049.750737 -- 53.554896
         Chain 4 -- -38759.582835 -- 53.554896

      Initial log likelihoods and log prior probs for run 2:
         Chain 1 -- -38348.591921 -- 53.554896
         Chain 2 -- -39602.594468 -- 53.554896
         Chain 3 -- -38874.065643 -- 53.554896
         Chain 4 -- -39227.723762 -- 53.554896


      Using a relative burnin of 25.0 % for diagnostics

      Chain results (5000000 generations requested):

         0 -- [-38239.042] (-37743.353) (-38049.751) (-38759.583) * [-38348.592] (-39602.594) (-38874.066) (-39227.724) (...0 remote chains...) 
^C
[ptitle@iu mbTest]$ ls
sceloporus.nex  sceloporus.nex.mcmc  sceloporus.nex.run1.p  sceloporus.nex.run1.t  sceloporus.nex.run2.p  sceloporus.nex.run2.t
[ptitle@iu mbTest]$ mpirun -np 1 ~/MrBayes/src/mb sceloporus.nex 


                            MrBayes pre-3.2.7 x86_64

                      (Bayesian Analysis of Phylogeny)

                             (Parallel version)
                         (1 processors available)

              Distributed under the GNU General Public License


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

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



   Executing file "sceloporus.nex"
   DOS line termination
   Longest line length = 1632
   Parsing file
   Expecting NEXUS formatted file
   Reading data block
      Allocated taxon set
      Allocated matrix
      Defining new matrix with 123 taxa and 1606 characters
      Data is Dna
      Missing data coded as ?
      Gaps coded as -
      Taxon   1 -> AZYuJAS289
      Taxon   2 -> AZYuJAS290
      Taxon   3 -> AZlaJAS294
      Taxon   4 -> AZcoTBP271
      Taxon   5 -> AZcoGM1054
      Taxon   6 -> AZcoDGM994
      Taxon   7 -> AZgiP26438
      Taxon   8 -> AZgrGM1012
      Taxon   9 -> AZgrGM1013
      Taxon  10 -> AZgrGM1024
      Taxon  11 -> AZlaDGM856
      Taxon  12 -> AZmaDGM984
      Taxon  13 -> AZmaDGM992
      Taxon  14 -> AZmaRM4401
      Taxon  15 -> AZmaRM4402
      Taxon  16 -> AZmaRM4403
      Taxon  17 -> AZmoGM1045
      Taxon  18 -> AZmoDGM492
      Taxon  19 -> AZmoDGM699
      Taxon  20 -> AZmoDGM704
      Taxon  21 -> AZmoRM4394
      Taxon  22 -> AZpiKWS238
      Taxon  23 -> AZyuDGM826
      Taxon  24 -> AZyuDGM838
      Taxon  25 -> AZyuDGM852
      Taxon  26 -> AZyuDGM858
      Taxon  27 -> AZyuDGM865
      Taxon  28 -> CAfrP25750
      Taxon  29 -> CAimDGM534
      Taxon  30 -> CAimDGM558
      Taxon  31 -> CAimDGM694
      Taxon  32 -> CAimKWS170
      Taxon  33 -> CAinCRF530
      Taxon  34 -> CAinoDGM74
      Taxon  35 -> CAinCRF529
      Taxon  36 -> CAkeDS2SP7
      Taxon  37 -> CAkeP26556
      Taxon  38 -> CAla78323
      Taxon  39 -> CAlaDAW220
      Taxon  40 -> CAlaM14610
      Taxon  41 -> CAlaM23289
      Taxon  42 -> CAmoJQR132
      Taxon  43 -> CArvJOS138
      Taxon  44 -> CArvESA441
      Taxon  45 -> CAsaBUR167
      Taxon  46 -> CAsaMCFMAG
      Taxon  47 -> CAsarnMCC
      Taxon  48 -> CAsa150079
      Taxon  49 -> CAsa150088
      Taxon  50 -> CAsa179886
      Taxon  51 -> CAsaM19838
      Taxon  52 -> CAsdDGM691
      Taxon  53 -> CAsdDGM748
      Taxon  54 -> CAsdSWT701
      Taxon  55 -> MXBCDGM474
      Taxon  56 -> MXBCDGM475
      Taxon  57 -> MXBCDGM486
      Taxon  58 -> MXchRM4860
      Taxon  59 -> MXduA83134
      Taxon  60 -> MXsoM14488
      Taxon  61 -> MXsoP26449
      Taxon  62 -> MXso210345
      Taxon  63 -> NMdoTWR230
      Taxon  64 -> NMedDGM938
      Taxon  65 -> NMhiU48819
      Taxon  66 -> NMluGM947
      Taxon  67 -> NMluDGM948
      Taxon  68 -> NMsiDGM891
      Taxon  69 -> NMsoDGM900
      Taxon  70 -> NMsoDGM904
      Taxon  71 -> NMsoDGM905
      Taxon  72 -> NMvaDGM924
      Taxon  73 -> NVchDGM612
      Taxon  74 -> NVch162077
      Taxon  75 -> NVclDGM296
      Taxon  76 -> NVclDGM678
      Taxon  77 -> NVesDGM210
      Taxon  78 -> NVlyDGM610
      Taxon  79 -> NVwaDGM608
      Taxon  80 -> UTemGM1058
      Taxon  81 -> UTgrDGM156
      Taxon  82 -> UTgrDGM169
      Taxon  83 -> UTgrDGM175
      Taxon  84 -> UTkaGM1034
      Taxon  85 -> UTsnDM142
      Taxon  86 -> UTsnDG043
      Taxon  87 -> UTsnnDGM645
      Taxon  88 -> UTwsGM261
      Taxon  89 -> UTwsGM263
      Taxon  90 -> UTwsnDGM751
      Taxon  91 -> UTwsJRM4437
      Taxon  92 -> hunsiM376
      Taxon  93 -> hunsiM377
      Taxon  94 -> hunsiRWM619
      Taxon  95 -> lickGM378
      Taxon  96 -> lineatulus
      Taxon  97 -> orcuOM14377
      Taxon  98 -> orcuOM14453
      Taxon  99 -> orcuOM14673
      Taxon 100 -> orcuRWM798
      Taxon 101 -> orcuS201108
      Taxon 102 -> orcuS201124
      Taxon 103 -> zostZ16290
      Taxon 104 -> zosV161292
      Taxon 105 -> zosV161293
      Taxon 106 -> zosV161311
      Taxon 107 -> zosWM1890
      Taxon 108 -> zosGM364
      Taxon 109 -> zosGM365
      Taxon 110 -> zosGM387
      Taxon 111 -> zosGM393
      Taxon 112 -> zosRO332
      Taxon 113 -> zosOM37006
      Taxon 114 -> zosWM1601
      Taxon 115 -> clarkii
      Taxon 116 -> edwardti80
      Taxon 117 -> smaragdnus
      Taxon 118 -> graciosus
      Taxon 119 -> grammicus
      Taxon 120 -> maculosus
      Taxon 121 -> bicanthlis
      Taxon 122 -> torquatus
      Taxon 123 -> variabilis
      Successfully read matrix
      Setting default partition (does not divide up characters)
      Setting model defaults
      Seed (for generating default start values) = 1544128192
      Setting output file names to "sceloporus.nex.run."
   Exiting data block
   Reading mrbayes block
      Excluding character(s)
      Setting Nst to 6
      Setting Rates to Gamma
      Successfully set likelihood model parameters
      Setting Brlenspr to Unconstrained:GammaDir(1.00,1.0000,0.70,0.50)
      Successfully set prior model parameters
      Setting number of generations to 5000000
      Running Markov chain
      MCMC stamp = 9909051894
      Seed = 1261289135
      Swapseed = 1544128192
      Model settings:

         Data not partitioned --
            Datatype  = DNA
            Nucmodel  = 4by4
            Nst       = 6
                        Substitution rates, expressed as proportions
                        of the rate sum, have a Dirichlet prior
                        (1.00,1.00,1.00,1.00,1.00,1.00)
            Covarion  = No
            # States  = 4
                        State frequencies have a Dirichlet prior
                        (1.00,1.00,1.00,1.00)
            Rates     = Gamma
                        The distribution is approximated using 4 categories.
                        Shape parameter is exponentially
                        distributed with parameter (1.00).

      Active parameters: 

         Parameters
         ---------------------
         Revmat              1
         Statefreq           2
         Shape               3
         Ratemultiplier      4
         Topology            5
         Brlens              6
         ---------------------

         1 --  Parameter  = Revmat
               Type       = Rates of reversible rate matrix
               Prior      = Dirichlet(1.00,1.00,1.00,1.00,1.00,1.00)

         2 --  Parameter  = Pi
               Type       = Stationary state frequencies
               Prior      = Dirichlet

         3 --  Parameter  = Alpha
               Type       = Shape of scaled gamma distribution of site rates
               Prior      = Exponential(1.00)

         4 --  Parameter  = Ratemultiplier
               Type       = Partition-specific rate multiplier
               Prior      = Fixed(1.0)

         5 --  Parameter  = Tau
               Type       = Topology
               Prior      = All topologies equally probable a priori
               Subparam.  = V

         6 --  Parameter  = V
               Type       = Branch lengths
               Prior      = Unconstrained:GammaDir(1.0,1.0000,0.7,0.5)


      Number of chains per MPI processor = 8

      The MCMC sampler will use the following moves:
         With prob.  Chain will use move
            0.94 %   Dirichlet(Revmat)
            0.94 %   Slider(Revmat)
            0.94 %   Dirichlet(Pi)
            0.94 %   Slider(Pi)
            1.89 %   Multiplier(Alpha)
            9.43 %   ExtSPR(Tau,V)
            9.43 %   ExtTBR(Tau,V)
            9.43 %   NNI(Tau,V)
            9.43 %   ParsSPR(Tau,V)
           37.74 %   Multiplier(V)
           13.21 %   Nodeslider(V)
            5.66 %   TLMultiplier(V)

      Division 1 has 624 unique site patterns
      Initializing conditional likelihoods
      Using standard FMA likelihood calculator for division 1 (single-precision)

      Initial log likelihoods and log prior probs for run 1:
         Chain 1 -- -39098.978535 -- 53.554896
         Chain 2 -- -38054.044640 -- 53.554896
         Chain 3 -- -39425.015629 -- 53.554896
         Chain 4 -- -40157.756230 -- 53.554896

      Initial log likelihoods and log prior probs for run 2:
         Chain 1 -- -40084.553712 -- 53.554896
         Chain 2 -- -39002.725314 -- 53.554896
         Chain 3 -- -38719.752582 -- 53.554896
         Chain 4 -- -39156.129424 -- 53.554896


      Using a relative burnin of 25.0 % for diagnostics

      Chain results (5000000 generations requested):

         0 -- [-39098.979] (-38054.045) (-39425.016) (-40157.756) * [-40084.554] (-39002.725) (-38719.753) (-39156.129) (...0 remote chains...) 
^C[ptitle@iu mbTest]$ mpirun -np 2 ~/MrBayes/src/mb sceloporus.nex 


                            MrBayes pre-3.2.7 x86_64

                      (Bayesian Analysis of Phylogeny)

                             (Parallel version)
                         (2 processors available)

              Distributed under the GNU General Public License


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

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



   Executing file "sceloporus.nex"
   DOS line termination
   Longest line length = 1632
   Parsing file
   Expecting NEXUS formatted file
   Reading data block
      Allocated taxon set
      Allocated matrix
      Defining new matrix with 123 taxa and 1606 characters
      Data is Dna
      Missing data coded as ?
      Gaps coded as -
      Taxon   1 -> AZYuJAS289
      Taxon   2 -> AZYuJAS290
      Taxon   3 -> AZlaJAS294
      Taxon   4 -> AZcoTBP271
      Taxon   5 -> AZcoGM1054
      Taxon   6 -> AZcoDGM994
      Taxon   7 -> AZgiP26438
      Taxon   8 -> AZgrGM1012
      Taxon   9 -> AZgrGM1013
      Taxon  10 -> AZgrGM1024
^C[ptitle@iu mbTest]$

**Tags:** phylogenetics, phylogeny, molecular-genetics, mrbayes

---

## 1 answers

### Answer by username_1 on 2018-12-14. Score: 1

It is not trivial getting MB to run in parallel because from my experience it required granting privileges to regular users. I used this via MPI (MPICH) on a Slurm/SGE cluster.

Essentially, this is coarse grain parallel processing.

It is certainly worth parallelizing MB because each chain can be run on a different nodes and avoids RAM bottlenecks on complex models and big data sets. For example, 8 to 10+ chains can be run, ensuring convergence quickly by running chains across nodes.

---

**Update** I later found it was much easier to run via EasyBuild with OpenMPI using the command `runmpi`.

> **Comments:**
> **username_0**: Interesting, so this might be an MPI permissions issue then. I will run this by the university IT folks and see if they can help me figure this out. I'll report back.  
> **username_0**: This seems to most likely have been an issue with mpi on my system, rather than with MrBayes, and this now works for me, although I'm not sure what changed.  

---

