Skip to content

Commit 32f31dc

Browse files
committed
Merge remote-tracking branch 'upstream/master' into symtridiag
2 parents 296c35a + dae9d4b commit 32f31dc

59 files changed

Lines changed: 4277 additions & 141 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
name: CI - Big-Endian
2+
3+
on:
4+
# Always run on pushes to the main branch
5+
push:
6+
branches: [master, main]
7+
# For PRs, ONLY run if the hash files or this workflow change
8+
pull_request:
9+
paths:
10+
- '.github/workflows/ci_big_endian.yml'
11+
- 'src/hash/**'
12+
- 'test/hash_functions/**'
13+
# Allow manual triggers from the GitHub Actions tab
14+
workflow_dispatch:
15+
16+
env:
17+
CTEST_TIME_TIMEOUT: "5" # some failures hang forever
18+
19+
jobs:
20+
test-big-endian:
21+
runs-on: ubuntu-24.04
22+
name: Test on s390x (big-endian)
23+
strategy:
24+
fail-fast: false
25+
26+
steps:
27+
- name: Checkout code
28+
uses: actions/checkout@v4
29+
30+
- name: Build and test on s390x
31+
uses: uraimo/run-on-arch-action@v3
32+
with:
33+
arch: s390x
34+
distro: ubuntu24.04
35+
36+
# Cache Docker image layer in GitHub Package Registry
37+
githubToken: ${{ github.token }}
38+
39+
# Install dependencies (cached in Docker image layer)
40+
install: |
41+
apt-get update -q -y
42+
apt-get install -q -y gfortran gcc g++ cmake python3-pip ninja-build git
43+
pip3 install --break-system-packages fypp
44+
45+
# Build and run big-endian tests
46+
run: |
47+
echo "=== Architecture Info ==="
48+
uname -m
49+
echo "Byte order: $(python3 -c 'import sys; print(sys.byteorder)')"
50+
51+
echo "=== Compiler Version ==="
52+
gfortran --version
53+
54+
echo "=== CMake Configure ==="
55+
cmake -G Ninja \
56+
-DCMAKE_BUILD_TYPE=Release \
57+
-DCMAKE_MAXIMUM_RANK:String=4 \
58+
-DFIND_BLAS:STRING=FALSE \
59+
-S . -B build
60+
61+
echo "=== Build (Targeted) ==="
62+
cmake --build build --target test_hash_functions --parallel
63+
64+
echo "=== Run Big-Endian Tests ==="
65+
ctest --test-dir build \
66+
-R hash_functions \
67+
--output-on-failure \
68+
--no-tests=error

.github/workflows/fpm-deployment.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,10 @@ jobs:
4646
python config/fypp_deployment.py --with_xdp --with_qp
4747
fpm test --profile release --flag '-DWITH_XDP -DWITH_QP'
4848
49+
- run: | # Tests without xdp and qp
50+
python config/fypp_deployment.py
51+
fpm test --profile release
52+
4953
# Update and deploy the f90 files generated by github-ci to the `stdlib-fpm` branch.
5054
- name: Deploy 🚀
5155
uses: JamesIves/github-pages-deploy-action@4.1.5

CMakeLists.txt

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ cmake_minimum_required(VERSION 3.14.0)
44
set(CMAKE_USER_MAKE_RULES_OVERRIDE ${CMAKE_CURRENT_SOURCE_DIR}/config/DefaultFlags.cmake)
55

66
project(fortran_stdlib
7-
LANGUAGES Fortran C
8-
DESCRIPTION "Community driven and agreed upon de facto standard library for Fortran"
7+
LANGUAGES Fortran C
8+
DESCRIPTION "Community driven and agreed upon de facto standard library for Fortran"
99
)
1010

1111
# Read version from file
@@ -116,8 +116,19 @@ endif()
116116

117117
# --- find preprocessor
118118
find_program(FYPP fypp)
119-
if(NOT FYPP)
120-
message(FATAL_ERROR "Preprocessor fypp not found! Please install fypp following the instructions in https://fypp.readthedocs.io/en/stable/fypp.html#installing")
119+
if(NOT FYPP OR "${FYPP}" MATCHES "NOTFOUND")
120+
message(FATAL_ERROR
121+
"\n [stdlib Build Error]: Preprocessor 'fypp' not found!\n"
122+
" ------------------------------------------------------------------------\n"
123+
" The fypp preprocessor is required to generate Fortran source from templates.\n\n"
124+
" Please install fypp following the instructions at https://github.com/aradi/fypp\n\n"
125+
" To diagnose your installation, please run the following in your terminal:\n"
126+
" Windows: 'where fypp' and 'where python'\n"
127+
" Linux/macOS: 'which fypp' and 'which python'\n\n"
128+
" Ensure the executable is in your PATH or set it manually during configuration:\n"
129+
" cmake -B build -DFYPP_EXECUTABLE=/path/to/fypp\n"
130+
" ------------------------------------------------------------------------\n"
131+
)
121132
endif()
122133

123134
# Custom preprocessor flags
@@ -156,4 +167,4 @@ install(EXPORT ${PROJECT_NAME}-targets
156167
)
157168

158169
# Export a pkg-config file
159-
include(${PROJECT_SOURCE_DIR}/config/export_pc.cmake)
170+
include(${PROJECT_SOURCE_DIR}/config/export_pc.cmake)

cmake/stdlib.cmake

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,12 @@
1010
#
1111
function(preprocess preproc preprocopts srcext trgext srcfiles trgfiles)
1212

13+
# Defensive check: Ensure the preprocessor path is valid before defining custom commands.
14+
# This prevents "empty command" errors during the build phase.
15+
if(NOT preproc OR "${preproc}" MATCHES "NOTFOUND")
16+
message(FATAL_ERROR "preprocess function called with invalid preprocessor path: '${preproc}'")
17+
endif()
18+
1319
set(_trgfiles)
1420
foreach(srcfile IN LISTS srcfiles)
1521
get_filename_component(filename ${srcfile} NAME)
@@ -87,8 +93,8 @@ function(configure_stdlib_target target_name regular_sources_var fypp_files_var
8793
endif()
8894

8995
set(LIB_MOD_DIR ${CMAKE_CURRENT_BINARY_DIR}/mod_files/${target_name}/)
90-
#set(INSTALL_MOD_DIR "${CMAKE_INSTALL_MODULEDIR}/${target_name}")
9196
set(INSTALL_MOD_DIR "${CMAKE_INSTALL_MODULEDIR}")
97+
9298
# We need the module directory before we finish the configure stage since the
9399
# build interface might resolve before the module directory is generated by CMake
94100
if(NOT EXISTS "${LIB_MOD_DIR}")
@@ -115,7 +121,7 @@ endfunction()
115121
# Determine if a module will be compiled
116122
#
117123
# Defines a CMake function that creates an ON/OFF option for a given stdlib module,
118-
#sets a compile definition accordingly, and prints its enabled/disabled status.
124+
# sets a compile definition accordingly, and prints its enabled/disabled status.
119125
#
120126
# Args:
121127
# module [in]: Name of the module to be compiled
@@ -133,4 +139,4 @@ function(check_modular module)
133139
add_compile_definitions(STDLIB_${umodule}=0)
134140
endif()
135141

136-
endfunction()
142+
endfunction()

doc/specs/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ This is an index/directory of the specifications (specs) for each new module/fea
3535
- [stats_distributions_uniform](./stdlib_stats_distribution_uniform.html) - Uniform Probability Distribution
3636
- [stats_distributions_normal](./stdlib_stats_distribution_normal.html) - Normal Probability Distribution
3737
- [stats_distributions_exponential](./stdlib_stats_distribution_exponential.html) - Exponential Probability Distribution
38+
- [stats_distributions_gamma](./stdlib_stats_distribution_gamma.html) - Gamma Probability Distribution
3839
- [string\_type](./stdlib_string_type.html) - Basic string support
3940
- [stringlist_type](./stdlib_stringlist_type.html) - 1-Dimensional list of strings
4041
- [strings](./stdlib_strings.html) - String handling and manipulation routines

doc/specs/stdlib_hash_procedures.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -394,6 +394,16 @@ generating seeds for `universal_mult_hash`.
394394
All assume a two's complement sign bit, and no out of
395395
range checks.
396396

397+
**Endianness note:** Both `pengy_hash` and `spooky_hash` will produce
398+
different hash values on big-endian processors (e.g., s390x, SPARC,
399+
PowerPC) compared to little-endian processors (e.g., x86, ARM, RISC-V)
400+
for the same input bytes. The hash quality is equally good on both
401+
architectures, but the outputs are not cross-architecture portable.
402+
Do not use these hashes for cross-architecture verification (e.g.,
403+
hashing a file on an x86 system and verifying the hash on an IBM
404+
mainframe). The 32-bit hashes `nmhash32`, `nmhash32x`, and
405+
`water_hash` produce identical results on all architectures.
406+
397407
The `stdlib_hash_32bit_fnv` and `stdlib_hash_64bit_fnv`
398408
submodules each provide implementations of the FNV-1 and FNV-1A
399409
algorithms in the form of two separate overloaded functions: `FNV_1`
@@ -1366,6 +1376,9 @@ performance on long keys. It passes all the SMHasher tests, and has
13661376
no known bad seeds.
13671377
It is a *pure* function for integer arrays, and an *elemental*
13681378
function for character strings.
1379+
Note that `pengy_hash` will produce different hash values on
1380+
big-endian and little-endian processors for the same input. The hash
1381+
quality is equally good on both architectures.
13691382

13701383
##### Example
13711384

0 commit comments

Comments
 (0)