Skip to content

Commit 0ce2372

Browse files
committed
Merge branch 'master' of github.com:fortran-lang/stdlib
2 parents 58074c7 + d8fd7b2 commit 0ce2372

File tree

278 files changed

+594590
-545263
lines changed

Some content is hidden

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

278 files changed

+594590
-545263
lines changed

.github/workflows/CI.yml

+10-9
Original file line numberDiff line numberDiff line change
@@ -19,24 +19,25 @@ jobs:
1919
strategy:
2020
fail-fast: false
2121
matrix:
22-
os: [ubuntu-latest, macos-12]
22+
os: [ubuntu-latest, macos-13]
2323
toolchain:
2424
- {compiler: gcc, version: 10}
2525
- {compiler: gcc, version: 11}
2626
- {compiler: gcc, version: 12}
2727
- {compiler: gcc, version: 13}
28-
- {compiler: intel, version: '2024.1'}
29-
- {compiler: intel-classic, version: '2021.9'}
30-
build: [cmake]
28+
- {compiler: intel, version: '2024.1'}
29+
build: [cmake]
3130
include:
31+
- os: ubuntu-22.04
32+
build: cmake
33+
toolchain: {compiler: intel-classic, version: '2021.10'}
3234
- os: ubuntu-latest
3335
build: cmake-inline
34-
toolchain:
35-
- {compiler: gcc, version: 10}
36+
toolchain: {compiler: gcc, version: 10}
3637
exclude:
37-
- os: macos-12
38+
- os: macos-13
3839
toolchain: {compiler: intel, version: '2024.1'}
39-
- os: macos-12
40+
- os: macos-13
4041
toolchain: {compiler: gcc, version: 13}
4142
env:
4243
BUILD_DIR: ${{ matrix.build == 'cmake' && 'build' || '.' }}
@@ -54,7 +55,7 @@ jobs:
5455
run: pip install --upgrade fypp ninja
5556

5657
- name: Setup Fortran compiler
57-
uses: fortran-lang/[email protected].1
58+
uses: fortran-lang/[email protected].2
5859
id: setup-fortran
5960
with:
6061
compiler: ${{ matrix.toolchain.compiler }}

.github/workflows/ci_windows.yml

+3-26
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,7 @@ jobs:
1313
fail-fast: false
1414
matrix:
1515
include: [
16-
{ msystem: MSYS, arch: x86_64 },
17-
{ msystem: MINGW64, arch: x86_64 },
18-
{ msystem: MINGW32, arch: i686 }
16+
{ msystem: MINGW64, arch: x86_64 }
1917
]
2018
defaults:
2119
run:
@@ -25,7 +23,6 @@ jobs:
2523

2624
- name: Setup MinGW native environment
2725
uses: msys2/setup-msys2@v2
28-
if: contains(matrix.msystem, 'MINGW')
2926
with:
3027
msystem: ${{ matrix.msystem }}
3128
update: false
@@ -34,30 +31,10 @@ jobs:
3431
mingw-w64-${{ matrix.arch }}-gcc
3532
mingw-w64-${{ matrix.arch }}-gcc-fortran
3633
mingw-w64-${{ matrix.arch }}-python
37-
mingw-w64-${{ matrix.arch }}-python-pip
38-
mingw-w64-${{ matrix.arch }}-python-setuptools
34+
mingw-w64-${{ matrix.arch }}-python-fypp
3935
mingw-w64-${{ matrix.arch }}-cmake
4036
mingw-w64-${{ matrix.arch }}-ninja
4137
42-
- name: Setup msys POSIX environment
43-
uses: msys2/setup-msys2@v2
44-
if: contains(matrix.msystem, 'MSYS')
45-
with:
46-
msystem: MSYS
47-
update: false
48-
install: >-
49-
git
50-
mingw-w64-x86_64-gcc
51-
mingw-w64-x86_64-gcc-fortran
52-
python
53-
python-pip
54-
cmake
55-
ninja
56-
57-
- name: Install fypp
58-
run: pip install fypp
59-
60-
# Build and test with built-in BLAS and LAPACK
6138
- run: >-
6239
PATH=$PATH:/mingw64/bin/ cmake
6340
-Wdev
@@ -82,7 +59,7 @@ jobs:
8259
- name: CTest
8360
run: PATH=$PATH:/mingw64/bin/ ctest --test-dir build --output-on-failure --parallel -V -LE quadruple_precision
8461

85-
- uses: actions/upload-artifact@v1
62+
- uses: actions/upload-artifact@v4
8663
if: failure()
8764
with:
8865
name: WindowsCMakeTestlog

.github/workflows/doc-deployment.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ jobs:
4040
ford -r $(git describe --always) --debug ${MAYBE_SKIP_SEARCH} "${FORD_FILE}"
4141
4242
- name: Upload Documentation
43-
uses: actions/upload-artifact@v2
43+
uses: actions/upload-artifact@v4
4444
with:
4545
name: FORD-API-docs
4646
path: ./API-doc/

.github/workflows/fpm-deployment.yml

+12-1
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@ jobs:
3838
- run: | # Just for deployment: create stdlib-fpm folder
3939
python config/fypp_deployment.py --deploy_stdlib_fpm
4040
41+
- run: | # Just for deployment: create stdlib-fpm-ilp64 folder
42+
python config/fypp_deployment.py --deploy_stdlib_fpm --with_ilp64
43+
4144
- run: | # Use fpm gnu ci to check xdp and qp
4245
python config/fypp_deployment.py --with_xdp --with_qp
4346
fpm test --profile release --flag '-DWITH_XDP -DWITH_QP'
@@ -48,4 +51,12 @@ jobs:
4851
if: github.event_name != 'pull_request'
4952
with:
5053
BRANCH: stdlib-fpm
51-
FOLDER: stdlib-fpm
54+
FOLDER: stdlib-fpm
55+
56+
# Update and deploy the f90 files generated by github-ci to the `stdlib-fpm-ilp64` branch.
57+
- name: Deploy with 64-bit integer support 🚀
58+
uses: JamesIves/[email protected]
59+
if: github.event_name != 'pull_request'
60+
with:
61+
BRANCH: stdlib-fpm-ilp64
62+
FOLDER: stdlib-fpm-ilp64

API-doc-FORD-file.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ project_website: https://stdlib.fortran-lang.org
4343
favicon: doc/media/favicon.ico
4444
license: by-sa
4545
author: fortran-lang/stdlib contributors
46-
author_pic: https://fortran-lang.org/assets/img/fortran_logo_512x512.png
46+
author_pic: https://fortran-lang.org/en/_static/fortran-logo-256x256.png
4747
4848
github: https://github.com/fortran-lang
4949
twitter: https://twitter.com/fortranlang

CMakeLists.txt

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ 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
7+
LANGUAGES Fortran C
88
DESCRIPTION "Community driven and agreed upon de facto standard library for Fortran"
99
)
1010

@@ -88,6 +88,7 @@ list(
8888
"-DWITH_CBOOL=$<BOOL:${WITH_CBOOL}>"
8989
"-DWITH_QP=$<BOOL:${WITH_QP}>"
9090
"-DWITH_XDP=$<BOOL:${WITH_XDP}>"
91+
"-DWITH_ILP64=$<BOOL:${WITH_ILP64}>"
9192
"-DPROJECT_VERSION_MAJOR=${PROJECT_VERSION_MAJOR}"
9293
"-DPROJECT_VERSION_MINOR=${PROJECT_VERSION_MINOR}"
9394
"-DPROJECT_VERSION_PATCH=${PROJECT_VERSION_PATCH}"

README.md

+53-3
Original file line numberDiff line numberDiff line change
@@ -90,15 +90,15 @@ Name | Version | Platform | Architecture
9090
GCC Fortran | 10, 11, 12, 13 | Ubuntu 22.04.2 LTS | x86_64
9191
GCC Fortran | 10, 11, 12, 13 | macOS 12.6.3 (21G419) | x86_64
9292
GCC Fortran (MSYS) | 13 | Windows Server 2022 (10.0.20348 Build 1547) | x86_64
93-
GCC Fortran (MinGW) | 13 | Windows Server 2022 (10.0.20348 Build 1547) | x86_64, i686
93+
GCC Fortran (MinGW) | 13 | Windows Server 2022 (10.0.20348 Build 1547) | x86_64
9494
Intel oneAPI LLVM | 2024.0 | Ubuntu 22.04.2 LTS | x86_64
9595
Intel oneAPI classic | 2023.1 | macOS 12.6.3 (21G419) | x86_64
9696

9797
The following combinations are known to work, but they are not tested in the CI:
9898

9999
Name | Version | Platform | Architecture
100100
--- | --- | --- | ---
101-
GCC Fortran (MinGW) | 9.3.0, 10.2.0, 11.2.0 | Windows 10 | x86_64, i686
101+
GCC Fortran (MinGW) | 9.3.0, 10.2.0, 11.2.0 | Windows 10 | x86_64
102102

103103
We try to test as many available compilers and platforms as possible.
104104
A list of tested compilers which are currently not working and the respective issue are listed below.
@@ -220,7 +220,29 @@ python config/fypp_deployment.py --help
220220
git checkout stdlib-fpm
221221
fpm build --profile release
222222
```
223-
#### Runing the examples
223+
224+
225+
#### Installing with fpm
226+
227+
Either option you chose for building the `stdlib`, you can install it with:
228+
```sh
229+
fpm install --profile release
230+
```
231+
The command above will install the following files:
232+
- `libstdlib.a` into `~/.local/lib/` (Unix) or `C:\Users\<username>\AppData\Roaming\local\lib\` (Windows)
233+
- all the `.[s]mod` files produced by the compiler into `~/.local/include/` (Unix) or `C:\Users\<username>\AppData\Roaming\local\include\` (Windows)
234+
235+
You can change the installation path by setting the prefix option to `fpm`:
236+
```sh
237+
fpm install --profile release --prefix /my/custom/installation/path/
238+
```
239+
240+
You can use the `stdlib` by adding the `-lstdlib` flag to your compiler.
241+
If your prefix is a non standard path, add also:
242+
- `-L/my/custom/installation/path/lib`
243+
- `-I/my/custom/installation/path/include`
244+
245+
#### Running the examples
224246
You can run the examples with `fpm` as:
225247

226248
```sh
@@ -324,6 +346,34 @@ as well as a specification document or ["spec"](https://stdlib.fortran-lang.org/
324346
Some discussions and prototypes of proposed APIs along with a list of popular open source Fortran projects are available on the
325347
[wiki](https://github.com/fortran-lang/stdlib/wiki).
326348

349+
## BLAS and LAPACK
350+
351+
`stdlib` ships full versions of BLAS and LAPACK, for all `real` and `complex` kinds, through generalized interface modules `stdlib_linalg_blas` and `stdlib_linalg_lapack`.
352+
The 32- and 64-bit implementations may be replaced by external optimized libraries if available, which may allow for faster code.
353+
When linking against external BLAS/LAPACK libraries, the user should define macros `STDLIB_EXTERNAL_BLAS` and `STDLIB_EXTERNAL_LAPACK`,
354+
to ensure that the external library version is used instead of the internal implementation.
355+
356+
- In case of a CMake build, the necessary configuration can be added by ensuring both macros are defined:
357+
```
358+
add_compile_definitions(STDLIB_EXTERNAL_BLAS STDLIB_EXTERNAL_LAPACK)
359+
```
360+
- In case of an `fpm` build, the stdlib dependency should be set as follows:
361+
```toml
362+
[dependencies]
363+
stdlib = { git="https://github.com/fortran-lang/stdlib", branch="stdlib-fpm", preprocess.cpp.macros=["STDLIB_EXTERNAL_BLAS", "STDLIB_EXTERNAL_LAPACK"] }
364+
```
365+
366+
Support for 64-bit integer size interfaces of all BLAS and LAPACK procedures may also be enabled
367+
by setting the CMake flag `-DWITH_ILP64=True`. The 64-bit integer version is always built in addition to
368+
the 32-bit integer version, that is always available. Additional macros `STDLIB_EXTERNAL_BLAS_I64` and `STDLIB_EXTERNAL_LAPACK_I64`
369+
may be defined to link against an external 64-bit integer library, such as Intel MKL.
370+
371+
- In case of an `fpm` build, 64-bit integer linear algebra support is given via branch `stdlib-fpm-ilp64`:
372+
```toml
373+
[dependencies]
374+
stdlib = { git="https://github.com/fortran-lang/stdlib", branch="stdlib-fpm-ilp64", preprocess.cpp.macros=["STDLIB_EXTERNAL_BLAS_I64", "STDLIB_EXTERNAL_LAPACK"] }
375+
```
376+
327377
## Contributing
328378

329379
* [Guidelines](CONTRIBUTING.md)

config/CMakeLists.txt

+5
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,11 @@ if (NOT DEFINED WITH_XDP)
3939
)
4040
set(WITH_XDP ${WITH_XDP} PARENT_SCOPE)
4141
endif()
42+
# Check if WITH_ILP64 is defined; if not, set it to FALSE
43+
if (NOT DEFINED WITH_ILP64)
44+
set(WITH_ILP64 FALSE)
45+
set(WITH_ILP64 ${WITH_ILP64} PARENT_SCOPE)
46+
endif()
4247

4348
# Export a pkg-config file
4449
configure_file(

config/cmake/Findtest-drive.cmake

+2-2
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ foreach(method ${${_pkg}_FIND_METHOD})
123123

124124
# We need the module directory in the subproject before we finish the configure stage
125125
if(NOT EXISTS "${${_pkg}_BINARY_DIR}/include")
126-
make_directory("${${_pkg}_BINARY_DIR}/include")
126+
file(MAKE_DIRECTORY "${${_pkg}_BINARY_DIR}/include")
127127
endif()
128128

129129
break()
@@ -147,7 +147,7 @@ foreach(method ${${_pkg}_FIND_METHOD})
147147
FetchContent_GetProperties("${_lib}" SOURCE_DIR "${_pkg}_SOURCE_DIR")
148148
FetchContent_GetProperties("${_lib}" BINARY_DIR "${_pkg}_BINARY_DIR")
149149
if(NOT EXISTS "${${_pkg}_BINARY_DIR}/include")
150-
make_directory("${${_pkg}_BINARY_DIR}/include")
150+
file(MAKE_DIRECTORY "${${_pkg}_BINARY_DIR}/include")
151151
endif()
152152

153153
break()

config/fypp_deployment.py

+28-19
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ def pre_process_fypp(args):
4242
kwd.append("-DWITH_QP=True")
4343
if args.with_xdp:
4444
kwd.append("-DWITH_XDP=True")
45+
if args.with_ilp64:
46+
kwd.append("-DWITH_ILP64=True")
4547

4648
optparser = fypp.get_option_parser()
4749
options, leftover = optparser.parse_args(args=kwd)
@@ -78,32 +80,38 @@ def process_f(file):
7880
return
7981

8082

81-
def deploy_stdlib_fpm():
83+
def deploy_stdlib_fpm(with_ilp64):
8284
"""create the stdlib-fpm folder for backwards compatibility (to be deprecated)
8385
"""
8486
import shutil
8587
prune=(
8688
"test_hash_functions.f90",
8789
"f18estop.f90",
8890
)
89-
if not os.path.exists('stdlib-fpm'+os.sep+'src'):
90-
os.makedirs('stdlib-fpm'+os.sep+'src')
91-
if not os.path.exists('stdlib-fpm'+os.sep+'test'):
92-
os.makedirs('stdlib-fpm'+os.sep+'test')
93-
if not os.path.exists('stdlib-fpm'+os.sep+'example'):
94-
os.makedirs('stdlib-fpm'+os.sep+'example')
91+
92+
if with_ilp64:
93+
base_folder = 'stdlib-fpm-ilp64'
94+
else:
95+
base_folder = 'stdlib-fpm'
96+
97+
if not os.path.exists(base_folder+os.sep+'src'):
98+
os.makedirs(base_folder+os.sep+'src')
99+
if not os.path.exists(base_folder+os.sep+'test'):
100+
os.makedirs(base_folder+os.sep+'test')
101+
if not os.path.exists(base_folder+os.sep+'example'):
102+
os.makedirs(base_folder+os.sep+'example')
95103

96104
def recursive_copy(folder):
97105
for root, _, files in os.walk(folder):
98106
for file in files:
99107
if file not in prune:
100-
if file.endswith(".f90") or file.endswith(".F90") or file.endswith(".dat") or file.endswith(".npy"):
101-
shutil.copy2(os.path.join(root, file), 'stdlib-fpm'+os.sep+folder+os.sep+file)
108+
if file.endswith((".f90", ".F90", ".dat", ".npy", ".c")):
109+
shutil.copy2(os.path.join(root, file), base_folder+os.sep+folder+os.sep+file)
102110
recursive_copy('src')
103111
recursive_copy('test')
104112
recursive_copy('example')
105113
for file in ['.gitignore','fpm.toml','LICENSE','VERSION']:
106-
shutil.copy2(file, 'stdlib-fpm'+os.sep+file)
114+
shutil.copy2(file, base_folder+os.sep+file)
107115
return
108116

109117
def fpm_build(args,unknown):
@@ -122,11 +130,11 @@ def fpm_build(args,unknown):
122130
flags= flags + unknown[idx+1]
123131
#==========================================
124132
# build with fpm
125-
subprocess.run(["fpm build"]+
126-
[" --compiler "]+[FPM_FC]+
127-
[" --c-compiler "]+[FPM_CC]+
128-
[" --cxx-compiler "]+[FPM_CXX]+
129-
[" --flag "]+[flags], shell=True, check=True)
133+
subprocess.run("fpm build"+
134+
" --compiler "+FPM_FC+
135+
" --c-compiler "+FPM_CC+
136+
" --cxx-compiler "+FPM_CXX+
137+
" --flag \"{}\"".format(flags), shell=True, check=True)
130138
return
131139

132140
if __name__ == "__main__":
@@ -137,11 +145,12 @@ def fpm_build(args,unknown):
137145
parser.add_argument("--vpatch", type=int, default=0, help="Project Version Patch")
138146

139147
parser.add_argument("--njob", type=int, default=4, help="Number of parallel jobs for preprocessing")
140-
parser.add_argument("--maxrank",type=int, default=7, help="Set the maximum allowed rank for arrays")
148+
parser.add_argument("--maxrank",type=int, default=4, help="Set the maximum allowed rank for arrays")
141149
parser.add_argument("--with_qp",action='store_true', help="Include WITH_QP in the command")
142150
parser.add_argument("--with_xdp",action='store_true', help="Include WITH_XDP in the command")
151+
parser.add_argument("--with_ilp64",action='store_true', help="Include WITH_ILP64 to build 64-bit integer BLAS/LAPACK")
143152
parser.add_argument("--lnumbering",action='store_true', help="Add line numbering in preprocessed files")
144-
parser.add_argument("--deploy_stdlib_fpm",action='store_true', help="create the stdlib-fpm folder")
153+
parser.add_argument("--deploy_stdlib_fpm",action='store_true', help="create the stdlib-fpm folder")
145154
# external libraries arguments
146155
parser.add_argument("--build", action='store_true', help="Build the project")
147156

@@ -158,8 +167,8 @@ def fpm_build(args,unknown):
158167
# pre process the meta programming fypp files
159168
pre_process_fypp(args)
160169
if args.deploy_stdlib_fpm:
161-
deploy_stdlib_fpm()
170+
deploy_stdlib_fpm(args.with_ilp64)
162171
#==========================================
163172
# build using fpm
164173
if args.build:
165-
fpm_build(args,unknown)
174+
fpm_build(args,unknown)

config/template.cmake

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
set("@PROJECT_NAME@_WITH_CBOOL" @WITH_CBOOL@)
44
set("@PROJECT_NAME@_WITH_QP" @WITH_QP@)
55
set("@PROJECT_NAME@_WITH_XDP" @WITH_XDP@)
6+
set("@PROJECT_NAME@_WITH_ILP64" @WITH_ILP64@)
67

78
if(NOT TARGET "@PROJECT_NAME@::@PROJECT_NAME@")
89
include("${CMAKE_CURRENT_LIST_DIR}/@[email protected]")

0 commit comments

Comments
 (0)