Skip to content
Commits on Source (4)
......@@ -44,10 +44,19 @@ install:
before_script:
- ulimit -c unlimited -S # Enable core dumps
after_failure:
- cat /home/travis/build/beagle-dev/beagle-lib/examples/synthetictest/test-suite.log
- cat /home/travis/build/beagle-dev/beagle-lib/examples/tinytest/test-suite.log
- cat /home/travis/build/beagle-dev/beagle-lib/examples/oddstatetest/test-suite.log
- cat /home/travis/build/beagle-dev/beagle-lib/examples/complextest/test-suite.log
- cat /home/travis/build/beagle-dev/beagle-lib/examples/fourtaxon/test-suite.log
- cat /home/travis/build/beagle-dev/beagle-lib/examples/matrixtest/test-suite.log
# Build steps
script:
- ./autogen.sh
- ./configure --with-opencl=${AMDAPPSDKROOT}
# - ./configure --with-opencl=${AMDAPPSDKROOT}
- ./configure --without-opencl
- make
- make check
......
The BEAGLE Developer group (http://beagle-lib.googlecode.com)
The BEAGLE Developer group (https://github.com/beagle-dev)
......@@ -13,7 +13,7 @@ java/beagle/GeneralBeagleImpl.java \
project/beagle-xcode/beagle-xcode.xcodeproj/project.pbxproj \
project/beagle-vs/complextest/complextest_vc90.vcproj \
project/beagle-vs/fourtaxon/fourtaxon_vc90.vcproj \
project/beagle-vs/genomictest/genomictest_vc90.vcproj \
project/beagle-vs/synthetictest/synthetictest_vc90.vcproj \
project/beagle-vs/tinytest/tinytest_vc90.vcproj \
project/beagle-vs/oddstatetest/oddstatetest_vc90.vcproj \
project/beagle-vs/matrixtest/matrixtest_vc90.vcproj \
......@@ -51,7 +51,7 @@ OPTIMIZATIONS= -O3 -mfpmath=sse -ftree-vectorizer-verbose=5 -msse -msse2 -ffast-
profile:
make clean
make CXXFLAGS="$(CXXFLAGS) -fprofile-generate $(OPTIMIZATIONS)"
make -C examples/genomictest/ check CXXFLAGS="$(CXXFLAGS) -static -fprofile-generate $(OPTIMIZATIONS)"
make -C examples/synthetictest/ check CXXFLAGS="$(CXXFLAGS) -static -fprofile-generate $(OPTIMIZATIONS)"
make mostlyclean
make CXXFLAGS="$(CXXFLAGS) -fprofile-use $(OPTIMIZATIONS)"
......
# @author Marc A. Suchard
# @author Andrew Rambaut
This is a stem README file. This file will contain:
# @author Daniel L. Ayres
1. General overview of BEAGLE
BEAGLE is a high-performance library that can perform the core calculations at the heart of most Bayesian
and Maximum Likelihood phylogenetics packages. It can make use of highly-parallel processors such as those
in graphics cards (GPUs) found in many PCs.
The project involves an open API and fast implementations of a library for evaluating phylogenetic
likelihoods (continuous time Markov processes) of biomolecular sequence evolution.
The aim is to provide high performance evaluation ‘services’ to a wide range of phylogenetic software,
both Bayesian samplers and Maximum Likelihood optimizers. This allows these packages to make use of
implementations that make use of optimized hardware such as graphics processing units.
2. Compilation instructions
Quick and dirty instructions on how to compile and install the BEAGLE library from the SVN repository 'trunk':
Quick and dirty instructions on how to compile and install the BEAGLE library from the git repository 'master':
$ svn checkout http://beagle-lib.googlecode.com/svn/trunk BEAGLE
$ cd BEAGLE
$ git clone --depth=1 https://github.com/beagle-dev/beagle-lib.git
$ cd beagle-lib
$ ./autogen.sh
$ ./configure
$ make
......@@ -19,17 +29,15 @@ Quick and dirty instructions on how to compile and install the BEAGLE library fr
Remarks:
When compiling in the MacOS Unix environment ("Terminal"), you need to install the autotools first. They are no
longer shipped with Xcode. For instance, you can install them using MacPorts (http://www.macports.org). First
install MacPorts, then do:
$ sudo port install autoconf
$ sudo port install automake
$ sudo port install libtool
$ sudo port install pkgconfig
longer shipped with Xcode. you need to obtain the following software packages: autoconf, automake, and libtool.
The easiest way to install these is with the Homebrew package manager (http://brew.sh/). Open 'Terminal.app'
and paste the installation command from the Homebrew website (you will find it at the top of the page, under
Install Homebrew). Next enter the following to install the required packages:
The last tool is not needed by BEAGLE but by many other software packages. Other options to install autotools
include Homebrew (http://mxcl.github.io/homebrew/) and directly from GNU source (http://www.gnu.org).
$ brew install libtool autoconf automake
3. Contact information
BEAGLE developer group: beagle-dev@googlegroups.com
### Overview
BEAGLE is a high-performance library that can perform the core calculations at the heart of most Bayesian and Maximum Likelihood phylogenetics packages. It can make use of highly-parallel processors such as those in graphics cards (GPUs) found in many PCs.
The project involves an open API and fast implementations of a library for evaluating phylogenetic likelihoods (continuous time Markov processes) of biomolecular sequence evolution.
......@@ -5,29 +7,37 @@ The project involves an open API and fast implementations of a library for evalu
The aim is to provide high performance evaluation 'services' to a wide range of phylogenetic software, both Bayesian samplers and Maximum Likelihood optimizers. This allows these packages to make use of implementations that make use of optimized hardware such as graphics processing units.
Currently the following software packages can make use of the BEAGLE library:
- BEAST http://beast.bio.ed.ac.uk/
- Garli https://garli.googlecode.com/
- MrBayes http://mrbayes.sourceforge.net/
- PhyML https://phyml.googlecode.com/
A manuscript describes the BEAGLE API and library:
http://sysbio.oxfordjournals.org/content/61/1/170
* BEAST [http://beast.bio.ed.ac.uk/](http://beast.bio.ed.ac.uk/)
* Garli [https://molevol.mbl.edu/index.php/Garli_wiki](https://molevol.mbl.edu/index.php/Garli_wiki)
* MrBayes [http://mrbayes.sourceforge.net/](http://mrbayes.sourceforge.net/)
* PhyML [http://www.atgc-montpellier.fr/phyml/](http://www.atgc-montpellier.fr/phyml/)
### References
A manuscript describes the BEAGLE API and library: [http://sysbio.oxfordjournals.org/content/61/1/170](http://sysbio.oxfordjournals.org/content/61/1/170)
The paper describing the algorithms used for calculating likelihoods of sequences on trees using many core devices like graphics processing units (GPUs) is available from: [http://tree.bio.ed.ac.uk/publications/390/](http://tree.bio.ed.ac.uk/publications/390/)
The paper describing the algorithms used for calculating likelihoods of sequences on trees using many core devices like graphics processing units (GPUs) is available from:
http://tree.bio.ed.ac.uk/publications/390/
### Binary installers
* [BEAGLE v3.0.2 for macOS](https://github.com/beagle-dev/beagle-lib/releases/download/v3.0.2/BEAGLE.v3.0.2.pkg)
* [BEAGLE v3.0.1 for Windows 64-bit](https://github.com/beagle-dev/beagle-lib/releases/download/v3.0.1/BEAGLE.v3.0.1.msi)
Binary installers:
- [BEAGLE v2.1.2 for Mac OS X 10.6 and later](https://www.dropbox.com/s/11kgt2jlq3lzln3/BEAGLE-2.1.2.pkg)
- [BEAGLE v2.1 for Windows XP and later](https://www.dropbox.com/s/61z48jvruzkwkku/BEAGLE-2.1.msi)
- [BEAGLE v2.1.0 for Windows XP and later](https://www.dropbox.com/s/61z48jvruzkwkku/BEAGLE-2.1.msi)
### Installation instructions
* [Instructions for installing BEAGLE on macOS](https://github.com/beagle-dev/beagle-lib/wiki/MacInstallInstructions)
* [Instructions for installing BEAGLE on Windows](https://github.com/beagle-dev/beagle-lib/wiki/WindowsInstallInstructions)
* [Instructions for installing BEAGLE on Linux](https://github.com/beagle-dev/beagle-lib/wiki/LinuxInstallInstructions)
### Documentation
Installation instructions:
- [Instructions for installing BEAGLE on Mac OS X](https://github.com/beagle-dev/beagle-lib/wiki/MacInstallInstructions)
- [Instructions for installing BEAGLE on Windows](https://github.com/beagle-dev/beagle-lib/wiki/WindowsInstallInstructions)
- [Instructions for installing BEAGLE on Linux](https://github.com/beagle-dev/beagle-lib/wiki/LinuxInstallInstructions)
* [API documentation](https://beagle-dev.github.io/html/beagle_8h.html)
* [Release notes](https://github.com/beagle-dev/beagle-lib/wiki/ReleaseNotes)
Documentation:
- [API documentation](http://beagle-lib.googlecode.com/svn/doc/html/beagle_8h.html)
- [Release notes](https://github.com/beagle-dev/beagle-lib/wiki/ReleaseNotes)
### Acknowledgements
# Acknowledgements
- This project is supported in part through the National Science Foundation grants IIS 1251151 and DMS 1264153.
* This project is supported in part through the National Science Foundation grants IIS-1251151, DMS-1264153, DBI-1356562, DBI-1661443, & DEB-1354146; National Institutes of Health grants R01-HG006139, R01-AI107034, & U19-AI135995; Wellcome Trust grant 206298/Z/17/Z; and European Research Council grant 725422-ReservoirDOCS.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
#NEXUS
begin mrbayes;
set autoclose=yes nowarn=yes seed=1 swapseed=1;
exe Dengue997.nex;
charset capsid = 1-342;
charset glycoprotein = 343-834;
charset envelope = 835-2325;
charset NS1 = 2325-3381;
charset NS2A = 3382-4038;
charset NS2B = 4039-4428;
charset NS3 = 4429-6285;
charset NS4A = 6286-6735;
charset NS4B = 6736-7482;
charset NS5 = 7483-.;
[partition by_codon = 3:1st_pos,2nd_pos,3rd_pos;]
partition by_gene = 10:capsid,glycoprotein,envelope,NS1,NS2A,NS2B,NS3,NS4A,NS4B,NS5;
set partition=by_gene;
lset nst=6 rates=invgamma;
[lset rates=propinv;]
[prset brlenspr=clock:uni;]
[prset applyto=(all) brlenspr=clock:uni;]
prset applyto=(all) ratepr=variable;
unlink shape=(all);
unlink pinvar=(all);
unlink statefreq=(all);
unlink revmat=(all);
unlink ratemultiplier=(all);
[unlink brlens=(all);]
[unlink clockrate=(all);]
set seed=1 swapseed=1;
[mcmc ngen=50000 nruns=1 nchains=1;]
[mcmc ngen=1 nruns=1 nchains=1;]
mcmc ngen=1000 nruns=1 nchains=1 printfreq=1000;
end;
dnl Process this file with autoconf to produce a configure script.
AC_PREREQ([2.59])
AC_INIT(libhmsbeagle, 2.1.2, beagle-dev@googlegroups.com)
AC_INIT(libhmsbeagle, 3.0.2, beagle-dev@googlegroups.com)
: ${CXXFLAGS=" -O3"}
: ${CXXFLAGS=""}
dnl -----------------------------------------------
dnl Package name and version number (user defined)
......@@ -11,8 +11,8 @@ dnl -----------------------------------------------
GENERIC_LIBRARY_NAME=libhmsbeagle
#release versioning
GENERIC_MAJOR_VERSION=2
GENERIC_MINOR_VERSION=1
GENERIC_MAJOR_VERSION=3
GENERIC_MINOR_VERSION=0
GENERIC_MICRO_VERSION=2
#API version
......@@ -23,7 +23,7 @@ AC_SUBST(GENERIC_API_VERSION)
GENERIC_REVISION_VERSION=$GENERIC_MINOR_VERSION
#shared library versioning
GENERIC_LIBRARY_VERSION=2:$GENERIC_REVISION_VERSION:1
GENERIC_LIBRARY_VERSION=3:$GENERIC_REVISION_VERSION:2
#
# current:revision:age
# | | |
......@@ -126,6 +126,44 @@ dnl OpenMP checker only defines for C when compiling both C and C++
OPENMP_CXXFLAGS=$OPENMP_CFLAGS
AC_SUBST(OPENMP_CXXFLAGS)
# ------------------------------------------------------------------------------
# Setup optimization level
# ------------------------------------------------------------------------------
AC_ARG_ENABLE(optimization,
AC_HELP_STRING([--disable-optimization],[build without compiler optimization]), , [enable_optimization=yes])
if test "$enable_optimization" = yes; then
AM_CXXFLAGS="$AM_CXXFLAGS -O3"
fi
# ------------------------------------------------------------------------------
# Setup debugging
# ------------------------------------------------------------------------------
AC_ARG_ENABLE(debugging,
AC_HELP_STRING([--enable-debugging],[build with debugging symbols]), , [enable_debugging=no])
if test "$enable_debugging" = yes; then
AM_CXXFLAGS="$AM_CXXFLAGS -g"
fi
# ------------------------------------------------------------------------------
# Setup C++11 threads
# ------------------------------------------------------------------------------
AM_CXXFLAGS="$AM_CXXFLAGS -std=c++11"
case $host_os in
*linux*)
dnl Check for gcc
if test x$GCC = xyes
then
AM_CXXFLAGS="$AM_CXXFLAGS -pthread"
fi
esac
# ------------------------------------------------------------------------------
# Setup OpenCL
# ------------------------------------------------------------------------------
......@@ -147,11 +185,12 @@ then
else
case $host_os in
*darwin*)
AC_CHECK_FILE(/System/Library/Frameworks/OpenCL.framework,,[with_opencl="no"])
with_opencl="no"
;;
*)
AC_CHECK_FILE(/usr/include/CL,[OPENCL_CFLAGS+=" -I/usr/include"],[with_opencl="no"])
esac
fi
fi
......@@ -179,11 +218,11 @@ then
then
CUDAPATH="$with_cuda"
CUDA_CFLAGS+=" -I$with_cuda/include"
CUDA_LIBS+=" -L$with_cuda/lib"
CUDA_LIBS+=" -L$with_cuda/lib64 -L$with_cuda/lib"
else
AC_CHECK_FILE(/usr/local/cuda/,[CUDAPATH="/usr/local/cuda"],[])
AC_CHECK_FILE(/usr/local/cuda/include,[CUDA_CFLAGS+=" -I/usr/local/cuda/include"],[CUDA_CFLAGS=""])
AC_CHECK_FILE(/usr/local/cuda/lib,[CUDA_LIBS+=" -L/usr/local/cuda/lib"],[])
AC_CHECK_FILE(/usr/local/cuda/lib$SUFFIX,[CUDA_LIBS+=" -L/usr/local/cuda/lib64 -L/usr/local/cuda/lib"],[])
fi
......@@ -214,13 +253,41 @@ if test x$DEBUG = xtrue
then
NVCCFLAGS="-g"
else
NVCCFLAGS="-O3"
NVCCFLAGS="-O3 -arch compute_30"
fi
if test x$EMULATION = xtrue
then
NVCCFLAGS+=" -deviceemu"
fi
# do not warn about deprecated GPU architectures
NVCCFLAGS+=" -Wno-deprecated-gpu-targets"
# ------------------------------------------------------------------------------
# Setup nvcc ccbin
# ------------------------------------------------------------------------------
AC_ARG_WITH([nvcc-ccbin],
[AS_HELP_STRING([--with-nvcc-ccbin=PATH],[path or executable name of host compiler for nvcc @<:@default=auto@:>@])],
[],
[with_nvcc_ccbin=auto])
if test "x$with_nvcc_ccbin" != "xno"
then
if test "x$with_nvcc_ccbin" != "xauto"
then
NVCCFLAGS+=" -ccbin $with_nvcc_ccbin"
else
case $host_os in
*darwin*)
NVCCFLAGS+=" -ccbin /usr/bin/clang"
;;
esac
fi
fi
# ------------------------------------------------------------------------------
# Setup SSE
# ------------------------------------------------------------------------------
......@@ -291,7 +358,7 @@ case $host_os in
then
NVCCFLAGS+=" -m64"
AM_CXXFLAGS="$AM_CXXFLAGS -m64"
NVCCFLAGS+=" -D_POSIX_C_SOURCE -ccbin /usr/bin/clang"
NVCCFLAGS+=" -D_POSIX_C_SOURCE"
CUDA_LIBS+=" -F/Library/Frameworks -framework CUDA"
fi
......@@ -399,7 +466,7 @@ AC_CONFIG_FILES([examples/tinytest/Makefile])
AC_CONFIG_FILES([examples/complextest/Makefile])
AC_CONFIG_FILES([examples/oddstatetest/Makefile])
AC_CONFIG_FILES([examples/fourtaxon/Makefile])
AC_CONFIG_FILES([examples/genomictest/Makefile])
AC_CONFIG_FILES([examples/synthetictest/Makefile])
AC_CONFIG_FILES([examples/matrixtest/Makefile])
AC_OUTPUT
......
libhmsbeagle (2.1.2+git20180619-1) UNRELEASED; urgency=medium
* New upstream version
* Force LC_ALL=C.UTF-8 encoding
-- Andreas Tille <tille@debian.org> Fri, 22 Jun 2018 23:38:14 +0200
libhmsbeagle (2.1.2+git20180307-1) unstable; urgency=medium
* New Github commit
......
......@@ -15,7 +15,7 @@ BUILDGNUTYPE := $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
BUILDARCH := $(shell dpkg-architecture -qDEB_BUILD_ARCH)
%:
dh $@ --with javahelper
LC_ALL=C.UTF-8 dh $@ --with javahelper
override_dh_auto_configure:
./autogen.sh
......
SUBDIRS=genomictest tinytest oddstatetest complextest fourtaxon matrixtest
SUBDIRS=synthetictest tinytest oddstatetest complextest fourtaxon matrixtest
check_PROGRAMS = genomictest
genomictest_SOURCES = genomictest.cpp linalg.cpp
genomictest_LDADD = $(top_builddir)/$(GENERIC_LIBRARY_NAME)/libhmsbeagle.la
check_SCRIPTS = genomictest.sh
genomictest.sh:
echo './genomictest' > genomictest.sh
echo './genomictest --states 64 --sites 100 --taxa 10' >> genomictest.sh
chmod +x genomictest.sh
clean-local:
rm -f genomictest.sh
TESTS = genomictest.sh
AM_CPPFLAGS = -I$(top_builddir) -I$(top_srcdir)
check_PROGRAMS = synthetictest
synthetictest_SOURCES = synthetictest.cpp linalg.cpp
synthetictest_LDADD = $(top_builddir)/$(GENERIC_LIBRARY_NAME)/libhmsbeagle.la
check_SCRIPTS = synthetictest.sh
synthetictest.sh:
echo './synthetictest' > synthetictest.sh
echo './synthetictest --states 64 --sites 100 --taxa 10' >> synthetictest.sh
chmod +x synthetictest.sh
clean-local:
rm -f synthetictest.sh
TESTS = synthetictest.sh
AM_CPPFLAGS = -I$(top_builddir) -I$(top_srcdir)
/*
* Beagle.java
/**
* @file Beagle.java
*
* Copyright 2009-2016 Phylogenetic Likelihood Working Group
*
* This file is part of BEAGLE.
*
* BEAGLE is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 3 of
* the License, or (at your option) any later version.
*
* BEAGLE is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with BEAGLE. If not, see
* <http://www.gnu.org/licenses/>.
*
* @brief This file documents the API as well as header for the
* Broad-platform Evolutionary Analysis General Likelihood Evaluator
*
* KEY CONCEPTS
*
* The key to BEAGLE performance lies in delivering fine-scale
* parallelization while minimizing data transfer and memory copy overhead.
* To accomplish this, the library lacks the concept of data structure for
* a tree, in spite of the intended use for phylogenetic analysis. Instead,
* BEAGLE acts directly on flexibly indexed data storage (called buffers)
* for observed character states and partial likelihoods. The client
* program can set the input buffers to reflect the data and can calculate
* the likelihood of a particular phylogeny by invoking likelihood
* calculations on the appropriate input and output buffers in the correct
* order. Because of this design simplicity, the library can support many
* different tree inference algorithms and likelihood calculation on a
* variety of models. Arbitrary numbers of states can be used, as can
* nonreversible substitution matrices via complex eigen decompositions,
* and mixture models with multiple rate categories and/or multiple eigen
* decompositions. Finally, BEAGLE application programming interface (API)
* calls can be asynchronous, allowing the calling program to implement
* other coarse-scale parallelization schemes such as evaluating
* independent genes or running concurrent Markov chains.
*
* USAGE
*
* To use the library, a client program first creates an instance of BEAGLE
* by calling beagleCreateInstance; multiple instances per client are
* possible and encouraged. All additional functions are called with a
* reference to this instance. The client program can optionally request
* that an instance run on certain hardware (e.g., a GPU) or have
* particular features (e.g., double-precision math). Next, the client
* program must specify the data dimensions and specify key aspects of the
* phylogenetic model. Character state data are then loaded and can be in
* the form of discrete observed states or partial likelihoods for
* ambiguous characters. The observed data are usually unchanging and
* loaded only once at the start to minimize memory copy overhead. The
* character data can be compressed into unique “site patterns” and
* associated weights for each. The parameters of the substitution process
* can then be specified, including the equilibrium state frequencies, the
* rates for one or more substitution rate categories and their weights,
* and finally, the eigen decomposition for the substitution process.
*
* In order to calculate the likelihood of a particular tree, the client
* program then specifies a series of integration operations that
* correspond to steps in Felsenstein’s algorithm. Finite-time transition
* probabilities for each edge are loaded directly if considering a
* nondiagonalizable model or calculated in parallel from the eigen
* decomposition and edge lengths specified. This is performed within
* BEAGLE’s memory space to minimize data transfers. A single function call
* will then request one or more integration operations to calculate
* partial likelihoods over some or all nodes. The operations are performed
* in the order they are provided, typically dictated by a postorder
* traversal of the tree topology. The client needs only specify nodes for
* which the partial likelihoods need updating, but it is up to the calling
* software to keep track of these dependencies. The final step in
* evaluating the phylogenetic model is done using an API call that yields
* a single log likelihood for the model given the data.
*
* Aspects of the BEAGLE API design support both maximum likelihood (ML)
* and Bayesian phylogenetic tree inference. For ML inference, API calls
* can calculate first and second derivatives of the likelihood with
* respect to the lengths of edges (branches). In both cases, BEAGLE
* provides the ability to cache and reuse previously computed partial
* likelihood results, which can yield a tremendous speedup over
* recomputing the entire likelihood every time a new phylogenetic model is
* evaluated.
*
* @author Likelihood API Working Group
*
* @author Daniel Ayres
* @author Peter Beerli
* @author Michael Cummings
* @author Aaron Darling
* @author Mark Holder
* @author John Huelsenbeck
* @author Paul Lewis
* @author Michael Ott
* @author Andrew Rambaut
* @author Fredrik Ronquist
* @author Marc Suchard
* @author David Swofford
* @author Derrick Zwickl
*
*/
......@@ -23,6 +125,7 @@ import java.io.Serializable;
public interface Beagle extends Serializable {
public static int OPERATION_TUPLE_SIZE = 7;
public static int PARTITION_OPERATION_TUPLE_SIZE = 9;
public static int NONE = -1;
......@@ -40,6 +143,17 @@ public interface Beagle extends Serializable {
*/
void setPatternWeights(final double[] patternWeights);
/**
* Set pattern partition assignments
*
* This function sets the vector of pattern partition indices for an instance. It should
* only be called after setTipPartials.
*
* @param partitionCount Number of partitions
* @param patternPartitions Array containing partitionCount partition indices (input)
*/
void setPatternPartitions(int partitionCount, final int[] patternPartitions);
/**
* Set the compressed state representation for tip node
*
......@@ -163,14 +277,25 @@ public interface Beagle extends Serializable {
final double[] categoryWeights);
/**
* Set category rates
* Set default category rates buffer
*
* This function sets the vector of category rates for an instance.
* This function sets the default vector of category rates for an instance.
*
* @param inCategoryRates Array containing categoryCount rate scalers (input)
*/
void setCategoryRates(final double[] inCategoryRates);
/**
* Set a category rates buffer
*
* This function sets the vector of category rates for a given buffer in an instance.
*
* @param categoryRatesIndex the index of the buffer
* @param inCategoryRates Array containing categoryCount rate scalers (input)
*/
void setCategoryRatesWithIndex(int categoryRatesIndex,
final double[] inCategoryRates);
/**
* Convolve lists of transition probability matrices
*
......@@ -208,6 +333,29 @@ public interface Beagle extends Serializable {
final double[] edgeLengths,
int count);
/**
* Calculate a list of transition probability matrices with multiple models
*
* This function calculates a list of transition probabilities matrices and their first and
* second derivatives (if requested).
*
* @param eigenIndices List of indices of eigen-decomposition buffers (input)
* @param categoryRateIndices List of indices of category-rate buffers (input)
* @param probabilityIndices List of indices of transition probability matrices to update (input)
* @param firstDerivativeIndices List of indices of first derivative matrices to update (input, NULL implies no calculation)
* @param secondDervativeIndices List of indices of second derivative matrices to update (input, NULL implies no calculation)
* @param edgeLengths List of edge lengths with which to perform calculations (input)
* @param count Length of lists
*/
void updateTransitionMatricesWithMultipleModels(
final int[] eigenIndices,
final int[] categoryRateIndices,
final int[] probabilityIndices,
final int[] firstDerivativeIndices,
final int[] secondDervativeIndices,
final double[] edgeLengths,
int count);
/**
* This function copies a finite-time transition probability matrix into a matrix buffer. This function
* is used when the application wishes to explicitly set the transition probability matrix rather than
......@@ -223,6 +371,7 @@ public interface Beagle extends Serializable {
int matrixIndex, /**< Index of matrix buffer (input) */
final double[] inMatrix, /**< Pointer to source transition probability matrix (input) */
double paddedValue);
/**
* Get a finite-time transition probability matrix
*
......@@ -241,9 +390,11 @@ public interface Beagle extends Serializable {
* Calculate or queue for calculation partials using a list of operations
*
* This function either calculates or queues for calculation a list partials. Implementations
* supporting SYNCH may queue these calculations while other implementations perform these
* operations immediately. Implementations supporting GPU may perform all operations in the list
* simultaneously.
* supporting ASYNCH may queue these calculations while other implementations perform these
* operations immediately and in order.
*
* If partitions have been set via beagleSetPatternPartitions, operationCount should be a
* multiple of partitionCount.
*
* Operations list is a list of 7-tuple integer indices, with one 7-tuple per operation.
* Format of 7-tuple operation: {destinationPartials,
......@@ -264,6 +415,35 @@ public interface Beagle extends Serializable {
int operationCount,
int cumulativeScaleIndex);
/**
* Calculate or queue for calculating partials by partition using a list of operations
*
* This function either calculates or queues for calculation a list partials. Implementations
* supporting ASYNCH may queue these calculations while other implementations perform these
* operations immediately and in order.
*
* If partitions have been set via beagleSetPatternPartitions, operationCount should be a
* multiple of partitionCount.
*
* Operations list is a list of 9-tuple integer indices, with one 9-tuple per operation.
* Format of 9-tuple operation: {destinationPartials,
* destinationScaleWrite,
* destinationScaleRead,
* child1Partials,
* child1TransitionMatrix,
* child2Partials,
* child2TransitionMatrix,
* partition,
* cumulativeScaleIndex}
*
* @param operations List of 9-tuples specifying operations (input)
* @param operationCount Number of operations (input)
*
*/
void updatePartialsByPartition(
final int[] operations,
int operationCount);
/**
* Accumulate scale factors
*
......@@ -280,6 +460,24 @@ public interface Beagle extends Serializable {
final int cumulativeScaleIndex
);
/**
* Accumulate scale factors by partition
*
* This function adds (log) scale factors from a list of scaleBuffers to a cumulative scale
* buffer. It is used to calculate the marginal scaling at a specific node for each site.
*
* @param scaleIndices List of scaleBuffers to add (input)
* @param count Number of scaleBuffers in list (input)
* @param cumulativeScaleIndex Index number of scaleBuffer to accumulate factors into (input)
* @param partitionIndex Index number of partition (input)
*/
void accumulateScaleFactorsByPartition(
final int[] scaleIndices,
int count,
int cumulativeScaleIndex,
int partitionIndex
);
/**
* Remove scale factors
*
......@@ -296,6 +494,23 @@ public interface Beagle extends Serializable {
final int cumulativeScaleIndex
);
/**
* Remove scale factors by partition
*
* This function removes (log) scale factors from a cumulative scale buffer. The
* scale factors to be removed are indicated in a list of scaleBuffers.
*
* @param scaleIndices List of scaleBuffers to remove (input)
* @param count Number of scaleBuffers in list (input)
* @param cumulativeScaleIndex Index number of scaleBuffer containing accumulated factors (input)
* @param partitionIndex Index number of partition (input)
*/
void removeScaleFactorsByPartition(
final int[] scaleIndices,
final int count,
final int cumulativeScaleIndex,
final int partitionIndex
);
/**
* Copy scale factors
......@@ -319,6 +534,16 @@ public interface Beagle extends Serializable {
*/
void resetScaleFactors(int cumulativeScaleIndex);
/**
* Reset scalefactors by partition
*
* This function resets a cumulative scale buffer.
*
* @param cumulativeScaleIndex Index number of cumulative scaleBuffer (input)
* @param partitionIndex Index number of partition (input)
*/
void resetScaleFactorsByPartition(int cumulativeScaleIndex, int partitionIndex);
/**
* Calculate site log likelihoods at a root node
*
......@@ -344,6 +569,39 @@ public interface Beagle extends Serializable {
int count,
double[] outSumLogLikelihood);
/**
* Calculate site log likelihoods at a root node by partition
*
* This function integrates a list of partials at a node with respect to a set of partials-weights and
* state frequencies to return the log likelihoods for each site
*
* @param bufferIndices List of partialsBuffer indices to integrate (input)
* @param categoryWeightsIndices List of indices of category weights to apply to each partialsBuffer (input)
* should be one categoryCount sized set for each of
* parentBufferIndices
* @param stateFrequenciesIndices List of indices of state frequencies for each partialsBuffer (input)
* should be one set for each of parentBufferIndices
* @param cumulativeScaleIndices List of scalingFactors indices to accumulate over (input). There
* should be one set for each of parentBufferIndices
* @param partitionIndices List of partition indices indicating which sites in each
* partialsBuffer should be used (input). There should be one
* index for each of bufferIndices
* @param partitionCount Number of partialsBuffer to integrate (input)
* @param count Number of sets of partitions to integrate across (input)
* @param outSumLogLikelihoodByPartition Pointer to destination for resulting sum of per partition log likelihoods (output)
* @param outSumLogLikelihood Pointer to destination for resulting sum of log likelihoods (output)
*/
void calculateRootLogLikelihoodsByPartition(int[] bufferIndices,
int[] categoryWeightsIndices,
int[] stateFrequenciesIndices,
int[] cumulativeScaleIndices,
int[] partitionIndices,
int partitionCount,
int count,
double[] outSumLogLikelihoodByPartition,
double[] outSumLogLikelihood);
/**
* Calculate site log likelihoods and derivatives along an edge
*
......@@ -367,7 +625,7 @@ public interface Beagle extends Serializable {
* @param outSumSecondDerivative Pointer to destination for resulting sum of second derivatives (output)
*/
void calculateEdgeLogLikelihoods(int[] parentBufferIndices,
/*void calculateEdgeLogLikelihoods(int[] parentBufferIndices,
int[] childBufferIndices,
int[] probabilityIndices,
int[] firstDerivativeIndices,
......@@ -378,7 +636,7 @@ public interface Beagle extends Serializable {
int count,
double[] outSumLogLikelihood,
double[] outSumFirstDerivative,
double[] outSumSecondDerivative);
double[] outSumSecondDerivative);*/
/**
* Return the individual log likelihoods for each site pattern.
......
......@@ -26,6 +26,7 @@ public enum BeagleFlag {
VECTOR_SSE(1 << 11, "SSE vector computation"),
VECTOR_NONE(1 << 12, "no vector computation"),
THREADING_CPP(1 << 30, "C++11 threading"),
THREADING_OPENMP(1 << 13, "OpenMP threading"),
THREADING_NONE(1 << 14, "no threading"),
......@@ -36,7 +37,10 @@ public enum BeagleFlag {
FRAMEWORK_CUDA(1 << 22, "use CUDA implementation with GPU resources"),
FRAMEWORK_OPENCL(1 << 23, "use OpenCL implementation with CPU or GPU resources"),
FRAMEWORK_CPU(1 << 27, "use CPU implementation");
FRAMEWORK_CPU(1 << 27, "use CPU implementation"),
PARALLELOPS_STREAMS(1 << 28, "Operations in updatePartials may be assigned to separate device streams"),
PARALLELOPS_GRID(1 << 29, "Operations in updatePartials may be folded into single kernel launch (necessary for partitions; typically performs better for problems with fewer pattern sites)");
BeagleFlag(long mask, String meaning) {
this.mask = mask;
......