Skip to content

Commit ed0b0c9

Browse files
authored
Merge pull request #1100 from jvdp1/module_io
Modularization of remaining modules
2 parents 9acc75b + eb838cb commit ed0b0c9

File tree

11 files changed

+277
-37
lines changed

11 files changed

+277
-37
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

CMakeLists.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,14 @@ endif()
5353
check_modular("ANSI")
5454
check_modular("BITSETS")
5555
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")
5662
check_modular("STATS")
63+
check_modular("SYSTEM")
5764

5865
option(FIND_BLAS "Find external BLAS and LAPACK" ON)
5966

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,14 @@ The table below lists all *C preprocessing* macros and flags currently used by `
289289
| `STDLIB_EXTERNAL_BLAS_I64` | Links against an external BLAS with ILP64 (64-bit integer) interfaces. Usually paired with `STDLIB_EXTERNAL_LAPACK_I64`. |
290290
| `STDLIB_EXTERNAL_LAPACK_I64` | Links against an external LAPACK with ILP64 (64-bit integer) interfaces. |
291291
| `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`. |
292297
| `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`. |
293300

294301
## Using stdlib in your project
295302

example/CMakeLists.txt

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,25 +31,37 @@ if (STDLIB_HASHMAPS)
3131
endif()
3232
add_subdirectory(hash_procedures)
3333
add_subdirectory(intrinsics)
34-
add_subdirectory(io)
34+
if (STDLIB_IO)
35+
add_subdirectory(io)
36+
endif()
3537
add_subdirectory(linalg)
36-
add_subdirectory(logger)
38+
if (STDLIB_LOGGER)
39+
add_subdirectory(logger)
40+
endif()
3741
add_subdirectory(math)
3842
add_subdirectory(optval)
39-
add_subdirectory(quadrature)
43+
if (STDLIB_QUADRATURE)
44+
add_subdirectory(quadrature)
45+
endif()
4046
add_subdirectory(selection)
4147
add_subdirectory(sorting)
4248
add_subdirectory(specialfunctions_gamma)
43-
add_subdirectory(specialmatrices)
49+
if (STDLIB_SPECIALMATRICES)
50+
add_subdirectory(specialmatrices)
51+
endif()
4452
if (STDLIB_STATS)
4553
add_subdirectory(stats)
4654
add_subdirectory(stats_distribution_exponential)
4755
add_subdirectory(stats_distribution_normal)
4856
add_subdirectory(stats_distribution_uniform)
4957
add_subdirectory(random)
5058
endif()
51-
add_subdirectory(stringlist_type)
59+
if (STDLIB_STRINGLIST)
60+
add_subdirectory(stringlist_type)
61+
endif()
5262
add_subdirectory(strings)
5363
add_subdirectory(string_type)
54-
add_subdirectory(system)
64+
if (STDLIB_SYSTEM)
65+
add_subdirectory(system)
66+
endif()
5567
add_subdirectory(version)

example/linalg/CMakeLists.txt

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,13 @@ ADD_EXAMPLE(get_norm)
4343
ADD_EXAMPLE(solve1)
4444
ADD_EXAMPLE(solve2)
4545
ADD_EXAMPLE(solve3)
46-
ADD_EXAMPLE(solve_bicgstab)
47-
ADD_EXAMPLE(solve_bicgstab_wilkinson)
48-
ADD_EXAMPLE(solve_cg)
49-
ADD_EXAMPLE(solve_pcg)
50-
ADD_EXAMPLE(solve_custom)
46+
if (STDLIB_LINALG_ITERATIVE)
47+
ADD_EXAMPLE(solve_bicgstab)
48+
ADD_EXAMPLE(solve_bicgstab_wilkinson)
49+
ADD_EXAMPLE(solve_cg)
50+
ADD_EXAMPLE(solve_pcg)
51+
ADD_EXAMPLE(solve_custom)
52+
endif()
5153
ADD_EXAMPLE(sparse_from_ijv)
5254
ADD_EXAMPLE(sparse_data_accessors)
5355
ADD_EXAMPLE(sparse_spmv)

include/macros.inc

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,41 @@
1313
#define STDLIB_HASHMAPS 1
1414
#endif
1515

16+
!Default: compile the io module
17+
#if !defined STDLIB_IO
18+
#define STDLIB_IO 1
19+
#endif
20+
21+
!Default: compile the linalg_iterative module
22+
#if !defined STDLIB_LINALG_ITERATIVE
23+
#define STDLIB_LINALG_ITERATIVE 1
24+
#endif
25+
26+
!Default: compile the logger module
27+
#if !defined STDLIB_LOGGER
28+
#define STDLIB_LOGGER 1
29+
#endif
30+
31+
!Default: compile the quadrature module
32+
#if !defined STDLIB_QUADRATURE
33+
#define STDLIB_QUADRATURE 1
34+
#endif
35+
36+
!Default: compile the specialmatrices module
37+
#if !defined STDLIB_SPECIALMATRICES
38+
#define STDLIB_SPECIALMATRICES 1
39+
#endif
40+
41+
!Default: compile the stringlist module
42+
#if !defined STDLIB_STRINGLIST
43+
#define STDLIB_STRINGLIST 1
44+
#endif
45+
46+
!Default: compile the system module
47+
#if !defined STDLIB_SYSTEM
48+
#define STDLIB_SYSTEM 1
49+
#endif
50+
1651
!Default: compile the stats module
1752
#if !defined STDLIB_STATS
1853
#define STDLIB_STATS 1

src/CMakeLists.txt

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -23,23 +23,23 @@ add_subdirectory(hash)
2323
ADD_SUBDIR(hashmaps)
2424

2525
add_subdirectory(intrinsics)
26-
add_subdirectory(io)
26+
ADD_SUBDIR(io)
2727

2828
add_subdirectory(lapack)
2929
add_subdirectory(lapack_extended)
3030
add_subdirectory(linalg_core)
31-
add_subdirectory(linalg_iterative)
31+
ADD_SUBDIR(linalg_iterative)
3232
add_subdirectory(linalg)
33-
add_subdirectory(logger)
33+
ADD_SUBDIR(logger)
3434
add_subdirectory(math)
35-
add_subdirectory(quadrature)
35+
ADD_SUBDIR(quadrature)
3636
add_subdirectory(selection)
3737
add_subdirectory(sorting)
3838
add_subdirectory(specialfunctions)
39-
add_subdirectory(specialmatrices)
40-
add_subdirectory(stringlist)
39+
ADD_SUBDIR(specialmatrices)
40+
ADD_SUBDIR(stringlist)
4141
add_subdirectory(strings)
42-
add_subdirectory(system)
42+
ADD_SUBDIR(system)
4343

4444
ADD_SUBDIR(stats)
4545

@@ -61,20 +61,13 @@ target_link_libraries(${PROJECT_NAME} PUBLIC
6161
${PROJECT_NAME}_core
6262
${PROJECT_NAME}_hash
6363
${PROJECT_NAME}_intrinsics
64-
${PROJECT_NAME}_io
6564
${PROJECT_NAME}_linalg_core
66-
${PROJECT_NAME}_linalg_iterative
6765
${PROJECT_NAME}_linalg
68-
${PROJECT_NAME}_logger
6966
${PROJECT_NAME}_math
70-
${PROJECT_NAME}_quadrature
7167
${PROJECT_NAME}_selection
7268
${PROJECT_NAME}_specialfunctions
73-
${PROJECT_NAME}_specialmatrices
7469
${PROJECT_NAME}_sorting
75-
${PROJECT_NAME}_stringlist
7670
${PROJECT_NAME}_strings
77-
${PROJECT_NAME}_system
7871
${PROJECT_NAME}_blas ${PROJECT_NAME}_lapack ${PROJECT_NAME}_lapack_extended
7972
${PROJECT_NAME}_sparse
8073
${OPTIONAL_LIB}

0 commit comments

Comments
 (0)