Skip to content

Commit 50e162b

Browse files
committed
Merge branch 'fix-median-bugs' of https://github.com/JAi-SATHVIK/stdlib into fix-median-bugs
2 parents 26d8d12 + 797e57b commit 50e162b

File tree

70 files changed

+1053
-294
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

70 files changed

+1053
-294
lines changed
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
name: CI - IO and system modules
2+
3+
on: [push, pull_request]
4+
5+
env:
6+
CMAKE_BUILD_PARALLEL_LEVEL: "2" # 2 cores on each GHA VM, enable parallel builds
7+
CTEST_OUTPUT_ON_FAILURE: "ON" # This way we don't need a flag to ctest
8+
CTEST_PARALLEL_LEVEL: "2"
9+
CTEST_TIME_TIMEOUT: "5" # some failures hang forever
10+
HOMEBREW_NO_ANALYTICS: "ON" # Make Homebrew installation a little quicker
11+
HOMEBREW_NO_AUTO_UPDATE: "ON"
12+
HOMEBREW_NO_BOTTLE_SOURCE_FALLBACK: "ON"
13+
HOMEBREW_NO_GITHUB_API: "ON"
14+
HOMEBREW_NO_INSTALL_CLEANUP: "ON"
15+
16+
jobs:
17+
Build:
18+
runs-on: ${{ matrix.os }}
19+
strategy:
20+
fail-fast: false
21+
matrix:
22+
os: [ubuntu-latest]
23+
toolchain:
24+
- {compiler: gcc, version: 14}
25+
build: [cmake]
26+
with_ansi: [On, Off]
27+
with_io: [On, Off]
28+
with_logger: [On, Off]
29+
with_stringlist: [On, Off]
30+
with_system: [On, Off]
31+
env:
32+
BUILD_DIR: ${{ matrix.build == 'cmake' && 'build' || '.' }}
33+
34+
steps:
35+
- name: Checkout code
36+
uses: actions/checkout@v4
37+
38+
- name: Set up Python 3.x
39+
uses: actions/setup-python@v5 # Use pip to install latest CMake, & FORD/Jin2For, etc.
40+
with:
41+
python-version: 3.x
42+
43+
- name: Install fypp
44+
run: pip install --upgrade fypp ninja
45+
46+
- name: Setup Fortran compiler
47+
uses: fortran-lang/setup-fortran@v1.6.2
48+
id: setup-fortran
49+
with:
50+
compiler: ${{ matrix.toolchain.compiler }}
51+
version: ${{ matrix.toolchain.version }}
52+
53+
# Build and test with built-in BLAS and LAPACK
54+
- name: Configure with CMake
55+
if: ${{ contains(matrix.build, 'cmake') }}
56+
run: >-
57+
cmake -Wdev -G Ninja
58+
-DCMAKE_BUILD_TYPE=Release
59+
-DCMAKE_MAXIMUM_RANK:String=4
60+
-DCMAKE_INSTALL_PREFIX=$PWD/_dist
61+
-DFIND_BLAS:STRING=FALSE
62+
-DSTDLIB_ANSI:STRING=${{ matrix.with_ansi }}
63+
-DSTDLIB_IO:STRING=${{ matrix.with_io }}
64+
-DSTDLIB_LOGGER:STRING=${{ matrix.with_logger }}
65+
-DSTDLIB_STRINGLIST:STRING=${{ matrix.with_stringlist }}
66+
-DSTDLIB_SYSTEM:STRING=${{ matrix.with_system }}
67+
-S . -B ${{ env.BUILD_DIR }}
68+
69+
- name: Build and compile
70+
if: ${{ contains(matrix.build, 'cmake') }}
71+
run: cmake --build ${{ env.BUILD_DIR }} --parallel
72+
73+
- name: catch build fail
74+
if: ${{ failure() && contains(matrix.build, 'cmake') }}
75+
run: cmake --build ${{ env.BUILD_DIR }} --verbose --parallel 1
76+
77+
- name: test
78+
if: ${{ contains(matrix.build, 'cmake') }}
79+
run: >-
80+
ctest
81+
--test-dir ${{ env.BUILD_DIR }}
82+
--parallel
83+
--output-on-failure
84+
--no-tests=error
85+
86+
- name: Install project
87+
if: ${{ contains(matrix.build, 'cmake') }}
88+
run: cmake --install ${{ env.BUILD_DIR }}
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
name: CI - Mathematical modules
2+
3+
on: [push, pull_request]
4+
5+
env:
6+
CMAKE_BUILD_PARALLEL_LEVEL: "2" # 2 cores on each GHA VM, enable parallel builds
7+
CTEST_OUTPUT_ON_FAILURE: "ON" # This way we don't need a flag to ctest
8+
CTEST_PARALLEL_LEVEL: "2"
9+
CTEST_TIME_TIMEOUT: "5" # some failures hang forever
10+
HOMEBREW_NO_ANALYTICS: "ON" # Make Homebrew installation a little quicker
11+
HOMEBREW_NO_AUTO_UPDATE: "ON"
12+
HOMEBREW_NO_BOTTLE_SOURCE_FALLBACK: "ON"
13+
HOMEBREW_NO_GITHUB_API: "ON"
14+
HOMEBREW_NO_INSTALL_CLEANUP: "ON"
15+
16+
jobs:
17+
Build:
18+
runs-on: ${{ matrix.os }}
19+
strategy:
20+
fail-fast: false
21+
matrix:
22+
os: [ubuntu-latest]
23+
toolchain:
24+
- {compiler: gcc, version: 14}
25+
build: [cmake]
26+
with_linalg_iterative: [On, Off]
27+
with_quadrature: [On, Off]
28+
with_specialmatrices: [On, Off]
29+
with_stats: [On, Off]
30+
env:
31+
BUILD_DIR: ${{ matrix.build == 'cmake' && 'build' || '.' }}
32+
33+
steps:
34+
- name: Checkout code
35+
uses: actions/checkout@v4
36+
37+
- name: Set up Python 3.x
38+
uses: actions/setup-python@v5 # Use pip to install latest CMake, & FORD/Jin2For, etc.
39+
with:
40+
python-version: 3.x
41+
42+
- name: Install fypp
43+
run: pip install --upgrade fypp ninja
44+
45+
- name: Setup Fortran compiler
46+
uses: fortran-lang/setup-fortran@v1.6.2
47+
id: setup-fortran
48+
with:
49+
compiler: ${{ matrix.toolchain.compiler }}
50+
version: ${{ matrix.toolchain.version }}
51+
52+
# Build and test with built-in BLAS and LAPACK
53+
- name: Configure with CMake
54+
if: ${{ contains(matrix.build, 'cmake') }}
55+
run: >-
56+
cmake -Wdev -G Ninja
57+
-DCMAKE_BUILD_TYPE=Release
58+
-DCMAKE_MAXIMUM_RANK:String=4
59+
-DCMAKE_INSTALL_PREFIX=$PWD/_dist
60+
-DFIND_BLAS:STRING=FALSE
61+
-DSTDLIB_LINALG_ITERATIVE:STRING=${{ matrix.with_linalg_iterative }}
62+
-DSTDLIB_QUADRATURE:STRING=${{ matrix.with_quadrature }}
63+
-DSTDLIB_SPECIALMATRICES:STRING=${{ matrix.with_specialmatrices }}
64+
-DSTDLIB_STATS:STRING=${{ matrix.with_stats }}
65+
-S . -B ${{ env.BUILD_DIR }}
66+
67+
- name: Build and compile
68+
if: ${{ contains(matrix.build, 'cmake') }}
69+
run: cmake --build ${{ env.BUILD_DIR }} --parallel
70+
71+
- name: catch build fail
72+
if: ${{ failure() && contains(matrix.build, 'cmake') }}
73+
run: cmake --build ${{ env.BUILD_DIR }} --verbose --parallel 1
74+
75+
- name: test
76+
if: ${{ contains(matrix.build, 'cmake') }}
77+
run: >-
78+
ctest
79+
--test-dir ${{ env.BUILD_DIR }}
80+
--parallel
81+
--output-on-failure
82+
--no-tests=error
83+
84+
- name: Install project
85+
if: ${{ contains(matrix.build, 'cmake') }}
86+
run: cmake --install ${{ env.BUILD_DIR }}

.github/workflows/ci_modular.yml renamed to .github/workflows/ci_modular_utilities.yml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: ci_modular
1+
name: CI - Utilities modules
22

33
on: [push, pull_request]
44

@@ -23,10 +23,8 @@ jobs:
2323
toolchain:
2424
- {compiler: gcc, version: 14}
2525
build: [cmake]
26-
with_ansi: [On, Off]
2726
with_bitset: [On, Off]
2827
with_hashmaps: [On, Off]
29-
with_stats: [On, Off]
3028
env:
3129
BUILD_DIR: ${{ matrix.build == 'cmake' && 'build' || '.' }}
3230

@@ -58,10 +56,8 @@ jobs:
5856
-DCMAKE_MAXIMUM_RANK:String=4
5957
-DCMAKE_INSTALL_PREFIX=$PWD/_dist
6058
-DFIND_BLAS:STRING=FALSE
61-
-DSTDLIB_ANSI:STRING=${{ matrix.with_ansi }}
6259
-DSTDLIB_BITSET:STRING=${{ matrix.with_bitset }}
6360
-DSTDLIB_HASHMAPS:STRING=${{ matrix.with_hashmaps }}
64-
-DSTDLIB_STATS:STRING=${{ matrix.with_stats }}
6561
-S . -B ${{ env.BUILD_DIR }}
6662
6763
- name: Build and compile

CHANGELOG.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,36 @@
1+
## Unreleased
2+
3+
Changes to the existing build system
4+
- Fixed absolute paths in generated pkg-config file for external BLAS/LAPACK
5+
[#1109](https://github.com/fortran-lang/stdlib/issues/1109)
6+
7+
# Version 0.8.1
8+
9+
Full release notes available at [v0.8.1] tag.
10+
11+
[v0.8.1]: https://github.com/fortran-lang/stdlib/releases/tag/v0.8.1
12+
13+
Changes to the existing build system
14+
- Changes in the build system
15+
- Completed refactoring of `stdlib` into modular components using CMake
16+
[#1098](https://github.com/fortran-lang/stdlib/pull/1098)
17+
[#1100](https://github.com/fortran-lang/stdlib/pull/1100)
18+
[#1102](https://github.com/fortran-lang/stdlib/pull/1102)
19+
- Resolve race condition in parallel FYPP preprocessing
20+
[#1103](https://github.com/fortran-lang/stdlib/pull/1103)
21+
22+
Changes to the existing modules
23+
- Change in module `stdlib_lingal_iterative_solvers`
24+
- Remove pure attribute from `stdlib_linop` `inner_product`
25+
[#1106](https://github.com/fortran-lang/stdlib/pull/1106)
26+
27+
Changes to the existing documentation
28+
- Change in README
29+
- Addition of a DOI badge
30+
[#1097](https://github.com/fortran-lang/stdlib/pull/1097)
31+
- Update of the table with flags for modularizing `stdlib`
32+
[#1098](https://github.com/fortran-lang/stdlib/pull/1098)
33+
134
# Version 0.8.0
235

336
Full release notes available at [v0.8.0] tag.

CMakeLists.txt

Lines changed: 12 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -49,45 +49,18 @@ if(NOT DEFINED CMAKE_MAXIMUM_RANK)
4949
set(CMAKE_MAXIMUM_RANK 4 CACHE STRING "Maximum array rank for generated procedures")
5050
endif()
5151

52-
option(STDLIB_ANSI "Compile STDLIB ANSI" ON)
53-
54-
if(STDLIB_ANSI)
55-
message(STATUS "Enable stdlib ansi module")
56-
add_compile_definitions(STDLIB_ANSI=1)
57-
else()
58-
message(STATUS "Disable stdlib ansi module")
59-
add_compile_definitions(STDLIB_ANSI=0)
60-
endif()
61-
62-
option(STDLIB_BITSET "Compile STDLIB BITSET" ON)
63-
64-
if(STDLIB_BITSET)
65-
message(STATUS "Enable stdlib bitset module")
66-
add_compile_definitions(STDLIB_BITSET=1)
67-
else()
68-
message(STATUS "Disable stdlib bitset module")
69-
add_compile_definitions(STDLIB_BITSET=0)
70-
endif()
71-
72-
option(STDLIB_HASHMAPS "Compile STDLIB HASHMAPS" ON)
73-
74-
if(STDLIB_HASHMAPS)
75-
message(STATUS "Enable stdlib hashmaps module")
76-
add_compile_definitions(STDLIB_HASHMAPS=1)
77-
else()
78-
message(STATUS "Disable stdlib hashmaps module")
79-
add_compile_definitions(STDLIB_HASHMAPS=0)
80-
endif()
81-
82-
option(STDLIB_STATS "Compile STDLIB STATS" ON)
83-
84-
if(STDLIB_STATS)
85-
message(STATUS "Enable stdlib stats module")
86-
add_compile_definitions(STDLIB_STATS=1)
87-
else()
88-
message(STATUS "Disable stdlib stats module")
89-
add_compile_definitions(STDLIB_STATS=0)
90-
endif()
52+
# --- determine if the following modules will be compiled
53+
check_modular("ANSI")
54+
check_modular("BITSETS")
55+
check_modular("HASHMAPS")
56+
check_modular("IO")
57+
check_modular("LINALG_ITERATIVE")
58+
check_modular("LOGGER")
59+
check_modular("QUADRATURE")
60+
check_modular("SPECIALMATRICES")
61+
check_modular("STRINGLIST")
62+
check_modular("STATS")
63+
check_modular("SYSTEM")
9164

9265
option(FIND_BLAS "Find external BLAS and LAPACK" ON)
9366

README.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,11 +282,21 @@ The table below lists all *C preprocessing* macros and flags currently used by `
282282

283283
| Macro/flag Name | Comments |
284284
| --- | --- |
285+
| `STDLIB_ANSI` | Enables compilation of the `stdlib_ansi` module when set to 1 (default). Set via CMake with `-DSTDLIB_ANSI=On/Off`. |
286+
| `STDLIB_BITSETS` | Enables compilation of the `stdlib_bitsets` module when set to 1 (default). Set via CMake with `-DSTDLIB_BITSETS=On/Off`. |
285287
| `STDLIB_EXTERNAL_BLAS` | Links against an external BLAS (32-bit integer interface). Set automatically by CMake when external BLAS/LAPACK are found, or manually via `add_compile_definitions(STDLIB_EXTERNAL_BLAS)`. In fpm: `preprocess.cpp.macros=["STDLIB_EXTERNAL_BLAS"]`. |
286288
| `STDLIB_EXTERNAL_LAPACK` | Links against an external LAPACK (32-bit integer interface). Usually paired with `STDLIB_EXTERNAL_BLAS`. |
287289
| `STDLIB_EXTERNAL_BLAS_I64` | Links against an external BLAS with ILP64 (64-bit integer) interfaces. Usually paired with `STDLIB_EXTERNAL_LAPACK_I64`. |
288290
| `STDLIB_EXTERNAL_LAPACK_I64` | Links against an external LAPACK with ILP64 (64-bit integer) interfaces. |
289-
291+
| `STDLIB_HASHMAPS` | Enables compilation of the `stdlib_hashmaps` module when set to 1 (default). Set via CMake with `-DSTDLIB_HASHMAPS=On/Off`. |
292+
| `STDLIB_IO` | Enables compilation of the `stdlib_io` module when set to 1 (default). Set via CMake with `-DSTDLIB_IO=On/Off`. |
293+
| `STDLIB_LINALG_ITERATIVE` | Enables compilation of the `stdlib_linalg_iterative_solvers` module when set to 1 (default). Set via CMake with `-DSTDLIB_LINALG_ITERATIVE=On/Off`. |
294+
| `STDLIB_LOGGER` | Enables compilation of the `stdlib_logger` module when set to 1 (default). Set via CMake with `-DSTDLIB_LOGGER=On/Off`. |
295+
| `STDLIB_QUADRATURE` | Enables compilation of the `stdlib_quadrature` module when set to 1 (default). Set via CMake with `-DSTDLIB_QUADRATURE=On/Off`. |
296+
| `STDLIB_SPECIALMATRICES` | Enables compilation of the `stdlib_specialmatrices` module when set to 1 (default). Set via CMake with `-DSTDLIB_SPECIALMATRICES=On/Off`. |
297+
| `STDLIB_STATS` | Enables compilation of the `stdlib_stats` module when set to 1 (default). Set via CMake with `-DSTDLIB_STATS=On/Off`. |
298+
| `STDLIB_STRINGLIST` | Enables compilation of the `stdlib_stringlist` module when set to 1 (default). Set via CMake with `-DSTDLIB_STRINGLIST=On/Off`. |
299+
| `STDLIB_SYSTEM` | Enables compilation of the `stdlib_system` module when set to 1 (default). Set via CMake with `-DSTDLIB_SYSTEM=On/Off`. |
290300

291301
## Using stdlib in your project
292302

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.8.0
1+
0.8.1

cmake/stdlib.cmake

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,3 +111,26 @@ function(configure_stdlib_target target_name regular_sources_var fypp_files_var
111111
)
112112
install(DIRECTORY ${LIB_MOD_DIR} DESTINATION "${INSTALL_MOD_DIR}")
113113
endfunction()
114+
115+
# Determine if a module will be compiled
116+
#
117+
# 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.
119+
#
120+
# Args:
121+
# module [in]: Name of the module to be compiled
122+
#
123+
function(check_modular module)
124+
string(TOUPPER "${module}" umodule)
125+
126+
option(STDLIB_${umodule} "Compile STDLIB ${umodule}" ON)
127+
128+
if(STDLIB_${umodule})
129+
message(STATUS "Enable stdlib module ${umodule}")
130+
add_compile_definitions(STDLIB_${umodule}=1)
131+
else()
132+
message(STATUS "Disable stdlib module ${umodule}")
133+
add_compile_definitions(STDLIB_${umodule}=0)
134+
endif()
135+
136+
endfunction()

0 commit comments

Comments
 (0)