Repository navigation
Build with any Fortran 2018 compiler and any LAPACK, and add CI - #8
Merged
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.f90replaces LAPACK95. It provides the sameppsvxcall through the Fortran 77 routinessppsvxand
cppsvx, which reference LAPACK, OpenBLAS, MKL and Apple's Accelerate all provide, and stops on any LAPACKerror, as LAPACK95 does without
info.fpm.tomllinkslapackandblas.src/nnqs_images.F90holds the coarray operations the program uses. With-DNNQS_COARRAYthey are the coarrayintrinsics; without it, the program runs as one image, so it builds with compilers that have no coarray runtime,
such as flang.
omp_set_default_device(1), which tied the build to OpenMP and named a device thatdepends on the machine.
OMP_DEFAULT_DEVICEdoes the same.prob_ratioandising_energyagainstvalues computed directly from ln ψ for random parameters. For these, the constructor takes optional
a,bandw, andlog_amplitude(new),prob_ratioandising_energyare public.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