Skip to content

Commit

Permalink
Merge branch 'master' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
amkozlov committed Mar 8, 2023
2 parents ffe2550 + 7164df6 commit 14675b3
Show file tree
Hide file tree
Showing 12 changed files with 10,026 additions and 138 deletions.
75 changes: 73 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,74 @@
# libpll-2
# # Libpll-2

libpll-2 is the new official fork of libpll (https://github.com/xflouris/libpll/). It implements site repeats to speed up computations.


Please read the wiki for more information.



# Projects that are already using libpll-2
List of projects already using libpll-2 and site repeats, and reported speedups compared with the tip pattern optimization:
* [RAxML-NG](https://github.com/amkozlov/raxml-ng): speedup ranges between 1.2 and 1.5
* [ModelTest-NG](https://github.com/ddarriba/modeltest): speedup around 1.3
* [EPA-ng](https://github.com/Pbdas/epa-ng): memory footprint reduced by 30%.


# Compilation instructions

Currently, `libpll` requires that [GNU Bison](http://www.gnu.org/software/bison/)
and [Flex](http://flex.sourceforge.net/) are installed on the target system. On
a Debian-based Linux system, the two packages can be installed using the command

`apt-get install flex bison`

The library also requires that a GNU system is available as it uses several
functions (e.g. `asprintf`) which are not present in the POSIX standard.
This, however will change in the future in order to have a more portable
and cross-platform library.

The library can be compiled using either of the following two ways.

**Cloning the repo** Clone the repo and bild the executable and documentation
using the following commands.

```bash
git clone https://github.com/xflouris/libpll.git
cd libpll
./autogen.sh
./configure
make
make install # as root, otherwise run: sudo make install
```

When using the cloned repository version, you will also need
[autoconf](https://www.gnu.org/software/autoconf/autoconf.html),
[automake](https://www.gnu.org/software/automake/) and
[libtool](https://www.gnu.org/software/libtool/) installed. On a Debian-based
Linux system, the packages can be installed using the command

```bash
sudo apt-get install autotools-dev autoconf libtool
```

The library will be installed on the operating system's standard paths. For
some GNU/Linux distributions it might be necessary to add that standard path
(typically `/usr/local/lib`) to `/etc/ld.so.conf` and run `ldconfig`.

Microsoft Windows compatibility was tested with a cross-compiler and seems to
work out-of-the-box using [MingW](http://www.mingw.org/).

# libpll-2 license and third party licenses

The libpll-2 code is currently licensed under the
[GNU Affero General Public License version 3](http://www.gnu.org/licenses/agpl-3.0.en.html).
Please see LICENSE.txt for details.

libpll-2 includes code from several other projects. We would like to thank the
authors for making their source code available.

libpll includes code from GNU Compiler Collection distributed under the GNU
General Public License.



The future line of libpll...
35 changes: 30 additions & 5 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,11 @@ endif()
set (SSE_FLAGS "-msse3")
set (AVX_FLAGS "-mavx")
set (AVX2_FLAGS "-mfma -mavx2")
set (NEON_FLAGS "-march=armv8-a+fp+simd")

find_package(BISON)
find_package(FLEX)
set(LIBPLL_BISON_FLAGS "-y -d -p pll_utree_")
set(LIBPLL_BISON_FLAGS "-d -p pll_utree_")
set(LIBPLL_FLEX_FLAGS "-P pll_utree_")
BISON_TARGET(parse_utree_t
${CMAKE_CURRENT_SOURCE_DIR}/parse_utree.y ${CMAKE_CURRENT_BINARY_DIR}/parse_utree.c
Expand All @@ -23,7 +24,7 @@ FLEX_TARGET(lex_utree_t
${CMAKE_CURRENT_SOURCE_DIR}/lex_utree.l ${CMAKE_CURRENT_BINARY_DIR}/lex_utree.c
COMPILE_FLAGS ${LIBPLL_FLEX_FLAGS})
ADD_FLEX_BISON_DEPENDENCY(lex_utree_t parse_utree_t)
set(LIBPLL_BISON_FLAGS "-y -d -p pll_rtree_")
set(LIBPLL_BISON_FLAGS "-d -p pll_rtree_")
set(LIBPLL_FLEX_FLAGS "-P pll_rtree_")
BISON_TARGET(parse_rtree_t
${CMAKE_CURRENT_SOURCE_DIR}/parse_rtree.y ${CMAKE_CURRENT_BINARY_DIR}/parse_rtree.c
Expand Down Expand Up @@ -104,8 +105,11 @@ endif ()
if (NOT DEFINED ENABLE_AVX2)
SET(ENABLE_AVX2 "True")
endif ()
if (NOT DEFINED ENABLE_SSE2NEON)
SET(ENABLE_SSE2NEON "True")
endif ()

# check simd installed
# check simd supported by the compiler
if (ENABLE_SSE)
SET(_code " #include <immintrin.h>
int main() {__m128d a = _mm_setzero_pd(); return 1;}")
Expand Down Expand Up @@ -142,7 +146,18 @@ if (ENABLE_AVX2)
set(ENABLE_AVX2 "False")
endif()
endif()

if (ENABLE_SSE2NEON)
SET(_code " #include <sse2neon.h>
int main() {__m128d a = _mm_setzero_pd(); return 1;}")
SET(_file ${CMAKE_CURRENT_BINARY_DIR}/testsse2neon.c)
FILE(WRITE "${_file}" "${_code}")
TRY_COMPILE(SSE2NEON_COMPILED ${CMAKE_CURRENT_BINARY_DIR} ${_file}
COMPILE_DEFINITIONS "${NEON_FLAGS} -I${CMAKE_CURRENT_SOURCE_DIR}")
if (NOT SSE2NEON_COMPILED)
message(STATUS "Disable sse2neon simd, because not supported")
set(ENABLE_SSE2NEON "False")
endif()
endif()

# set simd flags
if (ENABLE_SSE)
Expand All @@ -151,7 +166,15 @@ if (ENABLE_SSE)
message(STATUS "SSE enabled. To disable it, run cmake with -DENABLE_SSE=false")
set(LIBPLL_SOURCES ${LIBPLL_SOURCES} ${LIBPLL_SSE_SOURCES})
SET_SOURCE_FILES_PROPERTIES( ${LIBPLL_SSE_SOURCES} PROPERTIES COMPILE_FLAGS ${SSE_FLAGS} )
elseif (ENABLE_SSE2NEON)
# atm either SSE or SSE2NEON kernels can be built, since the share the same function and object names
add_definitions(-DHAVE_SSE3 -DHAVE_SSE2NEON)
set(SIMD_FLAGS "${SIMD_FLAGS} ${NEON_FLAGS}")
message(STATUS "SSE2NEON enabled. To disable it, run cmake with -DENABLE_SSE2NEON=false")
set(LIBPLL_SOURCES ${LIBPLL_SOURCES} ${LIBPLL_SSE_SOURCES})
SET_SOURCE_FILES_PROPERTIES( ${LIBPLL_SSE_SOURCES} PROPERTIES COMPILE_FLAGS ${NEON_FLAGS} )
endif ()

if (ENABLE_AVX)
add_definitions(-DHAVE_AVX)
set(SIMD_FLAGS "${SIMD_FLAGS} ${AVX_FLAGS}")
Expand All @@ -167,7 +190,9 @@ if (ENABLE_AVX2)
SET_SOURCE_FILES_PROPERTIES( ${LIBPLL_AVX2_SOURCES} PROPERTIES COMPILE_FLAGS ${AVX2_FLAGS} )
endif ()

add_definitions(-DHAVE_X86INTRIN_H)
if (ENABLE_SSE OR ENABLE_AVX OR ENABLE_AVX2)
add_definitions(-DHAVE_X86INTRIN_H)
endif()

set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${LIBPLL_BASE_FLAGS}")

Expand Down
9 changes: 8 additions & 1 deletion src/hardware.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
https://github.com/xflouris/libpll/issues/138
*/
#if (defined(__APPLE__)) || \
#if (defined(__APPLE__) && !defined(__aarch64__)) || \
(!defined(__clang__) && defined(__GNUC__) && (__GNUC__ < 4 || \
(__GNUC__ == 4 && __GNUC_MINOR__ < 8))) || \
(defined(__clang__) && (__clang_major__ < 3 || \
Expand Down Expand Up @@ -112,6 +112,13 @@ static void cpu_features_detect()
pll_hardware.init = 1;
#if defined(__PPC__)
pll_hardware.altivec_present = __builtin_cpu_supports("altivec");
#elif defined(__aarch64__) && defined(HAVE_SSE2NEON)
pll_hardware.sse_present = 1;
pll_hardware.sse2_present = 1;
pll_hardware.sse3_present = 1;
pll_hardware.ssse3_present = 1;
pll_hardware.sse41_present = 1;
pll_hardware.sse42_present = 1;
#elif defined(__x86_64__) || defined(__i386__)
pll_hardware.mmx_present = __builtin_cpu_supports("mmx");
pll_hardware.sse_present = __builtin_cpu_supports("sse");
Expand Down
Loading

0 comments on commit 14675b3

Please sign in to comment.