Bayesian phylogentic programs like MrBayes and BEAST work better when the BEAGLE library is installed. BEAGLE provides these programs with an MCMC sampler using CPU-based or GPU-based computation. Therefore, before compiling or using MrBayes and BEAST, BEAGLE and other prerequisites must be set-up and installed first. Unfortunately, setting-up all these software and libraries can become pretty frustrating very quickly.
Here I show how to properly set-up these programs to keep your frustration to a minimum. Broadly speaking, these instructions are applicable for Windows, Mac, and Linux. However, because I am specifically recounting my own experiencing setting-up my Linux machine, the more detailed parts of this guide focuses on installing on Linux.
- Go to https://developer.nvidia.com/cuda-downloads and fill out the form to download the appropriate CUDA drivers for your OS.
- Follow the installation instructions on the download page. In my case, I downloaded CUDA drivers for my Ubuntu 16.04 system. The download page provided me with 4 installer types - runfile (local), deb (local), deb (network), cluster (local). I chose "deb (local)" and downloaded the file (about 2 GB) to my computer.
- I installed the CUDA drivers installer following the onscreen instructions on the download page. Below are the instruction I got for installing CUDA in Ubuntu 16.04:
> sudo dpkg -i cuda-repo-ubuntu1604-8-0-local-ga2_8.0.61-1_amd64.deb
> sudo apt-get update
> sudo apt-get install cuda
Now you have CUDA drivers installed in your system. Next we need to install the BEAGLE library.
- Go to https://github.com/beagle-dev/beagle-lib and check the README.md on the page for the right installer for your system. Since I am using Ubuntu 16.04, I have to download the source code and compile the library by myself. The following steps are for compiling from source. If you are using Windows or Mac, please download the provided binaries to save yourself the trouble of compiling.
- Download the source code by cloning the repository
> git clone --depth=1 https://github.com/beagle-dev/beagle-lib.git
- Open the folder you just downloaded by cloning. Create a configuration file by running
autogen.sh
and configure the installation path. Set the installation path to/usr/local
if you have root access or$HOME
if not. See the following set of commands below for more detail.
> cd beagle-lib
> ./autogen.sh
> ./configure --prefix=/usr/local
> sudo make install
- Add
/usr/local
to yourLD_LIBRARY_PATH
andPKG_CONFIG_PATH
environment variables. In Ubuntu, open~/.bashrc
and addexport LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
andexport PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH
to your path. If you do not have root access and installed it somewhere else, please add your installation path toLD_LIBRARY_PATH
andPKG_CONFIG_PATH
variables instead.
> echo "export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH" >> ~/.bashrc
> echo "export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH" >> ~/.bashrc
- Update your system configuration by running
source
on your updated bash file.
> source ~/.bashrc
- Still in the source code folder, run
make check
to check your installation and if it is communicating properly with your nVidia graphic cards. Everything should pass.
Now you have successfully installed BEAGLE with CUDA support. You can now install software that depend on BEAGLE like MrBayes and BEAST.
- Download MrBayes from http://mrbayes.sourceforge.net/download.php, selecting the right version for your system. If you are running Windows or Mac, download the compile executable. If like me, you are running Linux, you need to download the source code.
- After downloading the source code, extract and go into the folder. Find the
src
directory and go into that as well. Open the file "CompileInstructions.txt". This document shows the different options available when compiling MrBayes.
> cd mrbayes-3.2.6
> cd src
> nano CompileInstructions.txt
- If you have settled on the options to use or are fine with the default, configure MrBayes using
.configure
and compile usingmake
. If you have root access, install in/usr/local/bin
using make install.
> ./configure
> make
> sudo make install
Congratulations! You should now have a working installation of MrBayes with access to the BEAGLE GPU library.
Recently, I face the trouble to install beagle library for running beast V1.X. It seems never working properly. Thank you for this instruction document.