Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
bfbf450
Sparse consistency bonus matrix, ensemble alignment, NSGA-III optimiz…
TimoLassmann Mar 9, 2026
f0cf213
Prior to parameter cleanup
TimoLassmann Mar 12, 2026
ae4ce12
Clean 2-path architecture with per-run optimizer parameters
TimoLassmann Mar 12, 2026
32e555d
POAR consistency merge, Kimura nucleotide matrices, NSGA-III optimize…
TimoLassmann Mar 18, 2026
9208173
Unified nucleotide presets: replace separate RNA/DNA with single pres…
TimoLassmann Mar 19, 2026
ccaa5a9
Chase-Lev work-stealing thread pool with tests and benchmarks
TimoLassmann Mar 21, 2026
3e84b9a
Threadpool as default parallelization, unified CLI mode presets
TimoLassmann Mar 24, 2026
adb215a
Add memcheck container, parallel optimizer, and stress tests
TimoLassmann Mar 24, 2026
8fd3daf
Consolidate entry points, parallelize alignment pipeline
TimoLassmann Mar 25, 2026
1002f0a
Add confidence masking for ensemble alignment output
TimoLassmann Mar 26, 2026
53abded
Add sequences to existing alignment (--add mode)
TimoLassmann Mar 26, 2026
280a40e
Fix _mm_malloc guards, update build.zig for zig 0.15, modernize bench…
TimoLassmann Apr 1, 2026
79f325b
Fix benchmark corruption bugs: temp-file race, length-invariant check…
TimoLassmann Apr 17, 2026
67308a1
Bump locked dependencies to resolve Dependabot CVEs
TimoLassmann May 15, 2026
2db696c
Drop stale OMP_NUM_THREADS from cibuildwheel config
TimoLassmann May 15, 2026
1c9b47f
Remove deprecated 'precise' mode alias; align mode docs
TimoLassmann May 15, 2026
dd01498
Remove paper-side benchmarks, optimizers, and PRDs
TimoLassmann May 15, 2026
9c7a24d
Remove dead code
TimoLassmann May 15, 2026
e7e55b3
Tidy design-doc references; commit parameter-cleanup PRD
TimoLassmann May 15, 2026
fb0d5c4
Clean up build warnings and stale libomp installs in CI
TimoLassmann May 15, 2026
eee0d93
Drop developer-only design docs from the source tree
TimoLassmann May 16, 2026
d1ce73c
Harden POAR file parsing against integer overflow
TimoLassmann May 16, 2026
afc18b5
Fix test_module_exports: add four missing symbols
TimoLassmann May 16, 2026
f7b3dac
Fix Linux build: gate d2 declaration on HAVE_AVX2
TimoLassmann May 16, 2026
b09d43f
Remove benchmark CI workflow
TimoLassmann May 16, 2026
f5baaf3
Fix DSSIM matrix mismatch; harden finalise + comparison error paths
TimoLassmann May 16, 2026
90d3e74
Add tests/check-local.sh — pre-push verification gate
TimoLassmann May 16, 2026
fe02b24
Apply black formatting to python-kalign/__init__.py
TimoLassmann May 16, 2026
5bd7602
Bump version to 3.5.2 and add ChangeLog entry
TimoLassmann May 16, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .containerignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
.git
build
build-*
benchmarks/data
benchmarks/results
__pycache__
Expand Down
136 changes: 0 additions & 136 deletions .github/workflows/benchmark.yml

This file was deleted.

6 changes: 3 additions & 3 deletions .github/workflows/cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,12 @@ jobs:
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y libomp-dev cmake
sudo apt-get install -y cmake

- name: Install dependencies (macOS)
if: runner.os == 'macOS'
run: |
brew install --formula libomp cmake
brew install --formula cmake

- name: Configure CMake
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
Expand Down Expand Up @@ -83,7 +83,7 @@ jobs:
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y libomp-dev cmake
sudo apt-get install -y cmake

- name: Configure CMake with ASAN
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=ASAN
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,12 @@ jobs:
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y libomp-dev cmake
sudo apt-get install -y cmake

- name: Install system dependencies (macOS)
if: runner.os == 'macOS'
run: |
brew install libomp cmake
brew install cmake

- name: Install Python dependencies
run: |
Expand Down Expand Up @@ -116,12 +116,12 @@ jobs:
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y libomp-dev cmake
sudo apt-get install -y cmake

- name: Install system dependencies (macOS)
if: runner.os == 'macOS'
run: |
brew install libomp cmake
brew install cmake

- name: Install build dependencies
run: |
Expand Down
11 changes: 6 additions & 5 deletions .github/workflows/wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,12 @@ jobs:
CIBW_BUILD: cp39-* cp310-* cp311-* cp312-* cp313-*
CIBW_SKIP: "*-win32 *-manylinux_i686 *-musllinux*"
CIBW_ARCHS: ${{ matrix.cibw_archs }}
# Set minimum macOS version to match OpenMP requirements
# Disable OpenMP on macOS to avoid libomp.dylib conflicts
# Use built-in threadpool for parallelization instead
CIBW_CONFIG_SETTINGS_MACOS: >
cmake.args=-DUSE_OPENMP=OFF;-DUSE_THREADPOOL=ON
CIBW_ENVIRONMENT_MACOS: >
CMAKE_BUILD_PARALLEL_LEVEL=2
OMP_NUM_THREADS=1
MACOSX_DEPLOYMENT_TARGET=14.0
CMAKE_OSX_DEPLOYMENT_TARGET=14.0

Expand All @@ -75,15 +77,14 @@ jobs:

# macOS specific settings
CIBW_BEFORE_ALL_MACOS: |
brew install --formula cmake libomp || echo "Dependencies may already be installed"
brew install --formula cmake || echo "cmake already installed"
CIBW_REPAIR_WHEEL_COMMAND_MACOS: >
delocate-wheel --require-archs {delocate_archs} -w {dest_dir} -v {wheel}

# Environment variables for builds
CIBW_ENVIRONMENT: >
CMAKE_BUILD_PARALLEL_LEVEL=2
OMP_NUM_THREADS=1


# Skip testing during wheel build to avoid cross-compilation issues
CIBW_TEST_SKIP: "*"

Expand Down
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -419,3 +419,7 @@ callgrind.out.*
*.large.fasta
test_data/large/

# Benchmark data (downloaded datasets + simulation results)
benchmarks/data/
benchmarks/results/

34 changes: 28 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ include(GenerateExportHeader)

set(KALIGN_LIBRARY_VERSION_MAJOR 3)
set(KALIGN_LIBRARY_VERSION_MINOR 5)
set(KALIGN_LIBRARY_VERSION_PATCH 1)
set(KALIGN_LIBRARY_VERSION_PATCH 2)
set(KALIGN_LIBRARY_VERSION_STRING ${KALIGN_LIBRARY_VERSION_MAJOR}.${KALIGN_LIBRARY_VERSION_MINOR}.${KALIGN_LIBRARY_VERSION_PATCH})


Expand Down Expand Up @@ -61,14 +61,18 @@ include(GNUInstallDirs)
include(CTest)
include(CheckCSourceRuns)

option(USE_OPENMP "Use OpenMP for parallelization" ON)
option(USE_OPENMP "Use OpenMP for parallelization" OFF)
option(USE_THREADPOOL "Use built-in threadpool instead of OpenMP" ON)
option(ENABLE_SSE "Enable compile-time SSE4.1 support." ON)
option(ENABLE_AVX "Enable compile-time AVX support." ON)
option(ENABLE_AVX2 "Enable compile-time AVX2 support." ON)

# Performance tuning parameters
set(KALIGN_ALN_SERIAL_THRESHOLD "250" CACHE STRING "Alignment positions threshold below which to use serial instead of parallel processing")
set(KALIGN_KMEANS_UPGMA_THRESHOLD "50" CACHE STRING "Number of sequences threshold below which to use UPGMA instead of parallel k-means")
# Threadpool parallelization thresholds (all settings in one place)
set(KALIGN_ALN_SERIAL_THRESHOLD "500" CACHE STRING "Hirschberg DP width below which to run serial")
set(KALIGN_KMEANS_UPGMA_THRESHOLD "50" CACHE STRING "Sequence count below which to use UPGMA instead of parallel k-means")
set(KALIGN_DIST_MIN_SEQS "50" CACHE STRING "Minimum sequences to parallelize distance/anchor computations")
set(KALIGN_PFOR_MIN_CHUNK "10" CACHE STRING "Minimum iterations per chunk in tp_parallel_for")

# option(ENABLE_FMA "Enable compile-time FMA support." ON)
# option(ENABLE_AVX512 "Enable compile-time AVX512 support." ON)
Expand Down Expand Up @@ -96,6 +100,20 @@ if(USE_OPENMP)
endif(OPENMP_FOUND OR OpenMP_FOUND)
endif(USE_OPENMP)

# Built-in threadpool (alternative to OpenMP)
if(USE_THREADPOOL)
if(USE_OPENMP AND (OPENMP_FOUND OR OpenMP_FOUND))
message(WARNING "Both USE_OPENMP and USE_THREADPOOL are ON. Threadpool takes precedence.")
endif()
find_package(Threads QUIET)
if(Threads_FOUND)
add_definitions(-DUSE_THREADPOOL)
message(STATUS "Built-in threadpool is enabled.")
else()
set(USE_THREADPOOL OFF)
message(STATUS "pthreads not found — falling back to serial execution.")
endif()
endif()

if (ENABLE_SSE)
#
Expand Down Expand Up @@ -199,6 +217,8 @@ endif(HAVE_AVX2)
# Add performance tuning parameters as compile definitions
add_definitions(-DKALIGN_ALN_SERIAL_THRESHOLD=${KALIGN_ALN_SERIAL_THRESHOLD})
add_definitions(-DKALIGN_KMEANS_UPGMA_THRESHOLD=${KALIGN_KMEANS_UPGMA_THRESHOLD})
add_definitions(-DKALIGN_DIST_MIN_SEQS=${KALIGN_DIST_MIN_SEQS})
add_definitions(-DKALIGN_PFOR_MIN_CHUNK=${KALIGN_PFOR_MIN_CHUNK})

add_subdirectory(lib)
add_subdirectory(src)
Expand All @@ -223,8 +243,10 @@ if(BUILD_PYTHON_MODULE)
# Link against the static kalign library
target_link_libraries(_core PRIVATE kalign_static)

# Link OpenMP if found
if(OpenMP_CXX_FOUND)
# Link OpenMP or threadpool
if(USE_THREADPOOL)
target_link_libraries(_core PRIVATE Threads::Threads)
elseif(OpenMP_CXX_FOUND)
target_link_libraries(_core PRIVATE OpenMP::OpenMP_CXX)
endif()

Expand Down
55 changes: 54 additions & 1 deletion ChangeLog
Original file line number Diff line number Diff line change
@@ -1,4 +1,57 @@
2026-02-27 Timo Lassmann <timolassmann@icloud.com>
2026-05-16 Timo Lassmann <timolassmann@icloud.com>

* version 3.5.2 - Four-mode preset system, threadpool, hardening
Algorithm and presets
- Four mode presets stable for protein and nucleotide:
fast, default, recall, accurate. Per-mode configurations
derived by NSGA-III multi-objective optimisation on
BAliBASE v4 (protein) and BRAliBASE (RNA).
- Unified nucleotide preset (DNA and RNA share one path).
- Ensemble alignment with POAR consensus and per-column /
per-residue confidence scores.
- New --add mode: append sequences to an existing alignment.
- Sparse consistency-bonus matrix for large MSAs (avoids
quadratic memory in column count).
- Removed deprecated 'precise' mode alias (Python only;
never shipped as a wheel).

Parallelism
- Chase-Lev work-stealing thread pool is now the default
parallelism backend; OpenMP is optional (USE_OPENMP=ON).
- macOS wheels no longer link libomp.dylib, resolving the
conda-forge / numpy OpenMP runtime conflict.

Security / robustness
- POAR file parsing now rejects malformed inputs that would
cause integer overflow in pair-count or per-pair entry
count (lib/src/poar.c). Limited threat model (requires
explicit --load-poar) but tightened anyway.
- finalise_alignment is now atomic w.r.t. msa->sequences:
validates all per-sequence linear lengths before swapping
any pointer, so a failure leaves the MSA unchanged.
- kalign_msa_compare wraps finalise_alignment in RUN(); a
failure surfaces cleanly instead of producing a half-
finalised MSA.
- DSSIM stress test now uses KALIGN_MATRIX_AUTO so it
exercises both protein and DNA biotypes correctly.
- Bumped locked dependencies (cryptography, flask, werkzeug,
pillow, pygments, pytest, urllib3, requests, mako, black)
past their CVE fix versions.

Build / tooling
- build.zig updated for zig 0.16 (four cross-compile targets).
- tests/check-local.sh: one-command pre-push gate that runs
zig build + native ctest + Linux ASAN container + pytest.
- Containerfile.memcheck (Ubuntu + ASAN + Valgrind) for local
Linux memory-bug reproduction.
- Removed paper-side benchmark machinery, optimizer scripts,
and design-rationale PRDs from the public tree (preserved
in the manuscript repository for reproducibility).
- Cleaned up ~550 lines of dead code (coretralign,
bitShiftRight256ymm, unused split() in bisectingKmeans).
- Build is now warning-free on clang and GCC.
- Dropped the broken benchmark CI workflow (BAliBASE download
endpoint has been gone for months).

* version 3.5.1 - Bugfix release
- Fix memory leak in build_tree_from_pairwise (realign/ensemble)
Expand Down
Loading
Loading