Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
214 changes: 214 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,214 @@
name: Maxent CI

on:
push:
branches:
- master
- modernize/step2
pull_request:
branches:
- master
- modernize/step2

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}

env:
BOOST_VERSION: "1.91.0"
BOOST_VERSION_U: "1_91_0"

jobs:
linux-build:
name: >-
Maxent / ${{ matrix.plat.os }} / ${{ matrix.plat.c_compiler }}-${{ matrix.plat.c_version }} /
${{ matrix.plat.variant }}
runs-on: ${{ matrix.plat.os }}
timeout-minutes: 90
strategy:
fail-fast: false
matrix:
plat:
# Match the compiler installation conventions used by ALPS 3.0 CI.
- { os: ubuntu-22.04, comp_pack: "gcc-11 g++-11", c_compiler: gcc, cxx_compiler: g++, c_version: 11, variant: strict }
- { os: ubuntu-24.04, comp_pack: "gcc-13 g++-13", c_compiler: gcc, cxx_compiler: g++, c_version: 13, variant: strict }
- { os: ubuntu-24.04, comp_pack: "gcc-15 g++-15", c_compiler: gcc, cxx_compiler: g++, c_version: 15, variant: strict }
- { os: ubuntu-22.04, comp_pack: "clang-15", c_compiler: clang, cxx_compiler: clang++, c_version: 15, variant: strict }
- { os: ubuntu-24.04, comp_pack: "clang-19", c_compiler: clang, cxx_compiler: clang++, c_version: 19, variant: strict }
- { os: ubuntu-24.04, comp_pack: "gcc-13 g++-13", c_compiler: gcc, cxx_compiler: g++, c_version: 13, variant: lapack, lapack: true }
- { os: ubuntu-24.04, comp_pack: "clang-19", c_compiler: clang, cxx_compiler: clang++, c_version: 19, variant: asan-ubsan, sanitizers: true }
- { os: ubuntu-24.04, comp_pack: "gcc-13 g++-13", c_compiler: gcc, cxx_compiler: g++, c_version: 13, variant: alps-flags, alps_flags: true }

steps:
- uses: actions/checkout@v7
- name: Check out ALPSCore
uses: actions/checkout@v7
with:
repository: ALPSCore/ALPSCore
path: alpscore
- name: Set up Python
uses: actions/setup-python@v7
with:
python-version: "3.14"
- name: Install dependencies
timeout-minutes: 20
run: |
printf 'Acquire::Retries "3";\nAcquire::http::Timeout "30";\nAcquire::https::Timeout "30";\n' \
| sudo tee /etc/apt/apt.conf.d/99ci-timeouts > /dev/null
sudo apt-get update
sudo apt-get install -y liblapack-dev libblas-dev libopenmpi-dev libhdf5-serial-dev libeigen3-dev
if [[ "${{ matrix.plat.c_compiler }}" == "clang" && "${{ matrix.plat.c_version }}" -ge 19 ]]; then
wget -nv --tries=3 --timeout=60 -O /tmp/llvm.sh https://apt.llvm.org/llvm.sh
sudo bash /tmp/llvm.sh "${{ matrix.plat.c_version }}" all
else
if [[ "${{ matrix.plat.c_compiler }}" == "gcc" && "${{ matrix.plat.c_version }}" -ge 15 ]]; then
sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
sudo apt-get update
fi
sudo apt-get install -y ${{ matrix.plat.comp_pack }}
fi
python -m pip install --upgrade pip
python -m pip install "numpy>=1.26" "h5py>=3.10"
- name: Determine dependency cache identity
id: dependency-cache
run: |
{
"${{ matrix.plat.cxx_compiler }}-${{ matrix.plat.c_version }}" --version
dpkg-query -W -f='${Package}=${Version}\n' \
libhdf5-serial-dev libeigen3-dev libopenmpi-dev
} > "${RUNNER_TEMP}/dependency-versions.txt"
dependency_key=$(sha256sum "${RUNNER_TEMP}/dependency-versions.txt" | cut -d ' ' -f 1)
echo "key=${dependency_key}" >> "${GITHUB_OUTPUT}"
- name: Cache Boost and ALPSCore
id: cache-dependencies
uses: actions/cache@v6
with:
path: |
${{ runner.temp }}/boost
${{ runner.temp }}/alpscore-install
key: maxent-deps-${{ runner.os }}-${{ runner.arch }}-${{ steps.dependency-cache.outputs.key }}-boost-${{ env.BOOST_VERSION }}-${{ hashFiles('alpscore/**') }}
- name: Build Boost and ALPSCore
if: steps.cache-dependencies.outputs.cache-hit != 'true'
env:
CC: ${{ matrix.plat.c_compiler }}-${{ matrix.plat.c_version }}
CXX: ${{ matrix.plat.cxx_compiler }}-${{ matrix.plat.c_version }}
run: |
wget -nv --tries=3 --timeout=60 --waitretry=10 \
"https://archives.boost.io/release/${BOOST_VERSION}/source/boost_${BOOST_VERSION_U}.tar.gz"
tar -xzf "boost_${BOOST_VERSION_U}.tar.gz"
cd "boost_${BOOST_VERSION_U}"
./bootstrap.sh --prefix="${RUNNER_TEMP}/boost" --with-libraries=program_options
./b2 -j 2 install
cd ..
cmake -S alpscore -B alpscore-build \
-DTesting=OFF \
-DALPS_CXX_STD=c++17 \
-DBoost_ROOT="${RUNNER_TEMP}/boost" \
-DCMAKE_PREFIX_PATH="${RUNNER_TEMP}/boost" \
-DCMAKE_INSTALL_PREFIX="${RUNNER_TEMP}/alpscore-install"
cmake --build alpscore-build -j 2
cmake --install alpscore-build
- name: Configure Maxent
env:
CC: ${{ matrix.plat.c_compiler }}-${{ matrix.plat.c_version }}
CXX: ${{ matrix.plat.cxx_compiler }}-${{ matrix.plat.c_version }}
run: |
extra_flags=""
if [[ "${{ matrix.plat.sanitizers || false }}" == "true" ]]; then
extra_flags="-fsanitize=address,undefined -fno-omit-frame-pointer"
elif [[ "${{ matrix.plat.alps_flags || false }}" == "true" ]]; then
extra_flags="-fpermissive -DBOOST_NO_AUTO_PTR -DBOOST_FILESYSTEM_NO_CXX20_ATOMIC_REF -DBOOST_TIMER_ENABLE_DEPRECATED"
fi
cmake -S . -B build/ci \
-DCMAKE_BUILD_TYPE=${{ matrix.plat.sanitizers && 'Debug' || 'Release' }} \
-DCMAKE_PREFIX_PATH="${RUNNER_TEMP}/alpscore-install;${RUNNER_TEMP}/boost" \
-DALPSCore_DIR="${RUNNER_TEMP}/alpscore-install/share/ALPSCore" \
-DBoost_ROOT="${RUNNER_TEMP}/boost" \
-DMAXENT_USE_LAPACK=${{ matrix.plat.lapack && 'ON' || 'OFF' }} \
-DMAXENT_WERROR=ON \
-DCMAKE_CXX_FLAGS="${extra_flags}" \
-DCMAKE_EXE_LINKER_FLAGS="${extra_flags}"
- name: Build Maxent
run: cmake --build build/ci -j 2
- name: Test Maxent
env:
ASAN_OPTIONS: detect_leaks=1
UBSAN_OPTIONS: print_stacktrace=1
run: ctest --test-dir build/ci --output-on-failure
- name: Upload test logs on failure
if: failure()
uses: actions/upload-artifact@v7
with:
name: test-logs-${{ matrix.plat.c_compiler }}-${{ matrix.plat.c_version }}-${{ matrix.plat.variant }}
path: build/ci/Testing/Temporary/**

macos-build:
name: Maxent / macos-15 / AppleClang / strict
runs-on: macos-15
timeout-minutes: 90
steps:
- uses: actions/checkout@v7
- name: Check out ALPSCore
uses: actions/checkout@v7
with:
repository: ALPSCore/ALPSCore
path: alpscore
- name: Set up Python
uses: actions/setup-python@v7
with:
python-version: "3.14"
- name: Install dependencies
timeout-minutes: 30
run: |
brew install boost eigen hdf5 open-mpi
python -m pip install --upgrade pip
python -m pip install "numpy>=1.26" "h5py>=3.10"
- name: Determine dependency cache identity
id: dependency-cache
run: |
{
/usr/bin/clang --version
brew list --versions boost eigen hdf5 open-mpi
} > "${RUNNER_TEMP}/dependency-versions.txt"
dependency_key=$(shasum -a 256 "${RUNNER_TEMP}/dependency-versions.txt" | cut -d ' ' -f 1)
echo "key=${dependency_key}" >> "${GITHUB_OUTPUT}"
- name: Cache ALPSCore
id: cache-alpscore
uses: actions/cache@v6
with:
path: ${{ runner.temp }}/alpscore-install
key: maxent-alpscore-${{ runner.os }}-${{ runner.arch }}-${{ steps.dependency-cache.outputs.key }}-${{ hashFiles('alpscore/**') }}
- name: Build ALPSCore
if: steps.cache-alpscore.outputs.cache-hit != 'true'
env:
CC: /usr/bin/clang
CXX: /usr/bin/clang++
run: |
cmake -S alpscore -B alpscore-build \
-DTesting=OFF \
-DALPS_CXX_STD=c++17 \
-DCMAKE_PREFIX_PATH="$(brew --prefix)" \
-DEIGEN3_INCLUDE_DIR="$(brew --prefix eigen)/include/eigen3" \
-DCMAKE_INSTALL_PREFIX="${RUNNER_TEMP}/alpscore-install"
cmake --build alpscore-build -j "$(sysctl -n hw.ncpu)"
cmake --install alpscore-build
- name: Configure Maxent
env:
CC: /usr/bin/clang
CXX: /usr/bin/clang++
run: |
cmake -S . -B build/ci \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_PREFIX_PATH="${RUNNER_TEMP}/alpscore-install;$(brew --prefix)" \
-DALPSCore_DIR="${RUNNER_TEMP}/alpscore-install/share/ALPSCore" \
-DMAXENT_WERROR=ON
- name: Build Maxent
run: cmake --build build/ci -j "$(sysctl -n hw.ncpu)"
- name: Test Maxent
run: ctest --test-dir build/ci --output-on-failure
- name: Upload test logs on failure
if: failure()
uses: actions/upload-artifact@v7
with:
name: test-logs-macos-15-appleclang
path: build/ci/Testing/Temporary/**
75 changes: 0 additions & 75 deletions .travis.yml

This file was deleted.

6 changes: 4 additions & 2 deletions ALPS3_MIGRATION_PLAN.md
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,8 @@ Keep the `MaxEntSimulation` public getters stable, because the tests use them.

### 2.4 Hygiene and CI

* Delete `.travis.yml` and add GitHub Actions with this matrix:
* **In progress 2026-09-24:** delete `.travis.yml` and add GitHub Actions,
mirroring ALPS 3.0's workflow conventions, with this matrix:
* Ubuntu: GCC 11/13/15, Clang 15/19
* macOS arm64: AppleClang
* one ASan/UBSan job
Expand All @@ -445,7 +446,8 @@ Keep the `MaxEntSimulation` public getters stable, because the tests use them.
Build ALPSCore from source in CI and cache it.
* **Replace the allowlist `.gitignore`.** Done 2026-09-23: replaced with a minimal ignore list (build dirs, OS/editor files, Python caches). Local-only material (D10) is hidden per clone via `.git/info/exclude`, not in the repository.
* ~~Remove the dead Pade sources~~ Done: Pade was removed entirely (D7).
* Update the README: build instructions, dependency list (no GSL), and remove the Travis badge.
* **Done 2026-09-24:** update the README build/test instructions and dependency
list, and replace the Travis badge with the GitHub Actions badge.

### 2.5 Isolate ALPSCore behind two seams (bridge into step 4)

Expand Down
11 changes: 9 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,10 @@ if(NOT Boost_FOUND)
message(FATAL_ERROR "Boost ${ALPSCore_BOOST_VERSION} (the version ALPSCore was built with) was not "
"found. Pass -DBoost_DIR=<dir containing BoostConfig.cmake> or add its prefix to CMAKE_PREFIX_PATH.")
endif()
find_package(Eigen3 3.3 CONFIG REQUIRED)
find_package(Eigen3 CONFIG REQUIRED)
if(Eigen3_VERSION VERSION_LESS 3.3)
message(FATAL_ERROR "Eigen 3.3 or newer is required (found ${Eigen3_VERSION})")
endif()

set(HAVE_BLAS 0)
set(HAVE_LAPACK 0)
Expand All @@ -55,7 +58,11 @@ configure_file(cmake/maxent_config.hpp.in ${PROJECT_BINARY_DIR}/config/maxent_co
add_library(maxent_warnings INTERFACE)
target_compile_options(maxent_warnings INTERFACE
$<$<CXX_COMPILER_ID:GNU,Clang,AppleClang>:-Wall -Wextra -Wpedantic>
$<$<AND:$<BOOL:${MAXENT_WERROR}>,$<CXX_COMPILER_ID:GNU,Clang,AppleClang>>:-Werror>)
$<$<AND:$<BOOL:${MAXENT_WERROR}>,$<CXX_COMPILER_ID:GNU,Clang,AppleClang>>:-Werror>
# GCC diagnoses Boost.Variant's type-erased storage as maybe-uninitialized
# when ALPS parameters are instantiated. Keep the warning visible without
# treating this third-party false positive as a Maxent build failure.
$<$<AND:$<BOOL:${MAXENT_WERROR}>,$<CXX_COMPILER_ID:GNU>>:-Wno-error=maybe-uninitialized>)

# ---------------------------------------------------------------- library and program
add_library(maxent_core STATIC
Expand Down
14 changes: 10 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Maxent
======
[![Build Status](https://travis-ci.org/CQMP/Maxent.svg?branch=master)](https://travis-ci.org/CQMP/Maxent)
[![CI](https://github.com/CQMP/Maxent/actions/workflows/build.yml/badge.svg)](https://github.com/CQMP/Maxent/actions/workflows/build.yml)
[![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE.txt)

The Maxent Project: A utility for performing analytic continuation using the method of Maximum Entropy.
Expand Down Expand Up @@ -38,10 +38,15 @@ Table of Contents
### Libraries

#### Boost
When compiling both ALPSCore and Maxent, be careful to ensure boost was compiled with the same library and stdlib as ALPSCore and Maxent.
Maxent uses Boost headers and the `program_options` library in its utilities.
Use the same Boost version and C++ standard library that were used to build
ALPSCore; CMake checks the version reported by ALPSCore.

#### ALPSCore
ALPSCore needs to be properly installed, see [ALPSCore library](https://github.com/ALPSCore/ALPSCore). ALPSCore provides the location of the Boost libraries.
ALPSCore must be installed, including its CMake package files; see the
[ALPSCore library](https://github.com/ALPSCore/ALPSCore). Set `ALPSCore_DIR`
to the directory containing `ALPSCoreConfig.cmake` when it is not found
automatically.

#### Eigen3
For our linear algebra routines we use Eigen3 version >=3.3. CMake finds it through its `Eigen3Config.cmake`; if it is not in a standard location, add its prefix to `CMAKE_PREFIX_PATH` or set `-DEigen3_DIR=/path/to/share/eigen3/cmake`.
Expand Down Expand Up @@ -80,7 +85,8 @@ Options:
| `MAXENT_USE_SYSTEM_GTEST` | OFF | use an installed GoogleTest instead of downloading 1.18.0 |

### Tests
Once compiled, run `ctest --test-dir build` (or `ctest --preset <preset>` for
Once compiled, run `ctest --test-dir build --output-on-failure` (or
`ctest --preset <preset>` for
a preset build) to make sure everything works. This runs the unit tests (label
`unit`) and the regression suite (label `regression-fast`, needs Python 3 with
numpy and h5py); see [test/regression/README.md](test/regression/README.md).
Expand Down
8 changes: 5 additions & 3 deletions src/default_model.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,11 @@ double GeneralDefaultModel::norm() {
//this is an evaluation on an equidistant grid; sum integrated by trapezoidal rule
double delta_omega = (omega_max - omega_min) / (ntab - 1);
for (int o = 1; o < ntab; ++o) {
double omega1 = omega_min + (o - 1) * delta_omega;
double omega2 = omega_min + o * delta_omega;
// This weighted-endpoint form gives an exact zero on symmetric grids.
// That matters for models with a deliberately discontinuous zero branch
// and avoids compiler-dependent FMA rounding at the branch point.
double omega1 = ((ntab - o) * omega_min + (o - 1) * omega_max) / (ntab - 1);
double omega2 = ((ntab - 1 - o) * omega_min + o * omega_max) / (ntab - 1);
sum += ((*Mod)(omega1) + (*Mod)(omega2)) / 2. * delta_omega;
xtab[o] = sum;
}
Expand Down Expand Up @@ -191,4 +194,3 @@ std::shared_ptr<DefaultModel> make_default_model(const alps::params& parms, std:
}



1 change: 1 addition & 0 deletions src/maxent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include "maxent.hpp"
#include <alps/utilities/fs/remove_extensions.hpp>

#include <iomanip>

int main(int argc,const char** argv)
{
Expand Down
Loading
Loading