Skip to content

Commit d1d665b

Browse files
committed
Addition of stdlib_experimental_stats function mean
Squashed commit of the following: commit 3266163 Merge: e96c12d 4274f0d Author: Vandenplas, Jeremie <[email protected]> Date: Tue Jan 21 20:47:32 2020 +0100 modification of CMake and Makefile Merge branch 'stat_cmake' into stat_dev commit 4274f0d Author: Vandenplas, Jeremie <[email protected]> Date: Tue Jan 21 20:44:24 2020 +0100 stat_cmake: update Makefile commit 17e3d16 Author: Vandenplas, Jeremie <[email protected]> Date: Tue Jan 21 20:35:19 2020 +0100 second try cmake commit 397eb18 Author: Vandenplas, Jeremie <[email protected]> Date: Tue Jan 21 20:18:37 2020 +0100 Modifications of CMake for tests on Ubuntu 7 commit e96c12d Author: Vandenplas, Jeremie <[email protected]> Date: Tue Jan 21 19:40:05 2020 +0100 small change in md commit 7eec9ae Author: Vandenplas, Jeremie <[email protected]> Date: Tue Jan 21 19:37:06 2020 +0100 stat_dev: renamed stat to stats commit 8199b6d Author: Vandenplas, Jeremie <[email protected]> Date: Tue Jan 21 19:26:20 2020 +0100 stat_dev: changed spec commit b1c481d Author: Vandenplas, Jeremie <[email protected]> Date: Tue Jan 21 19:15:25 2020 +0100 stat_dev: modifs following comments commit e64657c Author: Vandenplas, Jeremie <[email protected]> Date: Tue Jan 21 14:23:59 2020 +0100 stat_dev: addition of .md file for mean commit ad504e8 Merge: 5a1adcb bab50e3 Author: Vandenplas, Jeremie <[email protected]> Date: Tue Jan 21 13:16:21 2020 +0100 Merge remote-tracking branch 'jvdp1/stat_dev_1' into stat_dev commit bab50e3 Author: Vandenplas, Jeremie <[email protected]> Date: Tue Jan 21 13:13:00 2020 +0100 stat_dev_1: changed all to iterations commit 8d4c11f Author: Vandenplas, Jeremie <[email protected]> Date: Tue Jan 21 10:31:26 2020 +0100 stat_dev_1:moved all calls to mean functions to loops commit 922e523 Author: Vandenplas, Jeremie <[email protected]> Date: Tue Jan 21 09:13:10 2020 +0100 stat_dev_1: update test_mean commit 5a1adcb Author: Vandenplas, Jeremie <[email protected]> Date: Mon Jan 20 23:55:15 2020 +0100 stat_dev: inverting loops for efficiency commit 86970ae Author: Vandenplas, Jeremie <[email protected]> Date: Mon Jan 20 22:54:55 2020 +0100 stat_dev: use specific interface commit 6574a67 Author: Vandenplas, Jeremie <[email protected]> Date: Mon Jan 20 22:36:33 2020 +0100 stat_dev: addition of calls to error_stop commit e98090b Author: Vandenplas, Jeremie <[email protected]> Date: Mon Jan 20 21:32:27 2020 +0100 stat_dev: extension to rank 15 commit e0e3092 Author: Vandenplas, Jeremie <[email protected]> Date: Mon Jan 20 12:46:44 2020 +0100 stat_dev: simplified merge commit 22ff6e4 Author: Vandenplas, Jeremie <[email protected]> Date: Mon Jan 20 10:38:41 2020 +0100 stat_dev: progress rank 3 commit 7612613 Author: Vandenplas, Jeremie <[email protected]> Date: Mon Jan 20 10:34:06 2020 +0100 stat_dev: add rank 3 commit 60ab523 Author: Vandenplas, Jeremie <[email protected]> Date: Sun Jan 19 22:14:51 2020 +0100 stat_dev: addition of integer cases commit 6fb6ca5 Author: Vandenplas, Jeremie <[email protected]> Date: Sun Jan 19 21:03:46 2020 +0100 stat_dev: avoid allocatable functions commit a1c6353 Author: Vandenplas, Jeremie <[email protected]> Date: Sun Jan 19 20:11:49 2020 +0100 modification to have the same behaviour as Fortran sum commit 72500e1 Author: Vandenplas, Jeremie <[email protected]> Date: Sun Jan 19 15:23:34 2020 +0100 stat_dev: add error_stop commit 1272574 Author: Vandenplas, Jeremie <[email protected]> Date: Sun Jan 19 15:02:52 2020 +0100 stat_dev: update Makefile commit 426d43f Author: Vandenplas, Jeremie <[email protected]> Date: Sun Jan 19 12:21:09 2020 +0100 stat_dev: addition of test and creation of modules and submodules with fypp how to use pure functions inside submodules commit 965f37b Author: Vandenplas, Jeremie <[email protected]> Date: Sun Jan 19 11:35:11 2020 +0100 moved to submodules how to use pure functions in submodules commit d9af336 Author: Vandenplas, Jeremie <[email protected]> Date: Sun Jan 19 11:22:52 2020 +0100 stat_dev: init commit dc7e49b Merge: f300f4a cb7cf71 Author: Ondřej Čertík <[email protected]> Date: Tue Jan 14 11:11:12 2020 -0700 Merge pull request fortran-lang#109 from nncarlson/target-include Update CMakeLists handling of .mod files commit cb7cf71 Author: Neil Carlson <[email protected]> Date: Mon Jan 13 16:38:12 2020 -0700 Update CMakeLists handling of .mod files commit f300f4a Merge: 12bd060 0ea0ee1 Author: Milan Curcic <[email protected]> Date: Wed Jan 8 18:20:09 2020 -0500 Merge pull request fortran-lang#54 from scivision/systemlib add system module commit 0ea0ee1 Author: Michael Hirsch, Ph.D <[email protected]> Date: Mon Jan 6 11:41:46 2020 -0500 make sleep test automated check with system_clock commit c8974dc Author: Michael Hirsch, Ph.D <[email protected]> Date: Mon Dec 30 16:20:55 2019 -0500 add system module There are a number of capabilities it would be useful to bring from cstdlib and STL. This is an initial demonstration, replacing the non-cross-compiler sleep() with a standard implmeentation that works across compilers and operating systems, with millisecond integer input. commit 12bd060 Merge: 006beda e1d861d Author: Ondřej Čertík <[email protected]> Date: Wed Jan 8 11:52:06 2020 -0700 Merge pull request fortran-lang#97 from certik/goals Add Goals and Motivation section into README commit e1d861d Author: Ondřej Čertík <[email protected]> Date: Wed Jan 8 10:00:27 2020 -0700 Update README.md commit ca4554a Author: Ondřej Čertík <[email protected]> Date: Wed Jan 8 09:49:39 2020 -0700 Add Goals and Motivation section into README commit 006beda Merge: 1926ade e81d295 Author: Ondřej Čertík <[email protected]> Date: Tue Jan 7 15:41:39 2020 -0700 Merge pull request fortran-lang#94 from certik/workflow Document workflow based on the discussion in #5 commit e81d295 Author: Ondřej Čertík <[email protected]> Date: Tue Jan 7 08:20:24 2020 -0700 Update the workflow based on feedback commit 1926ade Merge: 7a6108e f857482 Author: Ondřej Čertík <[email protected]> Date: Tue Jan 7 08:01:39 2020 -0700 Merge pull request fortran-lang#96 from nshaffer/dev-optval Make optval pure or pure elemental where possible commit f857482 Merge: 274a2bb 7a6108e Author: Ondřej Čertík <[email protected]> Date: Tue Jan 7 07:48:17 2020 -0700 Merge branch 'master' into dev-optval commit 274a2bb Author: Nathaniel Shaffer <[email protected]> Date: Tue Jan 7 07:00:21 2020 -0700 add tests for 1d arrays (reals, ints, logical) commit e06e322 Author: Nathaniel Shaffer <[email protected]> Date: Tue Jan 7 06:58:14 2020 -0700 add "elemental" and/or "pure" attributes where possible commit 92926e0 Author: Ondřej Čertík <[email protected]> Date: Mon Jan 6 15:01:31 2020 -0700 Make the specification requirement part of step 3. commit 1f56d0d Author: Ondřej Čertík <[email protected]> Date: Mon Jan 6 12:09:48 2020 -0700 Document workflow based on the discussion in #5 commit 7a6108e Merge: e2b0cda a606606 Author: Izaak "Zaak" Beekman <[email protected]> Date: Mon Jan 6 13:02:55 2020 -0500 ci ctest enhancements (fortran-lang#92) Merge [scivision:citime] into master [scivision:citime]: https://github.com/scivision/stdlib/tree/citime commit a606606 Author: Michael Hirsch, Ph.D <[email protected]> Date: Mon Jan 6 11:50:17 2020 -0500 ci ctest enhancements commit e2b0cda Merge: 57d99f8 f0a6886 Author: Ondřej Čertík <[email protected]> Date: Mon Jan 6 08:01:24 2020 -0700 Merge pull request fortran-lang#90 from certik/stream Use access = "stream" by default commit f0a6886 Author: Ondřej Čertík <[email protected]> Date: Mon Jan 6 07:56:18 2020 -0700 Update src/stdlib_experimental_io.f90 Co-Authored-By: Jeremie Vandenplas <[email protected]> commit 05540fd Author: Ondřej Čertík <[email protected]> Date: Mon Jan 6 07:52:24 2020 -0700 Use access = "stream" by default commit 57d99f8 Merge: c3e4816 d845f2d Author: Ondřej Čertík <[email protected]> Date: Mon Jan 6 07:42:42 2020 -0700 Merge pull request fortran-lang#89 from pdebuyl/qsavetxt_format_string Use explicit formatting in qsavetxt commit d845f2d Author: Pierre de Buyl <[email protected]> Date: Mon Jan 6 10:35:55 2020 +0100 Use explicit formatting in qsavetxt
1 parent c3e4816 commit d1d665b

27 files changed

+33319
-50
lines changed

.github/workflows/CI.yml

+8-2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ env:
77
CMAKE_BUILD_PARALLEL_LEVEL: "2" # 2 cores on each GHA VM, enable parallel builds
88
CTEST_OUTPUT_ON_FAILURE: "ON" # This way we don't need a flag to ctest
99
CTEST_PARALLEL_LEVEL: "2"
10+
CTEST_TIME_TIMEOUT: "5" # some failures hang forever
1011
HOMEBREW_NO_ANALYTICS: "ON" # Make Homebrew installation a little quicker
1112
HOMEBREW_NO_AUTO_UPDATE: "ON"
1213
HOMEBREW_NO_BOTTLE_SOURCE_FALLBACK: "ON"
@@ -55,10 +56,15 @@ jobs:
5556
run: cmake -Wdev -DCMAKE_BUILD_TYPE=Release -S . -B build
5657

5758
- name: Build and compile
58-
run: cmake --build build || cmake --build build --verbose --parallel 1
59+
run: cmake --build build
60+
61+
- name: catch build fail
62+
run: cmake --build build --verbose --parallel 1
63+
if: failure()
5964

6065
- name: test
61-
run: cmake --build build --target test
66+
run: ctest --parallel --output-on-failure
67+
working-directory: build
6268

6369
- name: Test in-tree builds
6470
if: contains( matrix.gcc_v, '9') # Only test one compiler on each platform

.github/workflows/ci_windows.yml

+3-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ on: [push, pull_request]
44

55
env:
66
CI: "ON"
7+
CTEST_TIME_TIMEOUT: "5" # some failures hang forever
78

89
jobs:
910
Build:
@@ -24,7 +25,8 @@ jobs:
2425
- name: CMake build
2526
run: cmake --build build --parallel
2627

27-
- run: cmake --build build --verbose --parallel 1
28+
- name: catch build fail
29+
run: cmake --build build --verbose --parallel 1
2830
if: failure()
2931

3032
- name: CTest

CMakeLists.txt

+1-5
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,6 @@ cmake_minimum_required(VERSION 3.14.0)
22
project(stdlib Fortran)
33
enable_testing()
44

5-
# this avoids stdlib and projects using stdlib from having to introspect stdlib's directory structure
6-
# FIXME: this eventually needs to be handled more precisely, as this spills all .mod/.smod into one directory
7-
# and thereby can clash if module/submodule names are the same in different parts of library
8-
set(CMAKE_Fortran_MODULE_DIRECTORY ${CMAKE_BINARY_DIR})
9-
105
# --- compiler options
116
if(CMAKE_Fortran_COMPILER_ID STREQUAL GNU)
127
add_compile_options(-fimplicit-none)
@@ -20,6 +15,7 @@ endif()
2015
include(CheckFortranSourceCompiles)
2116
include(CheckFortranSourceRuns)
2217
check_fortran_source_compiles("error stop i; end" f18errorstop SRC_EXT f90)
18+
check_fortran_source_compiles("real, allocatable :: array(:, :, :, :, :, :, :, :, :, :); end" f03rank SRC_EXT f90)
2319
check_fortran_source_runs("use, intrinsic :: iso_fortran_env, only : real128; real(real128) :: x; x = x+1; end" f03real128)
2420

2521
add_subdirectory(src)

README.md

+26-7
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,24 @@
11
# Fortran Standard Library
22

3+
[![Actions Status](https://github.com/fortran-lang/stdlib/workflows/CI/badge.svg)](https://github.com/fortran-lang/stdlib/actions)
4+
[![Actions Status](https://github.com/fortran-lang/stdlib/workflows/CI_windows/badge.svg)](https://github.com/fortran-lang/stdlib/actions)
5+
6+
7+
## Goals and Motivation
8+
9+
The Fortran Standard, as published by the ISO (https://wg5-fortran.org/), does
10+
not have a Standard Library. The goal of this project is to provide a community
11+
driven and agreed upon *de facto* "standard" library for Fortran, called a
12+
Fortran Standard Library (`stdlib`). We have a rigorous process how `stdlib` is
13+
developed as documented in our [Workflow](WORKFLOW.md). `stdlib` is both a
14+
specification and a reference implementation. We are cooperating with the
15+
Fortran Standards Committee (e.g., the effort
16+
[started](https://github.com/j3-fortran/fortran_proposals/issues/104) at the J3
17+
committee repository) and the plan is to continue working with the Committee in
18+
the future (such as in the step 5. in the [Workflow](WORKFLOW.md) document), so
19+
that if the Committee wants to standardize some feature already available in `stdlib`, it would
20+
base it on `stdlib`'s implementation.
21+
322
## Scope
423

524
The goal of the Fortran Standard Library is to achieve the following general scope:
@@ -16,19 +35,19 @@ The goal of the Fortran Standard Library is to achieve the following general sco
1635

1736
### Get the code
1837

19-
```
38+
```sh
2039
git clone https://github.com/fortran-lang/stdlib
2140
cd stdlib
2241
```
2342

2443
### Build with CMake
2544

26-
```
27-
mkdir build
28-
cd build
29-
cmake ..
30-
make
31-
ctest
45+
```sh
46+
cmake -B build
47+
48+
cmake --build build
49+
50+
cmake --build build --target test
3251
```
3352

3453
### Build with make

WORKFLOW.md

+55-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,57 @@
11
# Workflow for the Fortran stdlib contributors
22

3-
This document will describe the workflow we'll follow when developing the Fortran stdlib.
4-
It's largely to be discussed and decided.
5-
For now, take a look at the [issues](https://github.com/fortran-lang/stdlib).
3+
This document describes our current workflow.
4+
5+
We welcome everyone and anyone to participate and propose additions to stdlib.
6+
It is okay if you do not have experience for specification or implementation,
7+
but have an idea for stdlib. If the idea is popular among the community, more
8+
experienced contributors will help it through all 5 steps.
9+
10+
11+
1. **Idea**: You have an idea or a proposal. Open an
12+
[issue](https://github.com/fortran-lang/stdlib/issues) to discuss it. This
13+
is on the level of "is there interest in having image reader/writer
14+
functions in stdlib?" The goal of this step is to find out if the community
15+
is interested in having this functionality as part of stdlib.
16+
17+
2. **API**: When there seems to be significant interest in the proposal (vast
18+
majority of participants think it is a good idea), move on to discuss the
19+
specific API. It's OK to propose the API off the bat if you already have an
20+
idea for it. This step is exploratory and its goal is to find out what the
21+
API should *look* and *feel* like.
22+
23+
3. **Specification**: Discuss the API and iterate. When there is vast majority
24+
approval for the API, move on to implement it and submit a PR. Small PRs are
25+
always better than large. It is OK to implement only a few functions of a
26+
new module, and continue work on the others in a later PR. All new
27+
functionality goes into an "experimental" namespace
28+
(`stdlib_experimental_*.f90`). As part of the PR, when submitting a new
29+
public facing API, please provide the initial draft of the specification
30+
document as well as the the initial reference implementation of this
31+
specification. The specification is a document that describes the API and
32+
the functionality, so that anyone can use it to create an implementation
33+
from scratch without looking at `stdlib`. The `stdlib` library then provides
34+
the reference implementation.
35+
36+
4. **Implementation** in experimental: When opening a PR, request reviews from
37+
one or more people that are most relevant to it. These are likely to be
38+
people involved in prior steps of the workflow. Other contributors (not
39+
explicitly invited) are encouraged to provide reviews and suggestions as
40+
well. Iterate until all (or most) participants are on the same page.
41+
We can merge when there is vast majority approval of the PR.
42+
43+
5. **Release**: Moving from experimental to release. The experimental
44+
"namespace" contains new functionality together with its specification. In
45+
order to move from experimental to release, the specification document must
46+
be approved by the wide community and the standards committee (informally).
47+
If that happens, it has now been blessed for broad use and we can move the
48+
code into the main section of `stdlib`, and the particular specification
49+
document becomes part of the Fortran Standard Library.
50+
51+
52+
Note: the general term "vast majority" above means at least 80%, but ultimately
53+
it is left to our best judgement to ensure that the community agrees that each
54+
PR and proposal was approved by "vast majority".
55+
56+
You are welcome to propose changes to this workflow by opening an
57+
[issue](https://github.com/fortran-lang/stdlib/issues).

src/CMakeLists.txt

+19-1
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,40 @@ set(SRC
22
stdlib_experimental_ascii.f90
33
stdlib_experimental_io.f90
44
stdlib_experimental_error.f90
5-
stdlib_experimental_optval.f90
65
stdlib_experimental_kinds.f90
6+
stdlib_experimental_optval.f90
7+
stdlib_experimental_system.F90
78
)
89

910
add_library(fortran_stdlib ${SRC})
1011

12+
set(LIB_MOD_DIR ${CMAKE_CURRENT_BINARY_DIR}/mod_files/)
13+
set_target_properties(fortran_stdlib PROPERTIES
14+
Fortran_MODULE_DIRECTORY ${LIB_MOD_DIR})
15+
target_include_directories(fortran_stdlib PUBLIC
16+
$<BUILD_INTERFACE:${LIB_MOD_DIR}>
17+
$<INSTALL_INTERFACE:include>
18+
)
19+
1120
if(f18errorstop)
1221
target_sources(fortran_stdlib PRIVATE f18estop.f90)
1322
else()
1423
target_sources(fortran_stdlib PRIVATE f08estop.f90)
1524
endif()
1625

26+
if(f03rank)
27+
target_sources(fortran_stdlib PRIVATE f03_stdlib_experimental_stats.f90)
28+
target_sources(fortran_stdlib PRIVATE f03_stdlib_experimental_stats_mean.f90)
29+
else()
30+
target_sources(fortran_stdlib PRIVATE f90_stdlib_experimental_stats.f90)
31+
target_sources(fortran_stdlib PRIVATE f90_stdlib_experimental_stats_mean.f90)
32+
endif()
33+
1734
add_subdirectory(tests)
1835

1936
install(TARGETS fortran_stdlib
2037
RUNTIME DESTINATION bin
2138
ARCHIVE DESTINATION lib
2239
LIBRARY DESTINATION lib
2340
)
41+
install(DIRECTORY ${LIB_MOD_DIR} DESTINATION include)

src/Makefile.manual

+7-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@ SRC = stdlib_experimental_ascii.f90 \
33
stdlib_experimental_io.f90 \
44
stdlib_experimental_optval.f90 \
55
stdlib_experimental_kinds.f90 \
6-
f18estop.f90
6+
f18estop.f90 \
7+
f03_stdlib_experimental_stats.f90 \
8+
f03_stdlib_experimental_stats_mean.f90
79

810
LIB = libstdlib.a
911

@@ -34,3 +36,7 @@ stdlib_experimental_io.o: \
3436
stdlib_experimental_optval.o \
3537
stdlib_experimental_kinds.o
3638
stdlib_experimental_optval.o: stdlib_experimental_kinds.o
39+
f03_stdlib_experimental_stats_mean.o: \
40+
stdlib_experimental_optval.o \
41+
stdlib_experimental_kinds.o \
42+
f03_stdlib_experimental_stats.o

0 commit comments

Comments
 (0)