Skip to content

Build with any Fortran 2018 compiler and any LAPACK, and add CI - #8

Merged
acbbullock merged 5 commits into
mainfrom
portable-build-and-ci
Nov 11, 2026
Merged

acbbullock merged 5 commits into
mainfrom
portable-build-and-ci

Conversation

@acbbullock

@acbbullock acbbullock commented Nov 11, 2026 •

Copy link
Copy Markdown
Owner

The project built only with Intel's compilers and MKL, through a copy of Intel's LAPACK95 interface module that has
since been removed from the history. This makes it build with gfortran, ifx and LLVM flang against any LAPACK, and adds
CI. The optimization algorithm is unchanged; the numerical work comes next.

Changes

  • src/nnqs_lapack.f90 replaces LAPACK95. It provides the same ppsvx call through the Fortran 77 routines sppsvx
    and cppsvx, which reference LAPACK, OpenBLAS, MKL and Apple's Accelerate all provide, and stops on any LAPACK
    error, as LAPACK95 does without info. fpm.toml links lapack and blas.
  • src/nnqs_images.F90 holds the coarray operations the program uses. With -DNNQS_COARRAY they are the coarray
    intrinsics; without it, the program runs as one image, so it builds with compilers that have no coarray runtime,
    such as flang.
  • The main program no longer calls omp_set_default_device(1), which tied the build to OpenMP and named a device that
    depends on the machine. OMP_DEFAULT_DEVICE does the same.
  • IO-Fortran-Library is pinned to v2.3.0.
  • Tests check the LAPACK interface against systems with known solutions, and prob_ratio and ising_energy against
    values computed directly from ln ψ for random parameters. For these, the constructor takes optional a, b and
    w, and log_amplitude (new), prob_ratio and ising_energy are public.
  • The README's build section describes the new build.

CI

gfortran 15 and 16, ifx 2025.3 and 2026.1, and flang 23 on Ubuntu; gfortran on macOS (Apple Silicon and Intel) and on
Windows through MSYS2; 4 images with ifx and with gfortran 15 and OpenCoarrays 2.10.3, built from source; and runtime checks and sanitizers. gfortran 13 and 14 are not supported, as they reject the locality specifiers on do concurrent.

Tested locally with gfortran 16, ifx 2026.2 and flang 23 against reference LAPACK, with ifx on 3 images, and under
gfortran's runtime checks and sanitizers and ifx's runtime checks.

🤖 Generated with Claude Code

acbbullock and others added 5 commits November 11, 2026 15:09
Replace Intel's LAPACK95 interface module with nnqs_lapack, an interface
to the Fortran 77 routines sppsvx and cppsvx that every LAPACK provides.
It stops on any LAPACK error, as LAPACK95's ppsvx does when called
without info. fpm links liblapack and libblas.

Move the coarray operations into nnqs_images. With NNQS_COARRAY
defined, they are the coarray intrinsics; without it, the program runs
as one image, so it builds with compilers that have no coarray runtime,
such as LLVM flang.

Drop omp_set_default_device from the main program, which tied the build
to OpenMP and named a device that depends on the machine.
OMP_DEFAULT_DEVICE does the same.

Pin IO-Fortran-Library to v2.3.0.

Add tests that check the LAPACK interface against systems with known
solutions, and prob_ratio and ising_energy against values computed
from ln ψ for random parameters. For these, the constructor takes
optional parameters a, b and w, and log_amplitude, prob_ratio and
ising_energy are public. The optimization itself is unchanged.

Tested with gfortran 16, ifx 2026.2 and flang 23 linking reference
LAPACK, with ifx on 3 images, and under gfortran's runtime checks and
sanitizers and ifx's runtime checks.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Build and test with gfortran 13 to 16, ifx 2025.3 and 2026.1, and LLVM
flang 23 on Ubuntu; gfortran on macOS (Apple Silicon and Intel) and on
Windows through MSYS2; on 4 images with ifx and with gfortran and
OpenCoarrays; and under runtime checks and sanitizers.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
gfortran 13 and 14 reject the locality specifiers on do concurrent, so
CI tests gfortran 15 and 16, and the README says so. Ubuntu's
OpenCoarrays is built for gfortran 13, so the gfortran coarray job
builds OpenCoarrays 2.10.3, the first release to support GCC 15, from
source with gfortran 15 and Open MPI.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
From gfortran 15 on, OpenCoarrays refuses to configure with Open MPI,
which identifies one-sided memory windows by address rather than by an
id common to all images. Build it with MPICH instead, with MPICH's
wrappers pointed at gfortran 15.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
caf takes -cpp, like -c, to mean it is only compiling, and then leaves
out its coarray and MPI libraries. fpm passes -cpp when it links if the
flags define a macro, so linking with caf failed with undefined
references to _gfortran_caf_*. ci/fpm-caf removes -cpp from commands
without -c, which are the ones that link. fpm identifies it as caf by
its name.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@acbbullock
acbbullock merged commit 445173e into main Nov 11, 2026
12 checks passed
@acbbullock
acbbullock deleted the portable-build-and-ci branch November 12, 2026 07:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant