Skip to content

Commit cc29ce8

Browse files
Merge pull request #22 from fortran-lang/master
merge
2 parents 58394f1 + ce3a106 commit cc29ce8

Some content is hidden

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

59 files changed

+8991
-169
lines changed

.github/workflows/CI.yml

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ name: CI
33
on: [push, pull_request]
44

55
env:
6-
CI: "ON" # We can detect this in the build system and other vendors implement it
76
CMAKE_BUILD_PARALLEL_LEVEL: "2" # 2 cores on each GHA VM, enable parallel builds
87
CTEST_OUTPUT_ON_FAILURE: "ON" # This way we don't need a flag to ctest
98
CTEST_PARALLEL_LEVEL: "2"
@@ -21,14 +20,14 @@ jobs:
2120
fail-fast: false
2221
matrix:
2322
os: [ubuntu-latest, macos-latest]
24-
gcc_v: [7, 8, 9, 10] # Version of GFortran we want to use.
23+
gcc_v: [9, 10, 11] # Version of GFortran we want to use.
2524
env:
2625
FC: gfortran-${{ matrix.gcc_v }}
2726
GCC_V: ${{ matrix.gcc_v }}
2827

2928
steps:
3029
- name: Checkout code
31-
uses: actions/checkout@v1
30+
uses: actions/checkout@v2
3231

3332
- name: Set up Python 3.x
3433
uses: actions/setup-python@v1 # Use pip to install latest CMake, & FORD/Jin2For, etc.
@@ -62,20 +61,19 @@ jobs:
6261
run: >-
6362
cmake -Wdev
6463
-DCMAKE_BUILD_TYPE=Release
65-
-DCMAKE_MAXIMUM_RANK=4
64+
-DCMAKE_MAXIMUM_RANK:String=4
6665
-DCMAKE_INSTALL_PREFIX=$PWD/_dist
6766
-S . -B build
6867
6968
- name: Build and compile
70-
run: cmake --build build
69+
run: cmake --build build --parallel
7170

7271
- name: catch build fail
7372
run: cmake --build build --verbose --parallel 1
7473
if: failure()
7574

7675
- name: test
77-
run: ctest --parallel --output-on-failure
78-
working-directory: build
76+
run: ctest --test-dir build --parallel --output-on-failure
7977

8078
- name: Install project
8179
run: cmake --install build
@@ -110,7 +108,7 @@ jobs:
110108

111109
steps:
112110
- name: Checkout code
113-
uses: actions/checkout@v1
111+
uses: actions/checkout@v2
114112

115113
- name: Set up Python 3.x
116114
uses: actions/setup-python@v1
@@ -179,7 +177,7 @@ jobs:
179177
run: >-
180178
cmake -Wdev
181179
-DCMAKE_BUILD_TYPE=Release
182-
-DCMAKE_MAXIMUM_RANK=4
180+
-DCMAKE_MAXIMUM_RANK:String=4
183181
-DCMAKE_INSTALL_PREFIX=$PWD/_dist
184182
-S . -B build
185183

.github/workflows/PR-review.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ jobs:
66
runs-on: ubuntu-latest
77
steps:
88
- name: Check out code.
9-
uses: actions/checkout@v1
9+
uses: actions/checkout@v2
1010
- name: misspell
1111
uses: reviewdog/action-misspell@v1
1212
with:

.github/workflows/ci_windows.yml

Lines changed: 4 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -3,45 +3,10 @@ name: CI_windows
33
on: [push, pull_request]
44

55
env:
6-
CI: "ON"
76
CTEST_TIME_TIMEOUT: "5" # some failures hang forever
7+
CMAKE_GENERATOR: Ninja
88

99
jobs:
10-
Build:
11-
runs-on: windows-latest
12-
strategy:
13-
fail-fast: false
14-
15-
steps:
16-
- uses: actions/checkout@v1
17-
18-
- name: Install fypp
19-
run: pip install fypp
20-
21-
- run: cmake -G "MinGW Makefiles" -DCMAKE_SH="CMAKE_SH-NOTFOUND" -Wdev -B build -DCMAKE_BUILD_TYPE=Debug -DCMAKE_Fortran_FLAGS_DEBUG="-Wall -Wextra -Wimplicit-interface -fPIC -g -fcheck=all -fbacktrace" -DCMAKE_MAXIMUM_RANK=4
22-
23-
env:
24-
FC: gfortran
25-
CC: gcc
26-
CXX: g++
27-
28-
- name: CMake build
29-
run: cmake --build build --parallel
30-
31-
- name: catch build fail
32-
run: cmake --build build --verbose --parallel 1
33-
if: failure()
34-
35-
- name: CTest
36-
run: ctest --output-on-failure --parallel -V -LE quadruple_precision
37-
working-directory: build
38-
39-
- uses: actions/upload-artifact@v1
40-
if: failure()
41-
with:
42-
name: WindowsCMakeTestlog
43-
path: build/Testing/Temporary/LastTest.log
44-
4510
msys2-build:
4611
runs-on: windows-latest
4712
strategy:
@@ -93,13 +58,12 @@ jobs:
9358
run: pip install fypp
9459

9560
- run: >-
96-
cmake -G Ninja
97-
-DCMAKE_SH="CMAKE_SH-NOTFOUND"
61+
cmake
9862
-Wdev
9963
-B build
10064
-DCMAKE_BUILD_TYPE=Debug
10165
-DCMAKE_Fortran_FLAGS_DEBUG="-Wall -Wextra -Wimplicit-interface -fPIC -g -fcheck=all -fbacktrace"
102-
-DCMAKE_MAXIMUM_RANK=4
66+
-DCMAKE_MAXIMUM_RANK:String=4
10367
-DCMAKE_INSTALL_PREFIX=$PWD/_dist
10468
env:
10569
FC: gfortran
@@ -114,8 +78,7 @@ jobs:
11478
if: failure()
11579

11680
- name: CTest
117-
run: ctest --output-on-failure --parallel -V -LE quadruple_precision
118-
working-directory: build
81+
run: ctest --test-dir build --output-on-failure --parallel -V -LE quadruple_precision
11982

12083
- uses: actions/upload-artifact@v1
12184
if: failure()

CMakeLists.txt

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ add_subdirectory(config)
1616

1717
# --- compiler options
1818
if(CMAKE_Fortran_COMPILER_ID STREQUAL GNU)
19+
if(CMAKE_Fortran_COMPILER_VERSION VERSION_LESS 9.0)
20+
message(FATAL_ERROR "GCC Version 9 or newer required")
21+
endif()
1922
add_compile_options(-fimplicit-none)
2023
add_compile_options(-ffree-line-length-132)
2124
add_compile_options(-Wall)
@@ -24,32 +27,29 @@ if(CMAKE_Fortran_COMPILER_ID STREQUAL GNU)
2427
add_compile_options(-Wconversion-extra)
2528
# -pedantic-errors triggers a false positive for optional arguments of elemental functions,
2629
# see test_optval and https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95446
27-
add_compile_options(-pedantic-errors)
28-
if(CMAKE_Fortran_COMPILER_VERSION VERSION_GREATER_EQUAL 8.0)
29-
add_compile_options(-std=f2018)
30-
else()
31-
add_compile_options(-std=f2008ts)
30+
if(CMAKE_Fortran_COMPILER_VERSION VERSION_LESS 11.0)
31+
add_compile_options(-pedantic-errors)
3232
endif()
33-
elseif(CMAKE_Fortran_COMPILER_ID STREQUAL Intel)
34-
add_compile_options(-warn declarations,general,usage,interfaces,unused)
35-
if(CMAKE_Fortran_COMPILER_VERSION VERSION_LESS 18.0)
36-
add_compile_options(-stand f15)
33+
add_compile_options(-std=f2018)
34+
elseif(CMAKE_Fortran_COMPILER_ID MATCHES "^Intel")
35+
if(WIN32)
36+
add_compile_options(/warn:declarations,general,usage,interfaces,unused)
37+
add_compile_options(/stand:f18)
3738
else()
39+
add_compile_options(-warn declarations,general,usage,interfaces,unused)
3840
add_compile_options(-stand f18)
3941
endif()
40-
elseif(CMAKE_Fortran_COMPILER_ID STREQUAL PGI)
41-
add_compile_options(-Mdclchk)
4242
endif()
4343

4444
# --- compiler feature checks
4545
include(CheckFortranSourceCompiles)
4646
include(CheckFortranSourceRuns)
47-
check_fortran_source_runs("i=0; error stop i; end" f18errorstop SRC_EXT f90)
47+
check_fortran_source_runs("i=0; error stop i; end" f18errorstop)
4848
check_fortran_source_compiles("real, allocatable :: array(:, :, :, :, :, :, :, :, :, :); end" f03rank SRC_EXT f90)
4949
check_fortran_source_runs("use, intrinsic :: iso_fortran_env, only : real128; real(real128) :: x; x = x+1; end" f03real128)
5050

51-
if(DEFINED CMAKE_MAXIMUM_RANK)
52-
set(CMAKE_MAXIMUM_RANK ${CMAKE_MAXIMUM_RANK})
51+
if(NOT DEFINED CMAKE_MAXIMUM_RANK)
52+
set(CMAKE_MAXIMUM_RANK 4 CACHE STRING "Maximum array rank for generated procedures")
5353
endif()
5454

5555
# --- find preprocessor

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -87,9 +87,8 @@ The following combinations are tested on the default branch of stdlib:
8787

8888
Name | Version | Platform | Architecture
8989
--- | --- | --- | ---
90-
GCC Fortran | 7, 8, 9, 10 | Ubuntu 18.04 | x86_64
91-
GCC Fortran | 7, 8, 9, 10 | MacOS Catalina 10.15 | x86_64
92-
GCC Fortran | 8 | Windows Server 2019 | x86_64
90+
GCC Fortran | 9, 10, 11 | Ubuntu 20.04 | x86_64
91+
GCC Fortran | 9, 10, 11 | MacOS Catalina 10.15 | x86_64
9392
GCC Fortran (MSYS) | 10 | Windows Server 2019 | x86_64
9493
GCC Fortran (MinGW) | 10 | Windows Server 2019 | x86_64, i686
9594
Intel oneAPI classic | 2021.1 | Ubuntu 20.04 | x86_64
@@ -106,7 +105,7 @@ A list of tested compilers which are currently not working and the respective is
106105

107106
Name | Version | Platform | Architecture | Status
108107
--- | --- | --- | --- | ---
109-
GCC Fortran | 7.4 | Windows 10 | i686 | [#296](https://github.com/fortran-lang/stdlib/issues/296)
108+
GCC Fortran | <9 | any | any | [#296](https://github.com/fortran-lang/stdlib/issues/296), [#430](https://github.com/fortran-lang/stdlib/pull/430)
110109
NVIDIA HPC SDK | 20.7, 20.9, 20.11 | Manjaro Linux 20 | x86_64 | [#107](https://github.com/fortran-lang/stdlib/issues/107)
111110
NAG | 7.0 | RHEL | x86_64 | [#108](https://github.com/fortran-lang/stdlib/issues/108)
112111
Intel Parallel Studio XE | 16, 17, 18 | OpenSUSE | x86_64 | failed to compile
@@ -128,15 +127,16 @@ Important options are
128127
- `-G Ninja` to use the Ninja backend instead of the default Make backend. Other build backends are available with a similar syntax.
129128
- `-DCMAKE_INSTALL_PREFIX` is used to provide the install location for the library.
130129
- `-DCMAKE_MAXIMUM_RANK` the maximum array rank procedures should be generated for.
131-
The default is 15 for Fortran 2003 compliant compilers, otherwise 7 for compilers not supporting Fortran 2003 completely yet.
130+
The default value is chosen as 4.
131+
The maximum is 15 for Fortran 2003 compliant compilers, otherwise 7 for compilers not supporting Fortran 2003 completely yet.
132132
The minimum required rank to compile this project is 4.
133133
Compiling with maximum rank 15 can be resource intensive and requires at least 16 GB of memory to allow parallel compilation or 4 GB memory for sequential compilation.
134134
- `-DBUILD_SHARED_LIBS` set to `on` in case you want link your application dynamically against the standard library (default: `off`).
135135

136136
For example, to configure a build using the Ninja backend and generating procedures up to rank 7, which is installed to your home directory use
137137

138138
```sh
139-
cmake -B build -G Ninja -DCMAKE_MAXIMUM_RANK=7 -DCMAKE_INSTALL_PREFIX=$HOME/.local
139+
cmake -B build -G Ninja -DCMAKE_MAXIMUM_RANK:String=7 -DCMAKE_INSTALL_PREFIX=$HOME/.local
140140
```
141141

142142
To build the standard library run

config/CMakeLists.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# SPDX-Identifier: MIT
22

3+
option(
4+
CMAKE_INSTALL_MODULEDIR
5+
"Directory in prefix to install generated module files"
6+
"${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME}/${CMAKE_Fortran_COMPILER_ID}-${CMAKE_Fortran_COMPILER_VERSION}"
7+
)
8+
39
# Export a pkg-config file
410
configure_file(
511
"${CMAKE_CURRENT_SOURCE_DIR}/template.pc"

config/template.pc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
prefix=@CMAKE_INSTALL_PREFIX@
22
libdir=${prefix}/@CMAKE_INSTALL_LIBDIR@
33
includedir=${prefix}/@CMAKE_INSTALL_INCLUDEDIR@
4+
moduledir=${prefix}/@CMAKE_INSTALL_MODULEDIR@
45

56
Name: @PROJECT_NAME@
67
Description: @PROJECT_DESCRIPTION@
78
Version: @PROJECT_VERSION@
89
Libs: -L${libdir} -l@PROJECT_NAME@
9-
Cflags: -I${includedir}
10+
Cflags: -I${includedir} -I${moduledir}

doc/specs/index.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,19 +15,18 @@ This is and index/directory of the specifications (specs) for each new module/fe
1515
- [bitsets](./stdlib_bitsets.html) - Bitset data types and procedures
1616
- [error](./stdlib_error.html) - Catching and handling errors
1717
- [IO](./stdlib_io.html) - Input/output helper & convenience
18+
- [kinds](./stdlib_kinds.html) - Kind parameters
1819
- [linalg](./stdlib_linalg.html) - Linear Algebra
1920
- [logger](./stdlib_logger.html) - Runtime logging system
21+
- [math](./stdlib_math.html) - General purpose mathematical functions
2022
- [optval](./stdlib_optval.html) - Fallback value for optional arguments
2123
- [quadrature](./stdlib_quadrature.html) - Numerical integration
24+
- [sorting](./stdlib_sorting.html) - Sorting of rank one arrays
2225
- [stats](./stdlib_stats.html) - Descriptive Statistics
2326
- [stats_distribution_PRNG](./stdlib_stats_distribution_PRNG.html) - Probability Distributions random number generator
2427
- [string\_type](./stdlib_string_type.html) - Basic string support
2528
- [strings](./stdlib_strings.html) - String handling and manipulation routines
2629

27-
## Missing specs
28-
29-
- [kinds](https://github.com/fortran-lang/stdlib/blob/master/src/stdlib_kinds.f90)
30-
3130
## Released/Stable Features & Modules
3231

3332
- (None yet)

doc/specs/stdlib_kinds.md

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
---
2+
title: kinds
3+
---
4+
5+
# The `stdlib_kinds` module
6+
7+
[TOC]
8+
9+
## Introduction
10+
11+
The `stdlib_kinds` module provides kind parameters for the Fortran intrinsic data types,
12+
*integer*, *logical*, *real*, and *complex*.
13+
14+
15+
## Constants provided by `stdlib_kinds`
16+
17+
### `sp`
18+
19+
Alias for intrinsic named constant `real32` imported from `iso_fortran_env`.
20+
21+
22+
### `dp`
23+
24+
Alias for intrinsic named constant `real64` imported from `iso_fortran_env`.
25+
26+
27+
### `qp`
28+
29+
Alias for intrinsic named constant `real128` imported from `iso_fortran_env`.
30+
31+
32+
### `int8`
33+
34+
Reexported intrinsic named constant `int8` from `iso_fortran_env`.
35+
36+
37+
### `int16`
38+
39+
Reexported intrinsic named constant `int16` from `iso_fortran_env`.
40+
41+
42+
### `int32`
43+
44+
Reexported intrinsic named constant `int32` from `iso_fortran_env`.
45+
46+
47+
### `int64`
48+
49+
Reexported intrinsic named constant `int64` from `iso_fortran_env`.
50+
51+
52+
### `lk`
53+
54+
Kind parameter of the default logical data type.
55+
56+
57+
### `c_bool`
58+
59+
Reexported intrinsic named constant `c_bool` from `iso_c_binding`.

doc/specs/stdlib_linalg.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,3 +168,41 @@ program demo_trace
168168
print *, trace(A) ! 1 + 5 + 9
169169
end program demo_trace
170170
```
171+
172+
## `outer_product` - Computes the outer product of two vectors
173+
174+
### Status
175+
176+
Experimental
177+
178+
### Description
179+
180+
Computes the outer product of two vectors
181+
182+
### Syntax
183+
184+
`d = [[stdlib_linalg(module):outer_product(interface)]](u, v)`
185+
186+
### Arguments
187+
188+
`u`: Shall be a rank-1 array
189+
190+
`v`: Shall be a rank-1 array
191+
192+
### Return value
193+
194+
Returns a rank-2 array equal to `u v^T` (where `u, v` are considered column vectors). The shape of the returned array is `[size(u), size(v)]`.
195+
196+
### Example
197+
198+
```fortran
199+
program demo_outer_product
200+
use stdlib_linalg, only: outer_product
201+
implicit none
202+
real, allocatable :: A(:,:), u(:), v(:)
203+
u = [1., 2., 3. ]
204+
v = [3., 4.]
205+
A = outer_product(u,v)
206+
!A = reshape([3., 6., 9., 4., 8., 12.], [3,2])
207+
end program demo_outer_product
208+
```

0 commit comments

Comments
 (0)