Skip to content

Commit 0a0137b

Browse files
committed
After catch up merge
2 parents d0a4a76 + 2bb6539 commit 0a0137b

File tree

167 files changed

+25137
-7233
lines changed

Some content is hidden

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

167 files changed

+25137
-7233
lines changed

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<!--
2+
Thank you for contributing to stdlib.
3+
To help us get your pull request merged more quickly, please consider reviewing any of the already open pull requests.
4+
-->

.github/workflows/CI.yml

Lines changed: 42 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,20 @@ jobs:
2121
matrix:
2222
os: [ubuntu-latest, macos-latest]
2323
gcc_v: [9, 10, 11] # Version of GFortran we want to use.
24+
build: [cmake]
25+
include:
26+
- os: ubuntu-latest
27+
gcc_v: 10
28+
build: cmake-inline
29+
- os: ubuntu-latest
30+
gcc_v: 10
31+
build: make
2432
env:
2533
FC: gfortran-${{ matrix.gcc_v }}
34+
CC: gcc-${{ matrix.gcc_v }}
35+
CXX: g++-${{ matrix.gcc_v }}
2636
GCC_V: ${{ matrix.gcc_v }}
37+
BUILD_DIR: ${{ matrix.build == 'cmake' && 'build' || '.' }}
2738

2839
steps:
2940
- name: Checkout code
@@ -34,63 +45,64 @@ jobs:
3445
with:
3546
python-version: 3.x
3647

37-
- name: Install CMake Linux
38-
if: contains(matrix.os, 'ubuntu')
39-
run: ci/install_cmake.sh
40-
4148
- name: Install fypp
4249
run: pip install --upgrade fypp
4350

44-
- name: Install GFortran Linux
51+
- name: Install GCC compilers Linux
4552
if: contains( matrix.os, 'ubuntu')
4653
run: |
4754
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
4855
sudo apt-get update
49-
sudo apt-get install -y gcc-${GCC_V} gfortran-${GCC_V}
56+
sudo apt-get install -y gcc-${GCC_V} g++-${GCC_V} gfortran-${GCC_V}
5057
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-${GCC_V} 100 \
5158
--slave /usr/bin/gfortran gfortran /usr/bin/gfortran-${GCC_V} \
59+
--slave /usr/bin/g++ g++ /usr/bin/g++-${GCC_V} \
5260
--slave /usr/bin/gcov gcov /usr/bin/gcov-${GCC_V}
5361
54-
- name: Install GFortran macOS
62+
- name: Install GCC compilers macOS
5563
if: contains( matrix.os, 'macos')
5664
run: |
5765
brew install gcc@${GCC_V} || brew upgrade gcc@${GCC_V} || true
5866
brew link gcc@${GCC_V}
5967
6068
- name: Configure with CMake
69+
if: ${{ contains(matrix.build, 'cmake') }}
6170
run: >-
6271
cmake -Wdev
6372
-DCMAKE_BUILD_TYPE=Release
6473
-DCMAKE_MAXIMUM_RANK:String=4
6574
-DCMAKE_INSTALL_PREFIX=$PWD/_dist
66-
-S . -B build
75+
-S . -B ${{ env.BUILD_DIR }}
6776
6877
- name: Build and compile
69-
run: cmake --build build --parallel
78+
if: ${{ contains(matrix.build, 'cmake') }}
79+
run: cmake --build ${{ env.BUILD_DIR }} --parallel
7080

7181
- name: catch build fail
72-
run: cmake --build build --verbose --parallel 1
73-
if: failure()
82+
run: cmake --build ${{ env.BUILD_DIR }} --verbose --parallel 1
83+
if: ${{ failure() && contains(matrix.build, 'cmake') }}
7484

7585
- name: test
76-
run: ctest --test-dir build --parallel --output-on-failure
86+
if: ${{ contains(matrix.build, 'cmake') }}
87+
run: >-
88+
ctest
89+
--test-dir ${{ env.BUILD_DIR }}
90+
--parallel
91+
--output-on-failure
92+
--no-tests=error
7793
7894
- name: Install project
79-
run: cmake --install build
80-
81-
- name: Test in-tree builds
82-
if: contains( matrix.gcc_v, '10') # Only test one compiler on each platform
83-
run: |
84-
cmake -DCMAKE_MAXIMUM_RANK=4 .
85-
cmake --build .
86-
cmake --build . --target test
95+
if: ${{ contains(matrix.build, 'cmake') }}
96+
run: cmake --install ${{ env.BUILD_DIR }}
8797

8898
- name: Test manual makefiles
89-
if: contains(matrix.os, 'ubuntu') && contains(matrix.gcc_v, '10')
99+
if: ${{ matrix.build == 'make' }}
90100
run: |
91-
make -f Makefile.manual FYPPFLAGS="-DMAXRANK=4" -j
101+
make -f Makefile.manual -j
92102
make -f Makefile.manual test
93103
make -f Makefile.manual clean
104+
env:
105+
ADD_FYPPFLAGS: "-DMAXRANK=4"
94106

95107
intel-build:
96108
runs-on: ${{ matrix.os }}
@@ -99,12 +111,15 @@ jobs:
99111
matrix:
100112
os: [ubuntu-latest, macos-latest]
101113
fc: [ifort]
114+
cc: [icc]
115+
cxx: [icpc]
102116
env:
103117
MACOS_HPCKIT_URL: >-
104-
https://registrationcenter-download.intel.com/akdlm/irc_nas/17398/m_HPCKit_p_2021.1.0.2681_offline.dmg
105-
MACOS_FORTRAN_COMPONENTS: >-
106-
intel.oneapi.mac.ifort-compiler
118+
https://registrationcenter-download.intel.com/akdlm/irc_nas/18242/m_HPCKit_p_2021.4.0.3389_offline.dmg
119+
MACOS_FORTRAN_COMPONENTS: all
107120
FC: ${{ matrix.fc }}
121+
CC: ${{ matrix.cc }}
122+
CXX: ${{ matrix.cxx }}
108123

109124
steps:
110125
- name: Checkout code
@@ -115,10 +130,6 @@ jobs:
115130
with:
116131
python-version: 3.x
117132

118-
- name: Install CMake Linux
119-
if: contains(matrix.os, 'ubuntu')
120-
run: ci/install_cmake.sh
121-
122133
- name: Prepare for cache restore (OSX)
123134
if: contains(matrix.os, 'macos')
124135
run: |
@@ -146,6 +157,7 @@ jobs:
146157
if: contains(matrix.os, 'ubuntu')
147158
run: |
148159
sudo apt-get install intel-oneapi-compiler-fortran
160+
sudo apt-get install intel-oneapi-compiler-dpcpp-cpp-and-cpp-classic
149161
150162
- name: Install Intel oneAPI compiler (OSX)
151163
if: contains(matrix.os, 'macos') && steps.cache-install.outputs.cache-hit != 'true'
@@ -189,7 +201,7 @@ jobs:
189201
if: failure()
190202

191203
- name: test
192-
run: ctest --parallel --output-on-failure
204+
run: ctest --parallel --output-on-failure --no-tests=error
193205
working-directory: build
194206

195207
- name: Install project

.github/workflows/fpm-deployment.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ jobs:
3333
- name: Install fpm latest release
3434
uses: fortran-lang/setup-fpm@v3
3535
with:
36-
github-token: ${{ secrets.GITHUB_TOKEN }}
36+
fpm-version: 'v0.4.0'
3737

3838
- name: Run fpm test ⚙
3939
run: |

API-doc-FORD-file.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ media_dir: doc/media
99
fpp_extensions: fypp
1010
preprocess: true
1111
macro: MAXRANK=3
12+
PROJECT_VERSION_MAJOR=0
13+
PROJECT_VERSION_MINOR=0
14+
PROJECT_VERSION_PATCH=0
1215
preprocessor: fypp
1316
display: public
1417
protected
@@ -25,7 +28,7 @@ extra_mods: iso_fortran_env:https://gcc.gnu.org/onlinedocs/gfortran/ISO_005fFORT
2528
print_creation_date: true
2629
creation_date: %Y-%m-%d %H:%M %z
2730
project_github: https://github.com/fortran-lang/stdlib
28-
project_download: https://github.com/fortran-lang/stdlib/archive/master.zip
31+
project_download: https://github.com/fortran-lang/stdlib/archive/HEAD.zip
2932
project_website: https://stdlib.fortran-lang.org
3033
favicon: doc/media/favicon.ico
3134
license: by-sa
@@ -54,7 +57,7 @@ The documentation for comment markup in source code, running [FORD] and the [FOR
5457

5558
[FORD]: https://github.com/Fortran-FOSS-Programmers/ford#readme
5659
[FORD wiki]: https://github.com/Fortran-FOSS-Programmers/ford/wiki
57-
[FORD project file]: https://github.com/fortran-lang/stdlib/blob/master/API-doc-FORD-file.md
60+
[FORD project file]: https://github.com/fortran-lang/stdlib/blob/HEAD/API-doc-FORD-file.md
5861

5962
Goals and Motivation
6063
====================

CHANGELOG.md

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,53 @@
11
# Unreleased
22

3+
Features available from the latest git source
4+
5+
- new module `stdlib_hash_32bit`
6+
[#573](https://github.com/fortran-lang/stdlib/pull/573)
7+
- new procedures: `fibonacci_hash`, `fnv_1_hash`,
8+
`fnv_1a_hash`, `new_nmhash32_seed`, `new_nmhash32x_seed`,
9+
`new_water_hash_seed`, `nmhash32`, `nmhash32x`, `odd_random_integer`,
10+
`universal_mult_hash`, and `water_hash`
11+
- new module `stdlib_hash_64bit`
12+
[#573](https://github.com/fortran-lang/stdlib/pull/573)
13+
- new procedures: `fibonacci_hash`, `fnv_1_hash`, `fnv_1a_hash`,
14+
`new_pengy_hash_seed`, `new_spooky_hash_seed`,
15+
`odd_random_integer`, `pengy_hash`, `spooky_hash`, `spookyhash_128`, and
16+
`universal_mult_hash`
17+
- new module `stdlib_array`
18+
[#603](https://github.com/fortran-lang/stdlib/pull/603)
19+
- new procedures `trueloc`, `falseloc`
20+
- new module `stdlib_distribution_uniform`
21+
[#272](https://github.com/fortran-lang/stdlib/pull/272)
22+
- new module `stdlib_selection`
23+
[#500](https://github.com/fortran-lang/stdlib/pull/500)
24+
- new procedures `select`, `arg_select`
25+
- new module `stdlib_version`
26+
[#579](https://github.com/fortran-lang/stdlib/pull/579)
27+
- new procedure `get_stdlib_version`
28+
- update module `stdlib_io`
29+
[597](https://github.com/fortran-lang/stdlib/pull/597)
30+
- new procedure `getline`
31+
- new module `stdlib_io_npy`
32+
[#581](https://github.com/fortran-lang/stdlib/pull/581)
33+
- new procedures `save_npy`, `load_npy`
34+
- update module `stdlib_math`
35+
- new procedures `is_close` and `all_close`
36+
[#488](https://github.com/fortran-lang/stdlib/pull/488)
37+
- new procedures `arg`, `argd` and `argpi`
38+
[#498](https://github.com/fortran-lang/stdlib/pull/498)
39+
40+
Changes to existing modules
41+
42+
- change in module `stdlib_math`
43+
- `linspace` and `logspace` made pure
44+
[#549](https://github.com/fortran-lang/stdlib/pull/549)
45+
- change in module `stdlib_string_type`
46+
- `move` procedure made *pure*/*elemental*
47+
[#562](https://github.com/fortran-lang/stdlib/pull/562)
48+
- support for quadruple precision made optional
49+
[#565](https://github.com/fortran-lang/stdlib/pull/565)
50+
351

452
# Version 0.1.0
553

CMakeLists.txt

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,17 @@
11
cmake_minimum_required(VERSION 3.14.0)
22
project(fortran_stdlib
33
LANGUAGES Fortran
4-
VERSION 0.1.0
54
DESCRIPTION "Community driven and agreed upon de facto standard library for Fortran"
65
)
6+
7+
# Read version from file
8+
file(STRINGS "${PROJECT_SOURCE_DIR}/VERSION" PROJECT_VERSION)
9+
string(REPLACE "." ";" VERSION_LIST ${PROJECT_VERSION})
10+
list(GET VERSION_LIST 0 PROJECT_VERSION_MAJOR)
11+
list(GET VERSION_LIST 1 PROJECT_VERSION_MINOR)
12+
list(GET VERSION_LIST 2 PROJECT_VERSION_PATCH)
13+
unset(VERSION_LIST)
14+
715
enable_testing()
816

917
# Follow GNU conventions for installation directories
@@ -21,10 +29,11 @@ if(CMAKE_Fortran_COMPILER_ID STREQUAL GNU)
2129
endif()
2230
add_compile_options(-fimplicit-none)
2331
add_compile_options(-ffree-line-length-132)
32+
add_compile_options(-fno-range-check) # Needed for gfortran 9 and
33+
# earlier for hash functions
2434
add_compile_options(-Wall)
2535
add_compile_options(-Wextra)
2636
add_compile_options(-Wimplicit-procedure)
27-
add_compile_options(-Wconversion-extra)
2837
# -pedantic-errors triggers a false positive for optional arguments of elemental functions,
2938
# see test_optval and https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95446
3039
if(CMAKE_Fortran_COMPILER_VERSION VERSION_LESS 11.0)
@@ -33,12 +42,11 @@ if(CMAKE_Fortran_COMPILER_ID STREQUAL GNU)
3342
add_compile_options(-std=f2018)
3443
elseif(CMAKE_Fortran_COMPILER_ID MATCHES "^Intel")
3544
if(WIN32)
36-
add_compile_options(/warn:declarations,general,usage,interfaces,unused)
37-
add_compile_options(/stand:f18)
45+
set(fortran_flags /stand:f18 /warn:declarations,general,usage,interfaces,unused)
3846
else()
39-
add_compile_options(-warn declarations,general,usage,interfaces,unused)
40-
add_compile_options(-stand f18)
47+
set(fortran_flags -stand f18 -warn declarations,general,usage,interfaces,unused)
4148
endif()
49+
add_compile_options("$<$<COMPILE_LANGUAGE:Fortran>:${fortran_flags}>")
4250
endif()
4351

4452
# --- compiler feature checks
@@ -55,7 +63,7 @@ endif()
5563
# --- find preprocessor
5664
find_program(FYPP fypp)
5765
if(NOT FYPP)
58-
message(FATAL_ERROR "Preprocessor fypp not found!")
66+
message(FATAL_ERROR "Preprocessor fypp not found! Please install fypp following the instructions in https://fypp.readthedocs.io/en/stable/fypp.html#installing")
5967
endif()
6068

6169
add_subdirectory(src)

CONTRIBUTING.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ requests.
99

1010
By contributing to *stdlib*, you certify that you own or are allowed to share the
1111
content of your contribution under the
12-
[stdlib license](https://github.com/fortran-lang/stdlib/blob/master/LICENSE).
12+
[stdlib license](https://github.com/fortran-lang/stdlib/blob/HEAD/LICENSE).
1313

1414
* [Style](#style)
1515
* [Reporting a bug](#reporting-a-bug)
@@ -22,7 +22,7 @@ content of your contribution under the
2222
## Style
2323

2424
Please follow the
25-
[Fortran stdlib style guide](https://github.com/fortran-lang/stdlib/blob/master/STYLE_GUIDE.md)
25+
[Fortran stdlib style guide](https://github.com/fortran-lang/stdlib/blob/HEAD/STYLE_GUIDE.md)
2626
for any Fortran code that you contribute.
2727
This allows the community to focus on substance rather than style.
2828

@@ -42,7 +42,7 @@ Before opening a bug report:
4242
1. Check if the issue has already been reported
4343
([issues](https://github.com/fortran-lang/stdlib/issues)).
4444
2. Check if it is still an issue or it has been fixed?
45-
Try to reproduce it with the latest version from the master branch.
45+
Try to reproduce it with the latest version from the default branch.
4646
3. Isolate the problem and create a minimal test case.
4747

4848
A good bug report should include all information needed to reproduce the bug.
@@ -74,7 +74,7 @@ It is quite possible we have not considered such solutions yet.
7474
## Workflow
7575

7676
The general workflow is documented in
77-
[this document](https://github.com/fortran-lang/stdlib/blob/master/WORKFLOW.md)
77+
[this document](https://github.com/fortran-lang/stdlib/blob/HEAD/WORKFLOW.md)
7878

7979
The workflow guide is a living document.
8080
You are welcome to propose changes to the workflow by
@@ -89,9 +89,11 @@ You are welcome to propose changes to the workflow by
8989
* Smaller PRs are better than large PRs, and will lead to a shorter review and
9090
merge cycle.
9191
* Add tests for your feature or bug fix to be sure that it stays functional and useful.
92+
* Include new features and changes in the
93+
[CHANGELOG](https://github.com/fortran-lang/stdlib/blob/master/CHANGELOG.md)
9294
* Be open to constructive criticism and requests for improving your code.
9395
* Again, please follow the
94-
[Fortran stdlib style guide](https://github.com/fortran-lang/stdlib/blob/master/STYLE_GUIDE.md).
96+
[Fortran stdlib style guide](https://github.com/fortran-lang/stdlib/blob/HEAD/STYLE_GUIDE.md).
9597

9698

9799
## For new contributors

Makefile.manual

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,17 @@
11
# Fortran stdlib Makefile
22

33
FC ?= gfortran
4-
FFLAGS ?= -Wall -Wextra -Wimplicit-interface -fPIC -g -fcheck=all
5-
FYPPFLAGS ?=
4+
# -fno-range-check needed for hash functions for gfortran-9
5+
FFLAGS ?= -Wall -Wextra -Wimplicit-interface -fPIC -g -fcheck=all -fno-range-check
6+
ADD_FYPPFLAGS ?=
7+
8+
VERSION := $(subst ., ,$(file < VERSION))
9+
VERSION_FYPPFLAGS += \
10+
-DPROJECT_VERSION_MAJOR=$(word 1,$(VERSION)) \
11+
-DPROJECT_VERSION_MINOR=$(word 2,$(VERSION)) \
12+
-DPROJECT_VERSION_PATCH=$(word 3,$(VERSION))
13+
14+
FYPPFLAGS := $(ADD_FYPPFLAGS) $(VERSION_FYPPFLAGS)
615

716
export FC
817
export FFLAGS

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -176,15 +176,15 @@ Alternatively, you can build using provided Makefiles:
176176
make -f Makefile.manual
177177
```
178178

179-
You can limit the maximum rank by setting ``-DMAXRANK=<num>`` in the ``FYPPFLAGS`` environment variable (which can reduce the compilation time):
179+
You can limit the maximum rank by setting ``-DMAXRANK=<num>`` in the ``ADD_FYPPFLAGS`` environment variable (which can reduce the compilation time):
180180

181181
```sh
182-
make -f Makefile.manual FYPPFLAGS=-DMAXRANK=4
182+
make -f Makefile.manual ADD_FYPPFLAGS=-DMAXRANK=4
183183
```
184184

185185
You can also specify the compiler and compiler-flags by setting the ``FC`` and ``FFLAGS`` environmental variables. Among other things, this facilitates use of compiler optimizations that are not specified in the Makefile.manual defaults.
186186
```sh
187-
make -f Makefile.manual FYPPFLAGS=-DMAXRANK=4 FC=gfortran FFLAGS="-O3 -flto"
187+
make -f Makefile.manual ADD_FYPPFLAGS=-DMAXRANK=4 FC=gfortran FFLAGS="-O3"
188188
```
189189

190190
### Build with [fortran-lang/fpm](https://github.com/fortran-lang/fpm)

0 commit comments

Comments
 (0)